Google chart APIs

Creating charts with the google apis are pretty simple. You just feed parameters to the api and you get some pretty graphs, pie charts, venn-diagrams, maps and other stuff back. Watch the URLs in the examples to see what we need to do. All the charts have a couple of basic parameters. chs indicates the size of the chart. cht indicates the type of chart we want to draw. You can draw a lot of different types of charts but I will only give you three examples.

To make a pie-chart. You specify percentages with the chd=t:X,Y,Z parameters. The chl-parameter is used to nominate the different slices of the pie:
http://chart.apis.google.com/chart?cht=p3&chd=t:10,30,20,40&chs=450×200&chl=the|state|of|things

To make a Venn-diagram you just specify the size of the different sets with the chd=t:X,Y,Z followed by the overlap of the different sets XY,YZ,XZ: 
http://chart.apis.google.com/chart?cht=v&chd=t:70,70,70,30,30,30&chs=450×300

To draw a map you specify the cht (chart-type) t and give the “strength” of colours with the chd-parameter. The chtm-parameter defines the map you want (world, europe, america, africa, asia, etc) while the cocd sets the colour-codes of the colouring. chld takes (ISO) country-codes of the countries you want to highlight:

http://chart.apis.google.com/chart?cht=t&chs=440×220&chd=t:100,50,0,25,75,30,60,90,50,90,80,70,20,10,50,70,60,50,0&chtm=europe&cocd=FFFFFF,EFFEEE,FFAAAA&chld=NOSEDKGBFRHURUESITDENLBEFILUROGRCYCZMC

Read more on the google chart-api here

Leave a Reply