[Jifty-commit] r5577 - in jifty/trunk: lib/Jifty/Plugin/Chart/Renderer
Jifty commits
jifty-commit at lists.jifty.org
Wed Jul 23 23:01:39 EDT 2008
Author: trs
Date: Wed Jul 23 23:01:39 2008
New Revision: 5577
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/Google.pm
Log:
r37830 at zot: tom | 2008-07-23 22:40:57 -0400
A few fixes for map charts
r37831 at zot: tom | 2008-07-23 22:44:03 -0400
Some more fixes for maps
r37832 at zot: tom | 2008-07-23 23:01:27 -0400
More fixes
Modified: jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/Google.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/Google.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Chart/Renderer/Google.pm Wed Jul 23 23:01:39 2008
@@ -30,7 +30,7 @@
width => 200,
height => 100,
labels => [],
- geography => 'world',
+ geoarea => 'world',
min_minus => 0,
max_plus => 0,
@_
@@ -70,7 +70,21 @@
$args{'width'} =~ s/px$//;
$args{'height'} =~ s/px$//;
- if ( $args{'type'} eq 'map' ) {
+ # Check size and die if wrong
+ for ( qw(width height) ) {
+ if ( $type eq 't' ) {
+ my $max = $_ eq 'width' ? 440 : 220;
+ die "$_ over ${max}px" if $args{$_} > $max;
+ } else {
+ die "$_ over 1000px" if $args{$_} > 1000;
+ }
+ }
+
+ # Check chart area
+ die "Chart area over maximum allowed (300,000 for charts, 96,800 for maps)"
+ if $args{'width'} * $args{'height'} > ( $type eq 't' ? 96800 : 300000 );
+
+ if ( $type eq 't' ) {
$args{'codes'} = shift @{ $args{'data'} };
# Light blue for water
@@ -107,12 +121,13 @@
$url .= "&chs=$args{'width'}x$args{'height'}";
# Add the data (encoding it first)
- if ( $args{'type'} eq 'map' ) {
- $url .= "&chtm=$args{'geographical'}"; # Geo. area
- $url .= "&chld=" . join '', @{ $args{'codes'} }; # Codes
+ if ( $type eq 't' ) {
+ # Map!
+ $url .= "&chtm=$args{'geoarea'}";
+ $url .= "&chld=" . join '', @{ $args{'codes'} };
# We need to do simple encoding
- $url .= "&chd=t:" . $self->_simple_encode_data( $args{'max_value'}, $args{'data'} );
+ $url .= "&chd=s:" . $self->_simple_encode_data( $args{'max_value'}, @{$args{'data'}} );
}
else {
my $min = $args{'min_value'} - $args{'min_minus'};
More information about the Jifty-commit
mailing list