Using this script you can take a simple, valid and accessible data table like the following and it gets automatically converted to a pie chart.
<table class="tochart size300x100 color990000" summary="Browsers for this site, March 2007"> <caption>Browsers</caption> <thead> <tr><th scope="col">Browser</th><th scope="col">Percent</th></tr> </thead> <tbody> <tr><td>Firefox</td><td>60</td></tr> <tr><td>MSIE</td><td>25</td></tr> <tr><td>Opera</td><td>10</td></tr> <tr><td>Safari</td><td>5</td></tr> </tbody> </table>
Simply add the script to the end of the body and it’ll convert all tables with a class called “tochart”. You can define the size (widthxheight) and the colour as a hexadecimal triplet as shown in this example. If you leave size and colour out, the script will use presets you can alter as variables in the script itself.
It is great to see some good development in the Google Chart API arena.
If know of any other cool applications that use libraries like the Google Chart API we would love to hear about them. You can leave them in the comments or if you sign up for a free account on this blog, you can blog about it on Ajaxonomy.com.