Saturday, May 18, 2013

Motion Chart to visualize how the components of India's GDP changed over the years


The Motion Chart is at: http://goo.gl/cYtmOz

Data for the chart was taken from rbi.org (once again! rbi.org is a good source for statistical data on India's growth parameters) and plotted through Google Motion Chart API.
Google Motion Chart API is in JavaScript and it expects data in a particular format. The best way to understand the API would be to look at the source code of the chart web-page and the documentation of the API.
Oh! and the html page for the chart needs to be on a web server, I used the free web hosting service from 000webhost.com (thanks to them!)

Some technical details:
The final html file loaded into the browser looked like this.
Data from rbi.org, after some cleaning looked something like this.
I used this Python script to make things easy and generate some part of the code for JavaScript for the data for chart(manually, it would really be a pain). It took the cleaned data file as input and generated this, a representation of data in a format understood by API.
Though, looks like it is possible to create json string from data and pass it to API, that would perhaps be a better way to do it.

No comments:

Post a Comment