Google Charts

Frequently Asked Questions

Getting Started

What is the Google Visualization API?
The Google Visualization API allows you to create charts and reporting applications over structured data and helps integrate these directly into your website or on a Gadget.
What can I do with the Visualization API?
With the Google Visualization API, you can access structured data--created locally in your browser or retrieved from supported data sources in a simple tabular format. You can also implement your own data source as Visualization API data source and enable any Visualization-compliant visualization and/or application to access your data. The format is amenable to use by reporting, analysis or chart applications. You can thus visualize the data and/or add new functionality to applications, such as Google Spreadsheets.
Where can I find documentation for the Visualization API?
You can find the developer guide and all other related documentation at https://developers.google.com/chart/interactive/docs.
I have a question related to embedding a Chart gadget on Google Spreadsheets. Where do I go for help?
For specific questions related to Google Spreadsheets we suggest you first check the Spreadsheet Integration section. You can also refer to the help pages for Google Spreadsheets. If you are not able to find an answer in either of these places, the best way is to post your question on the Visualization discussion group. Google employees also participate in the group and pop in from time to time to answer developer questions.
How do I embed a Chart gadget on my website?

If you have your gadget on a Google Spreadsheet, open the gadget menu, and select 'Publish gadget'. Paste the provided URL into your web page.

If you have your gadget on iGoogle, open the gadget preferences, select 'Share this gadget', select 'copy and paste a link to this gadget' and check the 'Send my settings for this gadget'. Paste the provided URL into your web page.

On any other web page, if you have acces to the source code, paste the XML of the gadget wrapped inside an iframe on the page. Be sure to set the data source preference in the XML.

How do I create a new Chart?
The best way to get started is to read the Introduction, and the Quick Start section.
What is a Data Source URL?
A Data Source URL is the unique URL identifier of a Visualization API data source. A data source URL may also include Chart Query Language parameters. In this case a query (such as sorting, grouping, etc) is performed on the data source prior to fetching the data.
How do I create a new Chart gadget?
The best way to get started is to first get familiar with the Developers Guide, and then read the Gadget Extensions section and start coding.
Where can I find example code of Chart apps and/or gadgets using the Visualization API?
You can find example code at the Visualization API example code documentation.
Can a Flash application access the Visualization API?
Absolutely. The Visualization API uses a JavaScript API, but there are libraries that enable Flash apps to connect with Javascript code. One such library you may find useful can be found at http://code.google.com/p/swfobject. See below for some development issues affecting Flash.
 
Where can I find a sample Chart data source implementation?
See the Visualization API Python sample page for explanations and example code.
How do I implement a data source?
Read the section on using and creating a chart, to learn how charts work, then read Implementing a Data Source to learn how to create a data source. You can also use the Google Chart Data Source Java library to get started quickly if you use Java.
Can I access a chart from a Java application?
Yes. The Google Visualization Library for the Google Web Toolkit (GWT) allows you to access the API compliant visualizations from Java code compiled with the GWT compiler and to write Visualization API compliant visualizations in Java using the GWT complier. The release candidate library also supports the Visualization API event model.
Can I access a chart from an application written with the Google Web Toolkit (GWT) compiler?
Yes. The Google Visualization Library for the Google Web Toolkit (GWT) allows you to access the API compliant visualizations from Java code compiled with the GWT compiler and to write Visualization API compliant visualizations in Java using the GWT complier. The release candidate library also supports the Visualization API event model.
I have a different question/problem, who do I contact to get more information?
Please post your question in the Google Visualization API discussion group to get help from the Visualization developer community. The Visualization team also participates in this group to answer questions.

Using the API

What is the difference between the Google Chart API and the Google Visualization API?

The Chart API provides a simple way to create image charts of various kinds by sending a formatted URL that includes both the data and chart configuration options to a Google server. The Chart API includes a closed set of charts with various options. The Chart API datasets are limited to the size of a URL (roughly 2K).

The Visualization API provides a way to connect charts and data sources over the web and to publish them:

  • The Visualization API provides a Javascript API and a Gadget API to access charts.
  • Its gallery of charts includes Google-created charts, but is also open to any third party to create their own Visualization API-compliant visualizations.
  • Visualization API charts and charts can be anything that can be rendered by a browser. This includes images, Javascript, vector-graphics, Flash, etc.
  • A considerable number of Chart API charts are accessible through the Visualization API, although some of their configuration options may not be available.
  • The API also provides a documented wire protocol and a way for anyone to expose their data sources to any of the APIs visualizations.
  • The API has a defined event model that allows charts to throw and receive events and thus communicate with their host page and/or other charts on the page.
What data sources can I access using the Visualization API?
With the Visualization API you can access data locally from your browser by creating the API's standard DataTable format, or access any data source that supports the API. Well-known applications that already support the API are Google Spreadsheets and Salesforce.com on their Force.com developer platform. You may also implement your own data as a Chart data source.
I created a Chart application using the Visualization API, can I make that app into a Gadget?
Absolutely. To wrap your application as a gadget refer to the Gadget Extensions section of the developer guide.
My application expects the data it receives to be in a specific format. How do I handle exceptions?
You can use the getNumberOfColumns() and getColumnType() methods of class google.visualization.DataTable to test that the data you get matches what you expect, and issue an error message for mismatches.
What are the differences between Gadget Charts and Javascript Charts?
Here are the major differences:
  • Gadgets run in separate iframes and are therefore safer to place on any webpage, even if they are developed by 3rd parties. They are also easily publishable and shareable on Gadget containers, such as iGoogle, etc. However, they require more server calls and it is very difficult to create inter-gadget communication.
  • Javascript code runs directly on the webpage and is therefore less "safe". However, the advantage of Javascript is lower latency and the ability to access the Gviz Event Model. With events, you can easily create dashboards in which one chart is tied to others on the page. This example shows how you can listen for events so that clicking one chart can affect the focus of another.
