Subject: | two_axes works only if numeric |
Date: | Fri, 7 Nov 2008 16:04:54 +0100 |
To: | bug-GDGraph [...] rt.cpan.org |
From: | Andrej Mikus <perluser [...] mikus.sk> |
* a concise description of the buggy behavior and how it differs
* from what you expected,
Noticed a problem that my values for Y2 axis are not printed if two_axes
option is not numeric but a different true value (string). Based on the
documentation and comments in the code I expect that true/false is
significant, not the value itself. For some reason the value is used in
numeric calculations leading to a bug.
* the versions of Perl, GD::Graph and GD that you are using,
$ perl -MGD::Graph -e 'print qq/$GD::Graph::VERSION\n/'
1.44
* a short demonstration script that shows the bug in action,
two_axes => $p_col{$alias}, use_axis => \@ua, y2_label => '%',
* a patch that fixes it. :-)
*** axestype.pm.orig Tue Nov 4 09:48:17 2008
--- axestype.pm Fri Nov 7 15:54:55 2008
***************
*** 662,668 ****
# Do some sanity checks
$s->{two_axes} = 0 if $s->{_data}->num_sets < 2 || $s->{two_axes} < 0;
! $s->{two_axes} = 1 if $s->{two_axes} > 1;
delete $s->{y_label2} unless $s->{two_axes};
--- 662,668 ----
# Do some sanity checks
$s->{two_axes} = 0 if $s->{_data}->num_sets < 2 || $s->{two_axes} < 0;
! $s->{two_axes} = 1 if $s->{two_axes};
delete $s->{y_label2} unless $s->{two_axes};
* Workaround:
two_axes => $p_col{$alias} && 1, use_axis => \@ua, y2_label => '%',