Google Chart API Released
Google has released a chart generator service called the Google Chart API. The Google Chart API lets you build a URL that will dynamically create a chart for you. This service is used internally for Google Finance, Google Video, and beyond.
"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. Usage is quite straightforward: you link to an image in the form of a parameterized URL, e.g.
http://chart.apis.google.com/chart?cht= p3&chd=t:90,49&chs=350x150&chl=Foo|Bar

Splitting up the image URL parameters, you can see what it's made up of:
cht=p3 |
the chart type, in this case, a pie chart |
chd=t:90,49 |
the chart values, text-encoded, and separated by a comma |
chs=350x150 |
the custom chart size, 350x150 pixels |
chl=Foo|Bar |
the different labels for the pie chart sections, separated via the pipe character |
Here are a couple of more examples of what can be done with the Chart API (cached again, but click them to see a live parametrized version):
Google, Google Char, API







Leave a comment »