UNPKG

@antv/f2

Version:

Charts for mobile visualization.

44 lines (43 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _tslib = require("tslib"); var _fEngine = require("@antv/f-engine"); var _util = require("@antv/util"); var _default = exports.default = function _default(props, context) { var _a = props.theme, theme = _a === void 0 ? {} : _a; var _b = (0, _util.deepMix)((0, _tslib.__assign)({}, theme.line), props), points = _b.points, style = _b.style, offsetX = _b.offsetX, offsetY = _b.offsetY, animation = _b.animation; var checkNaN = points.some(function (d) { return isNaN(d.x) || isNaN(d.y); }); if (checkNaN) return; var _c = points[0] || {}, x1 = _c.x, y1 = _c.y; var _d = points[1] || {}, x2 = _d.x, y2 = _d.y; var offsetXNum = context.px2hd(offsetX); var offsetYNum = context.px2hd(offsetY); var posX1 = x1 + ((0, _util.isArray)(offsetXNum) ? offsetXNum[0] || 0 : offsetXNum || 0); var posY1 = y1 + ((0, _util.isArray)(offsetYNum) ? offsetYNum[0] || 0 : offsetYNum || 0); var posX2 = x2 + ((0, _util.isArray)(offsetXNum) ? offsetXNum[1] || 0 : offsetXNum || 0); var posY2 = y2 + ((0, _util.isArray)(offsetYNum) ? offsetYNum[1] || 0 : offsetYNum || 0); return (0, _fEngine.jsx)("group", null, (0, _fEngine.jsx)("line", { style: (0, _tslib.__assign)({ x1: posX1, y1: posY1, x2: posX2, y2: posY2 }, style), animation: animation })); };