Wednesday, July 2, 2008

Google Visualizations and TrimQuery for Dynamic Data Analysis

Google Visualizations is quite useful, but has enormous scope of improvement and possibilities still. It can become a powerful visualizations framework if focused on well. In their current state, they do not scale very well for large data sets, lack necessary events and methods to have interactiveness, do not have ways to customize the fonts and axes scales.They still can be used to create impressive visualizations with some external help.

I stumbled upon a library called TrimQuery in Google code that lets you have the power of SQL based data manipulation on the client side using Javascript. I found it very useful in combination with Google Visualizations. My strategy is to get a set of data from the server, then do multiple analyses on the data by grouping/slicing/dicing on the browser using TrimQuery, and use Google Visualizations to represent the analyzed data.

I've used both TrimQuery and Google Visualizations to create a sample application. You can see it here (I haven't looked into IE compatibility yet. It works with Firefox.) and download the sources here. The data is generated randomly and you can experiment with different sizes of data sets by modifying the count variable in method genData in file test_data_generators.js.

Google has not yet released specifications for creating a data source for visualizations. And why are not all gadgets are also available as visualizations? It is not difficult to mimic the format in which Google Spreadsheets return data, but it is much nicer to work with an official stable specification rather than trying to hack it. With data sources applications would be more efficient in communicating data between client and server and the plumbing between visualizations and data would be standardized.