Google releases charts API: Create customizable charts for your websites

Bookmark/Share » Post Google releases charts API: Create customizable charts for your websites to digg. bookmark on del.cio.us Add TheLiveWeb.net to Technorati. add to stumbleupon Post Google releases charts API: Create customizable charts for your websites to Reddit Google Bookmark

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:
Google pie chart sample

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&param-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!

If you liked this post or find this website useful, please consider subscribing to the full feed RSS. You can also subscribe by Email and have new posts sent directly to you.
Share » Post Google releases charts API: Create customizable charts for your websites to digg. bookmark on del.cio.us Add TheLiveWeb.net to Technorati. add to stumbleupon Post Google releases charts API: Create customizable charts for your websites to Reddit Google Bookmark

Next Steps »

2 Responses to “Google releases charts API: Create customizable charts for your websites”

  1. 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. :P

  2. 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.

Leave a Reply

Related Posts from the Past: