[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-138-g5b54fb6

? sunnavy sunnavy at bestpractical.com
Fri Aug 20 23:30:48 EDT 2010


The branch, 3.8-trunk has been updated
       via  5b54fb6ee81a3af222fed2c3fd321a39b692211e (commit)
      from  c0cc3c9e0bb842959f3fa34c5d49a6fddf0a64ee (commit)

Summary of changes:
 share/html/Search/Chart |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 5b54fb6ee81a3af222fed2c3fd321a39b692211e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Aug 21 11:22:36 2010 +0800

    tweak the bar_spacing according the the number of bars

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index acfc33f..647d490 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -146,12 +146,11 @@ if ($tix->Count == 0) {
 }
 
 if ($chart_class eq "GD::Graph::bars") {
+    my $count = keys %data;
     $chart->set(
         x_label => $tix->Label( $PrimaryGroupBy ),
         y_label => loc('Tickets'),
         show_values => 1,
-        bar_spacing => 5,
-        bargroup_spacing => 10,
         x_label_position => 0.6,
         y_label_position => 0.6,
         values_space => -1,
@@ -160,7 +159,10 @@ if ($chart_class eq "GD::Graph::bars") {
 # the following line to make sure there's enough space for values to show
         y_max_value => 5*(int($max_value/5) + 2),
 # if there're too many bars or at least one key is too long, use vertical
-        x_labels_vertical => ( keys(%data) * $max_key_length > 60 ) ? 1 : 0,
+        x_labels_vertical => ( $count * $max_key_length > 60 ) ? 1 : 0,
+        $count > 30 ? ( bar_spacing => 1 ) : ( $count > 20 ? ( bar_spacing => 2 ) : 
+            ( $count > 10 ? ( bar_spacing => 3 ) : ( bar_spacing => 5 ) )
+        ),
     );
 }
 

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


More information about the Rt-commit mailing list