You can use public Google Fusion Tables as a data source for your chart. In order to do this, you must first understand how to send data queries for charts, and you should also take a look at the Fusion Tables website and the Fusion Table SQL syntax.
Here is how to query a Fusion Table for data:
- Find the ID of the Fusion Table table that you want. Open the Fusion Table in your browser and look for the number in the URL. For example, if the URL is
http://www.google.com/fusiontables/DataSource?dsrcid=641716, the table ID is 641716. Note that the table must be public for the query to work (that is, view permissions must be granted to everyone).
- Choose which columns to reference. You can use either the column label, or the string "colN" where N is the zero-based column index, starting from the leftmost column, for example:
col1, and so on.
- Create a query that includes a
FROMclause that references the table ID, as well as the columns you have selected. Important: The query should use the Fusion Tables SQL syntax; this syntax is similar to, but not the same as the same as the Google Chart Tools query syntax. Clause order matters in this syntax: for example, the
FROMclause must precede any optional
GROUP BYclauses. A successful response will return a data table with columns appropriate for your chart. Read your chart's documentation to learn its required data format. You can send and handle the query using any supported methods, including
- If you need to customize the column names, modify the retrieved table by calling
- Set the table as your chart's data source.
Important: Columns can appear to be a different data type than actually are. For example, column with values such as "1/12/2011" might be in a column of type string; Fusion Tables does not expose a way to learn the declared column type in tables that you do not own. Trying to reformat or sort a string-formatted date using a date formatter will fail.