UNPKG

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