[Jifty-commit] r7345 - in plugins: Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer

Jifty commits jifty-commit at lists.jifty.org
Thu Jul 23 18:22:36 EDT 2009


Author: trs
Date: Thu Jul 23 18:22:35 2009
New Revision: 7345

Modified:
   plugins/   (props changed)
   plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm

Log:
 r48638 at zot:  tom | 2009-07-23 17:40:31 -0400
 * Correctly handle label positions, esp. for multiple datasets
 * Allow the native Google chart types to be used


Modified: plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm
==============================================================================
--- plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm	(original)
+++ plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm	Thu Jul 23 18:22:35 2009
@@ -61,6 +61,9 @@
         geo                     => 't',
     );
 
+    # The Google chart types themselves are valid too
+    $types{$_} = $_ for values %types;
+
     # Make sure the type is ready to be used
     my $type = $types{ lc $args{type} } || undef;
 
@@ -281,8 +284,20 @@
             $url .= "&chxs=" . join '|', @styles if @styles;
 
             # label positions
-            $url .= "&chxp=" . join ',', @{ $args{'positions'} }
-                if defined $args{'positions'};
+            if ( defined $args{'positions'} ) {
+                $url .= "&chxp=";
+                if ( ref $args{'positions'}->[0] eq 'ARRAY' ) {
+                    my @sets;
+                    my $idx = 0;
+                    for my $set ( @{ $args{'positions'} } ) {
+                        push @sets, join ',', $idx, @$set;
+                        $idx++;
+                    }
+                    $url .= join '|', @sets;
+                } else {
+                    $url .= join ',', 0, @{$args{'positions'}};
+                }
+            }
         }
     }
 


More information about the Jifty-commit mailing list