Author: spadkins
Date: Wed Apr 18 09:31:55 2007
New Revision: 9436
Modified:
p5ee/trunk/App-Widget/lib/App/Widget/Graph.pm
Log:
Percent values are now handled properly for display.
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 Apr 18 09:31:55 2007
@@ -94,10 +94,50 @@
$self->load_data($spec) if (!$spec->{y});
my $yn = [];
my ($y);
+
+ my $column_defs;
+ my $columns = $spec->{columns};
+ $columns = [ split(/,/, $columns) ] if (!ref($columns));
+ if ($self->{objects}) {
+ $column_defs = $self->{column_defs};
+ }
+ else {
+ my $object_set = $self->get_object_set($spec);
+ if ($#$columns != -1) {
+ $object_set->include_columns($columns);
+ $column_defs = $object_set->get_column_defs();
+ }
+ }
+
+ my $a = [];
+ my $b = [];
+
if ($spec->{y}) {
$y = $spec->{y};
if (ref($y->[0]) eq "ARRAY") {
+
$yn = $y;
+
+ if ($#$columns != -1) {
+ for (my $i = 0; $i <= $#$yn; $i++) {
+ my $array = $yn->[$i];
+ my $format = $column_defs->{$columns->[$i]}{format};
+ foreach my $val (@$array) {
+ if ( $format =~ /%/ ) {
+ my $fval = App::Widget->format($val,
$column_defs->{$columns->[$i]});
+ $fval =~ s/%//g;
+ push (@$a, $fval);
+ } else {
+ push (@$a, $val);
+ }
+ }
+ push(@$b, $a);
+ $a = [];
+ }
+ if ($#$b != -1) {
+ $yn = $b;
+ }
+ }
}
else {
push(@$yn, $y);