[Jifty-commit] r3792 - in jifty/trunk: . lib/Jifty/Plugin/Chart/Renderer

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Aug 4 18:31:36 EDT 2007


Author: sterling
Date: Sat Aug  4 18:31:35 2007
New Revision: 3792

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/Chart/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/PlotKit.pm
   jifty/trunk/lib/Jifty/Plugin/Chart/View.pm

Log:
 r8374 at dynpc145:  andrew | 2007-08-04 17:30:10 -0500
  r8360 at dynpc145:  andrew | 2007-08-04 16:59:22 -0500
  Removed some redundant code from the PlotKit renderer and added support for options to the GD::Graph and Chart renderers.
 


Modified: jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/PlotKit.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/PlotKit.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/PlotKit.pm	Sat Aug  4 18:31:35 2007
@@ -43,11 +43,7 @@
     my $self = shift;
     my %args = ( options => {}, @_ );
 
-    # Turn any subs into values returned
-    for my $key (keys %args) {
-        $args{$key} = $args{$key}->(\%args) if ref $args{$key} eq 'CODE';
-    }
-
+    # translations from generic type to PlotKit types
     my %types = (
         lines          => { type => 'line' },
         bars           => { type => 'bar', barOrientation => 'vertical' },
@@ -63,6 +59,7 @@
     $args{type} = delete $options->{type};
     $args{options}{$_} = $options->{$_} foreach keys %$options;
 
+    # Bad stuff, not a supported type
     if ( not defined $args{type} ) {
         Jifty->log->warn("Unsupported chart type: $orig_type!");
         return;

Modified: jifty/trunk/lib/Jifty/Plugin/Chart/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Chart/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Chart/View.pm	Sat Aug  4 18:31:35 2007
@@ -28,6 +28,7 @@
     # Render the chart and output the PNG file generated
     eval {
         my $chart = $args->{class}->new( $args->{width}, $args->{height} );
+        $chart->set(%{ $args->{options} }) if $args->{options};
         # XXX scalar_png() is undocumented!!! Might bad to rely upon.
         outs_raw($chart->scalar_png($args->{data}));
     };
@@ -57,6 +58,7 @@
     # Render the chart and output the PNG file generated
     eval {
         my $graph = $args->{class}->new( $args->{width}, $args->{height} );
+        $graph->set(%{ $args->{options} }) if $args->{options};
         my $gd    = $graph->plot($args->{data})
             or die $graph->error;
         outs_raw($gd->png);


More information about the Jifty-commit mailing list