? googlechart_simple.diff
? usage/includes/.cvsignore
Index: usage/includes/pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/includes/pages.inc,v
retrieving revision 1.3
diff -u -p -r1.3 pages.inc
--- usage/includes/pages.inc	10 Aug 2009 21:02:08 -0000	1.3
+++ usage/includes/pages.inc	23 Mar 2010 09:29:11 -0000
@@ -512,12 +512,10 @@ function theme_project_usage_chart_by_re
     }
   }
 
-  // Now convert the series into strings with the data. Along the way figure
-  // out the range of data.
+  // Figure out the range of the data
   $min = $max = 0;
   $data = array();
   foreach ($series as $s) {
-    $data[] = implode(',', $s);
     $max = max($max, max($s));
   }
 
@@ -531,6 +529,25 @@ function theme_project_usage_chart_by_re
   $max = ($zeros > 0) ? (substr($max, 0, 1) + 1 . str_repeat('0', $zeros)) : 10;
   $value_axis = range($min, $max, '1'. str_repeat('0', $zeros));
 
+  // Encode datapoints according to Google Charts simple encoding to avoid
+  // 'Request-URI Too Large' errors
+  $simple_encoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+  $simple_encoding_length = strlen($simple_encoding)-1;
+  foreach ($series as $nr => $s) {
+    $series_data[$nr] = '';
+    foreach ($s as $value) {
+      if ($value >= $min) {
+        $series_data[$nr] .= $simple_encoding[round($simple_encoding_length * ($value / $max))];
+        print $max . '-' . $value . "<br />";
+      }
+      else {
+        $series_data[$nr] .= '_';
+      }
+    }
+  }
+  $chart_data = 's:' . implode(',', $series_data);
+
+
   // Might need more colors than this.
   $colors = array('EDAA00', '0062A0', 'A17300', 'ED8200', '38B4BA', '215D6E');
 
@@ -545,7 +562,7 @@ function theme_project_usage_chart_by_re
     'cht' => 'lc',
     // Pick some colors.
     'chco' => implode(',', array_slice($colors, 0, count($series))),
-    'chd' =>  't:'. implode('|', $data),
+    'chd' =>  $chart_data,
     // Set the range of the chart
     'chds' => implode(',', array_fill(0, count($series), $min .','. $max)),
      // Legend is the header titles after excluding the date.
