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

Issue with non-numeric data in chart value axes #14

Closed
jmcnamara opened this issue Aug 27, 2012 · 2 comments
Closed

Issue with non-numeric data in chart value axes #14

jmcnamara opened this issue Aug 27, 2012 · 2 comments
Assignees
Labels

Comments

@jmcnamara
Copy link
Owner

Reported by @msmcgillis.

Non-numeric data in chart value axes should be treated as zero or else Excel will generate warnings when reading the data. Example:

use Excel::Writer::XLSX;

gen(["-nan",3,4,5,"inf"],"fail.xlsx"); # Excel will not show any chart at all
gen([0,3,4,5,0],"works.xlsx");         # this works but shouldn't be necessary


sub gen {
  my $ss=Excel::Writer::XLSX->new($_[1]);
  my $wsd=$ss->add_worksheet("Data");
  $wsd->write("A1",$_[0]); # places text in chart need to be 0
  my $wsc=$ss->add_worksheet("Chart");
  my $chart=$ss->add_chart(type=>"line",embedded=>1);
  $chart->add_series(values=>'=Data!$A$1:$E$1');
  $wsc->insert_chart("A2",$chart);
}
jmcnamara added a commit that referenced this issue Aug 27, 2012
Non-numeric data in chart value axes are now converted to zero in
chart data cache, as required by Excel.
@ghost ghost assigned jmcnamara Aug 27, 2012
@msmcgillis
Copy link

I pulled your latest master and ran a number of test cases for data that was giving me problems. Looks like your new code always produced nice charts regardless of the string issue. Once I see a release go out with this in it I will probably do another merge of your released version with my branch to pick it up.

Thanks!

@jmcnamara
Copy link
Owner Author

Pushed to CPAN.

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

No branches or pull requests

2 participants