From e5b8441820d13ce4191d39e9b5cd4fa635a99935 Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Wed, 2 Jul 2025 23:24:37 +0800 Subject: [PATCH 1/2] chore: add echarts 6 features in codegen --- demo/utils/codegen.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/demo/utils/codegen.js b/demo/utils/codegen.js index 8752517..bf191e7 100644 --- a/demo/utils/codegen.js +++ b/demo/utils/codegen.js @@ -8,6 +8,7 @@ const COMPONENTS_MAP = { singleAxis: "SingleAxisComponent", parallel: "ParallelComponent", calendar: "CalendarComponent", + matrix: "MatrixComponent", graphic: "GraphicComponent", toolbox: "ToolboxComponent", tooltip: "TooltipComponent", @@ -21,6 +22,7 @@ const COMPONENTS_MAP = { legend: "LegendComponent", dataZoom: "DataZoomComponent", visualMap: "VisualMapComponent", + thumbnail: "ThumbnailComponent", aria: "AriaComponent", dataset: "DatasetComponent", @@ -41,6 +43,7 @@ const CHARTS_MAP = { tree: "TreeChart", treemap: "TreemapChart", graph: "GraphChart", + chord: "ChordChart", gauge: "GaugeChart", funnel: "FunnelChart", parallel: "ParallelChart", @@ -84,7 +87,13 @@ const CHARTS_GL_MAP = { linesGL: "LinesGLChart", }; -const FEATURES = ["UniversalTransition", "LabelLayout"]; +const FEATURES = [ + "UniversalTransition", + "LabelLayout", + "AxisBreak", + "LegacyGridContainLabel", + "ScatterJitter", +]; const RENDERERS_MAP = { canvas: "CanvasRenderer", svg: "SVGRenderer", From 97f70cd2ed38f97929a04f28b357a3f2b6a2a9b5 Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Sat, 9 Aug 2025 11:11:06 +0800 Subject: [PATCH 2/2] update according to https://github.com/apache/echarts-examples/commit/772cf01859d941bbf7e422f8e1345e9a6b94a6b9 --- demo/utils/codegen.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/demo/utils/codegen.js b/demo/utils/codegen.js index bf191e7..ce61bfd 100644 --- a/demo/utils/codegen.js +++ b/demo/utils/codegen.js @@ -91,7 +91,7 @@ const FEATURES = [ "UniversalTransition", "LabelLayout", "AxisBreak", - "LegacyGridContainLabel", + // "LegacyGridContainLabel", "ScatterJitter", ]; const RENDERERS_MAP = { @@ -164,7 +164,7 @@ function collectDeps(option) { if (INJECTED_COMPONENTS.includes(key)) { return; } - const val = option[key]; + let val = option[key]; if (Array.isArray(val) && !val.length) { return; @@ -181,12 +181,12 @@ function collectDeps(option) { } }); - let series = option.series; - if (!Array.isArray(series)) { - series = [series]; - } - + const series = Array.isArray(option.series) ? option.series : [option.series]; + let hasScatterSeries = false; series.forEach((seriesOpt) => { + if (seriesOpt.type === "scatter") { + hasScatterSeries = true; + } if (CHARTS_MAP[seriesOpt.type]) { deps.push(CHARTS_MAP[seriesOpt.type]); } @@ -213,6 +213,21 @@ function collectDeps(option) { deps.push("UniversalTransition"); } }); + + Object.keys(option).forEach((key) => { + if (key.endsWith("Axis")) { + const val = option[key]; + for (const axisOption of Array.isArray(val) ? val : [val]) { + if (hasScatterSeries && +axisOption.jitter > 0) { + deps.push("ScatterJitter"); + } + if (axisOption.breaks && axisOption.breaks.length > 0) { + deps.push("AxisBreak"); + } + } + } + }); + // Dataset transform if (option.dataset && Array.isArray(option.dataset)) { option.dataset.forEach((dataset) => {