Google Chart API

So, I was surprised to see my news this morning, when information aesthetics spread the news of the new Google Chart API. Looks like they’ve been reading my blog, and they decided to save me the trouble of installing matplotlib or anything.

It’s not interactive, which still makes Dojo charting a very useful alternative, but it’s good to have a quick, easy API for just embedded charts for simple data. As an example, here’s a chart of the number of visits this site got during the first 12 days of National Blog Posting Month:

Unfortunately, I can’t show stats for the whole month, because I simply don’t have them. I must’ve screwed up my template somehow, because the urchin tracker disappeared at some point, so from the 13th on, all my stats flatlined. I suppose I could represent that on the chart, but it would make me sad.

The lowdown

It’s missing a number of features I would like, but for an initial offering of a free service, it’s pretty well stocked. It’s got a variety of graph types available, including line, bar, scatter and the infamous pie. It supports axis labels, including labels on the top and/or right sides of a chart, and even multiple sets of labels per axis, which can be used (as shown above) to give an overall title to a horizontal axis. It can technically be done for vertical axes as well, but it doesn’t rotate, so it looks a little weird compared to traditional charts. Colors are fully configurable, which is especially useful when including multiple data sets, which is also supported.

Unfortunately, I was shocked, horrified and moderately surprised to see that nowhere is there any mention of how to encode negative numbers. Google, I appreciate you trying to help, and I understand that this grew out of needs for Google Finance, where stock prices can never dip below zero. But there’s really not that much data out there in the real world that always exists solely above the origin. This limitation alone puts me into a wait-and-see mode, because if Google doesn’t do something about it soon, there’s not much real-world value in the service.

One other particular feature I was hoping for, and was sadly lacking, is the ability to turn off axis lines entirely. Given the ability to create a simple line graph at small image sizes, this API would be immensely useful in the generation of sparklines. A simple Django template tag could generate a sparkline-type chart inline in a template, and many complex tables could be quickly made much more reasonable to interpret.

Of course, in the shadow of the negative number problem, this one is quite trivial:

Finally, a decent use for pie charts.

Conclusion

I’ll definitely be keeping my eye on this. It’d be a great way to embed simple graphs in blog posts, if nothing else, so it’s certainly worth learning. But if Google gets just those two features included, this could actually be quite a powerful service.

Comments

  1. At 12:21 a.m. on Dec 7, 2007, Zellyn said ...

    From the Google finance page:

    I think their idea is that you're encoding the vertical position of points on the graph, not their actual values.

  2. At 1:33 p.m. on Dec 7, 2007, Eric said ...

    I've got to say, I was very impressed by the number of queries per user per day they allow: 50,000! That's not bad at all, it just prevents commercial shops from using it.

  3. At 2:03 p.m. on Dec 7, 2007, Marty Alchin said ...

    Interesting. That graph does indeed look like what I'm describing as being more useful. It incorporates undocumented features, which are apparently only available to Google-operated services. This is unfortunate, but not ultimately surprising. It means more to me though, so I'll be writing another post on the subject.

  4. At 2:45 p.m. on Dec 7, 2007, Marcin Kaszynski said ...

    zellyn: exactly.

    The idea is that you normalize the data and provide labels for the axes. There is no connection between a label's position on an axis, its contents and the actual value it represents on your graph.

    Google Analytics was using a very similar API to generate the small charts for some time now. It is nice to see it officially supported with larger number of chart types :)

  5. At 7:44 p.m. on Dec 13, 2007, Jon said ...

    Hi, my GUI for the charts API is at: Google Charts

    Thanks.

  6. At 2:04 p.m. on Dec 22, 2007, Anonymous said ...

    You CAN generate sparklines using google charts.

    Please take a look at - http://www.style.org/chartapi/sparklines/

  7. At 9:11 p.m. on Jan 21, 2008, ZD said ...

    Then what the point for me to calculate exact positions myself?

    The data I display spreads from -50 to 200 - what should I do in this situation? Add 50 to all the data (0..250) and label axis accordingly? It requires more efforts then should.

Speak up!


This particular article was posted on Friday, December 7, 2007, and has received 7 comments.

It was preceeded by Looking back at the sprint and followed by Google Chart API Revisited.

It contains the following links:

Archive

Categories

Powered by Django.