@antv/f2
Version:
Charts for mobile visualization.
56 lines (55 loc) • 1.54 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _jsx = require("../../jsx");
var _default = function _default(props, context) {
var coord = props.coord,
range = props.range,
position = props.position,
layout = props.layout;
var left = coord.left,
width = coord.width;
var top = layout.top,
height = layout.height;
var _ref = (range === null || range === void 0 ? void 0 : range.x) || (range === null || range === void 0 ? void 0 : range.y),
_ref2 = (0, _slicedToArray2.default)(_ref, 2),
start = _ref2[0],
end = _ref2[1];
var barLeft = width * start;
var barWidth = width * (end - start);
return (0, _jsx.jsx)("group", {
style: {
left: left,
top: position === 'top' ? top - context.px2hd('8px') : top + height
}
}, (0, _jsx.jsx)("line", {
style: {
position: 'absolute',
left: 0,
width: width,
height: 0
},
attrs: {
stroke: 'rgba(202, 215, 239, .2)',
lineCap: 'round',
lineWidth: '8px'
}
}), (0, _jsx.jsx)("line", {
style: {
position: 'absolute',
left: barLeft,
width: barWidth,
height: 0
},
attrs: {
stroke: 'rgba(202, 215, 239, .5)',
lineCap: 'round',
lineWidth: '8px'
}
}));
};
exports.default = _default;
;