[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-272-ga2ff1fe

? sunnavy sunnavy at bestpractical.com
Fri Mar 26 04:22:50 EDT 2010


The branch, 3.8-trunk has been updated
       via  a2ff1fe108a829a16ec8803097663606849667af (commit)
      from  5cbbae6424a1a3c8fc459a769eb1f1105161af7d (commit)

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

- Log -----------------------------------------------------------------
commit a2ff1fe108a829a16ec8803097663606849667af
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 26 16:22:45 2010 +0800

    make x_labes vertical if no enough space

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 793c7ad..19bd310 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -81,6 +81,7 @@ my $class = $class{ $PrimaryGroupBy };
 
 my %data;
 my $max_value = 0;
+my $max_key_length = 0;
 while ( my $entry = $tix->Next ) {
     my $key;
     if ( $class ) {
@@ -101,6 +102,7 @@ while ( my $entry = $tix->Next ) {
     }
     $data{ $key } = $value;
     $max_value = $value if $max_value < $value;
+    $max_key_length = length $key if $max_key_length < length $key;
 }
 
 # XXX: Convert 1970-01-01 date to the 'Not Set'
@@ -167,6 +169,8 @@ if ($chart_class eq "GD::Graph::bars") {
         values_space => -1,
 # the following line to make sure there's enough space for values to show
         y_max_value => 5*(int($max_value/5) + 1),
+# 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,
     );
 }
 

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


More information about the Rt-commit mailing list