UNPKG

1.2 kBJavaScriptView Raw
1import { jsx } from '@antv/f-engine';
2export default (function (props, context) {
3 var coord = props.coord,
4 range = props.range,
5 position = props.position,
6 layout = props.layout;
7 var left = coord.left,
8 width = coord.width;
9 var top = layout.top,
10 height = layout.height;
11 var _a = (range === null || range === void 0 ? void 0 : range.x) || (range === null || range === void 0 ? void 0 : range.y),
12 start = _a[0],
13 end = _a[1];
14 var barLeft = width * start;
15 var barWidth = width * (end - start);
16 if (isNaN(barWidth)) return;
17 return jsx("group", {
18 style: {
19 display: 'flex',
20 left: left,
21 top: position === 'top' ? top - context.px2hd('8px') : top + height
22 }
23 }, jsx("line", {
24 style: {
25 display: 'flex',
26 position: 'absolute',
27 left: 0,
28 width: width,
29 height: 0,
30 stroke: 'rgba(202, 215, 239, .2)',
31 lineCap: 'round',
32 lineWidth: '8px'
33 }
34 }), jsx("line", {
35 style: {
36 display: 'flex',
37 position: 'absolute',
38 left: barLeft,
39 width: barWidth,
40 height: 0,
41 stroke: 'rgba(202, 215, 239, .5)',
42 lineCap: 'round',
43 lineWidth: '8px'
44 }
45 }));
46});
\No newline at end of file