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

Jifty commits jifty-commit at lists.jifty.org
Tue Nov 18 16:15:11 EST 2008


Author: sartak
Date: Tue Nov 18 16:15:10 2008
New Revision: 6021

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

Log:
 r75718 at onn:  sartak | 2008-11-18 16:15:03 -0500
 Better column data structure


Modified: jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/GoogleViz.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/GoogleViz.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/GoogleViz.pm	Tue Nov 18 16:15:10 2008
@@ -94,16 +94,19 @@
 hashref. The hashref may specify C<type> and C<label>. If no C<label> is given,
 the C<id> is used.
 
+It also canonicalizes the columns so that each is a hashref with C<type> and
+C<label> set.
+
 =cut
 
 sub add_columns {
     my $self = shift;
     my %args = @_;
 
-    my %cols = %{ $args{columns} };
+    my $cols = $args{columns};
 
-    for my $id (keys %cols) {
-        my $column = $cols{$id};
+    for my $id (keys %$cols) {
+        my $column = $cols->{$id};
 
         my ($type, $label);
         if (ref($column)) {
@@ -116,6 +119,11 @@
 
         $label ||= $id;
 
+        $cols->{$id} = {
+            type  => $type,
+            label => $label,
+        };
+
         Jifty->web->out("data.addColumn('$type', '$label', '$id');\n");
     }
 }


More information about the Jifty-commit mailing list