[Jifty-commit] r7346 - in plugins: Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer
Jifty commits
jifty-commit at lists.jifty.org
Thu Jul 23 18:22:38 EDT 2009
Author: trs
Date: Thu Jul 23 18:22:38 2009
New Revision: 7346
Modified:
plugins/ (props changed)
plugins/Jifty-Plugin-Chart/lib/Jifty/Plugin/Chart/Renderer/Google.pm
Log:
r48639 at zot: tom | 2009-07-23 18:22:22 -0400
* Allow a choice between text encoding with data scaling or simple encoding
* Fix a max_plus bug where it was subtracted from the maxes rather than added
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:38 2009
@@ -28,6 +28,7 @@
sub render {
my $self = shift;
my %args = (
+ encoding => 'text',
width => 200,
height => 100,
labels => [],
@@ -200,7 +201,7 @@
}
my @min = map { $_ - $args{'min_minus'} } @{ $args{'min_value'} };
- my @max = map { $_ - $args{'max_plus'} } @{ $args{'max_value'} };
+ my @max = map { $_ + $args{'max_plus'} } @{ $args{'max_value'} };
# repeat if necessary
push @min, ($min[-1]) x (@{ $args{'data'} } - @min);
@@ -228,10 +229,15 @@
];
}
- # Let's do text encoding with data scaling
- $url .= "&chd=t:" . join '|', map { join ',', @$_ } @data;
-
- $url .= "&chds=" . join(',', mesh @min, @max);
+ if ( $args{'encoding'} eq 'simple' ) {
+ # We need to do simple encoding
+ $url .= "&chd=s:" . $self->_simple_encode_data( $args{'calculated_max'}, $args{'data'} );
+ }
+ else {
+ # Let's do text encoding with data scaling
+ $url .= "&chd=t:" . join '|', map { join ',', @$_ } @data;
+ $url .= "&chds=" . join(',', mesh @min, @max);
+ }
}
# Add a title
More information about the Jifty-commit
mailing list