[svn:p5ee] r12513 - p5ee/trunk/App-Widget/lib/App/Widget

[email protected] Wed, 18 Feb 2009 11:23:48 -0800 (PST)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Wed Feb 18 11:23:47 2009
New Revision: 12513

Modified:
   p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm

Log:
0002612: graphs day of week on graph axis displays as number, not day abbreviation

Modified: p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm	(original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm	Wed Feb 18 11:23:47 2009
@@ -84,6 +84,26 @@
     my ($self, $spec) = @_;
     $self->load_data($spec) if (!$spec->{y});
     my $x = $spec->{x};
+
+    my $context     = $self->{context};
+    my $column_defs = $spec->{column_defs};
+    my $keys        = $spec->{keys};
+    if (!ref($keys)) {
+        $keys = $keys ? [split(/,/, $keys)] : [];
+    }
+    foreach my $graph_key (@$keys) {
+        my $domain = $column_defs->{$graph_key}{domain};
+        if ($domain eq "dow") {
+            my $x_new;
+            my $value_domain = $context->value_domain($domain);
+            my $labels = $value_domain->labels();
+            foreach my $x_val (@$x) { 
+                push(@$x_new, $labels->{$x_val});
+            }
+            $x = $x_new;
+        }
+    }
+
     &App::sub_exit($x) if ($App::trace);
     return($x);
 }