From d5dfa4b84d3eb4942672792dc509aa0b1da645bd Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Tue, 9 May 2006 15:50:46 +0000 Subject: [PATCH] Fixing a very weird bug in the Pie Chart --- lib/WebGUI/Image/Graph/Pie.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Image/Graph/Pie.pm b/lib/WebGUI/Image/Graph/Pie.pm index 67125bd58..feebbcac4 100644 --- a/lib/WebGUI/Image/Graph/Pie.pm +++ b/lib/WebGUI/Image/Graph/Pie.pm @@ -61,12 +61,12 @@ sub addSlice { my $properties = shift; my $percentage = $properties->{percentage}; - + # Work around a bug in imagemagick where an A path with the same start and end point will segfault. if ($percentage == 1) { - $percentage = 0.9999999; + $percentage = 0.999999999; } - + my $label = $properties->{label}; my $color = $properties->{color}; @@ -103,7 +103,7 @@ sub addSlice { topHeight => $self->getTopHeight, bottomHeight => $self->getBottomHeight, explosionLength => $self->getExplosionLength, - scaleFactor => $self->getScaleFactor, + scaleFactor => $self->getScaleFactor || 1, # keep the slice number for debugging properties sliceNr => scalar(@{$self->{_slices}}), @@ -387,7 +387,7 @@ Draws the pie chart. sub draw { my ($currentSlice, $coordinates, $sliceData, $leftPlaneVisible, $rightPlaneVisible); my $self = shift; - + $self->processDataset; # Draw slices in the correct order or you'll get an MC Escher. @@ -925,7 +925,8 @@ Defaults to 1. sub getScaleFactor { my $self = shift; - return $self->{_pieProperties}->{scaleFactor} || 1; + return 1 unless (defined $self->{_pieProperties}->{scaleFactor}); + return $self->{_pieProperties}->{scaleFactor} || '1'; } #-------------------------------------------------------------------