Adding dynamically generated graphs and charts

If you are looking to add a graph or a pie chart on your web based application that will be dynamically generated, you can use several online open source JavaScript graphing tool to do this. However, I have recently found another option to add graphs and charts that would be generated with dynamic data and will be displayed as a .png image on your site.

For example, you want to show a pie chart for sex distribution of male 43 and female 38. With one line of code you can create and display the following chart:

Sex distribution

Thanks to Google for it’s amazing chart API to create graphs and charts in less than 2 minutes. This chart was created by using following code:

<img src=”http://chart.apis.google.com/chart?chs=450×200&chd=t:43,38&cht=p3&chl=Male|Female” alt=”Sex distribution” />

Here, the source of the image is http://chart.apis.google.com/chart and parameters it is taking in this case are:

  • size (e.g. chs=450×200 for size of the image),
  • data that you want to show(e.g. chd=t:43,38 for 43 and 38),
  • chart type (e.g. cht=p3 for 3 dimensional pie chart)
  • chart labels (e.g. chl=Male|Female)

The full documentaion of different types of graphs, charts, scatter plots can be found at Google chart API website.

Tags: , ,

Leave a Reply

You must be logged in to post a comment.

Custom Search