Monday, April 21, 2008

Google Chart
I have a project at work coming up that will require some dynamic charts. As I don't feel the need to reinvent a wheel that others have perfected before me, I decided to take a look at Google Charts. The first thing I noticed was that this was extremely easy to use. It took me about 45 seconds to create the graphic used on this post. For a pie chart all you basically have to do is set the data and the labels and you're done.

Chart Type:cht=p3
Chart Size:chs=250x100
Data: chd=t:20,40,5,10,5
Labels: chl=muffin%7Ccoffee%7Cscone%7Cbagels%7Cdounut
So the URL to call the graph looks like this:
http://chart.apis.google.com/chart?cht=p3
&chd=t:20,40,5,10,5
&chs=250x100
&chl=muffin%7Ccoffee%7Cscone%7Cbagels%7Cdounut"

As you see this is a very simple example of what Google Charts can do.The documentation is fantastic. You can create just about any chart you'd like. The short list is: line charts, sparkline charts, bar charts, pie charts (2D and 3D), scatter plots, maps (yes maps), venn diagrams, radar charts and the google-o-meter.  Google Charts is a very nice full featured Chart API that I know I'll be using in the future.


Happy Coding :-D
4/21/2008 4:19:41 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [2]