[Rt-commit] rt branch, 4.2/fix-charts-size, created. rt-4.0.0rc7-248-g90c042e

Emannuel Lacour elacour at bestpractical.com
Tue Apr 5 04:07:02 EDT 2011


The branch, 4.2/fix-charts-size has been created
        at  90c042eba72253d99deb9206a11ee09a480d569f (commit)

- Log -----------------------------------------------------------------
commit 357280dea984d208bc86c5d3a50550a8174d245e
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date:   Tue Apr 5 10:03:52 2011 +0200

    Adjust chart height dynamically to groupby values length

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 429fea5..d99f22d 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -110,7 +110,7 @@ unless (keys %data) {
 }
 
 
-my $chart = $chart_class->new( 600 => 400 );
+my $chart = $chart_class->new( 600 => 300 + ($max_key_length * 14) );
 $chart->set( pie_height => 60 ) if $chart_class eq 'GD::Graph::pie';
 my %font_config = RT->Config->Get('ChartFont');
 my $font = $font_config{ $session{CurrentUser}->UserObj->Lang || '' }
@@ -130,7 +130,7 @@ $chart->set_value_font( $font, 12 ) if $chart->can('set_value_font');
 # context, it can't be a simple error message. Without this check,
 # the chart will just be a non-loading image.
 if ($tix->Count == 0) {
-    my $plot = GD::Image->new(600 => 400);
+    my $plot = GD::Image->new(600 => 300 + ($max_key_length * 14) );
     $plot->colorAllocate(255, 255, 255); # background
     my $black = $plot->colorAllocate(0, 0, 0);
 

commit 90c042eba72253d99deb9206a11ee09a480d569f
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date:   Tue Apr 5 10:05:28 2011 +0200

    Adjust charts width to number of keys to draw

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index d99f22d..113b64e 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -109,8 +109,9 @@ unless (keys %data) {
     $data{''} = 0;
 }
 
+my $chart_width = ( scalar keys(%data) && ( scalar keys(%data) * 20 > 600 ) ) ? scalar keys(%data) * 20 : 600;
 
-my $chart = $chart_class->new( 600 => 300 + ($max_key_length * 14) );
+my $chart = $chart_class->new( $chart_width => 300 + ($max_key_length * 14) );
 $chart->set( pie_height => 60 ) if $chart_class eq 'GD::Graph::pie';
 my %font_config = RT->Config->Get('ChartFont');
 my $font = $font_config{ $session{CurrentUser}->UserObj->Lang || '' }
@@ -130,7 +131,7 @@ $chart->set_value_font( $font, 12 ) if $chart->can('set_value_font');
 # context, it can't be a simple error message. Without this check,
 # the chart will just be a non-loading image.
 if ($tix->Count == 0) {
-    my $plot = GD::Image->new(600 => 300 + ($max_key_length * 14) );
+    my $plot = GD::Image->new( $chart_width => 300 + ($max_key_length * 14) );
     $plot->colorAllocate(255, 255, 255); # background
     my $black = $plot->colorAllocate(0, 0, 0);
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list