This page describes how to use or modify the Google Visualization Java library, and how to contribute to the open source code for the project.
You must have the following components in order to use the Google Visualization Java library:
- A servlet container and the Servlet API version 2.4 or higher. One of the most commonly used servlet containers is Apache Tomcat, which includes the Servlet API. See http://tomcat.apache.org/download-55.cgi to download the binary for version 5.5. You need install only the Core module. You also need Tomcat to complete the tutorial sections: Getting Started, Using an External Data Store, and Defining Capabilities and the Flow of Events.
- The Java Development Kit version 6.0
Note: It is also possible to use the JDK version 5.0. However, you must then remove
@Overridefrom every method in the library that overrides an interface method. This is due to the change in the
@Overrideannotation behavior in JDK version 6.0.
The data source Java library has the following dependencies. The library was tested with the versions listed; other versions might be acceptable, but have not been tested.
Included in the source or download:
- icu4j version 4.0.1.
- Jakarta commons lang version 2.4.
- Jakarta commons logging version 1.1.1.
- Google collections library version 1.0.
- javacc version 4.2. This is required only if you intend to compile the libraries, for example when modifying them as described below.
- opencsv version 1.8. This is required only if you intend to use a CSV data source.
Not included in the source or download:
- To use the
SqlDataSourceHelperclass with a mySQL database, you also need
mysql.jarin your runtime environment. See: http://www.mysql.com/products/connector/j/ for details and downloadable versions.
This section describes how to use the visualization Java library if you don't need to modify it. This process varies with your build system:
If using Maven, set up a dependency on the visualization library with the following settings:
- Group ID: com.google.visualization
- Artifact ID: visualization-datasource
- Version number: Use the latest version number listed on the project page.
If using any other build system:
- Download the library ZIP file from the project page, unzip the files, and include them in your project as your build system requires.
If you want to modify the library code, you'll have to download the source from the open source hosting site and build it. Before doing this, read the licensing information linked to by the "Code license" section on the project page to see whether your use case is allowed.
Here are the steps for downloading and building the library:
- Download the source code using SVN, as described in on the Source > Checkout tab on the open source project page.
- Build your code. If building in Maven, use the pom.xml file provided with the source. If building with Apache Ant, follow the instructions given next (note that the code has been tested with Ant version 1.7.0; if you have an earlier version of Ant, you might need to upgrade)
Ant Build Instructions
1. Modify your build properties:
- Navigate to the
build-srcsubdirectory of your chosen installation directory.
- Using a text editor, open the
build.propertiesfile and make the following changes:
- Edit the
servlet-api.jarproperty to point to your
servlet-api.jarfile. For example, if you installed Tomcat to your
c:drive in the
tomcat_homedirectory, then you would specify the
servlet-api.jarproperty as follows:
Note: Use forward slashes rather than backslashes in the file path, even when using Windows
- To use your own copies of the dependencies described above, edit the paths in the same build.properties file.
- Edit the
2. Build the library:
build-src subdirectory in the file and type one of the
ant datasource- Builds the data source library
ant example- Builds the examples
ant- Builds both data source and examples
ant test- Builds and runs the data source library tests. Very useful when you are modifying the library.
If you want to contribute changes to the open source project, you'll have to get submission permissions to the project. Send an email to firstname.lastname@example.org asking for permission and instructions on how to submit changes.