From 3aa5ff3636c4cee07985186ac0d14575404e8d9a Mon Sep 17 00:00:00 2001 From: "Adrien Minne (adrm)" Date: Fri, 18 Jul 2025 12:49:36 +0000 Subject: [PATCH] [FIX] xlsx: correctly export aggregated charts Follow up of #6075, for charts combo/scatter charts. The feature to aggregate the chart data based on the labels does not exist in xlsx files. But rather than exporting the chart as normal, ignoring the aggregation, we exported the chart as an image. Task: 4954426 X-original-commit: cec00d6a3073b3f0f05ba89793ca94321cb51c49 --- src/helpers/figures/charts/combo_chart.ts | 4 ---- src/helpers/figures/charts/scatter_chart.ts | 4 ---- tests/xlsx/xlsx_export.test.ts | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/helpers/figures/charts/combo_chart.ts b/src/helpers/figures/charts/combo_chart.ts index 086dfb8fd1..c3cebc7986 100644 --- a/src/helpers/figures/charts/combo_chart.ts +++ b/src/helpers/figures/charts/combo_chart.ts @@ -150,10 +150,6 @@ export class ComboChart extends AbstractChart { } getDefinitionForExcel(): ExcelChartDefinition | undefined { - // Excel does not support aggregating labels - if (this.aggregated) { - return undefined; - } const { dataSets, labelRange } = this.getCommonDataSetAttributesForExcel( this.labelRange, this.dataSets, diff --git a/src/helpers/figures/charts/scatter_chart.ts b/src/helpers/figures/charts/scatter_chart.ts index 18a682fb9c..5c03aa8fde 100644 --- a/src/helpers/figures/charts/scatter_chart.ts +++ b/src/helpers/figures/charts/scatter_chart.ts @@ -185,10 +185,6 @@ export class ScatterChart extends AbstractChart { } getDefinitionForExcel(): ExcelChartDefinition | undefined { - // Excel does not support aggregating labels - if (this.aggregated) { - return undefined; - } const dataSets: ExcelChartDataset[] = this.dataSets .map((ds: DataSet) => toExcelDataset(this.getters, ds)) .filter((ds) => ds.range !== ""); diff --git a/tests/xlsx/xlsx_export.test.ts b/tests/xlsx/xlsx_export.test.ts index 991dff6747..6ffbf1e1e8 100644 --- a/tests/xlsx/xlsx_export.test.ts +++ b/tests/xlsx/xlsx_export.test.ts @@ -1334,7 +1334,7 @@ describe("Test XLSX export", () => { expect(await exportPrettifiedXlsx(model)).toMatchSnapshot(); }); - test.each(["bar", "line", "pie", "radar"] as const)( + test.each(["bar", "line", "pie", "radar", "scatter", "combo"] as const)( "%s chart that aggregate labels is exported as normal chart, ignoring the aggregation", async (type) => { const model = new Model();