Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Combo chart with bar and scatter chart generates malformed pptx #1355

Open
Jank1310 opened this issue Oct 15, 2024 · 2 comments
Open

Comments

@Jank1310
Copy link

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

@szymon-jedify
Copy link

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

@szymon-jedify
Copy link

@Jank1310 for me the problem was with missing catAxes declaration. After adding them, it started to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants