Introducing the latest AJAX API: Google Visualization API

March 17, 2008

Post by Yoah Bar-David & Itai Raz, Software Engineers, Tel-Aviv

We are excited to launch the Google Visualization API, a new API designed for visualizing structured data. The API adds the ability to send queries to data sources and process the response. The first data source that already supports this API is Google Spreadsheets. We are also launching a set of visualization gadgets that use this API.

With this API, you can read data from a data source that supports the API. You can read an entire table, or you can run a query on the data source using the API's query language. The query response is an easy to process data table designed to simplify data visualization. It includes both the underlying values and the formatted values, column types, headers and more.

Use this API to create your own data visualization that is decoupled from data source implementation.

The API is loaded using the Google AJAX API loader: google.load("visualization", "1");

Every data source is identified by a URL. For example, each spreadsheet has it's unique data source URL. Using the google.visualization.Query class, you can run a query on the data source:

var q = new google.visualization.Query(DATA_SOURCE_URL);

Use the query language to select specific columns, filter rows, aggregate values and more.
var q = new google.visualization.Query(DATA_SOURCE_URL);
q.setQuery("select A, sum(D) group by A");

Here is an example of an animated bubble chart that uses data from a spreadsheet. This cool chart type was developed by the Google Trendalyzer team.

For more information, see the API documentation.