Wednesday, June 17, 2009

Using Google Charts in TRIRIGA

A customer asked a coworker of mine to embed some dashboard-style graphs on his portal to look something like this:
You can do pretty much exactly that with the Google Charts API; here is an example:


http://chart.apis.google.com/chart?chs=225x125&cht=gom&chtt=European%20Affairs&chl=72&chd=t:72

This will render a PNG image with the following parameters:

chs: chart size, e.g. 225x125
cht: chart type, here "gom" = Google-O-Meter
chtt: chart title
chl: label at end of arrow, here I just used the data value
chd: chart data, here "t:72" gives a value of 72

You can embed this in an HTML document by doing something like:

<img src="http://chart.apis.google.com/chart?chs=225x125&cht=gom&chtt=European%20Affairs&chl=72&chd=t:72"/>

More information is here:
http://code.google.com/apis/chart/basics.html

Many thanks to Eric Glass for this cool solution!

No comments: