@visactor/vmind
Version:
<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu
61 lines (53 loc) • 2.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.pipelineScatterPlot = exports.animationScatter = exports.scatterAxis = exports.scatterField = void 0;
const base_1 = require("../../../../types/base"), constants_1 = require("../constants"), common_1 = require("./common"), scatterField = context => {
const {cell: cell, spec: spec} = context;
return spec.xField = cell.x, spec.yField = cell.y, cell.color && (spec.seriesField = cell.color),
cell.size && (spec.sizeField = cell.size, spec.size = {
type: "linear"
}), {
spec: spec
};
};
exports.scatterField = scatterField;
const scatterAxis = context => {
const {spec: spec, fieldInfo: fieldInfo} = context, xField = spec.xField, yField = spec.yField, xFieldInfo = fieldInfo.find((field => xField === field.fieldName)), yFieldInfo = fieldInfo.find((field => yField === field.fieldName));
return spec.axes = [ {
orient: "bottom",
type: [ base_1.DataType.DATE, base_1.DataType.STRING ].includes(null == xFieldInfo ? void 0 : xFieldInfo.type) ? "band" : "linear",
label: {
style: {}
},
title: {
visible: !1,
style: {}
}
}, {
orient: "left",
type: [ base_1.DataType.DATE, base_1.DataType.STRING ].includes(null == yFieldInfo ? void 0 : yFieldInfo.type) ? "band" : "linear",
label: {
style: {}
},
title: {
visible: !1,
style: {}
}
} ], {
spec: spec
};
};
exports.scatterAxis = scatterAxis;
const animationScatter = context => {
var _a;
const {spec: spec} = context, totalTime = null !== (_a = context.totalTime) && void 0 !== _a ? _a : constants_1.DEFAULT_VIDEO_LENGTH, dataLength = spec.data.values.length, delay = totalTime / Math.ceil(dataLength / constants_1.oneByOneGroupSize);
return spec.animationAppear = {
duration: constants_1.animationDuration,
delay: (0, common_1.oneByOneDelayFunc)(delay)
}, {
spec: spec
};
};
exports.animationScatter = animationScatter, exports.pipelineScatterPlot = [ common_1.data, common_1.color, exports.scatterField, exports.scatterAxis, common_1.discreteLegend ];
//# sourceMappingURL=scatter.js.map