PptxGenJS
PptxGenJS copied to clipboard
[BUG] Combo chart with bar and scatter chart generates malformed pptx
Product Versions
- Please specify what version of the library you are using......: 3.12.0
- Please specify what version(s) of PowerPoint you are targeting: PowerPoint for Mac 16.89.1
Desired Behavior
This code should generate a presentation containing one combo chart:
import pptxgen from "pptxgenjs";
let pptx = new pptxgen();
let slide = pptx.addSlide();
let opts = {
x: 0.83,
y: 0.6,
w: 6.0,
h: 3.0,
showLegend: false,
showTitle: false,
valAxes: [
{
showValAxisTitle: true,
valAxisTitle: "Primary Value Axis",
},
{
showValAxisTitle: true,
valAxisTitle: "Secondary Value Axis",
},
],
catAxes: [
{
catAxisTitle: "Primary Category Axis",
},
{
catAxisHidden: true,
},
],
};
let labels = ["Mon", "Tue", "Wed", "Thu", "Fri"];
let chartTypes = [
{
type: pptx.charts.BAR,
data: [
{
name: "Bottom",
labels: labels,
values: [17, 26, 53, 10, 4],
},
],
options: {
barDir: "bar",
barGrouping: "clustered",
},
},
{
type: pptx.charts.SCATTER,
data: [
{
name: "X-Axis",
labels: labels,
values: [1, 2, 3, 4, 5],
},
{
name: "Y",
labels: labels,
values: [25, 35, 55, 10, 5],
},
],
options: {
secondaryValAxis: true,
secondaryCatAxis: true,
},
},
];
slide.addChart(chartTypes, opts);
Observed Behavior
PPTX is generated but PowerPoint shows the Repair Dialog when opening the file. If a LINE chart is used instead of SCATTER it works as expected.
Steps to Reproduce
Generate pptx using the code above Try to open powerpoint
I have the same problem, chart is generated, opened by any other app but power point. It tries to repair it, but at the end of the process it is completely deleted
@Jank1310 for me the problem was with missing catAxes declaration. After adding them, it started to work