Unofficial news and tips about Google

December 6, 2007

Dynamically Generated Charts

I've always wondered what's behind www.google.com/chart, the strange directory used by Google to dynamically generate charts. They use this charts at Google Video to show stats like this one (if you're brave, look at the image location):

The problem is that Google also adds a hash to the URL so you can't play around with the parameters and create your own charts. But now there's Google Chart API, a way to make these charts available to everyone.

"The Google Chart API returns a PNG-format image in response to a URL. Several types of image can be generated: line, bar, and pie charts for example. For each image type you can specify attributes such as size, colors, and labels. You can include a Chart API image in a webpage by embedding a URL within an <img> tag. When the webpage is displayed in a browser the Chart API renders the image within the page."

All these charts can be created dynamically by building some admittedly complicated URLs.

This is a great way to create simple charts programmatically and I'm sure many web apps will use them. The query limit of 50,000 queries per user per day is more than sufficient.

Update: It seems that the limit is not that generous. "The user is the webpage that links to the chart. We would like to make sure that all users get their charts fast and reliably. Therefore we may temporarily block users (websites) that exceed the limit. A chart request is not counted if the chart image is cached by the browser or by a proxy," clarified Uwe Maurer from Google Zürich.

7 comments:

> The query limit of 50,000 queries per user per day is> more than sufficient.

Depends on the use case. Even including such a chart in a blog post is risky because e.g. as soon as you're dugg, and the story stays on the digg frontpage for some time, you may get more than 50,000 hits.

It might be usefull for small company's business web applications, like some administrative intranet or something. But I doubt the copiright terms in wich it's released allows you to use it that way...