Sunday, October 4, 2009

Web Page Integration with Data Visualization using Google Chart API

I'm always looking for better ways to display data to business managers (and myself) so that business or I.T. decisions can be made more quickly. I've heard about Google Charts for a couple of years but never really investigated using them until this weekend. I previously haven't given much credit to Google but this is one service that I can give praise where rightfully deserved.

If you haven't heard about the Google Charts API, it is a "web service" that allows one to embed dynamically rendered charts on a web page. The chart selection can be Bar, Line, Pie, Venn, Scatter-Plot, "Google-o-Meter" (think speedometer), or even a World Map.

The user wanting to display a chart simply embeds a hyperlink to Google's Chart API in their webpage and upon loading, the visualization is loaded. Using this method of chart visualization means that you now have a platform, language, and browser independent chart control that you can embed into your website because it is simply based upon an http url.

Below is an example of a Pie Chart that this service offers:


Pie Chart Example


This Pie Chart was rendered using this simple url:

http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

where the parameters
  • cht assigns chart type ('p3' = Pie Chart)
  • chd assigns data points ('t:60,40' = 60% for the first value, 40% is the second)
  • chs assigns the size in pixel dimensions of the chart (250 pixels wide by 100 pixels tall)
  • chl assigns the data labels based upon the data point order (60% labeled "Hello", 40% labeled "World")
The "neatest" chart Google Chart offers is the World Map, where you can setup different gradients of colors to represent different countries and/or political boundaries within the countries by the intensity of the data point (1-100).

Below is an example of a map of the United States where I have only colored Georgia, red:




This chart was called using this url:

http://chart.apis.google.com/chart?cht=t&chs=440x220&chd=t:100&chtm=usa&chco=FFFFF,FF0000,FFFF00,00FF00&chld=GA


Of course, the rendering of these charts is very quick, as you can see by simply refreshing this blog page. Google allows unlimited calls to this API per day, but requests that you email them if you expect over 250,000 calls per day.

While some of you may already be familiar with this service offering, I hope that those of you who are not will find some value in this posting. From a dashboard perspective, this service can drastically lower the complexity of building a solution for your business.

David Bowles

2 comments:

  1. Nice work, David. You are fast. The second assignment is relevant to this. Other widely used Google web APIs are map and search.

    ReplyDelete
  2. Enlightening blog posting; very helpful.
    Thanks.

    -Bill Stephens

    ReplyDelete