Google releases charts API: Create customizable charts for your websites
Google yesterday released a chart API that let’s you create great looking charts on the fly using the data/settings provided in the url. It supports a bunch of charts like line chart, bar chart, pie chart, Venn diagrams and gives you pretty much complete control over how the charts look. You can choose size, color schemes, the background, legend and so on.
The API is very easy to use. Here for example, based on the Google analytics data I created a pie chart representing the browsers that people visiting this site are using:
Following is the url that generated this chart with a brief explanation of what these parameters represent:
http://chart.apis.google.com/chart? cht=p3 -> 3D pie chart &chs=300x130 -> chart size &chd=t:70,23,5,2 -> data (% of users using each browser type) &chl=Firefox|IE|Safari|Others -> chart labels (browser types) &chco=547d1c,DDDDDD -> colors used in chart
Embedding in web page
Embedding the images on your web page could not be easier, just use the img tag as you do with other images
<img src=”http://chart.apis.google.com/chart?param-1¶m-2…” />
The chart data attribute support 3 types of encoding : Simple encoding (supports 62 values using a-z, A-Z, 0-9), Text encoding (supports 1000 values using numbers between 0.0 and 100.0) and Extended encoding which supports 4k values. The developer guide for this api is available here.
Limitations
There are a couple of limitations on the usage:
- Usage Policy puts this restriction : “Use of the Google Chart API is subject to a query limit of 50,000 queries per user per day. If you go over this 24-hour limit, the Chart API may stop working for you temporarily. If you continue to exceed this limit, your access to the Chart API may be blocked.” But if you’re using it to generate charts with fixed set of values, it should be easy to periodically pre-generate and cache the images to get over this problem.
- The largest possible area for a chart is 300,000 pixels.
Despite these limitations, it seems like a great tool to generate charts on the fly. What’s best about the api is it’s simplicity!
Next Steps »
- Leave your comment (2)
- Trackback from your own site
- Read other posts in similar categories : Google, How-To, Technology






Subscribe by Email
The 50K query limit would probably prevent me from being able to use this in any of my major projects, but you’re right about the beauty of that API.
Added to del.icio.us for future use!
Now they need to get on sharing the charting from Google Finance and Analytics.
I agree it would be great if they could enhance it to make it interactive as charts on Google finance sites, but that’s going to be more complex as they use Flex charting on that site.