Sunday, January 31, 2010

Google Chart API

This is a bit of a geeky one but it might be useful for people who need to get graphs into their webpages / blogs but don't want to learn how to create images in a spreadsheet.

The Google Chart API lets you draw quick little graphs (and other graphics) using just a URL.

For example the url:
http://chart.apis.google.com/chart?cht=p3&chd=t:70,30&chs=250x100&chl=Chris|World

will create the following image:







You can change the image just by editing the URL. So, for instance, if you don't like the division in the above graph you can change the 70:30 ratio in the URL. So
http://chart.apis.google.com/chart?cht=p3&chd=t:10,90&chs=250x100&chl=Chris|World would give you:



The other parts of the URL are the type of chart (p3 for pie chart), the size of the chart (250 by 100 pixels) and the labels for the two sections (Chris and World).



There are lots of other charts available as well:

bar charts:






Venn diagrams:







A stranger example is maps. For example, this url: http://chart.apis.google.com/chart?cht=t&chtm=world&chco=FFFFFF,FF0000,FFFF00,00FF00&chld=CAGBSGUS&chd=t:0,0,0,0&chs=440x220
creates a map showing all the countries I've lived in:


No comments: