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

Values of 0 (zero) in series are missing in line chart #240

Closed
andrei-cs opened this issue Nov 15, 2017 · 2 comments
Closed

Values of 0 (zero) in series are missing in line chart #240

andrei-cs opened this issue Nov 15, 2017 · 2 comments
Assignees
Milestone

Comments

@andrei-cs
Copy link

For a series having 0's as values the points don't show up in the graph when viewing the PPT in Powerpoint.

screen shot 2017-11-15 at 15 29 42

If instead of providing 0's as numerical values I provide them as strings, the chart displays properly.

Code snippets from the provided JSFiddle.

Ex: Not working Values array:

var pptx = new PptxGenJS(); var slide = pptx.addNewSlide(); var opts = { x:1.0, y:1.0, font_size:42, color:'00FF00' }; slide.addText('Hello World!', opts); var chartData = [ { "name": "Chart", "labels": [ "16-Oct-17", "17-Oct-17", "18-Oct-17", "19-Oct-17", "20-Oct-17", "21-Oct-17", "22-Oct-17", "23-Oct-17", "24-Oct-17", "25-Oct-17", "26-Oct-17", "27-Oct-17", "28-Oct-17", "29-Oct-17", "30-Oct-17", "31-Oct-17", "01-Nov-17", "02-Nov-17", "03-Nov-17", "04-Nov-17", "05-Nov-17", "06-Nov-17", "07-Nov-17", "08-Nov-17", "09-Nov-17", "10-Nov-17", "11-Nov-17", "12-Nov-17", "13-Nov-17", "14-Nov-17", "15-Nov-17" ], "values": [ 0, 0, 149, 141, 0, 0, 0, 0, 0, 0, 139, 1177, 477, 0, 0, 2578, 0, 0, 349, 0, 0, 0, 2195, 1057, 807, 0, 0, 0, 148, 241, 0 ] } ] slide.addChart( pptx.charts.LINE, chartData) pptx.save();

Ex: Working Values Array

var pptx = new PptxGenJS(); var slide = pptx.addNewSlide(); var opts = { x:1.0, y:1.0, font_size:42, color:'00FF00' }; slide.addText('Hello World!', opts); var chartData = [ { "name": "Chart", "labels": [ "16-Oct-17", "17-Oct-17", "18-Oct-17", "19-Oct-17", "20-Oct-17", "21-Oct-17", "22-Oct-17", "23-Oct-17", "24-Oct-17", "25-Oct-17", "26-Oct-17", "27-Oct-17", "28-Oct-17", "29-Oct-17", "30-Oct-17", "31-Oct-17", "01-Nov-17", "02-Nov-17", "03-Nov-17", "04-Nov-17", "05-Nov-17", "06-Nov-17", "07-Nov-17", "08-Nov-17", "09-Nov-17", "10-Nov-17", "11-Nov-17", "12-Nov-17", "13-Nov-17", "14-Nov-17", "15-Nov-17" ], "values": [ '0', '0', 149, 141, '0', '0', '0', '0', '0', '0', 139, 1177, 477, '0', '0', 2578, '0', '0', 349, '0', '0', '0', 2195, 1057, 807, '0', '0', '0', 148, 241, '0' ] } ] slide.addChart( pptx.charts.LINE, chartData) pptx.save();

@gitbrent gitbrent self-assigned this Nov 16, 2017
@gitbrent gitbrent added this to the 1.11.0 milestone Nov 16, 2017
@gitbrent gitbrent changed the title 0 values in series missing in line chart Values of 0 (zero) in series are missing in line chart Nov 16, 2017
gitbrent pushed a commit that referenced this issue Nov 20, 2017
@gitbrent
Copy link
Owner

Thanks for opening this issue @andrei-cs, and thanks to @hilnius for the contribution.

The Issue is now fixed in the current codebase:

var pptx = new PptxGenJS();
var slide = pptx.addNewSlide();

var chartData = [{
  "name": "Chart",
  "labels": [ "16-Oct-17", "17-Oct-17", "18-Oct-17", "19-Oct-17", "20-Oct-17", "21-Oct-17", "22-Oct-17", "23-Oct-17", "24-Oct-17", "25-Oct-17", "26-Oct-17", "27-Oct-17", "28-Oct-17", "29-Oct-17", "30-Oct-17", "31-Oct-17", "01-Nov-17", "02-Nov-17", "03-Nov-17", "04-Nov-17", "05-Nov-17", "06-Nov-17", "07-Nov-17", "08-Nov-17", "09-Nov-17", "10-Nov-17", "11-Nov-17", "12-Nov-17", "13-Nov-17", "14-Nov-17", "15-Nov-17" ],
  "values": [ 0, 0, 149, 141, 0, 0, 0, 0, 0, 0, 139, 1177, 477, 0, 0, 2578, 0, 0, 349, 0, 0, 0, 2195, 1057, 807, 0, 0, 0, 148, 241, 0 ]
}];

slide.addChart( pptx.charts.LINE, chartData);
pptx.save();

screen shot 2017-11-20 at 18 01 04

gitbrent pushed a commit that referenced this issue Nov 21, 2017
@gitbrent gitbrent modified the milestones: 1.11.0, 2.0.0 Nov 24, 2017
@9899962543
Copy link

Hi everyone,
I am creating a chart in PPT but in some of cases chart is not drawing in PPT once I edit data the data in PPT(by Right Click on Chart>Edit data) then chart is getting display.
Please sugget me what could be the issue.
Thanks in advance.

ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants