Google announced today their API for embedding charts in webpages, using nothing more than a standard HTTP URL with parameters. If you like showing data, you’re going to love this feature. You’ve probably already seen these charts on various Google properties like Google finance. While this won’t replace Excel, it includes the basic chart types: line charts, bar charts, pie charts, scatter plots, even Venn diagrams. Here’s their API documentation.
Here’s a simple example:
Here’s a walkthrough of the link text that generated this (split onto multiple lines for exposition and annotated with comments: what you put in a browser’s address box obviously needs to go on a single line, without the comments):
http://chart.apis.google.com/chart? | the base URL |
cht=v& | chart type: v for Venn |
chs=400×200& | chart size: 400 by 200 pixels |
chd=t:119,96,43,67,22,38,16& | chart data: the 3 circle sizes, and the intersection areas: see the API for details |
chdl=Redundant|Doesn’t-start-pericope|Has-Meta-comment& | chart legend |
chf=bg,s,efefef | chart fill: background = grey |
This is really a killer feature when you consider the amount of work it would take to create a diagram like the one above yourself. You’d have to
- Make a chart in some other application (like Excel) and paste in a picture of it
- Fool around with SVG or some other complex graphics language (and still have the problem of people not having SVG-capable browsers to see your chart!)
(The best general-purpose and web-friendly charting tool i’ve found is IBM’s ManyEyes site, which has a much richer palette of chart types: but that requires you to upload data tables and do some other configuration work.)
For data geeks like me, another key benefit that may not be obvious is that all the data is exposed here. If i paste in a picture of a chart, the viewer can only get the underlying data (and re-use it, or re-chart it) if i decide to supply it separately, or annotate my picture with it somehow. Here, the data is in the chart reference itself. That also means you can easily generate such charts programmatically.
Since we live in a data-rich world, i’m a big fan of using visualizations to make data easier to understand. Tools like Google Chart and ManyEyes take away one excuse, by making it easier to show what your data means.
About the chart above: you’d have to look at my talk with Steve Runge at the recent SBL meeting to make sense of this, but it shows the following characterizations, for 159 occurrences of vocatives (or nominatives of address) in the New Testament epistles:
- Redundant: many vocatives in the epistles like “brothers” or “beloved” don’t distinguish who’s being addressed (e.g. they’re not a typical “vocative of address” case). 119 of the 159 vocatives (75%) are like this.
- Doesn’t start pericope: some have posited that vocatives function to signal textual transitions like pericope breaks. While that’s sometimes true, the 96 (of 159, or 60%) shown here do not.
- Meta-comment: vocatives often co-occur with meta-comments like “I want you to know that …” (43 of 159, or 27%) See Steve’s work (and forthcoming resources from Logos) for more about this discourse function.
One thought on “Google Charts API”
Comments are closed.