Which charts are available as gadgets and which as Javascript charts?
We try to provide all charts in both flavors, we recommend that you do the same, as it is fairly easy to wrap a Javascript chart into a gadget.
How do I override the default exception and error handling in Gadgets?

If you call validateResponse() of class google.visualization.GadgetHelper, the default error message handling will check for errors and send a message to the user in case of an error.

If you do not want to use the default error handling, you can check for errors yourself by calling the isError() method of the google.visualization.QueryResponse class and issuing your own message for the error. Use methods getMessage() and getDetailedMessage() to obtain more information about the error.

My chart is not showing up on the page. What is the problem?
There may be several reasons causing your chart not to show.
  • Look for typos. Remember that JavaScript is a case-sensitive language.
  • Use a JavaScript debugger. In Firefox, you can use the JavaScript console, the Venkman Debugger, or the Firebug add-on. In IE, you can use the Microsoft Script Debugger.
  • You may be using the Google Loader incorrectly. Please refer to the Ajax Loader documentation.
  • Search the Google Visualization API discussion group. If you can't find a post that answers your question, post your question to the group along with a link to a web page that demonstrates the problem.
Is it safe to embed a chart in my web site?
Running third party code directly on your web site poses inherent risks. Gadgets run in a separate iframe, and are generally safer than JavaScript embedded in your web page. Google makes no promises or representations about the gadgets' and applications' performance, quality, security, or content. Chart applications and gadgets that do not comply with the Google Visualization API Terms of Service may be removed from the galleries.
Why does my Flash-based chart not work during development?
Because of Flash security settings, Flash-based charts might not work correctly when accessed from a file location in the browser (e.g., file:///c:/webhost/myhost/myviz.html) rather than from a web server URL (e.g., http://www.myhost.com/myviz.html). This is typically a testing issue only; the issue is not a problem when you access the chart from an http:// address. You can overcome this issue as described on the Macromedia web site.
Can I use charts offline?
No; your computer must have live access to http://www.google.com/jsapi in order to use charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included jsapi script, and is called when you invoke the google.load() method. Our terms of service do not allow you to download the google.load or google.visualization code to use offline.
Can I download and host the chart code locally, or on an intranet?
Sorry; our terms of service do not allow you to download and save or host the google.load or google.visualization code.

Google Visualization Program Policy

What is the Google Visualization Program Policy?
As described in the Terms of Service, we may decline to include and display content that violates our program policy by displaying or linking to:
  • Illegal content.
  • Invasions of personal privacy.
  • Pornography or obscenity.
  • Content, such as malicious code, that interferes with or is harmful to a user's computer or the functioning of the host web page.
  • Promotions of hate or incitement of violence.
  • Violations of copyright. Please see our DMCA policy for more information.
  • Violations of trademark.
  • Impersonations of third parties.

Developers that create charts that collect data, agree to maintain and link to a legally adequate privacy policy. Additionally, we require developers to ensure that their chart is secure, and to maintain their gadget or application as long as it resides in the chart directory.

These policies may be revised from time to time without notice.

Is the Google Visualization API available for commercial use?
Yes. For the fine print please refer to the Google Visualization API Terms of Service.
Can I use the Google Visualization API to create client-side software?
Currently we do not allow developers to use the Visualization API to create client-side software. You may only use the Visualization API through the interface provided. For the fine print please refer to the Google Visualization API Terms of Service.
What personal information can I collect through a Visualization gadget or visualization?
You may not store any personal information in the gadget or chart.  You may not collect sensitive personal information such as credit card numbers and social security numbers through a gadget or chart.
Is Google logging all my chart data?
The chart data included in the HTTP request is saved in temporary logs for no longer than two weeks for internal testing and debugging purposes. Of course you should understand that if your chart appears in an image tag on a public webpage, it could be crawled.
Violations of the program policies.
Violations of these Program Policies can result in the disabling of your gadget or chart, removal of your gadget or chart, being blacklisted from uploading future gadgets or charts, termination of your Google accounts and/or deletion of all your gadgets and charts.

Becoming Active in the Community

How can I share my Chart application or gadget with others?
Start by placing your chart on the Chart Gallery and your gadgets on the Gadget content directory and the API's Gadget Gallery. You can link back to your site and provide your source code if you wish. Get involved in our discussion group and get the community's feedback.
The Chart Gallery is a listing of applications that use the Visualization API. It provides a central location for the Visualization developer community to share Chart applications.
How do I get my Chart application on the Chart or Gadget Gallery?
Submit your chart to the Chart Gallery.
What is the Gadget content directory?
The Gadget content directory is a listing of Gadgets that can be added to iGoogle or other web pages. It provides a central location for users to find new gadgets to add to their pages. Most of the gadgets in the content directory were written by other companies and by Google's users.
How do I submit my Chart gadget to the Gadget content directory?
Any submission to the Chart Gadget Gallery will also auto-submit your gadget to the Gadget content directory.
Why would I want to submit a gadget to both the API's Gadget Gallery and the Gadget content directory?
The Gadget content directory provides the widest consumer audience for your gadget, while the Chart Gadget Gallery provides a targeted audience of chart developers. With both galleries you cover your two target audience groups and get both wide and in-depth market reach. Any submission to the Chart Gadget Gallery will also auto-submit your gadget to the Gadget content directory.
How do I make my Chart gadget more discoverable?
There are various ways you can promote your gadget and help other users discover it. Getting more people to use your gadgets is rewarding and helps increase your gadget's ranking in the Gadget content directory. Here's a few recommended ways to get started:
How can I promote my Chart data source?
Post your implementation on the Visualization Group. If we like it, we might even mention it ourselves.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.