Using Google Chart API in your website
Charts are useful and more informative way of representing data in a website. There are many commercial and opensource components and libraries available to implement charts in a website. Most of them are flash based and very attractive. There may be cases where you don’t want or can’t use flash based charts. So what are the alternatives? Write your own library using gd or any other image manipulation library or Use Google Chart API. Yes, google chart api is here to rescue you from all the tedious coding you will do to create your own library.
Google Chart API is simple and easy to implement and produces nifty chart in your website with the data you supplied to the API. The API generates a PNG-format image in response to a url. The API generates different kinds of Charts like bar, line, pie, 3D pie and that too in different color and sizes. isn’t that cool?
As already mentioned the google chart API is simple and easy to implement. (Read more about the chart API at http://code.google.com/apis/chart/) You just need to form a url in following format and send it to google.
Yes generating chart is that simple. Just copy the above example and see for yourself. Now let me explain the chart parameters.
http://chart.apis.google.com/chart?is the Chart API’s location.
chs=350x150is the chart’s size in pixels.
chd=t:70,30is the chart’s data.
cht=p3is the chart’s type.
chl=Joomla|Drupalis the chart’s label.
You must at least provide chs, chd, cht parameters to the API. Now let us discuss some variations of parameters
To know more about the Google Chart API, refer to google code at http://code.google.com/apis/chart/. The API docs provides all the information on how to use the Chart API in your website.