diff --git a/packages/o-spreadsheet-engine/src/types/chart/chart.ts b/packages/o-spreadsheet-engine/src/types/chart/chart.ts
index d5aa66502e..93743a908f 100644
--- a/packages/o-spreadsheet-engine/src/types/chart/chart.ts
+++ b/packages/o-spreadsheet-engine/src/types/chart/chart.ts
@@ -198,6 +198,7 @@ export interface ExcelChartDefinition {
useRightAxis?: boolean;
};
readonly axesDesign?: AxesDesign;
+ readonly showValues?: boolean;
readonly horizontal?: boolean;
readonly isDoughnut?: boolean;
readonly pieHolePercentage?: number;
diff --git a/packages/o-spreadsheet-engine/src/xlsx/conversion/figure_conversion.ts b/packages/o-spreadsheet-engine/src/xlsx/conversion/figure_conversion.ts
index b6bee59079..10f22f3997 100644
--- a/packages/o-spreadsheet-engine/src/xlsx/conversion/figure_conversion.ts
+++ b/packages/o-spreadsheet-engine/src/xlsx/conversion/figure_conversion.ts
@@ -115,6 +115,7 @@ function convertChartData(chartData: ExcelChartDefinition): ChartDefinition | un
horizontal: chartData.horizontal,
isDoughnut: chartData.isDoughnut,
pieHolePercentage: chartData.pieHolePercentage,
+ showValues: chartData.showValues,
};
try {
const ChartClass = chartRegistry.get(chartData.type);
diff --git a/packages/o-spreadsheet-engine/src/xlsx/extraction/chart_extractor.ts b/packages/o-spreadsheet-engine/src/xlsx/extraction/chart_extractor.ts
index 5201ffd23e..3fab38754b 100644
--- a/packages/o-spreadsheet-engine/src/xlsx/extraction/chart_extractor.ts
+++ b/packages/o-spreadsheet-engine/src/xlsx/extraction/chart_extractor.ts
@@ -40,7 +40,10 @@ export class XlsxChartExtractor extends XlsxBaseExtractor {
const chartHoleSize = this.extractChildAttr(rootChartElement, "c:holeSize", "val", {
default: "0",
}).asNum();
-
+ const showValueNodes = this.querySelectorAll(rootChartElement, "c:chart c:showVal");
+ const showValues = [...showValueNodes].some(
+ (el) => el.attributes.getNamedItem("val")?.value === "1"
+ );
return {
title: { text: chartTitle },
type: CHART_TYPE_CONVERSION_MAP[chartType]!,
@@ -68,6 +71,7 @@ export class XlsxChartExtractor extends XlsxBaseExtractor {
horizontal: chartDirection === "bar",
isDoughnut: chartHoleSize > 0,
pieHolePercentage: chartHoleSize,
+ showValues,
};
}
)[0];
@@ -94,7 +98,10 @@ export class XlsxChartExtractor extends XlsxBaseExtractor {
const barChartGrouping = this.extractChildAttr(chartElement, "c:grouping", "val", {
default: "clustered",
}).asString();
-
+ const showValueNodes = this.querySelectorAll(chartElement, "c:chart c:showVal");
+ const showValues = [...showValueNodes].some(
+ (el) => el.attributes.getNamedItem("val")?.value === "1"
+ );
return {
title: { text: chartTitle },
type: "combo",
@@ -125,6 +132,7 @@ export class XlsxChartExtractor extends XlsxBaseExtractor {
],
stacked: barChartGrouping === "stacked",
fontColor: "000000",
+ showValues,
};
}
diff --git a/packages/o-spreadsheet-engine/src/xlsx/functions/charts.ts b/packages/o-spreadsheet-engine/src/xlsx/functions/charts.ts
index 2d9ddb41cd..b5f8e6395e 100644
--- a/packages/o-spreadsheet-engine/src/xlsx/functions/charts.ts
+++ b/packages/o-spreadsheet-engine/src/xlsx/functions/charts.ts
@@ -328,6 +328,7 @@ function addBarChart(chart: ExcelChartDefinition): XMLString {
${extractTrendline(dataset.trend, color)}
${extractDataSetLabel(dataset.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${dataShapeProperty}
${
chart.labelRange ? escapeXml/*xml*/ `${stringRef(chart.labelRange!)}` : ""
@@ -358,6 +359,7 @@ function addBarChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(leftDataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -448,6 +450,7 @@ function addComboChart(chart: ExcelChartDefinition): XMLString {
${extractTrendline(dataSet.trend, firstColor)}
${extractDataSetLabel(dataSet.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${shapeProperty({
backgroundColor: firstColor,
line: { color: firstColor },
@@ -481,6 +484,7 @@ function addComboChart(chart: ExcelChartDefinition): XMLString {
${extractTrendline(dataSet.trend, color)}
${extractDataSetLabel(dataSet.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${dataShapeProperty}
${chart.labelRange ? escapeXml`${stringRef(chart.labelRange)}` : ""}
@@ -506,6 +510,7 @@ function addComboChart(chart: ExcelChartDefinition): XMLString {
${barDataSetNode}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -516,6 +521,7 @@ function addComboChart(chart: ExcelChartDefinition): XMLString {
+ ${insertDataLabels({ showValues: chart.showValues })}
${joinXmlNodes(leftDataSetsNodes)}
@@ -530,6 +536,7 @@ function addComboChart(chart: ExcelChartDefinition): XMLString {
+ ${insertDataLabels({ showValues: chart.showValues })}
${joinXmlNodes(rightDataSetsNodes)}
@@ -589,6 +596,7 @@ function addPyramidChart(chart: ExcelChartDefinition): XMLString {
${extractDataSetLabel(leftDataSet.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${shapeProperty({
backgroundColor: firstColor,
line: { color: firstColor },
@@ -606,6 +614,7 @@ function addPyramidChart(chart: ExcelChartDefinition): XMLString {
${extractDataSetLabel(rightDataSet.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${shapeProperty({
backgroundColor: secondColor,
line: { color: secondColor },
@@ -623,6 +632,7 @@ function addPyramidChart(chart: ExcelChartDefinition): XMLString {
${leftBarDataSetNode}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -632,6 +642,7 @@ function addPyramidChart(chart: ExcelChartDefinition): XMLString {
${rightBarDataSetNode}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -728,6 +739,7 @@ function addLineChart(chart: ExcelChartDefinition): XMLString {
${extractTrendline(dataset.trend, color)}
${extractDataSetLabel(dataset.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${dataShapeProperty}
${
chart.labelRange ? escapeXml`${stringRef(chart.labelRange!)}` : ""
@@ -755,6 +767,7 @@ function addLineChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(leftDataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -771,6 +784,7 @@ function addLineChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(rightDataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -823,6 +837,7 @@ function addScatterChart(chart: ExcelChartDefinition): XMLString {
${extractTrendline(dataset.trend, color)}
${extractDataSetLabel(dataset.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${
chart.labelRange
? escapeXml/*xml*/ `
@@ -850,6 +865,7 @@ function addScatterChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(leftDataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -866,6 +882,7 @@ function addScatterChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(rightDataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -916,6 +933,7 @@ function addRadarChart(chart: ExcelChartDefinition): XMLString {
${shapeProperty({ backgroundColor: color, line: { color } })}
${extractDataSetLabel(dataset.label)}
+ ${insertDataLabels({ showValues: chart.showValues })}
${dataShapeProperty}
${
chart.labelRange ? escapeXml`${stringRef(chart.labelRange!)}` : ""
@@ -934,6 +952,7 @@ function addRadarChart(chart: ExcelChartDefinition): XMLString {
${joinXmlNodes(dataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
@@ -978,7 +997,7 @@ function addDoughnutChart(
${extractDataSetLabel(dataset.label)}
${joinXmlNodes(dataPoints)}
- ${insertDataLabels({ showLeaderLines: true })}
+ ${insertDataLabels({ showLeaderLines: true, showValues: chart.showValues })}
${chart.labelRange ? escapeXml`${stringRef(chart.labelRange!)}` : ""}
${numberRef(dataset.range)}
@@ -992,23 +1011,28 @@ function addDoughnutChart(
- ${insertDataLabels()}
${joinXmlNodes(dataSetsNodes)}
+ ${insertDataLabels({ showValues: chart.showValues })}
`;
}
-function insertDataLabels({ showLeaderLines } = { showLeaderLines: false }): XMLString {
+function insertDataLabels(
+ { showLeaderLines, showValues }: { showLeaderLines?: Boolean; showValues?: Boolean } = {
+ showLeaderLines: false,
+ showValues: false,
+ }
+): XMLString {
return escapeXml/*xml*/ `
-
+
-
+
-
+
`;
}
diff --git a/tests/__xlsx__/xlsx_demo_data.xlsx b/tests/__xlsx__/xlsx_demo_data.xlsx
index 2e46f93401..87ff7a8f7d 100644
Binary files a/tests/__xlsx__/xlsx_demo_data.xlsx and b/tests/__xlsx__/xlsx_demo_data.xlsx differ
diff --git a/tests/xlsx/__snapshots__/xlsx_export.test.ts.snap b/tests/xlsx/__snapshots__/xlsx_export.test.ts.snap
index 25a05191dc..c9075778d0 100644
--- a/tests/xlsx/__snapshots__/xlsx_export.test.ts.snap
+++ b/tests/xlsx/__snapshots__/xlsx_export.test.ts.snap
@@ -74,6 +74,15 @@ exports[`Test XLSX export Charts Chart legend is set to none position 1`] = `
+
+
+
+
+
+
+
+
+
@@ -112,6 +121,15 @@ exports[`Test XLSX export Charts Chart legend is set to none position 1`] = `
+
+
+
+
+
+
+
+
+
@@ -140,6 +158,15 @@ exports[`Test XLSX export Charts Chart legend is set to none position 1`] = `
+
+
+
+
+
+
+
+
+
@@ -683,6 +710,15 @@ exports[`Test XLSX export Charts Export chart overflowing outside the sheet 1`]
+
+
+
+
+
+
+
+
+
@@ -714,6 +750,15 @@ exports[`Test XLSX export Charts Export chart overflowing outside the sheet 1`]
+
+
+
+
+
+
+
+
+
@@ -742,6 +787,15 @@ exports[`Test XLSX export Charts Export chart overflowing outside the sheet 1`]
+
+
+
+
+
+
+
+
+
@@ -1303,6 +1357,15 @@ exports[`Test XLSX export Charts chart dataset without title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -1334,6 +1397,15 @@ exports[`Test XLSX export Charts chart dataset without title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -1362,6 +1434,15 @@ exports[`Test XLSX export Charts chart dataset without title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -1931,6 +2012,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -1969,6 +2059,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -1997,6 +2096,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2206,15 +2314,6 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
-
-
-
-
-
-
-
-
@@ -2251,7 +2350,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2259,7 +2358,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2312,7 +2411,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2320,7 +2419,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2337,6 +2436,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2441,6 +2549,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2492,6 +2609,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2518,6 +2644,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2727,7 +2862,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2735,7 +2870,7 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
-
+
@@ -2847,6 +2982,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2898,6 +3042,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -2917,6 +3070,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -3152,6 +3314,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -3203,6 +3374,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -3229,6 +3409,15 @@ exports[`Test XLSX export Charts chart font color is white with a dark backgroun
+
+
+
+
+
+
+
+
+
@@ -4093,6 +4282,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -4144,6 +4342,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -4170,6 +4377,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -4566,6 +4782,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -4604,6 +4829,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -4632,6 +4866,15 @@ exports[`Test XLSX export Charts charts in different sheets 1`] = `
+
+
+
+
+
+
+
+
+
@@ -5125,15 +5368,6 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
-
-
-
-
-
-
-
-
-
@@ -5183,7 +5417,7 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
-
+
@@ -5191,7 +5425,7 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
-
+
@@ -5257,7 +5491,7 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
-
+
@@ -5265,7 +5499,7 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
-
+
@@ -5282,6 +5516,15 @@ exports[`Test XLSX export Charts doughnut chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -5719,6 +5962,15 @@ exports[`Test XLSX export Charts horizontal bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -5757,6 +6009,15 @@ exports[`Test XLSX export Charts horizontal bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -5785,6 +6046,15 @@ exports[`Test XLSX export Charts horizontal bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6365,6 +6635,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6416,6 +6695,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6442,6 +6730,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6665,6 +6962,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6703,6 +7009,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -6731,6 +7046,15 @@ exports[`Test XLSX export Charts multiple charts in the same sheet 1`] = `
+
+
+
+
+
+
+
+
+
@@ -7333,7 +7657,7 @@ exports[`Test XLSX export Charts pie chart with only title dataset 1`] = `
-
+
@@ -7341,7 +7665,7 @@ exports[`Test XLSX export Charts pie chart with only title dataset 1`] = `
-
+
@@ -7668,6 +7992,15 @@ exports[`Test XLSX export Charts pyramid chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -7695,6 +8028,15 @@ exports[`Test XLSX export Charts pyramid chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -7714,6 +8056,15 @@ exports[`Test XLSX export Charts pyramid chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -7741,6 +8092,15 @@ exports[`Test XLSX export Charts pyramid chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -8442,6 +8802,15 @@ exports[`Test XLSX export Charts simple bar chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -9040,6 +9409,15 @@ exports[`Test XLSX export Charts simple bar chart with customized dataset 1`] =
coucou
+
+
+
+
+
+
+
+
+
@@ -9068,6 +9446,15 @@ exports[`Test XLSX export Charts simple bar chart with customized dataset 1`] =
+
+
+
+
+
+
+
+
+
@@ -9636,6 +10023,15 @@ exports[`Test XLSX export Charts simple bar chart with customized title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -9664,6 +10060,15 @@ exports[`Test XLSX export Charts simple bar chart with customized title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -10232,6 +10637,15 @@ exports[`Test XLSX export Charts simple bar chart with dataset [ [Object] ] 1`]
+
+
+
+
+
+
+
+
+
@@ -10260,6 +10674,15 @@ exports[`Test XLSX export Charts simple bar chart with dataset [ [Object] ] 1`]
+
+
+
+
+
+
+
+
+
@@ -10828,6 +11251,15 @@ exports[`Test XLSX export Charts simple bar chart with dataset [ [Object], [Obje
+
+
+
+
+
+
+
+
+
@@ -10866,6 +11298,15 @@ exports[`Test XLSX export Charts simple bar chart with dataset [ [Object], [Obje
+
+
+
+
+
+
+
+
+
@@ -10894,6 +11335,15 @@ exports[`Test XLSX export Charts simple bar chart with dataset [ [Object], [Obje
+
+
+
+
+
+
+
+
+
@@ -11462,6 +11912,15 @@ exports[`Test XLSX export Charts simple combo chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -11489,6 +11948,15 @@ exports[`Test XLSX export Charts simple combo chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -12059,6 +12527,15 @@ exports[`Test XLSX export Charts simple combo chart with customized dataset 1`]
coucou
+
+
+
+
+
+
+
+
+
@@ -12086,6 +12563,15 @@ exports[`Test XLSX export Charts simple combo chart with customized dataset 1`]
+
+
+
+
+
+
+
+
+
@@ -12654,6 +13140,15 @@ exports[`Test XLSX export Charts simple combo chart with customized title 1`] =
+
+
+
+
+
+
+
+
+
@@ -12681,6 +13176,15 @@ exports[`Test XLSX export Charts simple combo chart with customized title 1`] =
+
+
+
+
+
+
+
+
+
@@ -13249,6 +13753,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object] ] 1`
+
+
+
+
+
+
+
+
+
@@ -13276,6 +13789,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object] ] 1`
+
+
+
+
+
+
+
+
+
@@ -13844,6 +14366,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -13871,6 +14402,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -13878,6 +14418,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -13903,6 +14452,15 @@ exports[`Test XLSX export Charts simple combo chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -14510,6 +15068,15 @@ exports[`Test XLSX export Charts simple line chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -14536,6 +15103,15 @@ exports[`Test XLSX export Charts simple line chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -15118,6 +15694,15 @@ exports[`Test XLSX export Charts simple line chart with customized dataset 1`] =
coucou
+
+
+
+
+
+
+
+
+
@@ -15144,6 +15729,15 @@ exports[`Test XLSX export Charts simple line chart with customized dataset 1`] =
+
+
+
+
+
+
+
+
+
@@ -15724,6 +16318,15 @@ exports[`Test XLSX export Charts simple line chart with customized title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -15750,6 +16353,15 @@ exports[`Test XLSX export Charts simple line chart with customized title 1`] = `
+
+
+
+
+
+
+
+
+
@@ -16330,6 +16942,15 @@ exports[`Test XLSX export Charts simple line chart with dataset [ [Object] ] 1`]
+
+
+
+
+
+
+
+
+
@@ -16356,6 +16977,15 @@ exports[`Test XLSX export Charts simple line chart with dataset [ [Object] ] 1`]
+
+
+
+
+
+
+
+
+
@@ -16936,6 +17566,15 @@ exports[`Test XLSX export Charts simple line chart with dataset [ [Object], [Obj
+
+
+
+
+
+
+
+
+
@@ -16987,6 +17626,15 @@ exports[`Test XLSX export Charts simple line chart with dataset [ [Object], [Obj
+
+
+
+
+
+
+
+
+
@@ -17013,6 +17661,15 @@ exports[`Test XLSX export Charts simple line chart with dataset [ [Object], [Obj
+
+
+
+
+
+
+
+
+
@@ -17567,15 +18224,6 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object] ] 1`]
-
-
-
-
-
-
-
-
-
@@ -17625,7 +18273,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object] ] 1`]
-
+
@@ -17633,7 +18281,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object] ] 1`]
-
+
@@ -17650,6 +18298,15 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object] ] 1`]
+
+
+
+
+
+
+
+
+
@@ -18073,15 +18730,6 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
-
-
-
-
-
-
-
-
-
@@ -18131,7 +18779,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
-
+
@@ -18139,7 +18787,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
-
+
@@ -18205,7 +18853,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
-
+
@@ -18213,7 +18861,7 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
-
+
@@ -18230,6 +18878,15 @@ exports[`Test XLSX export Charts simple pie chart with dataset [ [Object], [Obje
+
+
+
+
+
+
+
+
+
@@ -18678,6 +19335,15 @@ exports[`Test XLSX export Charts simple radar chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -18704,6 +19370,15 @@ exports[`Test XLSX export Charts simple radar chart with customized axis 1`] = `
+
+
+
+
+
+
+
+
+
@@ -19281,6 +19956,15 @@ exports[`Test XLSX export Charts simple radar chart with customized dataset 1`]
coucou
+
+
+
+
+
+
+
+
+
@@ -19307,6 +19991,15 @@ exports[`Test XLSX export Charts simple radar chart with customized dataset 1`]
+
+
+
+
+
+
+
+
+
@@ -19886,6 +20579,15 @@ exports[`Test XLSX export Charts simple radar chart with customized title 1`] =
+
+
+
+
+
+
+
+
+
@@ -19912,6 +20614,15 @@ exports[`Test XLSX export Charts simple radar chart with customized title 1`] =
+
+
+
+
+
+
+
+
+
@@ -20491,6 +21202,15 @@ exports[`Test XLSX export Charts simple radar chart with dataset [ [Object] ] 1`
+
+
+
+
+
+
+
+
+
@@ -20517,6 +21237,15 @@ exports[`Test XLSX export Charts simple radar chart with dataset [ [Object] ] 1`
+
+
+
+
+
+
+
+
+
@@ -21096,6 +21825,15 @@ exports[`Test XLSX export Charts simple radar chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -21147,6 +21885,15 @@ exports[`Test XLSX export Charts simple radar chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -21173,6 +21920,15 @@ exports[`Test XLSX export Charts simple radar chart with dataset [ [Object], [Ob
+
+
+
+
+
+
+
+
+
@@ -21760,6 +22516,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized axis 1`] =
+
+
+
+
+
+
+
+
+
@@ -21779,6 +22544,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized axis 1`] =
+
+
+
+
+
+
+
+
+
@@ -22369,6 +23143,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized dataset 1`
coucou
+
+
+
+
+
+
+
+
+
@@ -22388,6 +23171,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized dataset 1`
+
+
+
+
+
+
+
+
+
@@ -22976,6 +23768,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized title 1`]
+
+
+
+
+
+
+
+
+
@@ -22995,6 +23796,15 @@ exports[`Test XLSX export Charts simple scatter chart with customized title 1`]
+
+
+
+
+
+
+
+
+
@@ -23583,6 +24393,15 @@ exports[`Test XLSX export Charts simple scatter chart with dataset [ [Object] ]
+
+
+
+
+
+
+
+
+
@@ -23602,6 +24421,15 @@ exports[`Test XLSX export Charts simple scatter chart with dataset [ [Object] ]
+
+
+
+
+
+
+
+
+
@@ -24190,6 +25018,15 @@ exports[`Test XLSX export Charts simple scatter chart with dataset [ [Object], [
+
+
+
+
+
+
+
+
+
@@ -24241,6 +25078,15 @@ exports[`Test XLSX export Charts simple scatter chart with dataset [ [Object], [
+
+
+
+
+
+
+
+
+
@@ -24260,6 +25106,15 @@ exports[`Test XLSX export Charts simple scatter chart with dataset [ [Object], [
+
+
+
+
+
+
+
+
+
@@ -24829,6 +25684,15 @@ exports[`Test XLSX export Charts stacked bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -24867,6 +25731,15 @@ exports[`Test XLSX export Charts stacked bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -24895,6 +25768,15 @@ exports[`Test XLSX export Charts stacked bar chart 1`] = `
+
+
+
+
+
+
+
+
+
@@ -36988,6 +37870,15 @@ exports[`Test XLSX export multiple elements are exported in the correct order 1`
+
+
+
+
+
+
+
+
+
@@ -37019,6 +37910,15 @@ exports[`Test XLSX export multiple elements are exported in the correct order 1`
+
+
+
+
+
+
+
+
+
@@ -37047,6 +37947,15 @@ exports[`Test XLSX export multiple elements are exported in the correct order 1`
+
+
+
+
+
+
+
+
+
@@ -37564,6 +38473,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -37629,6 +38547,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -37655,6 +38582,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -37892,6 +38828,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -37944,6 +38889,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -37972,6 +38926,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -38181,15 +39144,6 @@ exports[`Test XLSX export references with headers should be converted to referen
-
-
-
-
-
-
-
-
-
@@ -38499,7 +39453,7 @@ exports[`Test XLSX export references with headers should be converted to referen
-
+
@@ -38507,7 +39461,7 @@ exports[`Test XLSX export references with headers should be converted to referen
-
+
@@ -39808,7 +40762,7 @@ exports[`Test XLSX export references with headers should be converted to referen
-
+
@@ -39816,7 +40770,7 @@ exports[`Test XLSX export references with headers should be converted to referen
-
+
@@ -39833,6 +40787,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -39959,6 +40922,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -40025,6 +40997,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -40044,6 +41025,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -40279,6 +41269,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -40330,6 +41329,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
@@ -40356,6 +41364,15 @@ exports[`Test XLSX export references with headers should be converted to referen
+
+
+
+
+
+
+
+
+
diff --git a/tests/xlsx/xlsx_import.test.ts b/tests/xlsx/xlsx_import.test.ts
index 503dd1381a..7e2f0f46d8 100644
--- a/tests/xlsx/xlsx_import.test.ts
+++ b/tests/xlsx/xlsx_import.test.ts
@@ -779,6 +779,15 @@ describe("Import xlsx data", () => {
expect(figure.tag).toEqual("chart");
});
+ test("Can import charts with or without showValues", () => {
+ const testSheet = getWorkbookSheet("jestCharts", convertedData)!;
+ const figureLine = testSheet.figures.find((figure) => figure.data.type === "line");
+ const figuresBar = testSheet.figures.filter((figure) => figure.data.type === "bar");
+ expect(figureLine?.data.showValues).toBe(false);
+ expect(figuresBar[0].data.showValues).toBe(true);
+ expect(figuresBar[1].data.showValues).toBe(true);
+ });
+
test.each([
[
"line",
diff --git a/tests/xlsx/xlsx_import_export.test.ts b/tests/xlsx/xlsx_import_export.test.ts
index 03e53a231e..da32504000 100644
--- a/tests/xlsx/xlsx_import_export.test.ts
+++ b/tests/xlsx/xlsx_import_export.test.ts
@@ -311,6 +311,7 @@ describe("Export data to xlsx then import it", () => {
legendPosition: "top" as const,
stacked: false,
labelsAsText: false,
+ showValues: true,
},
{
title: { text: "demo chart 2" },
@@ -325,6 +326,7 @@ describe("Export data to xlsx then import it", () => {
legendPosition: "bottom" as const,
stacked: true,
horizontal: false,
+ showValues: true,
},
{
title: { text: "demo horizontal bar chart 2" },
@@ -336,6 +338,7 @@ describe("Export data to xlsx then import it", () => {
legendPosition: "top" as const,
stacked: true,
horizontal: true,
+ showValues: true,
},
{
title: { text: "pie demo chart" },
@@ -348,6 +351,7 @@ describe("Export data to xlsx then import it", () => {
stacked: false,
isDoughnut: false,
pieHolePercentage: 0,
+ showValues: true,
},
{
title: { text: "doughnut demo chart" },
@@ -360,6 +364,7 @@ describe("Export data to xlsx then import it", () => {
stacked: false,
isDoughnut: true,
pieHolePercentage: 50,
+ showValues: true,
},
{
title: { text: "demo chart4" },
@@ -371,6 +376,7 @@ describe("Export data to xlsx then import it", () => {
legendPosition: "top" as const,
stacked: true,
labelsAsText: false,
+ showValues: true,
},
{
title: { text: "demo chart 5" },
@@ -387,6 +393,7 @@ describe("Export data to xlsx then import it", () => {
background: "#AAAAAA",
legendPosition: "bottom" as const,
stacked: true,
+ showValues: true,
},
{
title: { text: "demo chart6" },
@@ -398,7 +405,7 @@ describe("Export data to xlsx then import it", () => {
legendPosition: "top" as const,
labelsAsText: false,
fillArea: false,
- showValues: false,
+ showValues: true,
},
])("Charts %s", async (chartDef: any) => {
createChart(model, chartDef, "1");