@antv/f2
Version:
Charts for mobile visualization.
48 lines • 1.32 kB
JavaScript
import { __assign } from "tslib";
import { jsx } from '@antv/f-engine';
export default (function (props, context) {
var coord = props.coord,
range = props.range,
position = props.position,
layout = props.layout,
style = props.style,
background = props.background,
barStyle = props.barStyle;
var top = coord.top,
height = coord.height;
var left = layout.left,
width = layout.width;
var _a = (range === null || range === void 0 ? void 0 : range.y) || (range === null || range === void 0 ? void 0 : range.x),
start = _a[0],
end = _a[1];
var barTop = height * start;
var barHeight = height * (end - start);
return jsx("group", {
style: __assign({
display: 'flex',
top: top,
left: position === 'left' ? left - context.px2hd('8px') : left + width
}, style)
}, jsx("line", {
style: __assign({
position: 'absolute',
top: 0,
left: 0,
width: 0,
height: height,
stroke: 'rgba(202, 215, 239, .2)',
lineCap: 'round',
lineWidth: '8px'
}, background)
}), jsx("line", {
style: __assign({
position: 'absolute',
top: barTop,
width: 0,
height: barHeight,
stroke: 'rgba(202, 215, 239, .5)',
lineCap: 'round',
lineWidth: '8px'
}, barStyle)
}));
});