The JFreeChart Class Library
Version 1.0.6
Installation Guide
Written by David Gilb e rt
June 15, 2007
c
2000-2007, Object Refinery Limited. All rights reserved.
Everyone is permitted to copy and distribute verbatim copies of this document,
but changing it is not allowed.
IMPORTANT NOTICE:
We work hard to make this document as accurate and informative as we can, but
cannot guarantee that it is error-free.
Contents
1 Introduction 2
1.1 What is JFreeChart? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.3 Home Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 This Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.1 Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.2 Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Comments and Suggestions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Sample Charts 5
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Pie Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Line Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 XY Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6 Time Series Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.8 Area Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9 Difference Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.10 Step Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.11 Gantt Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.12 Multiple Axis Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.13 Combined and Overlaid Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.14 Future Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 Downloading and Installing JFreeChart 20
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2 Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3 Unpacking the Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3.1 Unpacking on Linux/Unix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.2 Unpacking on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.3 The Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4 Running the Demonstration Applications . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5 Compiling the Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6 Generating the Javadoc Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 22
1
CONTENTS 2
4 The JFreeChart Developer Guide 23
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 The Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 Demo Application Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
A The GNU Lesser General Public Licence 25
A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
A.2 The Licence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
A.3 Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
A.3.2 Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 1
Introduction
1.1 What is JFreeChart?
1.1.1 Overview
JFreeChart is a free chart library for the Java(tm) platform. It is designed for use in applications,
applets, servlets and JSP. JFreeChart is distributed with com plete source code subject to the terms
of the GNU Lesser General Public Licence, which permits JFreeChart to be used in proprietary or
free software applications (see Appendix A for details).
Dual Axis Chart
S1 S2 S3 S4
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Category 8
Category
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
6.0
6.5
7.0
7.5
8.0
Value
0
5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
Secondary
Figure 1.1: A sample chart
Figure 1.1 shows a typical chart created using JFreeChart. Many more examples are shown in later
sections of this document.
3
CHAPTER 1. INTRODUCTION 4
1.1.2 Features
JFreeChart can generate pie charts, bar charts (regular and stacked, with an optional 3D-effect),
line charts, scatter plots, time series charts (including moving averages, high-low-open-close charts
and candlestick plots), Gantt charts, meter charts (dial, compass and thermometer), symbol charts,
wind plots, combination charts and more.
Additional features include:
• data is accessible from any implementation of the defined interfaces;
• export to PNG and JPEG image file formats (or you can use Java’s ImageIO library to export
to any format supported by ImageIO);
• export to any format with a Graphics2D implementation including:
– PDF via iText (http://www.lowagie.com/iText/);
– SVG via Batik (http://xml.apache.org/batik/);
• tool tips;
• interactive zooming;
• chart mouse events (these can be used for drill-down charts or information pop-ups);
• annotations;
• HTML image map generation;
• works in applications, servlets, JSP (thanks to the Cewolf project
1
) and applets;
• distributed with complete source code subject to the terms of the GNU Lesser General Public
License (LGPL);
JFreeChart is written entirely in Java, and should run on any implementation of the Java 2 platform
(JDK 1.3.1 or later). It w ill also work quite well with free runtimes based on GNU Classpath 0.92
or later.
2
1.1.3 Home Page
The JFreeChart home page can be found at:
http://www.jfree.org/jfreechart/
Here you will find all the latest information about JFreeChart, including s ample charts, download
links, Javadocs, a discussion forum and more.
1
See http://cewolf.sourceforge.net for details.
2
See http://www.gnu.org/software/classpath/ for de tails .