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

Function groupSeries

src/component/toolbox/feature/DataView.ts:70–109  ·  view source on GitHub ↗

* Group series into two types * 1. on category axis, like line, bar * 2. others, like scatter, pie

(ecModel: GlobalModel)

Source from the content-addressed store, hash-verified

68 * 2. others, like scatter, pie
69 */
70function groupSeries(ecModel: GlobalModel) {
71 const seriesGroupByCategoryAxis: Dictionary<SeriesGroup> = {};
72 const otherSeries: SeriesModel[] = [];
73 const meta: SeriesGroupMeta[] = [];
74 ecModel.eachRawSeries(function (seriesModel) {
75 const coordSys = seriesModel.coordinateSystem;
76
77 if (coordSys && (coordSys.type === 'cartesian2d' || coordSys.type === 'polar')) {
78 // TODO: TYPE Consider polar? Include polar may increase unnecessary bundle size.
79 const baseAxis = (coordSys as Cartesian2D).getBaseAxis();
80 if (baseAxis.type === 'category') {
81 const key = getCartesianAxisHashKey(baseAxis);
82 if (!seriesGroupByCategoryAxis[key]) {
83 seriesGroupByCategoryAxis[key] = {
84 categoryAxis: baseAxis,
85 valueAxis: coordSys.getOtherAxis(baseAxis),
86 series: []
87 };
88 meta.push({
89 axisDim: baseAxis.dim,
90 axisIndex: baseAxis.index
91 });
92 }
93 seriesGroupByCategoryAxis[key].series.push(seriesModel);
94 }
95 else {
96 otherSeries.push(seriesModel);
97 }
98 }
99 else {
100 otherSeries.push(seriesModel);
101 }
102 });
103
104 return {
105 seriesGroupByCategoryAxis: seriesGroupByCategoryAxis,
106 other: otherSeries,
107 meta: meta
108 };
109}
110
111/**
112 * Assemble content of series on cateogory axis

Callers 1

getContentFromModelFunction · 0.85

Calls 4

getCartesianAxisHashKeyFunction · 0.90
eachRawSeriesMethod · 0.80
getBaseAxisMethod · 0.65
getOtherAxisMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…