[Jifty-commit] r7344 - in plugins: Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer
Jifty commits
jifty-commit at lists.jifty.org
Thu Jul 23 16:17:53 EDT 2009
Author: trs
Date: Thu Jul 23 16:17:53 2009
New Revision: 7344
Modified:
plugins/ (props changed)
plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm
Log:
r48632 at zot: tom | 2009-07-23 16:17:37 -0400
Fix a couple glaring issues with simple data encoding for Google charts
* Multiple datasets were ignored and only the first was encoded (!)
* Out of bounds indexes were compared and set to the length of the
mappable array rather than the last index
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 16:17:53 2009
@@ -169,7 +169,7 @@
$url .= "&chld=" . join '', @{ $args{'codes'} };
# We need to do simple encoding
- $url .= "&chd=s:" . $self->_simple_encode_data( $args{'max_value'}, @{$args{'data'}} );
+ $url .= "&chd=s:" . $self->_simple_encode_data( $args{'max_value'}, $args{'data'} );
}
else {
# Deal with out of range horizontal markers here by fixing our range
@@ -388,14 +388,17 @@
my $i = 0;
my $result = '';
my @map = ('A'..'Z', 'a'..'z', 0..9);
- for my $value ( @$data ) {
- if ( looks_like_number($value) ) {
- my $index = int($value / $maxes->[$i] * (@map - 1));
- $index = 0 if $index < 0;
- $index = @map if $index > @map;
- $result .= $map[$index];
- } else {
- $result .= '_';
+ for my $set ( @$data ) {
+ $result .= ',' if $i; # if this isn't the first set
+ for my $value ( @$set ) {
+ if ( looks_like_number($value) ) {
+ my $index = int($value / $maxes->[$i] * $#map);
+ $index = 0 if $index < 0;
+ $index = $#map if $index > $#map;
+ $result .= $map[$index];
+ } else {
+ $result .= '_';
+ }
}
++$i;
}
More information about the Jifty-commit
mailing list