... and Google returns a PNG graphic containing the chart. For instance, above URL results in the following image:
Splitting up the image URL parameters, you can see what it's made up of:
|the chart type, in this case, a pie chart|
|the chart values, text-encoded, and separated by a comma|
|the custom chart size, 350x150 pixels|
|the different labels for the pie chart sections, separated via the pipe character|
I'm not linking live to Google but caching this image on my server instead, just in case, as Google limits your requests to this API to 50,000 per day. Even with that limit, you can grab the image and do the caching on your own server automatically (by copying the binary), which would mean 50,000 requests will be good enough for many use cases.
This service is really neat all in all. The last time I wanted to do a dynamic 3D pie chart as above, I used some PHP scripts (accessing the GD image library) which were ugly to configure, and not just because the code was obfuscated to make it hard to remove "created by" messages in the image. Then again I'm not sure the Google Charts API does everything other services can do, and we also don't know how long they will keep up support for it – think of other half-cancelled APIs like the Google SOAP API (and there doesn't seem to be a quick way for Google to make money from the Google Chart API yet... adding ads would be too noisy for users for this purpose, and there's no way to make the ad clickable anyway).
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):
Also see how you can kidnap Google Page Creator's image generator.
>> More posts