Google Visualization API Wrapper
Sept. 2nd,
2009
Putting google's API on a diet..
This page is about a library I made for the Google Visualization API .
Get all the details at your own reading pace, or jump straight to the source code and the examples.
Sometime ago, Google released their Visualization API that lets users take structured data from a variety of sources (regular user-provided data, a Google spreadsheet or as a gadget) and create interactive visualizations and reporting applications.
I have been using MotionChart for a while now, it is a beautifully crafted visualization tool, but at the same time, the code required to generate the chart is quite repetitive and unnecessarily complicated. Not exactly in line with the simplicity mantra Google is known for. The hello-world sample given by the google developers looks like this:
There are 5 lines added for each datapoint, alot of duplicated code and plenty of numbers to increment and keep track of. What happened to Don’t repeat yourself..
Lowering the signal-to-noise ratio
This library removes all the background noise and wraps the API around an object to provide a simplified and concise notation with a considerably smaller footprint. The sample above is thus re-written to the following (note the resemblance to CSV format):
Open example in new window
A bit more elaborate example with real data:
Open example in new window
Here are few things you can do to explore the above visualization:
- Change the variables with a click on the axis names.
- Use the play button for continuous playback.
- Zoom on a particular area by selecting it and choosing “zoom in”
- Use logarithmic scale (the size of the changes in proportion to the values).
- Select more bubbles for further inspection.
- Switch between bubble and bar charts with the button @ top right corner
Supported chart types
The following charts and visualizations are supported at the time being:
- Barchart
- Column chart
- Area chart
- Line chart
- MotionChart
This is basically animated scatterplot, so you need at least two datasets.
MotionChart is extremely well suited for tracking multiple variables over time. - Timeline
This is a time series chart where any given number of variables are plotted at successive times instead of the continuous playback display that the motionchart gives.
Download/examples
Follow the links below to access the full source code and the examples provided;
ExamplesView source codeDownload Version 1.0 [published under GPL/MIT]