charts4j API documentation

charts4j is a Java chart library that enables developers to programmatically generate nearly all1 the charts available in the Google Chart API .

See:
          Description

Packages
com.googlecode.charts4j  

 

charts4j is a Java chart library that enables developers to programmatically generate nearly all1 the charts available in the Google Chart API . charts4j can be incorporated into any Internet enabled Java (e.g. Swing) or web application environment (e.g. JSPs / Servlets, Spring MVC, GWT, etc.)

Installation

Developers only need to include the charts4j.jar in their classpath. It is available in the charts4j.zip file. The application must also be connected to the Internet because the charts are ultimately rendered by the Google Chart API server.

Usage

Developers who are using charts4j for the first time should start off by examining the Data and DataUtil classes. Next, they can build charts via the GCharts static factory class.

All data provided to charts4j is expressed as numbers between 0 and 100. If your data does not fall in that range, you will have to scale it so it does fall in that range. The DataUtil class can help scale data. Also note that grids, axis labels positions, markers are all expressed in the 0 to 100 range so that chart elements defined by the developer snap together consistently and nicely.

Another interesting feature of charts4j: Plots can be incorporated into more than one chart type. In particular, they can be incorporated into

Plots are created via the Plots static factory class. GCharts are created via the GCharts static factory class.

Chart URLs generated by charts4j can then be incorporated into a web or Internet application. In a JSP / Servlet environment, generate the URL in the servlet and insert that URL in the JSP for display of the chart.


Code examples can be found here.

For additional information, see:

Author:
Julien Chastang (julien.c.chastang at gmail dot com)

1. As of November 2008, the only chart types that are not supported are QR Codes, map pins, sticky notes, information bubbles, text with outline.