Skip Menu |

This queue is for tickets about the GDGraph CPAN distribution.

Maintainer(s)' notes

There are plenty of good ideas of what people can do published here on the queue. Turning a patch from the tracker into a pull request is not one of them. In order to get maintainers' attention way more quickier, PR should have at least a sample included. We know it's hard to test images generating software, but it doesn't mean we can not test numbers produced by intermediate algorithms used to generate these images, so either a test or a sample.

Report information
The Basics
Id: 4632
Status: resolved
Worked: 30 min
Priority: 0/
Queue: GDGraph

People
Owner: bwarfield [...] cpan.org
Requestors: dan [...] jprix.cz
earlej [...] hotmail.com
scassidy [...] overlandstorage.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.43
Fixed in: 1.4307



Subject: Bug with pie graph
Change the first value in sample91.pl to 22 - the graph displays fine. Change it to 23 and the highlight at the bottom disappears.
Subject: Bug with 3d pie graph not filling lower arc
First of all allow me to thank you for all the work you must have put into creating this package. It is very helpfull. Now to the bug. It occurs if a 3d pie has one of the slices very big. So big that it covers the whole front arc. In that case the front "3d" arc doesn't get filled by any color. The following patch should i believe fix it. It's a diff of the pie.pm file. 384c384,395 < return; --- Show quoted text
> # but it might happen that they wrap all the way around > # the front back to the back in which case we need to fill > # the whole front part > # Rawel > > if($pa > $pb){ > $pa=$ANGLE_OFFSET - 180; > $pb=$ANGLE_OFFSET; > } > else{ > return; > }
Thank you again for all the work, Yours sincerely Dan Rosendorf
From: kedlubnowski
[guest - Sun Jan 18 16:23:56 2004]: Show quoted text
> 384c384,395 > < return; > ---
> > # but it might happen that they wrap all the way around > > # the front back to the back in which case we need to fill > > # the whole front part > > # Rawel > > > > if($pa > $pb){
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This condition isn't enough. The following code covers all cases. if (($pa > 90 and $pb > 90 and $pa >= $pb) or ($pa < -90 and $pb < -90 and $pa >= $pb) or ($pa < -90 and $pb > 90)) { Show quoted text
> > $pa=$ANGLE_OFFSET - 180; > > $pb=$ANGLE_OFFSET; > > } > > else{ > > return; > >
Hope this will help. kedlubnowski
Subject: question about odd behaviour of pie chart from GD::Graph
Hi, I am seeing an odd behaviour in drawing pie charts using GD::Graph 1.43, ( using perl 5.8.6, GD 2.19, gd 2.0.33, libpng 1.2.8, zlib 1.1.3). When drawing 3d pie charts (output in png format), most of the time the 3d area is colored the same as the second slice (first value in the data array). When the first data value is below a certain value, the 3d area remains white. It seems to be related to the relative percentage of the 2 slices. (Sometimes I use a 3rd data value, and sometimes see the same behaviour). Specifically, if my data values are like this: my @piedata1=( ["Run","Not Run" ], [ 126, 1177], ); # if the first value is lower than 127, it gives a white 3d area; otherwise it is colored like the larger slice # for this example # 127 works, 126 and lower does not depending on the values, the 3d area is colored, or not. I am attaching my little test program. It was based on some of the sample programs from the distribution. I have tried a bunch of things, and if I am doing something wrong, I cannot figure out what it is. Can you please tell me if this is a bug, or something I am doing wrong? Thanks, Susan Cassidy
#!/usr/local/bin/perl use GD::Graph::pie; use GD::Graph::colour qw(:colours :lists :files :convert); #label array, then data points my @piedata1=( ["Run","Not Run" ], [ 126, 1177], ); # if the first value is lower than 127, it gives a white 3d area; otherwise it is colored like the larger slice # for this example # 127 works, 126 and lower does not my $filename='/var/www/html/pie'; draw_pie_chart({'filename'=> $filename, 'title_txt' => 'Tests Run', 'label_txt'=> 'Numbers of tests instances', 'data'=> \@piedata1}); print "file is in $filename\n"; sub draw_pie_chart { my ($param_ref)=@_; #the filename will have .png appended to it my $filename=$param_ref->{'filename'}; my $title_txt=$param_ref->{'title_txt'}; my $label_txt=$param_ref->{'label_txt'}; my $width=$param_ref->{'width'} || 250; my $height=$param_ref->{'height'} || 200; my @data=@{$param_ref->{'data'}}; add_colour(ov_dark_green => [ hex2rgb('#008080') ]); add_colour(ov_med_teal => [ hex2rgb('#33cccc') ]); add_colour(ov_lt_purple => [ hex2rgb('#e9d5f0') ]); my $default_color_list=[ qw(ov_med_teal ov_lt_purple red marine cyan green lblue pink gold lpurple) ] ; my $color_list=$param_ref->{'color_list'} || $default_color_list; errexit("draw_pie_chart: no filename specified") unless ($filename); errexit("draw_pie_chart: no data specified") unless ((scalar @data) > 0); my $my_graph = new GD::Graph::pie( $width, $height ); #my $color_list= [ qw(ov_med_teal ov_lt_purple red) ] ; #$my_graph->set( dclrs => [ qw(ov_med_teal ov_lt_purple red) ] ); $my_graph->set( dclrs => $color_list ); $my_graph->set_text_clr('black'); $my_graph->set( title => ${title_txt}, label => ${label_txt}, axislabelclr => 'black', '3d' => 1, #pie_height => 36, #orig height pie_height => 30, l_margin => 15, r_margin => 15, start_angle => 235, transparent => 0, ); $my_graph->plot(\@data); open(PNGFILE, ">${filename}.png") or errexit("Cannot open ${filename}.png for write: $!"); binmode PNGFILE; print PNGFILE $my_graph->gd->png(); close PNGFILE; chmod 0774, "${filename}.png"; } # end sub draw_pie_chart sub errexit { my (@msg)=@_; print STDERR @msg,"\n"; exit 1; }
Patch included in the next release. Thanks!
It was a bug, and you weren't doing anything wrong--this will be fixed in the next release (probably 1.4307). Probably a bit late to matter to you, I realize, but at least it won't happen to the next person with similar data. On Wed Feb 16 12:54:50 2005, guest wrote: Show quoted text
> Hi, > I am seeing an odd behaviour in drawing pie charts using GD::Graph > 1.43, ( using perl 5.8.6, GD 2.19, gd 2.0.33, libpng 1.2.8, zlib > 1.1.3). > > When drawing 3d pie charts (output in png format), most of the time > the 3d area is colored the same as the second slice (first value in > the data array). When the first data value is below a certain > value, the 3d area remains white. It seems to be related to the > relative percentage of the 2 slices. (Sometimes I use a 3rd data > value, and sometimes see the same behaviour). > > Specifically, if my data values are like this: > my @piedata1=( > ["Run","Not Run" ], > [ 126, 1177], > ); > # if the first value is lower than 127, it gives a white 3d area; > otherwise it is colored like the larger slice > # for this example > # 127 works, 126 and lower does not > > depending on the values, the 3d area is colored, or not. > > > I am attaching my little test program. It was based on some of the > sample programs from the distribution. I have tried a bunch of > things, and if I am doing something wrong, I cannot figure out what > it is. > > Can you please tell me if this is a bug, or something I am doing > wrong? > > Thanks, > Susan Cassidy > >