Skip Menu |

This queue is for tickets about the Chart CPAN distribution.

Report information
The Basics
Id: 50559
Status: new
Priority: 0/
Queue: Chart

People
Owner: Nobody in particular
Requestors: nine [...] detonation.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.4.1
Fixed in: (no value)



Subject: Pie chart incorrectly use text width to calculate maximum height
Chart::Pie takes the maximum of text width and height to calculate the maximum allowed diameter of the pie. This leaves huge vertical margins because obviously, text is usually much wider than it's height. The attached patch does an independent calculation for the two values and only then takes the minimum available space to calculate the diameter.
Subject: chart_pie_min_height.diff
--- Chart/Pie.pm 2009-10-16 13:26:57.548734365 +0200 +++ Chart/Pie.pm.new 2009-10-16 13:27:45.340736015 +0200 @@ -823,8 +823,10 @@ # always draw a circle, which means the diameter will be the smaller # of the width and height. let enougth space for the labels - my $labeldistance = 2*$self->maximum($fontW,$fontH); - $diameter = $self->minimum($width,$height) - 2*$max_label_len - $labeldistance; + my $min_width = $width - 2 * $max_label_len - 2 * $fontW; + my $min_height = $height - 2 * $fontH; + $diameter = $self->minimum($min_width, $min_height); + my $labeldistance = 2 * $self->maximum($fontW,$fontH); # make sure, that we have a positive diameter if ($diameter < 0)