Tuesday, April 27, 2010

Google Charts

Google charts is a great/free resource for doing charting.  Many organizations have restrictions on what software you can install, but with google charts no software is needed, just an internet connection.  See this link.  


Here is a simple example:
To get this image, all you have to do is reference this url: http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World


You can simply couple this with python using the webbrowser library. To open the image in a web browser via python try this:


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

4 comments:

Cagil Seker said...

That's cool but only URL parameters is somewhat limiting. Does this accept post parameters or other type of REST/SOAP style access?

Andrew said...

Here is some documents on how to do a POST request:
http://code.google.com/apis/chart/docs/post_requests.html

Here is some JSON documents:
http://code.google.com/apis/chart/docs/json_format.html#

If you want something more local, I would look at the matplotlib for python.

Cool blog by the way.

fme talk said...

Nice feature. Could this also be used for visualizing the csv file generate in the model described in this post?
http://anothergisblog.blogspot.com/2009/11/generating-elevation-profile-part-1.html

Andrew said...

Yes you can use it for my older post, one day I'll finish part two.. I actually was going to use the MS Charting Control to create the elevation profile.