MCPcopy
hub / github.com/apache/echarts / pointsLayout

Function pointsLayout

src/layout/points.ts:29–102  ·  view source on GitHub ↗
(seriesType: string, forceStoreInTypedArray?: boolean)

Source from the content-addressed store, hash-verified

27
28
29export default function pointsLayout(seriesType: string, forceStoreInTypedArray?: boolean): StageHandler {
30 return {
31 seriesType: seriesType,
32
33 plan: createRenderPlanner(),
34
35 reset: function (seriesModel: SeriesModel) {
36 const data = seriesModel.getData();
37 const coordSys = seriesModel.coordinateSystem;
38 const pipelineContext = seriesModel.pipelineContext;
39 const useTypedArray = forceStoreInTypedArray || pipelineContext.large;
40
41 if (!coordSys) {
42 return;
43 }
44
45 const dims = map(coordSys.dimensions, function (dim) {
46 return data.mapDimension(dim);
47 }).slice(0, 2);
48 const dimLen = dims.length;
49
50 const stackResultDim = data.getCalculationInfo('stackResultDimension');
51 if (isDimensionStacked(data, dims[0])) {
52 dims[0] = stackResultDim;
53 }
54 if (isDimensionStacked(data, dims[1])) {
55 dims[1] = stackResultDim;
56 }
57
58 const store = data.getStore();
59 const dimIdx0 = data.getDimensionIndex(dims[0]);
60 const dimIdx1 = data.getDimensionIndex(dims[1]);
61
62 return dimLen && {
63 progress(params, data) {
64 const segCount = params.end - params.start;
65 const points = useTypedArray && createFloat32Array(segCount * dimLen);
66
67 const tmpIn: ParsedValueNumeric[] = [];
68 const tmpOut: number[] = [];
69
70 for (let i = params.start, offset = 0; i < params.end; i++) {
71 let point;
72
73 if (dimLen === 1) {
74 const x = store.get(dimIdx0, i) as ParsedValueNumeric;
75 // NOTE: Make sure the second parameter is null to use default strategy.
76 point = coordSys.dataToPoint(x, null, tmpOut);
77 }
78 else {
79 tmpIn[0] = store.get(dimIdx0, i) as ParsedValueNumeric;
80 tmpIn[1] = store.get(dimIdx1, i) as ParsedValueNumeric;
81 // Let coordinate system to handle the NaN data.
82 point = coordSys.dataToPoint(tmpIn, null, tmpOut);
83 }
84
85 if (useTypedArray) {
86 points[offset++] = point[0];

Callers 2

updateTransformMethod · 0.85
updateTransformMethod · 0.85

Calls 7

isDimensionStackedFunction · 0.90
createRenderPlannerFunction · 0.85
mapDimensionMethod · 0.80
getCalculationInfoMethod · 0.80
getStoreMethod · 0.80
getDimensionIndexMethod · 0.80
getDataMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…