Skip to content

Commit d28e6ed

Browse files
authored
chore: add echarts 6 features in codegen
* chore: add echarts 6 features in codegen * update according to apache/echarts-examples@772cf01
1 parent 484dd19 commit d28e6ed

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

demo/utils/codegen.js

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const COMPONENTS_MAP = {
88
singleAxis: "SingleAxisComponent",
99
parallel: "ParallelComponent",
1010
calendar: "CalendarComponent",
11+
matrix: "MatrixComponent",
1112
graphic: "GraphicComponent",
1213
toolbox: "ToolboxComponent",
1314
tooltip: "TooltipComponent",
@@ -21,6 +22,7 @@ const COMPONENTS_MAP = {
2122
legend: "LegendComponent",
2223
dataZoom: "DataZoomComponent",
2324
visualMap: "VisualMapComponent",
25+
thumbnail: "ThumbnailComponent",
2426
aria: "AriaComponent",
2527
dataset: "DatasetComponent",
2628

@@ -41,6 +43,7 @@ const CHARTS_MAP = {
4143
tree: "TreeChart",
4244
treemap: "TreemapChart",
4345
graph: "GraphChart",
46+
chord: "ChordChart",
4447
gauge: "GaugeChart",
4548
funnel: "FunnelChart",
4649
parallel: "ParallelChart",
@@ -84,7 +87,13 @@ const CHARTS_GL_MAP = {
8487
linesGL: "LinesGLChart",
8588
};
8689

87-
const FEATURES = ["UniversalTransition", "LabelLayout"];
90+
const FEATURES = [
91+
"UniversalTransition",
92+
"LabelLayout",
93+
"AxisBreak",
94+
// "LegacyGridContainLabel",
95+
"ScatterJitter",
96+
];
8897
const RENDERERS_MAP = {
8998
canvas: "CanvasRenderer",
9099
svg: "SVGRenderer",
@@ -155,7 +164,7 @@ function collectDeps(option) {
155164
if (INJECTED_COMPONENTS.includes(key)) {
156165
return;
157166
}
158-
const val = option[key];
167+
let val = option[key];
159168

160169
if (Array.isArray(val) && !val.length) {
161170
return;
@@ -172,12 +181,12 @@ function collectDeps(option) {
172181
}
173182
});
174183

175-
let series = option.series;
176-
if (!Array.isArray(series)) {
177-
series = [series];
178-
}
179-
184+
const series = Array.isArray(option.series) ? option.series : [option.series];
185+
let hasScatterSeries = false;
180186
series.forEach((seriesOpt) => {
187+
if (seriesOpt.type === "scatter") {
188+
hasScatterSeries = true;
189+
}
181190
if (CHARTS_MAP[seriesOpt.type]) {
182191
deps.push(CHARTS_MAP[seriesOpt.type]);
183192
}
@@ -204,6 +213,21 @@ function collectDeps(option) {
204213
deps.push("UniversalTransition");
205214
}
206215
});
216+
217+
Object.keys(option).forEach((key) => {
218+
if (key.endsWith("Axis")) {
219+
const val = option[key];
220+
for (const axisOption of Array.isArray(val) ? val : [val]) {
221+
if (hasScatterSeries && +axisOption.jitter > 0) {
222+
deps.push("ScatterJitter");
223+
}
224+
if (axisOption.breaks && axisOption.breaks.length > 0) {
225+
deps.push("AxisBreak");
226+
}
227+
}
228+
}
229+
});
230+
207231
// Dataset transform
208232
if (option.dataset && Array.isArray(option.dataset)) {
209233
option.dataset.forEach((dataset) => {

0 commit comments

Comments
 (0)