Since I'm writing a sales application, I needed a way to produce charts. I've played around with the
<canvas>tag on a previous project, but really wanted something higher level. My boyfriend Jerry suggested I look at the Google Chart API. It's wonderfully simple: you build a URL like
http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|Worldand use it in an
<img>tag. Google renders up your chart as a PNG and sends it back to your browser, like this:
Google gives you a lot of chart types and formatting options, most of them well documented, though a few tricky option combinations could benefit from more verbose explanations. Fortunately it's pretty easy to experiment in the browser -- just tweak the URL and refresh.
My only criticism is the brevity of the URL parameters (
chtis chart type,
chxlis axis labels, etc.) and the various ways of delimiting multivalued parameters (data takes a comma delimited list, labels are pipe '|' delimited) can be trying to work with at times. Still, after a couple of hours of modest twiddling, I had a couple of Python functions to build URLs for a bar chart and pie chart, respectively and my sales app has two respectable looking charts on the home page. Google Chart API is definately worth taking a look at.