[Rt-commit] rt branch, 4.2/charts, updated. rt-4.1.13-160-g70e3e19

Thomas Sibley trs at bestpractical.com
Tue Jul 2 18:37:27 EDT 2013


The branch, 4.2/charts has been updated
       via  70e3e19e7161698d5c67afc71014d67110a3dd32 (commit)
       via  71a5e134b987302bc5e63ad161dc7ede1b6bd25a (commit)
       via  3ee4909ca08accd3ff6a3751f694acf258e6aea7 (commit)
      from  af1b6bf7a446f45e335a4f09633b7dd5584e386d (commit)

Summary of changes:
 etc/RT_Config.pm.in                   | 13 +++++++++++++
 lib/RT/Config.pm                      |  3 +++
 lib/RT/Report/Tickets.pm              | 10 +++++++++-
 sbin/rt-test-dependencies.in          |  2 +-
 share/html/Search/Chart               |  7 +------
 share/html/Search/Elements/ChartTable |  3 +++
 share/static/css/base/charts.css      |  4 ++++
 7 files changed, 34 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 3ee4909ca08accd3ff6a3751f694acf258e6aea7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 2 15:04:20 2013 -0700

    Require GD::Graph 1.47 for the hide_overlapping_values layout option
    
    Otherwise labels may not be visible at all.

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index b7e2b24..6b67142 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -338,7 +338,7 @@ IPC::Run 0.90
 
 $deps{'GD'} = [ text_to_hash( << '.') ];
 GD
-GD::Graph
+GD::Graph 1.47
 GD::Text
 .
 

commit 71a5e134b987302bc5e63ad161dc7ede1b6bd25a
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 2 15:35:22 2013 -0700

    @ChartColors config option
    
    Primarily for access from other parts of the charting code, such as
    table rendering, but also useful for anyone who wants to adjust the
    defaults to something more pleasing.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 345a747..b347efe 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1167,6 +1167,19 @@ At this time, this feature only applies to MySQL and PostgreSQL.
 
 Set($ChartsTimezonesInDB, 0);
 
+=item C<@ChartColors>
+
+An array of 6-digit hexadecimal RGB color values used for chart series.  By
+default there are 12 distinct colors.
+
+=cut
+
+Set(@ChartColors, qw(
+    66cc66 ff6666 ffcc66 663399
+    3333cc 339933 993333 996633
+    33cc33 cc3333 cc9933 6633cc
+));
+
 =back
 
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index f36ec2f..59c7276 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -821,6 +821,9 @@ our %META = (
             $config->Set( CustomFieldGroupings => %$groups );
         },
     },
+    ChartColors => {
+        Type    => 'ARRAY',
+    },
 );
 my %OPTIONS = ();
 my @LOADED_CONFIGS = ();
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 52d59cd..1e9abcb 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -438,12 +438,7 @@ foreach my $opt ( grep /_font$/, keys %chart_options ) {
 }
 $chart->set(%chart_options) if keys %chart_options;
 
-# refine values' colors, with both Color::Scheme's help and my own tweak
-$chart->{dclrs} = [
-    '66cc66', 'ff6666', 'ffcc66', '663399',
-    '3333cc', '339933', '993333', '996633',
-    '33cc33', 'cc3333', 'cc9933', '6633cc',
-];
+$chart->{dclrs} = [ RT->Config->Get("ChartColors") ];
 
 {
     no warnings 'redefine';

commit 70e3e19e7161698d5c67afc71014d67110a3dd32
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 2 15:36:27 2013 -0700

    Color the chart table column headings to match the image
    
    Now no legend is needed and a quick visual association is possible.

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 93b7f16..16b48eb 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -936,6 +936,12 @@ sub FormatTable {
         colspan => scalar @{ $columns{'Groups'} },
     };
 
+    my $pick_color = do {
+        my @colors = RT->Config->Get("ChartColors");
+        sub { $colors[ $_[0] % @colors - 1 ] }
+    };
+
+    my $function_count = 0;
     foreach my $column ( @{ $columns{'Functions'} } ) {
         $i = 0;
 
@@ -973,6 +979,7 @@ sub FormatTable {
                 type => 'head',
                 value => $label,
                 rowspan => scalar @head,
+                color => $pick_color->(++$function_count),
             };
             push @{ $footer[0]{'cells'} }, { type => 'value', value => undef };
             next;
@@ -987,10 +994,11 @@ sub FormatTable {
                 type => 'head',
                 value => $label,
                 rowspan => scalar @head,
+                color => $pick_color->(++$function_count),
             };
         } else {
             push @{ $head[0]{'cells'} }, { type => 'head', value => $label, colspan => scalar @subs };
-            push @{ $head[1]{'cells'} }, { type => 'head', value => $_ }
+            push @{ $head[1]{'cells'} }, { type => 'head', value => $_, color => $pick_color->(++$function_count) }
                 foreach @subs;
         }
 
diff --git a/share/html/Search/Elements/ChartTable b/share/html/Search/Elements/ChartTable
index 7d8465d..a9557cd 100644
--- a/share/html/Search/Elements/ChartTable
+++ b/share/html/Search/Elements/ChartTable
@@ -85,6 +85,9 @@ foreach my $section (qw(thead tbody tfoot)) {
                 my $value = int $cell->{ $dir };
                 $m->out(qq{ $dir="$value"});
             }
+            $m->out(' style="background-color: #'. $m->interp->apply_escapes($cell->{color}) .'"')
+                if $cell->{color};
+
             $m->out('>');
             if ( defined $cell->{'value'} ) {
                 if ( my $q = $cell->{'query'} ) {
diff --git a/share/static/css/base/charts.css b/share/static/css/base/charts.css
index ef9c129..c1b751b 100644
--- a/share/static/css/base/charts.css
+++ b/share/static/css/base/charts.css
@@ -15,3 +15,7 @@
     width: 3em;
     text-align: right;
 }
+
+.chart-wrapper .collection-as-table th {
+    text-shadow: 0 0 3px #ddd;
+}

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


More information about the Rt-commit mailing list