No such thing as a small change | |
PerlMonks |
GD::Graph skip_undef not working properlyby kryberg (Pilgrim) |
on Oct 02, 2003 at 17:37 UTC ( [id://295982]=perlquestion: print w/replies, xml ) | Need Help?? |
kryberg has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I’ve created a bunch of line graphs with GD and GD::Graph that update every 15 minutes. They are working well, with two exceptions. The first one perlmonks helped me fix here. The second problem is regarding undefined values.
Occasionally there is an equipment malfunction and there is missing data. I’m checking for the missing data and inserting undef. Here’s an example:
I have $graph->set(skip_undef=>1); in my program. The GD::Graph documentation says under Options for graphs with lines that “If skip_undef has a true value, there will be a gap in the chart where a Y value is undefined.” I am not getting a gap. What happens is that it plots the last defined value, draws a vertical line down to 0 on the y-axis, continues graphing at zero, then at the next defined value draws a vertical line back up the to the appropriate y-value, and continues graphing the rest of the values. If I have warnings on I get Argument "undef" isn't numeric in numeric lt (<) at /usr/local/lib/perl5/site_perl/5.8.0/GD/Graph/Data.pm line 231. for every undef value. True, they aren’t numeric, but I just want them skipped. I tried setting skip_undef=>0 just to see what happened. The points are supposed to get skipped, with the line being drawn between the defined points. I got the same result as with skip_undef=>1 – a line down to zero, then back up when points were defined again. Any suggestions for fixing this? Thanks
Back to
Seekers of Perl Wisdom
|
|