2

I am using Google Chart API in my Application and generating graph using URL "http://chart.apis.google.com"

I am getting error "The requested URL is too large to process", when I provide large set of parameters to this URL.

What I can do in this situation?

Soniya
  • 127
  • 3
  • 4
  • 11

4 Answers4

3

The Google Charts API FAQ offers this advice:

Is there a limit on the URL length for the Google Chart API? What is the maximum URL length?

The maximum length of a URL is not determined by the Google Chart API, but rather by web browser and web server considerations. The longest URL that Google accepts in a chart GET request is 2048 characters in length, after URL-encoding (e.g., | becomes %7C). For POST, this limit is 16K.

If URL length is a problem, here are a few suggestions for shortening your URL:

  • If you are using a text encoding data format, remove leading zeros from numbers, remove trailing zeros after decimal points, and round or truncate the numbers after decimal points.
  • If that does not shorten the URL enough, use simple (1 character) or extended (2 character) encoding.
  • Sample data less frequently; i.e., reduce granularity.
  • Remove accoutrements and decorations, such as colors, labels, and styles, from your chart.

also found this but there doesn't seem to be an answer/solution.
http://groups.google.com/group/google-chart-api/browse_thread/thread/b47c1588b39d98ce

Iain Samuel McLean Elder
  • 19,791
  • 12
  • 64
  • 80
Samuel
  • 1,389
  • 16
  • 29
0

I'm getting HTTP 414 but my URL length is not an issue (it is 1881 characters), and I have tried both GET and POST. My guess is that Google will also return this error when the chart you are requesting is too "expensive" to generate.

Jeff Evans
  • 1,257
  • 1
  • 15
  • 31
0

A method that worked well for me was to divide all values by 10 or 20 and converting the results to int (no commas), but I kept the numbers on the axis. This way, it's a little less accurate but reduces the amount of characters used in the URL.

Code example:

$newSalesrank = $rank/20;
$rankdata .= intval($newSalesrank);

This solved my problem, I got no more "url too long" errors and it still looks good on my charts - because it still looked the same, the numbers just were simply scaled down.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Saskia
  • 11
  • 4
0

In case it is a browser error - browsers have their maximum URL length limitations (IE 6/7 has 2,083 limit):

What is the maximum length of a URL in different browsers?

Community
  • 1
  • 1
Petteri H
  • 11,779
  • 12
  • 64
  • 94