Subject: | GD::Graph::points bug - filled circle or diamond beyond y_max_value fills entire graph |
Date: | Wed, 5 Mar 2008 12:39:22 -0800 |
To: | bug-GDGraph [...] rt.cpan.org |
From: | "Mark Waggoner" <mark [...] wagnell.com> |
Greetings,
I've encountered a bug when using GD::Graph::points.
In brief, if there is a point which has a Y value that is larger than the
y_max_value, and that point uses a filled circle or diamond marker, it will
end up coloring the entire graph surface the color of the marker.
I'm using perl 5.8.7, and GD::Graph version 1.43.
Here's a test program:
use GD::Graph::points;
my $graph = GD::Graph::points->new(640,400);
my $data = [
['a','b','c'],
[0,1,2],
[12,8,7],
[3,4,5],
[1,2,3],
];
my @markers = (1,7,1,5);
my @colors = (undef,qw(red green blue));
$graph->set(
y_long_ticks => 1,
legend_placement => "RC",
legend_spacing => 2,
y_max_value => 10,
y_min_value => 0,
zero_axis_only => 1,
markers => [@markers],
dclrs => [@colors],
) or die $graph->error;
my $gd = $graph->plot($data) or die $graph->error;
open(IMG, ">TEST.gif") or die $!;
binmode IMG;
print IMG $gd->gif;
close(IMG);
exit;
-----------------------------
This results in a graph with the entire background colored red.
If you change the "12" in the third part of the data to something less than
10, it will work OK. Also, changing the marker to a filled square works.
Looking at the code, it seems likely that the fillToBorder function that is
used for the filled circle and diamand doesn't work properly when the point
is outside of the "canvas".
Thanks for the helpful package!
Mark Waggoner