UNPKG

1.32 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 top = coord.top,
12 height = coord.height;
13 var left = layout.left,
14 width = layout.width;
15 var _a = (range === null || range === void 0 ? void 0 : range.y) || (range === null || range === void 0 ? void 0 : range.x),
16 start = _a[0],
17 end = _a[1];
18 var barTop = height * start;
19 var barHeight = height * (end - start);
20 return jsx("group", {
21 style: __assign({
22 display: 'flex',
23 top: top,
24 left: position === 'left' ? left - context.px2hd('8px') : left + width
25 }, style)
26 }, jsx("line", {
27 style: __assign({
28 position: 'absolute',
29 top: 0,
30 left: 0,
31 width: 0,
32 height: height,
33 stroke: 'rgba(202, 215, 239, .2)',
34 lineCap: 'round',
35 lineWidth: '8px'
36 }, background)
37 }), jsx("line", {
38 style: __assign({
39 position: 'absolute',
40 top: barTop,
41 width: 0,
42 height: barHeight,
43 stroke: 'rgba(202, 215, 239, .5)',
44 lineCap: 'round',
45 lineWidth: '8px'
46 }, barStyle)
47 }));
48});
\No newline at end of file