UNPKG

@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

57 lines (50 loc) 2 kB
import { DataType } from "../../../../types/base"; import { animationDuration, DEFAULT_VIDEO_LENGTH, oneByOneGroupSize } from "../constants"; import { color, data, discreteLegend, oneByOneDelayFunc } from "./common"; export const 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 }; }; export 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: [ DataType.DATE, DataType.STRING ].includes(null == xFieldInfo ? void 0 : xFieldInfo.type) ? "band" : "linear", label: { style: {} }, title: { visible: !1, style: {} } }, { orient: "left", type: [ DataType.DATE, DataType.STRING ].includes(null == yFieldInfo ? void 0 : yFieldInfo.type) ? "band" : "linear", label: { style: {} }, title: { visible: !1, style: {} } } ], { spec: spec }; }; export const animationScatter = context => { var _a; const {spec: spec} = context, totalTime = null !== (_a = context.totalTime) && void 0 !== _a ? _a : DEFAULT_VIDEO_LENGTH, dataLength = spec.data.values.length, delay = totalTime / Math.ceil(dataLength / oneByOneGroupSize); return spec.animationAppear = { duration: animationDuration, delay: oneByOneDelayFunc(delay) }, { spec: spec }; }; export const pipelineScatterPlot = [ data, color, scatterField, scatterAxis, discreteLegend ]; //# sourceMappingURL=scatter.js.map