@antv/g2
Version: 
the Grammar of Graphics in Javascript
30 lines • 1.29 kB
JavaScript
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;
};
import { Polyline } from '@antv/g';
import { applyStyle } from '../utils';
import { select } from '../../utils/selection';
export 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 select(new Polyline())
            .style('points', P)
            .call(applyStyle, finalStyle)
            .node();
    };
};
Line.props = {
    defaultMarker: 'line',
};
//# sourceMappingURL=line.js.map