@formant/ava
Version:
A framework for automated visual analytics.
39 lines (38 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.lineMarkStrategy = void 0;
var tslib_1 = require("tslib");
var constants_1 = require("../../constants");
var lineMarkStrategy = function (_a, _b) {
var points = _a.points, x = _a.x, y = _a.y;
var encode = _b.encode, style = _b.style, label = _b.label, tooltip = _b.tooltip;
var common = {
style: tslib_1.__assign({ lineDash: [2, 2], stroke: constants_1.INSIGHT_COLOR_PLATTE.highlight }, style),
labels: label
? [
{
text: label,
selector: 'last',
position: 'right',
style: {
textBaseline: 'bottom',
textAlign: 'end',
dy: -24,
},
},
]
: undefined,
tooltip: tooltip,
};
if (points) {
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'line', data: points, encode: tslib_1.__assign({ x: 'x', y: 'y' }, encode) });
}
if (x) {
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'lineX', data: [x] });
}
if (y) {
return tslib_1.__assign(tslib_1.__assign({}, common), { type: 'lineY', data: [y] });
}
return null;
};
exports.lineMarkStrategy = lineMarkStrategy;