UNPKG

@antv/g2

Version:

the Grammar of Graphics in Javascript

34 lines 1.44 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Line = void 0; const g_1 = require("@antv/g"); const utils_1 = require("../utils"); const selection_1 = require("../../utils/selection"); const Line = (options, context) => { return (P, value, defaults) => { const { color: defaultColor, lineWidth: defaultSize } = defaults, rest = __rest(defaults, ["color", "lineWidth"]); const { color = defaultColor, size = defaultSize } = value; const stroke = color; const finalStyle = Object.assign(Object.assign(Object.assign({ isBillboard: true }, rest), (stroke && { stroke })), (size && { lineWidth: size })); return (0, selection_1.select)(new g_1.Polyline()) .style('points', P) .call(utils_1.applyStyle, finalStyle) .node(); }; }; exports.Line = Line; exports.Line.props = { defaultMarker: 'line', }; //# sourceMappingURL=line.js.map