org.jfree.chart
Class ChartFactory

java.lang.Object
  |
  +--org.jfree.chart.ChartFactory

public class ChartFactory
extends java.lang.Object

A collection of utility methods for creating some standard charts with JFreeChart.

Author:
David Gilbert

Constructor Summary
ChartFactory()
           
 
Method Summary
static JFreeChart createAreaChart(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates an area chart with default settings.
static JFreeChart createAreaXYChart(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, XYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates an XY area plot.
static JFreeChart createBubbleChart(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, XYZDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a bubble chart with default settings.
static JFreeChart createCandlestickChart(java.lang.String title, java.lang.String timeAxisLabel, java.lang.String valueAxisLabel, HighLowDataset data, boolean legend)
          Creates and returns a default instance of a candlesticks chart.
static JFreeChart createGanttChart(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String dateAxisLabel, IntervalCategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a Gantt chart using the supplied attributes plus default values where required.
static JFreeChart createHighLowChart(java.lang.String title, java.lang.String timeAxisLabel, java.lang.String valueAxisLabel, HighLowDataset data, boolean legend)
          Creates and returns a default instance of a high-low-open-close chart.
static JFreeChart createHorizontalBarChart(java.lang.String title, java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a horizontal bar chart with default settings.
static JFreeChart createHorizontalBarChart3D(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a horizontal 3D-effect bar chart with default settings.
static JFreeChart createLineChart(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a line chart with default settings.
static JFreeChart createLineXYChart(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, XYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a line chart (based on an XYDataset) with default settings.
static JFreeChart createPie3DChart(java.lang.String title, PieDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a pie chart with default settings.
static JFreeChart createPieChart(java.lang.String title, CategoryDataset data, int extractType, boolean legend, boolean tooltips, boolean urls)
          Creates a chart containing multiple pie charts, from a TableDataset.
static JFreeChart createPieChart(java.lang.String title, PieDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a pie chart with default settings.
static JFreeChart createScatterPlot(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, XYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a scatter plot with default settings.
static JFreeChart createSignalChart(java.lang.String title, java.lang.String timeAxisLabel, java.lang.String valueAxisLabel, SignalsDataset data, boolean legend)
          Creates and returns a default instance of a signal chart.
static JFreeChart createStackedAreaChart(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates an area chart with default settings.
static JFreeChart createStackedHorizontalBarChart(java.lang.String title, java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a stacked horizontal bar chart with default settings.
static JFreeChart createStackedVerticalBarChart(java.lang.String title, java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a stacked vertical bar chart with default settings.
static JFreeChart createStackedVerticalBarChart3D(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a stacked vertical bar chart with default settings.
static JFreeChart createTimeSeriesChart(java.lang.String title, java.lang.String timeAxisLabel, java.lang.String valueAxisLabel, XYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates and returns a time series chart.
static JFreeChart createVerticalBarChart(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a vertical bar chart with default settings.
static JFreeChart createVerticalBarChart3D(java.lang.String title, java.lang.String categoryAxisLabel, java.lang.String valueAxisLabel, CategoryDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a vertical 3D-effect bar chart with default settings.
static JFreeChart createVerticalXYBarChart(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, IntervalXYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates and returns a default instance of a vertical XY bar chart.
static JFreeChart createWindPlot(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, WindDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a wind plot with default settings.
static JFreeChart createXYStepChart(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, XYDataset data, boolean legend, boolean tooltips, boolean urls)
          Creates a stepped XY plot with default settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartFactory

public ChartFactory()
Method Detail

createPieChart

public static JFreeChart createPieChart(java.lang.String title,
                                        PieDataset data,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls)
Creates a pie chart with default settings.

Parameters:
title - the chart title.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a pie chart.

createPieChart

public static JFreeChart createPieChart(java.lang.String title,
                                        CategoryDataset data,
                                        int extractType,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls)
Creates a chart containing multiple pie charts, from a TableDataset.

Parameters:
title - the chart title.
data - the dataset for the chart.
extractType - PER_ROW or PER_COLUMN (defined in PiePlot).
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a pie chart.

createPie3DChart

public static JFreeChart createPie3DChart(java.lang.String title,
                                          PieDataset data,
                                          boolean legend,
                                          boolean tooltips,
                                          boolean urls)
Creates a pie chart with default settings.

Parameters:
title - the chart title.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a pie chart.

createVerticalBarChart

public static JFreeChart createVerticalBarChart(java.lang.String title,
                                                java.lang.String categoryAxisLabel,
                                                java.lang.String valueAxisLabel,
                                                CategoryDataset data,
                                                boolean legend,
                                                boolean tooltips,
                                                boolean urls)
Creates a vertical bar chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a vertical bar chart.

createVerticalBarChart3D

public static JFreeChart createVerticalBarChart3D(java.lang.String title,
                                                  java.lang.String categoryAxisLabel,
                                                  java.lang.String valueAxisLabel,
                                                  CategoryDataset data,
                                                  boolean legend,
                                                  boolean tooltips,
                                                  boolean urls)
Creates a vertical 3D-effect bar chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a vertical 3D-effect bar chart.

createStackedVerticalBarChart

public static JFreeChart createStackedVerticalBarChart(java.lang.String title,
                                                       java.lang.String domainAxisLabel,
                                                       java.lang.String rangeAxisLabel,
                                                       CategoryDataset data,
                                                       boolean legend,
                                                       boolean tooltips,
                                                       boolean urls)
Creates a stacked vertical bar chart with default settings.

Parameters:
title - the chart title.
domainAxisLabel - the label for the category axis.
rangeAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
The chart.

createStackedVerticalBarChart3D

public static JFreeChart createStackedVerticalBarChart3D(java.lang.String title,
                                                         java.lang.String categoryAxisLabel,
                                                         java.lang.String valueAxisLabel,
                                                         CategoryDataset data,
                                                         boolean legend,
                                                         boolean tooltips,
                                                         boolean urls)
Creates a stacked vertical bar chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a stacked vertical bar chart.

createHorizontalBarChart

public static JFreeChart createHorizontalBarChart(java.lang.String title,
                                                  java.lang.String domainAxisLabel,
                                                  java.lang.String rangeAxisLabel,
                                                  CategoryDataset data,
                                                  boolean legend,
                                                  boolean tooltips,
                                                  boolean urls)
Creates a horizontal bar chart with default settings.

Parameters:
title - the chart title.
domainAxisLabel - the label for the category axis.
rangeAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a horizontal bar chart.

createHorizontalBarChart3D

public static JFreeChart createHorizontalBarChart3D(java.lang.String title,
                                                    java.lang.String categoryAxisLabel,
                                                    java.lang.String valueAxisLabel,
                                                    CategoryDataset data,
                                                    boolean legend,
                                                    boolean tooltips,
                                                    boolean urls)
Creates a horizontal 3D-effect bar chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a horizontal 3D-effect bar chart.

createStackedHorizontalBarChart

public static JFreeChart createStackedHorizontalBarChart(java.lang.String title,
                                                         java.lang.String domainAxisLabel,
                                                         java.lang.String rangeAxisLabel,
                                                         CategoryDataset data,
                                                         boolean legend,
                                                         boolean tooltips,
                                                         boolean urls)
Creates a stacked horizontal bar chart with default settings.

Parameters:
title - the chart title.
domainAxisLabel - the label for the category axis.
rangeAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a stacked horizontal bar chart.

createLineChart

public static JFreeChart createLineChart(java.lang.String title,
                                         java.lang.String categoryAxisLabel,
                                         java.lang.String valueAxisLabel,
                                         CategoryDataset data,
                                         boolean legend,
                                         boolean tooltips,
                                         boolean urls)
Creates a line chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a line chart.

createAreaChart

public static JFreeChart createAreaChart(java.lang.String title,
                                         java.lang.String categoryAxisLabel,
                                         java.lang.String valueAxisLabel,
                                         CategoryDataset data,
                                         boolean legend,
                                         boolean tooltips,
                                         boolean urls)
Creates an area chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
an area chart.

createStackedAreaChart

public static JFreeChart createStackedAreaChart(java.lang.String title,
                                                java.lang.String categoryAxisLabel,
                                                java.lang.String valueAxisLabel,
                                                CategoryDataset data,
                                                boolean legend,
                                                boolean tooltips,
                                                boolean urls)
Creates an area chart with default settings.

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
valueAxisLabel - the label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
an area chart.

createGanttChart

public static JFreeChart createGanttChart(java.lang.String title,
                                          java.lang.String categoryAxisLabel,
                                          java.lang.String dateAxisLabel,
                                          IntervalCategoryDataset data,
                                          boolean legend,
                                          boolean tooltips,
                                          boolean urls)
Creates a Gantt chart using the supplied attributes plus default values where required.

The chart uses the following classes amongst others:

Parameters:
title - the chart title.
categoryAxisLabel - the label for the category axis.
dateAxisLabel - the label for the date axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
A Gantt chart.

createLineXYChart

public static JFreeChart createLineXYChart(java.lang.String title,
                                           java.lang.String xAxisLabel,
                                           java.lang.String yAxisLabel,
                                           XYDataset data,
                                           boolean legend,
                                           boolean tooltips,
                                           boolean urls)
Creates a line chart (based on an XYDataset) with default settings.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
the chart.

createAreaXYChart

public static JFreeChart createAreaXYChart(java.lang.String title,
                                           java.lang.String xAxisLabel,
                                           java.lang.String yAxisLabel,
                                           XYDataset data,
                                           boolean legend,
                                           boolean tooltips,
                                           boolean urls)
Creates an XY area plot.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
an XY area chart.

createScatterPlot

public static JFreeChart createScatterPlot(java.lang.String title,
                                           java.lang.String xAxisLabel,
                                           java.lang.String yAxisLabel,
                                           XYDataset data,
                                           boolean legend,
                                           boolean tooltips,
                                           boolean urls)
Creates a scatter plot with default settings.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a scatter plot.

createBubbleChart

public static JFreeChart createBubbleChart(java.lang.String title,
                                           java.lang.String xAxisLabel,
                                           java.lang.String yAxisLabel,
                                           XYZDataset data,
                                           boolean legend,
                                           boolean tooltips,
                                           boolean urls)
Creates a bubble chart with default settings.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a scatter plot.

createWindPlot

public static JFreeChart createWindPlot(java.lang.String title,
                                        java.lang.String xAxisLabel,
                                        java.lang.String yAxisLabel,
                                        WindDataset data,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls)
Creates a wind plot with default settings.

Parameters:
title - the chart title.
xAxisLabel - a label for the x-axis.
yAxisLabel - a label for the y-axis.
data - the dataset for the chart.
legend - a flag that controls whether or not a legend is created.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a wind plot.

createTimeSeriesChart

public static JFreeChart createTimeSeriesChart(java.lang.String title,
                                               java.lang.String timeAxisLabel,
                                               java.lang.String valueAxisLabel,
                                               XYDataset data,
                                               boolean legend,
                                               boolean tooltips,
                                               boolean urls)
Creates and returns a time series chart.

A time series chart is an XYPlot with a date axis (horizontal) and a number axis (vertical), and each data item is connected with a line.

Note that you can supply a TimeSeriesCollection to this method, as it implements the XYDataset interface.

Parameters:
title - the chart title.
timeAxisLabel - a label for the time axis.
valueAxisLabel - a label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a time series chart.

createVerticalXYBarChart

public static JFreeChart createVerticalXYBarChart(java.lang.String title,
                                                  java.lang.String xAxisLabel,
                                                  java.lang.String yAxisLabel,
                                                  IntervalXYDataset data,
                                                  boolean legend,
                                                  boolean tooltips,
                                                  boolean urls)
Creates and returns a default instance of a vertical XY bar chart.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
a vertical XY bar chart.

createHighLowChart

public static JFreeChart createHighLowChart(java.lang.String title,
                                            java.lang.String timeAxisLabel,
                                            java.lang.String valueAxisLabel,
                                            HighLowDataset data,
                                            boolean legend)
Creates and returns a default instance of a high-low-open-close chart.

Parameters:
title - the chart title.
timeAxisLabel - a label for the time axis.
valueAxisLabel - a label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
Returns:
a high-low-open-close chart.

createCandlestickChart

public static JFreeChart createCandlestickChart(java.lang.String title,
                                                java.lang.String timeAxisLabel,
                                                java.lang.String valueAxisLabel,
                                                HighLowDataset data,
                                                boolean legend)
Creates and returns a default instance of a candlesticks chart.

Parameters:
title - the chart title.
timeAxisLabel - a label for the time axis.
valueAxisLabel - a label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
Returns:
a candlestick chart.

createSignalChart

public static JFreeChart createSignalChart(java.lang.String title,
                                           java.lang.String timeAxisLabel,
                                           java.lang.String valueAxisLabel,
                                           SignalsDataset data,
                                           boolean legend)
Creates and returns a default instance of a signal chart.

Parameters:
title - the chart title.
timeAxisLabel - a label for the time axis.
valueAxisLabel - a label for the value axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
Returns:
a signal chart.

createXYStepChart

public static JFreeChart createXYStepChart(java.lang.String title,
                                           java.lang.String xAxisLabel,
                                           java.lang.String yAxisLabel,
                                           XYDataset data,
                                           boolean legend,
                                           boolean tooltips,
                                           boolean urls)
Creates a stepped XY plot with default settings.

Parameters:
title - the chart title.
xAxisLabel - a label for the X-axis.
yAxisLabel - a label for the Y-axis.
data - the dataset for the chart.
legend - a flag specifying whether or not a legend is required.
tooltips - configure chart to generate tool tips?
urls - configure chart to generate URLs?
Returns:
A chart.