001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * -----------------
028 * ChartFactory.java
029 * -----------------
030 * (C) Copyright 2001-2013, by Object Refinery Limited and Contributors.
031 *
032 * Original Author:  David Gilbert (for Object Refinery Limited);
033 * Contributor(s):   Serge V. Grachov;
034 *                   Joao Guilherme Del Valle;
035 *                   Bill Kelemen;
036 *                   Jon Iles;
037 *                   Jelai Wang;
038 *                   Richard Atkinson;
039 *                   David Browning (for Australian Institute of Marine
040 *                       Science);
041 *                   Benoit Xhenseval;
042 *
043 * Changes
044 * -------
045 * 19-Oct-2001 : Version 1, most methods transferred from JFreeChart.java (DG);
046 * 22-Oct-2001 : Added methods to create stacked bar charts (DG);
047 *               Renamed DataSource.java --> Dataset.java etc. (DG);
048 * 31-Oct-2001 : Added 3D-effect vertical bar and stacked-bar charts,
049 *               contributed by Serge V. Grachov (DG);
050 * 07-Nov-2001 : Added a flag to control whether or not a legend is added to
051 *               the chart (DG);
052 * 17-Nov-2001 : For pie chart, changed dataset from CategoryDataset to
053 *               PieDataset (DG);
054 * 30-Nov-2001 : Removed try/catch handlers from chart creation, as the
055 *               exception are now RuntimeExceptions, as suggested by Joao
056 *               Guilherme Del Valle (DG);
057 * 06-Dec-2001 : Added createCombinableXXXXXCharts methods (BK);
058 * 12-Dec-2001 : Added createCandlestickChart() method (DG);
059 * 13-Dec-2001 : Updated methods for charts with new renderers (DG);
060 * 08-Jan-2002 : Added import for
061 *               com.jrefinery.chart.combination.CombinedChart (DG);
062 * 31-Jan-2002 : Changed the createCombinableVerticalXYBarChart() method to use
063 *               renderer (DG);
064 * 06-Feb-2002 : Added new method createWindPlot() (DG);
065 * 23-Apr-2002 : Updates to the chart and plot constructor API (DG);
066 * 21-May-2002 : Added new method createAreaChart() (JI);
067 * 06-Jun-2002 : Added new method createGanttChart() (DG);
068 * 11-Jun-2002 : Renamed createHorizontalStackedBarChart()
069 *               --> createStackedHorizontalBarChart() for consistency (DG);
070 * 06-Aug-2002 : Updated Javadoc comments (DG);
071 * 21-Aug-2002 : Added createPieChart(CategoryDataset) method (DG);
072 * 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);
073 * 09-Oct-2002 : Added methods including tooltips and URL flags (DG);
074 * 06-Nov-2002 : Moved renderers into a separate package (DG);
075 * 18-Nov-2002 : Changed CategoryDataset to TableDataset (DG);
076 * 21-Mar-2003 : Incorporated HorizontalCategoryAxis3D, see bug id 685501 (DG);
077 * 13-May-2003 : Merged some horizontal and vertical methods (DG);
078 * 24-May-2003 : Added support for timeline in createHighLowChart (BK);
079 * 07-Jul-2003 : Added createHistogram() method contributed by Jelai Wang (DG);
080 * 27-Jul-2003 : Added createStackedAreaXYChart() method (RA);
081 * 05-Aug-2003 : added new method createBoxAndWhiskerChart (DB);
082 * 08-Sep-2003 : Changed ValueAxis API (DG);
083 * 07-Oct-2003 : Added stepped area XY chart contributed by Matthias Rose (DG);
084 * 06-Nov-2003 : Added createWaterfallChart() method (DG);
085 * 20-Nov-2003 : Set rendering order for 3D bar charts to fix overlapping
086 *               problems (DG);
087 * 25-Nov-2003 : Added createWaferMapChart() method (DG);
088 * 23-Dec-2003 : Renamed createPie3DChart() --> createPieChart3D for
089 *               consistency (DG);
090 * 20-Jan-2004 : Added createPolarChart() method (DG);
091 * 28-Jan-2004 : Fixed bug (882890) with axis range in
092 *               createStackedXYAreaChart() method (DG);
093 * 25-Feb-2004 : Renamed XYToolTipGenerator --> XYItemLabelGenerator (DG);
094 * 11-Mar-2004 : Updated for pie chart changes (DG);
095 * 27-Apr-2004 : Added new createPieChart() method contributed by Benoit
096 *               Xhenseval (see RFE 942195) (DG);
097 * 11-May-2004 : Split StandardCategoryItemLabelGenerator
098 *               --> StandardCategoryToolTipGenerator and
099 *               StandardCategoryLabelGenerator (DG);
100 * 06-Jan-2005 : Removed deprecated methods (DG);
101 * 27-Jan-2005 : Added new constructor to LineAndShapeRenderer (DG);
102 * 28-Feb-2005 : Added docs to createBubbleChart() method (DG);
103 * 17-Mar-2005 : Added createRingPlot() method (DG);
104 * 21-Apr-2005 : Replaced Insets with RectangleInsets (DG);
105 * 29-Nov-2005 : Removed signal chart (DG);
106 * ------------- JFREECHART 1.0.x ---------------------------------------------
107 * 26-Jan-2006 : Corrected API docs for createScatterPlot() (DG);
108 * 23-Aug-2006 : Modified createStackedXYAreaChart() to use
109 *               StackedXYAreaRenderer2, because StackedXYAreaRenderer doesn't
110 *               handle negative values (DG);
111 * 27-Sep-2006 : Update createPieChart() method for deprecated code (DG);
112 * 29-Nov-2006 : Update createXYBarChart() to use a time based tool tip
113 *               generator is a DateAxis is requested (DG);
114 * 17-Jan-2007 : Added createBoxAndWhiskerChart() method from patch 1603937
115 *               submitted by Darren Jung (DG);
116 * 10-Jul-2007 : Added new methods to create pie charts with locale for
117 *               section label and tool tip formatting (DG);
118 * 14-Aug-2008 : Added ChartTheme facility (DG);
119 * 23-Oct-2008 : Check for legacy theme in setChartTheme() and reset default
120 *               bar painters (DG);
121 * 20-Dec-2008 : In createStackedAreaChart(), set category margin to 0.0 (DG);
122 * 02-Jul-2013 : Use ParamChecks class (DG);
123 * 
124 */
125
126package org.jfree.chart;
127
128import java.awt.Color;
129import java.awt.Font;
130import java.text.DateFormat;
131import java.text.NumberFormat;
132import java.util.Iterator;
133import java.util.List;
134import java.util.Locale;
135
136import org.jfree.chart.axis.CategoryAxis;
137import org.jfree.chart.axis.CategoryAxis3D;
138import org.jfree.chart.axis.DateAxis;
139import org.jfree.chart.axis.NumberAxis;
140import org.jfree.chart.axis.NumberAxis3D;
141import org.jfree.chart.axis.Timeline;
142import org.jfree.chart.axis.ValueAxis;
143import org.jfree.chart.labels.BoxAndWhiskerToolTipGenerator;
144import org.jfree.chart.labels.HighLowItemLabelGenerator;
145import org.jfree.chart.labels.IntervalCategoryToolTipGenerator;
146import org.jfree.chart.labels.ItemLabelAnchor;
147import org.jfree.chart.labels.ItemLabelPosition;
148import org.jfree.chart.labels.PieToolTipGenerator;
149import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
150import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
151import org.jfree.chart.labels.StandardPieToolTipGenerator;
152import org.jfree.chart.labels.StandardXYToolTipGenerator;
153import org.jfree.chart.labels.StandardXYZToolTipGenerator;
154import org.jfree.chart.labels.XYToolTipGenerator;
155import org.jfree.chart.plot.CategoryPlot;
156import org.jfree.chart.plot.Marker;
157import org.jfree.chart.plot.MultiplePiePlot;
158import org.jfree.chart.plot.PiePlot;
159import org.jfree.chart.plot.PiePlot3D;
160import org.jfree.chart.plot.PlotOrientation;
161import org.jfree.chart.plot.PolarPlot;
162import org.jfree.chart.plot.RingPlot;
163import org.jfree.chart.plot.ValueMarker;
164import org.jfree.chart.plot.WaferMapPlot;
165import org.jfree.chart.plot.XYPlot;
166import org.jfree.chart.renderer.DefaultPolarItemRenderer;
167import org.jfree.chart.renderer.WaferMapRenderer;
168import org.jfree.chart.renderer.category.AreaRenderer;
169import org.jfree.chart.renderer.category.BarRenderer;
170import org.jfree.chart.renderer.category.BarRenderer3D;
171import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer;
172import org.jfree.chart.renderer.category.CategoryItemRenderer;
173import org.jfree.chart.renderer.category.GanttRenderer;
174import org.jfree.chart.renderer.category.GradientBarPainter;
175import org.jfree.chart.renderer.category.LineAndShapeRenderer;
176import org.jfree.chart.renderer.category.LineRenderer3D;
177import org.jfree.chart.renderer.category.StackedAreaRenderer;
178import org.jfree.chart.renderer.category.StackedBarRenderer;
179import org.jfree.chart.renderer.category.StackedBarRenderer3D;
180import org.jfree.chart.renderer.category.StandardBarPainter;
181import org.jfree.chart.renderer.category.WaterfallBarRenderer;
182import org.jfree.chart.renderer.xy.CandlestickRenderer;
183import org.jfree.chart.renderer.xy.GradientXYBarPainter;
184import org.jfree.chart.renderer.xy.HighLowRenderer;
185import org.jfree.chart.renderer.xy.StackedXYAreaRenderer2;
186import org.jfree.chart.renderer.xy.StandardXYBarPainter;
187import org.jfree.chart.renderer.xy.WindItemRenderer;
188import org.jfree.chart.renderer.xy.XYAreaRenderer;
189import org.jfree.chart.renderer.xy.XYBarRenderer;
190import org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer;
191import org.jfree.chart.renderer.xy.XYBubbleRenderer;
192import org.jfree.chart.renderer.xy.XYItemRenderer;
193import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
194import org.jfree.chart.renderer.xy.XYStepAreaRenderer;
195import org.jfree.chart.renderer.xy.XYStepRenderer;
196import org.jfree.chart.title.TextTitle;
197import org.jfree.chart.urls.PieURLGenerator;
198import org.jfree.chart.urls.StandardCategoryURLGenerator;
199import org.jfree.chart.urls.StandardPieURLGenerator;
200import org.jfree.chart.urls.StandardXYURLGenerator;
201import org.jfree.chart.urls.StandardXYZURLGenerator;
202import org.jfree.chart.urls.XYURLGenerator;
203import org.jfree.chart.util.ParamChecks;
204import org.jfree.data.category.CategoryDataset;
205import org.jfree.data.category.IntervalCategoryDataset;
206import org.jfree.data.general.DefaultPieDataset;
207import org.jfree.data.general.PieDataset;
208import org.jfree.data.general.WaferMapDataset;
209import org.jfree.data.statistics.BoxAndWhiskerCategoryDataset;
210import org.jfree.data.statistics.BoxAndWhiskerXYDataset;
211import org.jfree.data.xy.IntervalXYDataset;
212import org.jfree.data.xy.OHLCDataset;
213import org.jfree.data.xy.TableXYDataset;
214import org.jfree.data.xy.WindDataset;
215import org.jfree.data.xy.XYDataset;
216import org.jfree.data.xy.XYZDataset;
217import org.jfree.ui.Layer;
218import org.jfree.ui.RectangleEdge;
219import org.jfree.ui.RectangleInsets;
220import org.jfree.ui.TextAnchor;
221import org.jfree.util.SortOrder;
222import org.jfree.util.TableOrder;
223
224/**
225 * A collection of utility methods for creating some standard charts with
226 * JFreeChart.
227 */
228public abstract class ChartFactory {
229
230    /** The chart theme. */
231    private static ChartTheme currentTheme = new StandardChartTheme("JFree");
232
233    /**
234     * Returns the current chart theme used by the factory.
235     *
236     * @return The chart theme.
237     *
238     * @see #setChartTheme(ChartTheme)
239     * @see ChartUtilities#applyCurrentTheme(JFreeChart)
240     *
241     * @since 1.0.11
242     */
243    public static ChartTheme getChartTheme() {
244        return currentTheme;
245    }
246
247    /**
248     * Sets the current chart theme.  This will be applied to all new charts
249     * created via methods in this class.
250     *
251     * @param theme  the theme (<code>null</code> not permitted).
252     *
253     * @see #getChartTheme()
254     * @see ChartUtilities#applyCurrentTheme(JFreeChart)
255     *
256     * @since 1.0.11
257     */
258    public static void setChartTheme(ChartTheme theme) {
259        ParamChecks.nullNotPermitted(theme, "theme");
260        currentTheme = theme;
261
262        // here we do a check to see if the user is installing the "Legacy"
263        // theme, and reset the bar painters in that case...
264        if (theme instanceof StandardChartTheme) {
265            StandardChartTheme sct = (StandardChartTheme) theme;
266            if (sct.getName().equals("Legacy")) {
267                BarRenderer.setDefaultBarPainter(new StandardBarPainter());
268                XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
269            }
270            else {
271                BarRenderer.setDefaultBarPainter(new GradientBarPainter());
272                XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
273            }
274        }
275    }
276
277    /**
278     * Creates a pie chart with default settings.
279     * <P>
280     * The chart object returned by this method uses a {@link PiePlot} instance
281     * as the plot.
282     *
283     * @param title  the chart title (<code>null</code> permitted).
284     * @param dataset  the dataset for the chart (<code>null</code> permitted).
285     * @param legend  a flag specifying whether or not a legend is required.
286     * @param tooltips  configure chart to generate tool tips?
287     * @param locale  the locale (<code>null</code> not permitted).
288     *
289     * @return A pie chart.
290     *
291     * @since 1.0.7
292     */
293    public static JFreeChart createPieChart(String title, PieDataset dataset,
294            boolean legend, boolean tooltips, Locale locale) {
295
296        PiePlot plot = new PiePlot(dataset);
297        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
298        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
299        if (tooltips) {
300            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
301        }
302        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
303                plot, legend);
304        currentTheme.apply(chart);
305        return chart;
306
307    }
308
309    /**
310     * Creates a pie chart with default settings.
311     * <P>
312     * The chart object returned by this method uses a {@link PiePlot} instance
313     * as the plot.
314     *
315     * @param title  the chart title (<code>null</code> permitted).
316     * @param dataset  the dataset for the chart (<code>null</code> permitted).
317     *
318     * @return A pie chart.
319     * 
320     * @since 1.0.16
321     */
322    public static JFreeChart createPieChart(String title, PieDataset dataset) {
323        return createPieChart(title, dataset, true, true, false);
324    }
325    
326    /**
327     * Creates a pie chart with default settings.
328     * <P>
329     * The chart object returned by this method uses a {@link PiePlot} instance
330     * as the plot.
331     *
332     * @param title  the chart title (<code>null</code> permitted).
333     * @param dataset  the dataset for the chart (<code>null</code> permitted).
334     * @param legend  a flag specifying whether or not a legend is required.
335     * @param tooltips  configure chart to generate tool tips?
336     * @param urls  configure chart to generate URLs?
337     *
338     * @return A pie chart.
339     */
340    public static JFreeChart createPieChart(String title, PieDataset dataset,
341            boolean legend, boolean tooltips, boolean urls) {
342
343        PiePlot plot = new PiePlot(dataset);
344        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
345        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
346        if (tooltips) {
347            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
348        }
349        if (urls) {
350            plot.setURLGenerator(new StandardPieURLGenerator());
351        }
352        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
353                plot, legend);
354        currentTheme.apply(chart);
355        return chart;
356    }
357
358    /**
359     * Creates a pie chart with default settings that compares 2 datasets.
360     * The colour of each section will be determined by the move from the value
361     * for the same key in <code>previousDataset</code>. ie if value1 > value2
362     * then the section will be in green (unless <code>greenForIncrease</code>
363     * is <code>false</code>, in which case it would be <code>red</code>).
364     * Each section can have a shade of red or green as the difference can be
365     * tailored between 0% (black) and percentDiffForMaxScale% (bright
366     * red/green).
367     * <p>
368     * For instance if <code>percentDiffForMaxScale</code> is 10 (10%), a
369     * difference of 5% will have a half shade of red/green, a difference of
370     * 10% or more will have a maximum shade/brightness of red/green.
371     * <P>
372     * The chart object returned by this method uses a {@link PiePlot} instance
373     * as the plot.
374     * <p>
375     * Written by <a href="mailto:opensource@objectlab.co.uk">Benoit
376     * Xhenseval</a>.
377     *
378     * @param title  the chart title (<code>null</code> permitted).
379     * @param dataset  the dataset for the chart (<code>null</code> permitted).
380     * @param previousDataset  the dataset for the last run, this will be used
381     *                         to compare each key in the dataset
382     * @param percentDiffForMaxScale scale goes from bright red/green to black,
383     *                               percentDiffForMaxScale indicate the change
384     *                               required to reach top scale.
385     * @param greenForIncrease  an increase since previousDataset will be
386     *                          displayed in green (decrease red) if true.
387     * @param legend  a flag specifying whether or not a legend is required.
388     * @param tooltips  configure chart to generate tool tips?
389     * @param locale  the locale (<code>null</code> not permitted).
390     * @param subTitle displays a subtitle with colour scheme if true
391     * @param showDifference  create a new dataset that will show the %
392     *                        difference between the two datasets.
393     *
394     * @return A pie chart.
395     *
396     * @since 1.0.7
397     */
398    public static JFreeChart createPieChart(String title, PieDataset dataset,
399            PieDataset previousDataset, int percentDiffForMaxScale,
400            boolean greenForIncrease, boolean legend, boolean tooltips,
401            Locale locale, boolean subTitle, boolean showDifference) {
402
403        PiePlot plot = new PiePlot(dataset);
404        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
405        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
406
407        if (tooltips) {
408            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
409        }
410
411        List keys = dataset.getKeys();
412        DefaultPieDataset series = null;
413        if (showDifference) {
414            series = new DefaultPieDataset();
415        }
416
417        double colorPerPercent = 255.0 / percentDiffForMaxScale;
418        for (Iterator it = keys.iterator(); it.hasNext();) {
419            Comparable key = (Comparable) it.next();
420            Number newValue = dataset.getValue(key);
421            Number oldValue = previousDataset.getValue(key);
422
423            if (oldValue == null) {
424                if (greenForIncrease) {
425                    plot.setSectionPaint(key, Color.green);
426                }
427                else {
428                    plot.setSectionPaint(key, Color.red);
429                }
430                if (showDifference) {
431                    assert series != null; // suppresses compiler warning
432                    series.setValue(key + " (+100%)", newValue);
433                }
434            }
435            else {
436                double percentChange = (newValue.doubleValue()
437                        / oldValue.doubleValue() - 1.0) * 100.0;
438                double shade
439                    = (Math.abs(percentChange) >= percentDiffForMaxScale ? 255
440                    : Math.abs(percentChange) * colorPerPercent);
441                if (greenForIncrease
442                        && newValue.doubleValue() > oldValue.doubleValue()
443                        || !greenForIncrease && newValue.doubleValue()
444                        < oldValue.doubleValue()) {
445                    plot.setSectionPaint(key, new Color(0, (int) shade, 0));
446                }
447                else {
448                    plot.setSectionPaint(key, new Color((int) shade, 0, 0));
449                }
450                if (showDifference) {
451                    assert series != null; // suppresses compiler warning
452                    series.setValue(key + " (" + (percentChange >= 0 ? "+" : "")
453                            + NumberFormat.getPercentInstance().format(
454                            percentChange / 100.0) + ")", newValue);
455                }
456            }
457        }
458
459        if (showDifference) {
460            plot.setDataset(series);
461        }
462
463        JFreeChart chart =  new JFreeChart(title,
464                JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
465
466        if (subTitle) {
467            TextTitle subtitle = new TextTitle("Bright " + (greenForIncrease 
468                    ? "red" : "green") + "=change >=-" + percentDiffForMaxScale
469                    + "%, Bright " + (!greenForIncrease ? "red" : "green")
470                    + "=change >=+" + percentDiffForMaxScale + "%",
471                    new Font("SansSerif", Font.PLAIN, 10));
472            chart.addSubtitle(subtitle);
473        }
474        currentTheme.apply(chart);
475        return chart;
476    }
477
478    /**
479     * Creates a pie chart with default settings that compares 2 datasets.
480     * The colour of each section will be determined by the move from the value
481     * for the same key in <code>previousDataset</code>. ie if value1 > value2
482     * then the section will be in green (unless <code>greenForIncrease</code>
483     * is <code>false</code>, in which case it would be <code>red</code>).
484     * Each section can have a shade of red or green as the difference can be
485     * tailored between 0% (black) and percentDiffForMaxScale% (bright
486     * red/green).
487     * <p>
488     * For instance if <code>percentDiffForMaxScale</code> is 10 (10%), a
489     * difference of 5% will have a half shade of red/green, a difference of
490     * 10% or more will have a maximum shade/brightness of red/green.
491     * <P>
492     * The chart object returned by this method uses a {@link PiePlot} instance
493     * as the plot.
494     * <p>
495     * Written by <a href="mailto:opensource@objectlab.co.uk">Benoit
496     * Xhenseval</a>.
497     *
498     * @param title  the chart title (<code>null</code> permitted).
499     * @param dataset  the dataset for the chart (<code>null</code> permitted).
500     * @param previousDataset  the dataset for the last run, this will be used
501     *                         to compare each key in the dataset
502     * @param percentDiffForMaxScale scale goes from bright red/green to black,
503     *                               percentDiffForMaxScale indicate the change
504     *                               required to reach top scale.
505     * @param greenForIncrease  an increase since previousDataset will be
506     *                          displayed in green (decrease red) if true.
507     * @param legend  a flag specifying whether or not a legend is required.
508     * @param tooltips  configure chart to generate tool tips?
509     * @param urls  configure chart to generate URLs?
510     * @param subTitle displays a subtitle with colour scheme if true
511     * @param showDifference  create a new dataset that will show the %
512     *                        difference between the two datasets.
513     *
514     * @return A pie chart.
515     */
516    public static JFreeChart createPieChart(String title, PieDataset dataset,
517            PieDataset previousDataset, int percentDiffForMaxScale,
518            boolean greenForIncrease, boolean legend, boolean tooltips, 
519            boolean urls, boolean subTitle, boolean showDifference) {
520
521        PiePlot plot = new PiePlot(dataset);
522        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
523        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
524
525        if (tooltips) {
526            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
527        }
528        if (urls) {
529            plot.setURLGenerator(new StandardPieURLGenerator());
530        }
531
532        List keys = dataset.getKeys();
533        DefaultPieDataset series = null;
534        if (showDifference) {
535            series = new DefaultPieDataset();
536        }
537
538        double colorPerPercent = 255.0 / percentDiffForMaxScale;
539        for (Iterator it = keys.iterator(); it.hasNext();) {
540            Comparable key = (Comparable) it.next();
541            Number newValue = dataset.getValue(key);
542            Number oldValue = previousDataset.getValue(key);
543
544            if (oldValue == null) {
545                if (greenForIncrease) {
546                    plot.setSectionPaint(key, Color.green);
547                }
548                else {
549                    plot.setSectionPaint(key, Color.red);
550                }
551                if (showDifference) {
552                    assert series != null; // suppresses compiler warning
553                    series.setValue(key + " (+100%)", newValue);
554                }
555            }
556            else {
557                double percentChange = (newValue.doubleValue()
558                        / oldValue.doubleValue() - 1.0) * 100.0;
559                double shade
560                    = (Math.abs(percentChange) >= percentDiffForMaxScale ? 255
561                    : Math.abs(percentChange) * colorPerPercent);
562                if (greenForIncrease
563                        && newValue.doubleValue() > oldValue.doubleValue()
564                        || !greenForIncrease && newValue.doubleValue()
565                        < oldValue.doubleValue()) {
566                    plot.setSectionPaint(key, new Color(0, (int) shade, 0));
567                }
568                else {
569                    plot.setSectionPaint(key, new Color((int) shade, 0, 0));
570                }
571                if (showDifference) {
572                    assert series != null; // suppresses compiler warning
573                    series.setValue(key + " (" + (percentChange >= 0 ? "+" : "")
574                            + NumberFormat.getPercentInstance().format(
575                            percentChange / 100.0) + ")", newValue);
576                }
577            }
578        }
579
580        if (showDifference) {
581            plot.setDataset(series);
582        }
583
584        JFreeChart chart =  new JFreeChart(title,
585                JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
586
587        if (subTitle) {
588            TextTitle subtitle = new TextTitle("Bright " + (greenForIncrease 
589                    ? "red" : "green") + "=change >=-" + percentDiffForMaxScale
590                    + "%, Bright " + (!greenForIncrease ? "red" : "green")
591                    + "=change >=+" + percentDiffForMaxScale + "%",
592                    new Font("SansSerif", Font.PLAIN, 10));
593            chart.addSubtitle(subtitle);
594        }
595        currentTheme.apply(chart);
596        return chart;
597    }
598
599    /**
600     * Creates a ring chart with default settings.
601     * <P>
602     * The chart object returned by this method uses a {@link RingPlot}
603     * instance as the plot.
604     *
605     * @param title  the chart title (<code>null</code> permitted).
606     * @param dataset  the dataset for the chart (<code>null</code> permitted).
607     * @param legend  a flag specifying whether or not a legend is required.
608     * @param tooltips  configure chart to generate tool tips?
609     * @param locale  the locale (<code>null</code> not permitted).
610     *
611     * @return A ring chart.
612     *
613     * @since 1.0.7
614     */
615    public static JFreeChart createRingChart(String title, PieDataset dataset,
616            boolean legend, boolean tooltips, Locale locale) {
617
618        RingPlot plot = new RingPlot(dataset);
619        plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
620        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
621        if (tooltips) {
622            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
623        }
624        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
625                plot, legend);
626        currentTheme.apply(chart);
627        return chart;
628    }
629
630    /**
631     * Creates a ring chart with default settings.
632     * <P>
633     * The chart object returned by this method uses a {@link RingPlot}
634     * instance as the plot.
635     *
636     * @param title  the chart title (<code>null</code> permitted).
637     * @param dataset  the dataset for the chart (<code>null</code> permitted).
638     * @param legend  a flag specifying whether or not a legend is required.
639     * @param tooltips  configure chart to generate tool tips?
640     * @param urls  configure chart to generate URLs?
641     *
642     * @return A ring chart.
643     */
644    public static JFreeChart createRingChart(String title, PieDataset dataset,
645            boolean legend, boolean tooltips, boolean urls) {
646
647        RingPlot plot = new RingPlot(dataset);
648        plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
649        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
650        if (tooltips) {
651            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
652        }
653        if (urls) {
654            plot.setURLGenerator(new StandardPieURLGenerator());
655        }
656        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
657                plot, legend);
658        currentTheme.apply(chart);
659        return chart;
660
661    }
662
663    /**
664     * Creates a chart that displays multiple pie plots.  The chart object
665     * returned by this method uses a {@link MultiplePiePlot} instance as the
666     * plot.
667     *
668     * @param title  the chart title (<code>null</code> permitted).
669     * @param dataset  the dataset (<code>null</code> permitted).
670     * @param order  the order that the data is extracted (by row or by column)
671     *               (<code>null</code> not permitted).
672     * @param legend  include a legend?
673     * @param tooltips  generate tooltips?
674     * @param urls  generate URLs?
675     *
676     * @return A chart.
677     */
678    public static JFreeChart createMultiplePieChart(String title,
679            CategoryDataset dataset, TableOrder order, boolean legend,
680            boolean tooltips, boolean urls) {
681
682        ParamChecks.nullNotPermitted(order, "order");
683        MultiplePiePlot plot = new MultiplePiePlot(dataset);
684        plot.setDataExtractOrder(order);
685        plot.setBackgroundPaint(null);
686        plot.setOutlineStroke(null);
687
688        if (tooltips) {
689            PieToolTipGenerator tooltipGenerator
690                = new StandardPieToolTipGenerator();
691            PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
692            pp.setToolTipGenerator(tooltipGenerator);
693        }
694
695        if (urls) {
696            PieURLGenerator urlGenerator = new StandardPieURLGenerator();
697            PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
698            pp.setURLGenerator(urlGenerator);
699        }
700
701        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
702                plot, legend);
703        currentTheme.apply(chart);
704        return chart;
705
706    }
707
708    /**
709     * Creates a 3D pie chart using the specified dataset.  The chart object
710     * returned by this method uses a {@link PiePlot3D} instance as the
711     * plot.
712     *
713     * @param title  the chart title (<code>null</code> permitted).
714     * @param dataset  the dataset for the chart (<code>null</code> permitted).
715     * @param legend  a flag specifying whether or not a legend is required.
716     * @param tooltips  configure chart to generate tool tips?
717     * @param locale  the locale (<code>null</code> not permitted).
718     *
719     * @return A pie chart.
720     *
721     * @since 1.0.7
722     */
723    public static JFreeChart createPieChart3D(String title, PieDataset dataset,
724            boolean legend, boolean tooltips, Locale locale) {
725
726        ParamChecks.nullNotPermitted(locale, "locale");
727        PiePlot3D plot = new PiePlot3D(dataset);
728        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
729        if (tooltips) {
730            plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
731        }
732        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
733                plot, legend);
734        currentTheme.apply(chart);
735        return chart;
736
737    }
738
739    /**
740     * Creates a 3D pie chart using the specified dataset.  The chart object
741     * returned by this method uses a {@link PiePlot3D} instance as the
742     * plot.
743     *
744     * @param title  the chart title (<code>null</code> permitted).
745     * @param dataset  the dataset for the chart (<code>null</code> permitted).
746     *
747     * @return A pie chart.
748     * 
749     * @since 1.0.16
750     */
751    public static JFreeChart createPieChart3D(String title,
752            PieDataset dataset) {
753        return createPieChart3D(title, dataset, true, true, false);
754    }
755    
756    /**
757     * Creates a 3D pie chart using the specified dataset.  The chart object
758     * returned by this method uses a {@link PiePlot3D} instance as the
759     * plot.
760     *
761     * @param title  the chart title (<code>null</code> permitted).
762     * @param dataset  the dataset for the chart (<code>null</code> permitted).
763     * @param legend  a flag specifying whether or not a legend is required.
764     * @param tooltips  configure chart to generate tool tips?
765     * @param urls  configure chart to generate URLs?
766     *
767     * @return A pie chart.
768     */
769    public static JFreeChart createPieChart3D(String title, PieDataset dataset,
770            boolean legend, boolean tooltips, boolean urls) {
771
772        PiePlot3D plot = new PiePlot3D(dataset);
773        plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
774        if (tooltips) {
775            plot.setToolTipGenerator(new StandardPieToolTipGenerator());
776        }
777        if (urls) {
778            plot.setURLGenerator(new StandardPieURLGenerator());
779        }
780        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
781                plot, legend);
782        currentTheme.apply(chart);
783        return chart;
784
785    }
786
787    /**
788     * Creates a chart that displays multiple pie plots.  The chart object
789     * returned by this method uses a {@link MultiplePiePlot} instance as the
790     * plot.
791     *
792     * @param title  the chart title (<code>null</code> permitted).
793     * @param dataset  the dataset (<code>null</code> permitted).
794     * @param order  the order that the data is extracted (by row or by column)
795     *               (<code>null</code> not permitted).
796     * @param legend  include a legend?
797     * @param tooltips  generate tooltips?
798     * @param urls  generate URLs?
799     *
800     * @return A chart.
801     */
802    public static JFreeChart createMultiplePieChart3D(String title,
803            CategoryDataset dataset, TableOrder order, boolean legend,
804            boolean tooltips, boolean urls) {
805
806        ParamChecks.nullNotPermitted(order, "order");
807        MultiplePiePlot plot = new MultiplePiePlot(dataset);
808        plot.setDataExtractOrder(order);
809        plot.setBackgroundPaint(null);
810        plot.setOutlineStroke(null);
811
812        JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
813        TextTitle seriesTitle = new TextTitle("Series Title",
814                new Font("SansSerif", Font.BOLD, 12));
815        seriesTitle.setPosition(RectangleEdge.BOTTOM);
816        pieChart.setTitle(seriesTitle);
817        pieChart.removeLegend();
818        pieChart.setBackgroundPaint(null);
819        plot.setPieChart(pieChart);
820
821        if (tooltips) {
822            PieToolTipGenerator tooltipGenerator
823                = new StandardPieToolTipGenerator();
824            PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
825            pp.setToolTipGenerator(tooltipGenerator);
826        }
827
828        if (urls) {
829            PieURLGenerator urlGenerator = new StandardPieURLGenerator();
830            PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
831            pp.setURLGenerator(urlGenerator);
832        }
833
834        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
835                plot, legend);
836        currentTheme.apply(chart);
837        return chart;
838
839    }
840
841    /**
842     * Creates a bar chart with a vertical orientation.  The chart object
843     * returned by this method uses a {@link CategoryPlot} instance as the
844     * plot, with a {@link CategoryAxis} for the domain axis, a
845     * {@link NumberAxis} as the range axis, and a {@link BarRenderer} as the
846     * renderer.
847     *
848     * @param title  the chart title (<code>null</code> permitted).
849     * @param categoryAxisLabel  the label for the category axis
850     *                           (<code>null</code> permitted).
851     * @param valueAxisLabel  the label for the value axis
852     *                        (<code>null</code> permitted).
853     * @param dataset  the dataset for the chart (<code>null</code> permitted).
854     *
855     * @return A bar chart.
856     * 
857     * @since 1.0.16
858     */
859    public static JFreeChart createBarChart(String title,
860            String categoryAxisLabel, String valueAxisLabel,
861            CategoryDataset dataset) {
862        return createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
863                PlotOrientation.VERTICAL, true, true, false);
864    }
865 
866    /**
867     * Creates a bar chart.  The chart object returned by this method uses a
868     * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
869     * for the domain axis, a {@link NumberAxis} as the range axis, and a
870     * {@link BarRenderer} as the renderer.
871     *
872     * @param title  the chart title (<code>null</code> permitted).
873     * @param categoryAxisLabel  the label for the category axis
874     *                           (<code>null</code> permitted).
875     * @param valueAxisLabel  the label for the value axis
876     *                        (<code>null</code> permitted).
877     * @param dataset  the dataset for the chart (<code>null</code> permitted).
878     * @param orientation  the plot orientation (horizontal or vertical)
879     *                     (<code>null</code> not permitted).
880     * @param legend  a flag specifying whether or not a legend is required.
881     * @param tooltips  configure chart to generate tool tips?
882     * @param urls  configure chart to generate URLs?
883     *
884     * @return A bar chart.
885     */
886    public static JFreeChart createBarChart(String title,
887            String categoryAxisLabel, String valueAxisLabel,
888            CategoryDataset dataset, PlotOrientation orientation,
889            boolean legend, boolean tooltips, boolean urls) {
890
891        ParamChecks.nullNotPermitted(orientation, "orientation");
892        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
893        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
894
895        BarRenderer renderer = new BarRenderer();
896        if (orientation == PlotOrientation.HORIZONTAL) {
897            ItemLabelPosition position1 = new ItemLabelPosition(
898                    ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
899            renderer.setBasePositiveItemLabelPosition(position1);
900            ItemLabelPosition position2 = new ItemLabelPosition(
901                    ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
902            renderer.setBaseNegativeItemLabelPosition(position2);
903         }
904        else if (orientation == PlotOrientation.VERTICAL) {
905            ItemLabelPosition position1 = new ItemLabelPosition(
906                    ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
907            renderer.setBasePositiveItemLabelPosition(position1);
908            ItemLabelPosition position2 = new ItemLabelPosition(
909                    ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
910            renderer.setBaseNegativeItemLabelPosition(position2);
911        }
912        if (tooltips) {
913            renderer.setBaseToolTipGenerator(
914                    new StandardCategoryToolTipGenerator());
915        }
916        if (urls) {
917            renderer.setBaseItemURLGenerator(
918                    new StandardCategoryURLGenerator());
919        }
920
921        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
922                renderer);
923        plot.setOrientation(orientation);
924        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
925                plot, legend);
926        currentTheme.apply(chart);
927        return chart;
928
929    }
930
931    /**
932     * Creates a stacked bar chart with default settings.  The chart object
933     * returned by this method uses a {@link CategoryPlot} instance as the
934     * plot, with a {@link CategoryAxis} for the domain axis, a
935     * {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
936     * as the renderer.
937     *
938     * @param title  the chart title (<code>null</code> permitted).
939     * @param domainAxisLabel  the label for the category axis
940     *                         (<code>null</code> permitted).
941     * @param rangeAxisLabel  the label for the value axis
942     *                        (<code>null</code> permitted).
943     * @param dataset  the dataset for the chart (<code>null</code> permitted).
944     *
945     * @return A stacked bar chart.
946     * 
947     * @since 1.0.16
948     */
949    public static JFreeChart createStackedBarChart(String title,
950            String domainAxisLabel, String rangeAxisLabel,
951            CategoryDataset dataset) {
952        return createStackedBarChart(title, domainAxisLabel, rangeAxisLabel,
953                dataset, PlotOrientation.VERTICAL, true, true, false);
954    }
955    
956    /**
957     * Creates a stacked bar chart with default settings.  The chart object
958     * returned by this method uses a {@link CategoryPlot} instance as the
959     * plot, with a {@link CategoryAxis} for the domain axis, a
960     * {@link NumberAxis} as the range axis, and a {@link StackedBarRenderer}
961     * as the renderer.
962     *
963     * @param title  the chart title (<code>null</code> permitted).
964     * @param domainAxisLabel  the label for the category axis
965     *                         (<code>null</code> permitted).
966     * @param rangeAxisLabel  the label for the value axis
967     *                        (<code>null</code> permitted).
968     * @param dataset  the dataset for the chart (<code>null</code> permitted).
969     * @param orientation  the orientation of the chart (horizontal or
970     *                     vertical) (<code>null</code> not permitted).
971     * @param legend  a flag specifying whether or not a legend is required.
972     * @param tooltips  configure chart to generate tool tips?
973     * @param urls  configure chart to generate URLs?
974     *
975     * @return A stacked bar chart.
976     */
977    public static JFreeChart createStackedBarChart(String title,
978            String domainAxisLabel, String rangeAxisLabel,
979            CategoryDataset dataset, PlotOrientation orientation,
980            boolean legend, boolean tooltips, boolean urls) {
981
982        ParamChecks.nullNotPermitted(orientation, "orientation");
983
984        CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
985        ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
986
987        StackedBarRenderer renderer = new StackedBarRenderer();
988        if (tooltips) {
989            renderer.setBaseToolTipGenerator(
990                    new StandardCategoryToolTipGenerator());
991        }
992        if (urls) {
993            renderer.setBaseItemURLGenerator(
994                    new StandardCategoryURLGenerator());
995        }
996
997        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
998                renderer);
999        plot.setOrientation(orientation);
1000        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1001                plot, legend);
1002        currentTheme.apply(chart);
1003        return chart;
1004
1005    }
1006
1007    /**
1008     * Creates a bar chart with a 3D effect. The chart object returned by this
1009     * method uses a {@link CategoryPlot} instance as the plot, with a
1010     * {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as
1011     * the range axis, and a {@link BarRenderer3D} as the renderer.
1012     *
1013     * @param title  the chart title (<code>null</code> permitted).
1014     * @param categoryAxisLabel  the label for the category axis
1015     *                           (<code>null</code> permitted).
1016     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1017     *                        permitted).
1018     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1019     *
1020     * @return A bar chart with a 3D effect.
1021     * 
1022     * @since 1.0.16
1023     */
1024    public static JFreeChart createBarChart3D(String title,
1025            String categoryAxisLabel, String valueAxisLabel,
1026            CategoryDataset dataset) {
1027        return createBarChart3D(title, categoryAxisLabel, valueAxisLabel,
1028                dataset, PlotOrientation.VERTICAL, true, true, false);
1029    }
1030    
1031    /**
1032     * Creates a bar chart with a 3D effect. The chart object returned by this
1033     * method uses a {@link CategoryPlot} instance as the plot, with a
1034     * {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as
1035     * the range axis, and a {@link BarRenderer3D} as the renderer.
1036     *
1037     * @param title  the chart title (<code>null</code> permitted).
1038     * @param categoryAxisLabel  the label for the category axis
1039     *                           (<code>null</code> permitted).
1040     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1041     *                        permitted).
1042     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1043     * @param orientation  the plot orientation (horizontal or vertical)
1044     *                     (<code>null</code> not permitted).
1045     * @param legend  a flag specifying whether or not a legend is required.
1046     * @param tooltips  configure chart to generate tool tips?
1047     * @param urls  configure chart to generate URLs?
1048     *
1049     * @return A bar chart with a 3D effect.
1050     */
1051    public static JFreeChart createBarChart3D(String title,
1052            String categoryAxisLabel, String valueAxisLabel,
1053            CategoryDataset dataset, PlotOrientation orientation,
1054            boolean legend, boolean tooltips, boolean urls) {
1055
1056        ParamChecks.nullNotPermitted(orientation, "orientation");
1057        CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
1058        ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
1059
1060        BarRenderer3D renderer = new BarRenderer3D();
1061        if (tooltips) {
1062            renderer.setBaseToolTipGenerator(
1063                    new StandardCategoryToolTipGenerator());
1064        }
1065        if (urls) {
1066            renderer.setBaseItemURLGenerator(
1067                    new StandardCategoryURLGenerator());
1068        }
1069
1070        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1071                renderer);
1072        plot.setOrientation(orientation);
1073        if (orientation == PlotOrientation.HORIZONTAL) {
1074            // change rendering order to ensure that bar overlapping is the
1075            // right way around
1076            plot.setRowRenderingOrder(SortOrder.DESCENDING);
1077            plot.setColumnRenderingOrder(SortOrder.DESCENDING);
1078        }
1079        plot.setForegroundAlpha(0.75f);
1080
1081        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1082                plot, legend);
1083        currentTheme.apply(chart);
1084        return chart;
1085
1086    }
1087
1088    /**
1089     * Creates a stacked bar chart with a 3D effect and default settings. The
1090     * chart object returned by this method uses a {@link CategoryPlot}
1091     * instance as the plot, with a {@link CategoryAxis3D} for the domain axis,
1092     * a {@link NumberAxis3D} as the range axis, and a
1093     * {@link StackedBarRenderer3D} as the renderer.
1094     *
1095     * @param title  the chart title (<code>null</code> permitted).
1096     * @param categoryAxisLabel  the label for the category axis
1097     *                           (<code>null</code> permitted).
1098     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1099     *                        permitted).
1100     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1101     *
1102     * @return A stacked bar chart with a 3D effect.
1103     * 
1104     * @since 1.0.16
1105     */
1106    public static JFreeChart createStackedBarChart3D(String title,
1107            String categoryAxisLabel, String valueAxisLabel,
1108            CategoryDataset dataset) {
1109        return createStackedBarChart3D(title, categoryAxisLabel, valueAxisLabel,
1110                dataset, PlotOrientation.VERTICAL, true, true, false);
1111    }
1112    
1113    /**
1114     * Creates a stacked bar chart with a 3D effect and default settings. The
1115     * chart object returned by this method uses a {@link CategoryPlot}
1116     * instance as the plot, with a {@link CategoryAxis3D} for the domain axis,
1117     * a {@link NumberAxis3D} as the range axis, and a
1118     * {@link StackedBarRenderer3D} as the renderer.
1119     *
1120     * @param title  the chart title (<code>null</code> permitted).
1121     * @param categoryAxisLabel  the label for the category axis
1122     *                           (<code>null</code> permitted).
1123     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1124     *                        permitted).
1125     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1126     * @param orientation  the orientation (horizontal or vertical)
1127     *                     (<code>null</code> not permitted).
1128     * @param legend  a flag specifying whether or not a legend is required.
1129     * @param tooltips  configure chart to generate tool tips?
1130     * @param urls  configure chart to generate URLs?
1131     *
1132     * @return A stacked bar chart with a 3D effect.
1133     */
1134    public static JFreeChart createStackedBarChart3D(String title,
1135            String categoryAxisLabel, String valueAxisLabel,
1136            CategoryDataset dataset, PlotOrientation orientation,
1137            boolean legend, boolean tooltips, boolean urls) {
1138
1139        ParamChecks.nullNotPermitted(orientation, "orientation");
1140        CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
1141        ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
1142
1143        // create the renderer...
1144        CategoryItemRenderer renderer = new StackedBarRenderer3D();
1145        if (tooltips) {
1146            renderer.setBaseToolTipGenerator(
1147                    new StandardCategoryToolTipGenerator());
1148        }
1149        if (urls) {
1150            renderer.setBaseItemURLGenerator(
1151                    new StandardCategoryURLGenerator());
1152        }
1153
1154        // create the plot...
1155        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1156                renderer);
1157        plot.setOrientation(orientation);
1158        if (orientation == PlotOrientation.HORIZONTAL) {
1159            // change rendering order to ensure that bar overlapping is the
1160            // right way around
1161            plot.setColumnRenderingOrder(SortOrder.DESCENDING);
1162        }
1163
1164        // create the chart...
1165        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1166                plot, legend);
1167        currentTheme.apply(chart);
1168        return chart;
1169
1170    }
1171
1172    /**
1173     * Creates an area chart with default settings.  The chart object returned
1174     * by this method uses a {@link CategoryPlot} instance as the plot, with a
1175     * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
1176     * range axis, and an {@link AreaRenderer} as the renderer.
1177     *
1178     * @param title  the chart title (<code>null</code> permitted).
1179     * @param categoryAxisLabel  the label for the category axis
1180     *                           (<code>null</code> permitted).
1181     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1182     *                        permitted).
1183     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1184     *
1185     * @return An area chart.
1186     * 
1187     * @since 1.0.16
1188     */
1189    public static JFreeChart createAreaChart(String title,
1190            String categoryAxisLabel, String valueAxisLabel,
1191            CategoryDataset dataset) {
1192        return createAreaChart(title, categoryAxisLabel, valueAxisLabel,
1193                dataset, PlotOrientation.VERTICAL, true, true, false);
1194    }
1195            
1196    /**
1197     * Creates an area chart with default settings.  The chart object returned
1198     * by this method uses a {@link CategoryPlot} instance as the plot, with a
1199     * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
1200     * range axis, and an {@link AreaRenderer} as the renderer.
1201     *
1202     * @param title  the chart title (<code>null</code> permitted).
1203     * @param categoryAxisLabel  the label for the category axis
1204     *                           (<code>null</code> permitted).
1205     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1206     *                        permitted).
1207     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1208     * @param orientation  the plot orientation (<code>null</code> not
1209     *                     permitted).
1210     * @param legend  a flag specifying whether or not a legend is required.
1211     * @param tooltips  configure chart to generate tool tips?
1212     * @param urls  configure chart to generate URLs?
1213     *
1214     * @return An area chart.
1215     */
1216    public static JFreeChart createAreaChart(String title,
1217            String categoryAxisLabel, String valueAxisLabel,
1218            CategoryDataset dataset, PlotOrientation orientation,
1219            boolean legend, boolean tooltips, boolean urls) {
1220
1221        ParamChecks.nullNotPermitted(orientation, "orientation");
1222        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
1223        categoryAxis.setCategoryMargin(0.0);
1224
1225        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
1226
1227        AreaRenderer renderer = new AreaRenderer();
1228        if (tooltips) {
1229            renderer.setBaseToolTipGenerator(
1230                    new StandardCategoryToolTipGenerator());
1231        }
1232        if (urls) {
1233            renderer.setBaseItemURLGenerator(
1234                    new StandardCategoryURLGenerator());
1235        }
1236
1237        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1238                renderer);
1239        plot.setOrientation(orientation);
1240        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1241                plot, legend);
1242        currentTheme.apply(chart);
1243        return chart;
1244
1245    }
1246
1247    /**
1248     * Creates a stacked area chart with default settings.  The chart object
1249     * returned by this method uses a {@link CategoryPlot} instance as the
1250     * plot, with a {@link CategoryAxis} for the domain axis, a
1251     * {@link NumberAxis} as the range axis, and a {@link StackedAreaRenderer}
1252     * as the renderer.
1253     *
1254     * @param title  the chart title (<code>null</code> permitted).
1255     * @param categoryAxisLabel  the label for the category axis
1256     *                           (<code>null</code> permitted).
1257     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1258     *                        permitted).
1259     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1260     *
1261     * @return A stacked area chart.
1262     * 
1263     * @since 1.0.16
1264     */
1265    public static JFreeChart createStackedAreaChart(String title,
1266            String categoryAxisLabel, String valueAxisLabel,
1267            CategoryDataset dataset) {
1268        return createStackedAreaChart(title, categoryAxisLabel, valueAxisLabel,
1269                dataset, PlotOrientation.VERTICAL, true, true, false);
1270    }
1271    
1272    /**
1273     * Creates a stacked area chart with default settings.  The chart object
1274     * returned by this method uses a {@link CategoryPlot} instance as the
1275     * plot, with a {@link CategoryAxis} for the domain axis, a
1276     * {@link NumberAxis} as the range axis, and a {@link StackedAreaRenderer}
1277     * as the renderer.
1278     *
1279     * @param title  the chart title (<code>null</code> permitted).
1280     * @param categoryAxisLabel  the label for the category axis
1281     *                           (<code>null</code> permitted).
1282     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1283     *                        permitted).
1284     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1285     * @param orientation  the plot orientation (horizontal or vertical)
1286     *                     (<code>null</code> not permitted).
1287     * @param legend  a flag specifying whether or not a legend is required.
1288     * @param tooltips  configure chart to generate tool tips?
1289     * @param urls  configure chart to generate URLs?
1290     *
1291     * @return A stacked area chart.
1292     */
1293    public static JFreeChart createStackedAreaChart(String title,
1294            String categoryAxisLabel, String valueAxisLabel,
1295            CategoryDataset dataset, PlotOrientation orientation,
1296            boolean legend, boolean tooltips, boolean urls) {
1297
1298        ParamChecks.nullNotPermitted(orientation, "orientation");
1299        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
1300        categoryAxis.setCategoryMargin(0.0);
1301        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
1302
1303        StackedAreaRenderer renderer = new StackedAreaRenderer();
1304        if (tooltips) {
1305            renderer.setBaseToolTipGenerator(
1306                    new StandardCategoryToolTipGenerator());
1307        }
1308        if (urls) {
1309            renderer.setBaseItemURLGenerator(
1310                    new StandardCategoryURLGenerator());
1311        }
1312
1313        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1314                renderer);
1315        plot.setOrientation(orientation);
1316        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1317                plot, legend);
1318        currentTheme.apply(chart);
1319        return chart;
1320
1321    }
1322
1323    /**
1324     * Creates a line chart with default settings.  The chart object returned
1325     * by this method uses a {@link CategoryPlot} instance as the plot, with a
1326     * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
1327     * range axis, and a {@link LineAndShapeRenderer} as the renderer.
1328     *
1329     * @param title  the chart title (<code>null</code> permitted).
1330     * @param categoryAxisLabel  the label for the category axis
1331     *                           (<code>null</code> permitted).
1332     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1333     *                        permitted).
1334     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1335     *
1336     * @return A line chart.
1337     * 
1338     * @since 1.0.16
1339     */
1340    public static JFreeChart createLineChart(String title,
1341            String categoryAxisLabel, String valueAxisLabel,
1342            CategoryDataset dataset) {
1343        return createLineChart(title, categoryAxisLabel, valueAxisLabel,
1344                dataset, PlotOrientation.VERTICAL, true, true, false);
1345    }
1346    
1347    /**
1348     * Creates a line chart with default settings.  The chart object returned
1349     * by this method uses a {@link CategoryPlot} instance as the plot, with a
1350     * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
1351     * range axis, and a {@link LineAndShapeRenderer} as the renderer.
1352     *
1353     * @param title  the chart title (<code>null</code> permitted).
1354     * @param categoryAxisLabel  the label for the category axis
1355     *                           (<code>null</code> permitted).
1356     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1357     *                        permitted).
1358     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1359     * @param orientation  the chart orientation (horizontal or vertical)
1360     *                     (<code>null</code> not permitted).
1361     * @param legend  a flag specifying whether or not a legend is required.
1362     * @param tooltips  configure chart to generate tool tips?
1363     * @param urls  configure chart to generate URLs?
1364     *
1365     * @return A line chart.
1366     */
1367    public static JFreeChart createLineChart(String title,
1368            String categoryAxisLabel, String valueAxisLabel,
1369            CategoryDataset dataset, PlotOrientation orientation,
1370            boolean legend, boolean tooltips, boolean urls) {
1371
1372        ParamChecks.nullNotPermitted(orientation, "orientation");
1373        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
1374        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
1375
1376        LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
1377        if (tooltips) {
1378            renderer.setBaseToolTipGenerator(
1379                    new StandardCategoryToolTipGenerator());
1380        }
1381        if (urls) {
1382            renderer.setBaseItemURLGenerator(
1383                    new StandardCategoryURLGenerator());
1384        }
1385        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1386                renderer);
1387        plot.setOrientation(orientation);
1388        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1389                plot, legend);
1390        currentTheme.apply(chart);
1391        return chart;
1392
1393    }
1394
1395    /**
1396     * Creates a line chart with default settings. The chart object returned by
1397     * this method uses a {@link CategoryPlot} instance as the plot, with a
1398     * {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as
1399     * the range axis, and a {@link LineRenderer3D} as the renderer.
1400     *
1401     * @param title  the chart title (<code>null</code> permitted).
1402     * @param categoryAxisLabel  the label for the category axis
1403     *                           (<code>null</code> permitted).
1404     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1405     *                        permitted).
1406     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1407     *
1408     * @return A line chart.
1409     * 
1410     * @since 1.0.16
1411     */
1412    public static JFreeChart createLineChart3D(String title,
1413            String categoryAxisLabel, String valueAxisLabel,
1414            CategoryDataset dataset) {
1415        return createLineChart3D(title, categoryAxisLabel, valueAxisLabel,
1416                dataset, PlotOrientation.VERTICAL, true, true, false);
1417    }    
1418        
1419    /**
1420     * Creates a line chart with default settings. The chart object returned by
1421     * this method uses a {@link CategoryPlot} instance as the plot, with a
1422     * {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as
1423     * the range axis, and a {@link LineRenderer3D} as the renderer.
1424     *
1425     * @param title  the chart title (<code>null</code> permitted).
1426     * @param categoryAxisLabel  the label for the category axis
1427     *                           (<code>null</code> permitted).
1428     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1429     *                        permitted).
1430     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1431     * @param orientation  the chart orientation (horizontal or vertical)
1432     *                     (<code>null</code> not permitted).
1433     * @param legend  a flag specifying whether or not a legend is required.
1434     * @param tooltips  configure chart to generate tool tips?
1435     * @param urls  configure chart to generate URLs?
1436     *
1437     * @return A line chart.
1438     */
1439    public static JFreeChart createLineChart3D(String title,
1440            String categoryAxisLabel, String valueAxisLabel,
1441            CategoryDataset dataset, PlotOrientation orientation,
1442            boolean legend, boolean tooltips, boolean urls) {
1443
1444        ParamChecks.nullNotPermitted(orientation, "orientation");
1445        CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
1446        ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
1447
1448        LineRenderer3D renderer = new LineRenderer3D();
1449        if (tooltips) {
1450            renderer.setBaseToolTipGenerator(
1451                    new StandardCategoryToolTipGenerator());
1452        }
1453        if (urls) {
1454            renderer.setBaseItemURLGenerator(
1455                    new StandardCategoryURLGenerator());
1456        }
1457        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1458                renderer);
1459        plot.setOrientation(orientation);
1460        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1461                plot, legend);
1462        currentTheme.apply(chart);
1463        return chart;
1464
1465    }
1466
1467    /**
1468     * Creates a Gantt chart using the supplied attributes plus default values
1469     * where required.  The chart object returned by this method uses a
1470     * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
1471     * for the domain axis, a {@link DateAxis} as the range axis, and a
1472     * {@link GanttRenderer} as the renderer.
1473     *
1474     * @param title  the chart title (<code>null</code> permitted).
1475     * @param categoryAxisLabel  the label for the category axis
1476     *                           (<code>null</code> permitted).
1477     * @param dateAxisLabel  the label for the date axis
1478     *                       (<code>null</code> permitted).
1479     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1480     *
1481     * @return A Gantt chart.
1482     * 
1483     * @since 1.0.16
1484     */
1485    public static JFreeChart createGanttChart(String title,
1486            String categoryAxisLabel, String dateAxisLabel,
1487            IntervalCategoryDataset dataset) {
1488        return createGanttChart(title, categoryAxisLabel, dateAxisLabel,
1489                dataset, true, true, false);
1490    }
1491    
1492    /**
1493     * Creates a Gantt chart using the supplied attributes plus default values
1494     * where required.  The chart object returned by this method uses a
1495     * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
1496     * for the domain axis, a {@link DateAxis} as the range axis, and a
1497     * {@link GanttRenderer} as the renderer.
1498     *
1499     * @param title  the chart title (<code>null</code> permitted).
1500     * @param categoryAxisLabel  the label for the category axis
1501     *                           (<code>null</code> permitted).
1502     * @param dateAxisLabel  the label for the date axis
1503     *                       (<code>null</code> permitted).
1504     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1505     * @param legend  a flag specifying whether or not a legend is required.
1506     * @param tooltips  configure chart to generate tool tips?
1507     * @param urls  configure chart to generate URLs?
1508     *
1509     * @return A Gantt chart.
1510     */
1511    public static JFreeChart createGanttChart(String title,
1512            String categoryAxisLabel, String dateAxisLabel,
1513            IntervalCategoryDataset dataset, boolean legend, boolean tooltips,
1514            boolean urls) {
1515
1516        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
1517        DateAxis dateAxis = new DateAxis(dateAxisLabel);
1518
1519        CategoryItemRenderer renderer = new GanttRenderer();
1520        if (tooltips) {
1521            renderer.setBaseToolTipGenerator(
1522                    new IntervalCategoryToolTipGenerator(
1523                    "{3} - {4}", DateFormat.getDateInstance()));
1524        }
1525        if (urls) {
1526            renderer.setBaseItemURLGenerator(
1527                    new StandardCategoryURLGenerator());
1528        }
1529
1530        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
1531                renderer);
1532        plot.setOrientation(PlotOrientation.HORIZONTAL);
1533        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1534                plot, legend);
1535        currentTheme.apply(chart);
1536        return chart;
1537
1538    }
1539
1540    /**
1541     * Creates a waterfall chart.  The chart object returned by this method
1542     * uses a {@link CategoryPlot} instance as the plot, with a
1543     * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
1544     * range axis, and a {@link WaterfallBarRenderer} as the renderer.
1545     *
1546     * @param title  the chart title (<code>null</code> permitted).
1547     * @param categoryAxisLabel  the label for the category axis
1548     *                           (<code>null</code> permitted).
1549     * @param valueAxisLabel  the label for the value axis (<code>null</code>
1550     *                        permitted).
1551     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1552     * @param orientation  the plot orientation (horizontal or vertical)
1553     *                     (<code>null</code> NOT permitted).
1554     * @param legend  a flag specifying whether or not a legend is required.
1555     * @param tooltips  configure chart to generate tool tips?
1556     * @param urls  configure chart to generate URLs?
1557     *
1558     * @return A waterfall chart.
1559     */
1560    public static JFreeChart createWaterfallChart(String title,
1561            String categoryAxisLabel, String valueAxisLabel,
1562            CategoryDataset dataset, PlotOrientation orientation,
1563            boolean legend, boolean tooltips, boolean urls) {
1564
1565        ParamChecks.nullNotPermitted(orientation, "orientation");
1566        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
1567        categoryAxis.setCategoryMargin(0.0);
1568
1569        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
1570
1571        WaterfallBarRenderer renderer = new WaterfallBarRenderer();
1572        if (orientation == PlotOrientation.HORIZONTAL) {
1573            ItemLabelPosition position = new ItemLabelPosition(
1574                    ItemLabelAnchor.CENTER, TextAnchor.CENTER,
1575                    TextAnchor.CENTER, Math.PI / 2.0);
1576            renderer.setBasePositiveItemLabelPosition(position);
1577            renderer.setBaseNegativeItemLabelPosition(position);
1578         }
1579        else if (orientation == PlotOrientation.VERTICAL) {
1580            ItemLabelPosition position = new ItemLabelPosition(
1581                    ItemLabelAnchor.CENTER, TextAnchor.CENTER,
1582                    TextAnchor.CENTER, 0.0);
1583            renderer.setBasePositiveItemLabelPosition(position);
1584            renderer.setBaseNegativeItemLabelPosition(position);
1585        }
1586        if (tooltips) {
1587            StandardCategoryToolTipGenerator generator
1588                = new StandardCategoryToolTipGenerator();
1589            renderer.setBaseToolTipGenerator(generator);
1590        }
1591        if (urls) {
1592            renderer.setBaseItemURLGenerator(
1593                    new StandardCategoryURLGenerator());
1594        }
1595
1596        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
1597                renderer);
1598        plot.clearRangeMarkers();
1599        Marker baseline = new ValueMarker(0.0);
1600        baseline.setPaint(Color.black);
1601        plot.addRangeMarker(baseline, Layer.FOREGROUND);
1602        plot.setOrientation(orientation);
1603        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1604                plot, legend);
1605        currentTheme.apply(chart);
1606        return chart;
1607
1608    }
1609
1610    /**
1611     * Creates a polar plot for the specified dataset (x-values interpreted as
1612     * angles in degrees).  The chart object returned by this method uses a
1613     * {@link PolarPlot} instance as the plot, with a {@link NumberAxis} for
1614     * the radial axis.
1615     *
1616     * @param title  the chart title (<code>null</code> permitted).
1617     * @param dataset  the dataset (<code>null</code> permitted).
1618     * @param legend  legend required?
1619     * @param tooltips  tooltips required?
1620     * @param urls  URLs required?
1621     *
1622     * @return A chart.
1623     */
1624    public static JFreeChart createPolarChart(String title, XYDataset dataset,
1625            boolean legend, boolean tooltips, boolean urls) {
1626
1627        PolarPlot plot = new PolarPlot();
1628        plot.setDataset(dataset);
1629        NumberAxis rangeAxis = new NumberAxis();
1630        rangeAxis.setAxisLineVisible(false);
1631        rangeAxis.setTickMarksVisible(false);
1632        rangeAxis.setTickLabelInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
1633        plot.setAxis(rangeAxis);
1634        plot.setRenderer(new DefaultPolarItemRenderer());
1635        JFreeChart chart = new JFreeChart(
1636                title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
1637        currentTheme.apply(chart);
1638        return chart;
1639
1640    }
1641    
1642    /**
1643     * Creates a scatter plot with default settings.  The chart object
1644     * returned by this method uses an {@link XYPlot} instance as the plot,
1645     * with a {@link NumberAxis} for the domain axis, a  {@link NumberAxis}
1646     * as the range axis, and an {@link XYLineAndShapeRenderer} as the
1647     * renderer.
1648     *
1649     * @param title  the chart title (<code>null</code> permitted).
1650     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1651     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1652     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1653     *
1654     * @return A scatter plot.
1655     * 
1656     * @since 1.0.16
1657     */
1658    public static JFreeChart createScatterPlot(String title, String xAxisLabel,
1659            String yAxisLabel, XYDataset dataset) {
1660        return createScatterPlot(title, xAxisLabel, yAxisLabel, dataset,
1661                PlotOrientation.VERTICAL, true, true, false);
1662    }
1663
1664    /**
1665     * Creates a scatter plot with default settings.  The chart object
1666     * returned by this method uses an {@link XYPlot} instance as the plot,
1667     * with a {@link NumberAxis} for the domain axis, a  {@link NumberAxis}
1668     * as the range axis, and an {@link XYLineAndShapeRenderer} as the
1669     * renderer.
1670     *
1671     * @param title  the chart title (<code>null</code> permitted).
1672     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1673     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1674     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1675     * @param orientation  the plot orientation (horizontal or vertical)
1676     *                     (<code>null</code> NOT permitted).
1677     * @param legend  a flag specifying whether or not a legend is required.
1678     * @param tooltips  configure chart to generate tool tips?
1679     * @param urls  configure chart to generate URLs?
1680     *
1681     * @return A scatter plot.
1682     */
1683    public static JFreeChart createScatterPlot(String title, String xAxisLabel,
1684            String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
1685            boolean legend, boolean tooltips, boolean urls) {
1686
1687        ParamChecks.nullNotPermitted(orientation, "orientation");
1688        NumberAxis xAxis = new NumberAxis(xAxisLabel);
1689        xAxis.setAutoRangeIncludesZero(false);
1690        NumberAxis yAxis = new NumberAxis(yAxisLabel);
1691        yAxis.setAutoRangeIncludesZero(false);
1692
1693        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
1694
1695        XYToolTipGenerator toolTipGenerator = null;
1696        if (tooltips) {
1697            toolTipGenerator = new StandardXYToolTipGenerator();
1698        }
1699
1700        XYURLGenerator urlGenerator = null;
1701        if (urls) {
1702            urlGenerator = new StandardXYURLGenerator();
1703        }
1704        XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
1705        renderer.setBaseToolTipGenerator(toolTipGenerator);
1706        renderer.setURLGenerator(urlGenerator);
1707        plot.setRenderer(renderer);
1708        plot.setOrientation(orientation);
1709
1710        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1711                plot, legend);
1712        currentTheme.apply(chart);
1713        return chart;
1714
1715    }
1716
1717    /**
1718     * Creates and returns a default instance of an XY bar chart.
1719     * <P>
1720     * The chart object returned by this method uses an {@link XYPlot} instance
1721     * as the plot, with a {@link DateAxis} for the domain axis, a
1722     * {@link NumberAxis} as the range axis, and a {@link XYBarRenderer} as the
1723     * renderer.
1724     *
1725     * @param title  the chart title (<code>null</code> permitted).
1726     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1727     * @param dateAxis  make the domain axis display dates?
1728     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1729     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1730     *
1731     * @return An XY bar chart.
1732     * 
1733     * @since 1.0.16
1734     */
1735    public static JFreeChart createXYBarChart(String title, String xAxisLabel,
1736            boolean dateAxis, String yAxisLabel, IntervalXYDataset dataset) {
1737        return createXYBarChart(title, xAxisLabel, dateAxis, yAxisLabel,
1738                dataset, PlotOrientation.VERTICAL, true, true, false);
1739    }
1740    
1741    /**
1742     * Creates and returns a default instance of an XY bar chart.
1743     * <P>
1744     * The chart object returned by this method uses an {@link XYPlot} instance
1745     * as the plot, with a {@link DateAxis} for the domain axis, a
1746     * {@link NumberAxis} as the range axis, and a {@link XYBarRenderer} as the
1747     * renderer.
1748     *
1749     * @param title  the chart title (<code>null</code> permitted).
1750     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1751     * @param dateAxis  make the domain axis display dates?
1752     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1753     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1754     * @param orientation  the orientation (horizontal or vertical)
1755     *                     (<code>null</code> NOT permitted).
1756     * @param legend  a flag specifying whether or not a legend is required.
1757     * @param tooltips  configure chart to generate tool tips?
1758     * @param urls  configure chart to generate URLs?
1759     *
1760     * @return An XY bar chart.
1761     */
1762    public static JFreeChart createXYBarChart(String title, String xAxisLabel,
1763            boolean dateAxis, String yAxisLabel, IntervalXYDataset dataset,
1764            PlotOrientation orientation, boolean legend, boolean tooltips,
1765            boolean urls) {
1766
1767        ParamChecks.nullNotPermitted(orientation, "orientation");
1768        ValueAxis domainAxis;
1769        if (dateAxis) {
1770            domainAxis = new DateAxis(xAxisLabel);
1771        }
1772        else {
1773            NumberAxis axis = new NumberAxis(xAxisLabel);
1774            axis.setAutoRangeIncludesZero(false);
1775            domainAxis = axis;
1776        }
1777        ValueAxis valueAxis = new NumberAxis(yAxisLabel);
1778
1779        XYBarRenderer renderer = new XYBarRenderer();
1780        if (tooltips) {
1781            XYToolTipGenerator tt;
1782            if (dateAxis) {
1783                tt = StandardXYToolTipGenerator.getTimeSeriesInstance();
1784            }
1785            else {
1786                tt = new StandardXYToolTipGenerator();
1787            }
1788            renderer.setBaseToolTipGenerator(tt);
1789        }
1790        if (urls) {
1791            renderer.setURLGenerator(new StandardXYURLGenerator());
1792        }
1793
1794        XYPlot plot = new XYPlot(dataset, domainAxis, valueAxis, renderer);
1795        plot.setOrientation(orientation);
1796
1797        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1798                plot, legend);
1799        currentTheme.apply(chart);
1800        return chart;
1801
1802    }
1803
1804    /**
1805     * Creates an area chart using an {@link XYDataset}.
1806     * <P>
1807     * The chart object returned by this method uses an {@link XYPlot} instance
1808     * as the plot, with a {@link NumberAxis} for the domain axis, a
1809     * {@link NumberAxis} as the range axis, and a {@link XYAreaRenderer} as
1810     * the renderer.
1811     *
1812     * @param title  the chart title (<code>null</code> permitted).
1813     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1814     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1815     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1816     *
1817     * @return An XY area chart.
1818     * 
1819     * @since 1.0.16
1820     */
1821    public static JFreeChart createXYAreaChart(String title,String xAxisLabel,
1822            String yAxisLabel, XYDataset dataset) {
1823        return createXYAreaChart(title, xAxisLabel, yAxisLabel, dataset, 
1824                PlotOrientation.VERTICAL, true, true, false);
1825    }
1826    
1827    /**
1828     * Creates an area chart using an {@link XYDataset}.
1829     * <P>
1830     * The chart object returned by this method uses an {@link XYPlot} instance
1831     * as the plot, with a {@link NumberAxis} for the domain axis, a
1832     * {@link NumberAxis} as the range axis, and a {@link XYAreaRenderer} as
1833     * the renderer.
1834     *
1835     * @param title  the chart title (<code>null</code> permitted).
1836     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1837     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1838     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1839     * @param orientation  the plot orientation (horizontal or vertical)
1840     *                     (<code>null</code> NOT permitted).
1841     * @param legend  a flag specifying whether or not a legend is required.
1842     * @param tooltips  configure chart to generate tool tips?
1843     * @param urls  configure chart to generate URLs?
1844     *
1845     * @return An XY area chart.
1846     */
1847    public static JFreeChart createXYAreaChart(String title, String xAxisLabel,
1848            String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
1849            boolean legend, boolean tooltips, boolean urls) {
1850
1851        ParamChecks.nullNotPermitted(orientation, "orientation");
1852        NumberAxis xAxis = new NumberAxis(xAxisLabel);
1853        xAxis.setAutoRangeIncludesZero(false);
1854        NumberAxis yAxis = new NumberAxis(yAxisLabel);
1855        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
1856        plot.setOrientation(orientation);
1857        plot.setForegroundAlpha(0.5f);
1858
1859        XYToolTipGenerator tipGenerator = null;
1860        if (tooltips) {
1861            tipGenerator = new StandardXYToolTipGenerator();
1862        }
1863
1864        XYURLGenerator urlGenerator = null;
1865        if (urls) {
1866            urlGenerator = new StandardXYURLGenerator();
1867        }
1868
1869        plot.setRenderer(new XYAreaRenderer(XYAreaRenderer.AREA, tipGenerator,
1870                urlGenerator));
1871        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1872                plot, legend);
1873        currentTheme.apply(chart);
1874        return chart;
1875
1876    }
1877
1878    /**
1879     * Creates a stacked XY area plot.  The chart object returned by this
1880     * method uses an {@link XYPlot} instance as the plot, with a
1881     * {@link NumberAxis} for the domain axis, a {@link NumberAxis} as the
1882     * range axis, and a {@link StackedXYAreaRenderer2} as the renderer.
1883     *
1884     * @param title  the chart title (<code>null</code> permitted).
1885     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1886     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1887     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1888     *
1889     * @return A stacked XY area chart.
1890     * 
1891     * @since 1.0.16
1892     */
1893    public static JFreeChart createStackedXYAreaChart(String title,
1894            String xAxisLabel, String yAxisLabel, TableXYDataset dataset) {
1895        return createStackedXYAreaChart(title, xAxisLabel, yAxisLabel,
1896                dataset, PlotOrientation.VERTICAL, true, true, false);
1897    }
1898    
1899    /**
1900     * Creates a stacked XY area plot.  The chart object returned by this
1901     * method uses an {@link XYPlot} instance as the plot, with a
1902     * {@link NumberAxis} for the domain axis, a {@link NumberAxis} as the
1903     * range axis, and a {@link StackedXYAreaRenderer2} as the renderer.
1904     *
1905     * @param title  the chart title (<code>null</code> permitted).
1906     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1907     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1908     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1909     * @param orientation  the plot orientation (horizontal or vertical)
1910     *                     (<code>null</code> NOT permitted).
1911     * @param legend  a flag specifying whether or not a legend is required.
1912     * @param tooltips  configure chart to generate tool tips?
1913     * @param urls  configure chart to generate URLs?
1914     *
1915     * @return A stacked XY area chart.
1916     */
1917    public static JFreeChart createStackedXYAreaChart(String title,
1918            String xAxisLabel, String yAxisLabel, TableXYDataset dataset,
1919            PlotOrientation orientation, boolean legend, boolean tooltips,
1920            boolean urls) {
1921
1922        ParamChecks.nullNotPermitted(orientation, "orientation");
1923        NumberAxis xAxis = new NumberAxis(xAxisLabel);
1924        xAxis.setAutoRangeIncludesZero(false);
1925        xAxis.setLowerMargin(0.0);
1926        xAxis.setUpperMargin(0.0);
1927        NumberAxis yAxis = new NumberAxis(yAxisLabel);
1928        XYToolTipGenerator toolTipGenerator = null;
1929        if (tooltips) {
1930            toolTipGenerator = new StandardXYToolTipGenerator();
1931        }
1932
1933        XYURLGenerator urlGenerator = null;
1934        if (urls) {
1935            urlGenerator = new StandardXYURLGenerator();
1936        }
1937        StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(
1938                toolTipGenerator, urlGenerator);
1939        renderer.setOutline(true);
1940        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
1941        plot.setOrientation(orientation);
1942
1943        plot.setRangeAxis(yAxis);  // forces recalculation of the axis range
1944
1945        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
1946                plot, legend);
1947        currentTheme.apply(chart);
1948        return chart;
1949
1950    }
1951
1952    /**
1953     * Creates a line chart (based on an {@link XYDataset}) with default
1954     * settings.
1955     *
1956     * @param title  the chart title (<code>null</code> permitted).
1957     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1958     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1959     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1960     *
1961     * @return The chart.
1962     */
1963    public static JFreeChart createXYLineChart(String title,
1964            String xAxisLabel, String yAxisLabel, XYDataset dataset) {
1965        return createXYLineChart(title, xAxisLabel, yAxisLabel, dataset,
1966                PlotOrientation.VERTICAL, true, true, false);
1967    }
1968
1969    /**
1970     * Creates a line chart (based on an {@link XYDataset}) with default
1971     * settings.
1972     *
1973     * @param title  the chart title (<code>null</code> permitted).
1974     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
1975     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
1976     * @param dataset  the dataset for the chart (<code>null</code> permitted).
1977     * @param orientation  the plot orientation (horizontal or vertical)
1978     *                     (<code>null</code> NOT permitted).
1979     * @param legend  a flag specifying whether or not a legend is required.
1980     * @param tooltips  configure chart to generate tool tips?
1981     * @param urls  configure chart to generate URLs?
1982     *
1983     * @return The chart.
1984     */
1985    public static JFreeChart createXYLineChart(String title, String xAxisLabel,
1986            String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
1987            boolean legend, boolean tooltips, boolean urls) {
1988
1989        ParamChecks.nullNotPermitted(orientation, "orientation");
1990        NumberAxis xAxis = new NumberAxis(xAxisLabel);
1991        xAxis.setAutoRangeIncludesZero(false);
1992        NumberAxis yAxis = new NumberAxis(yAxisLabel);
1993        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
1994        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
1995        plot.setOrientation(orientation);
1996        if (tooltips) {
1997            renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
1998        }
1999        if (urls) {
2000            renderer.setURLGenerator(new StandardXYURLGenerator());
2001        }
2002
2003        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2004                plot, legend);
2005        currentTheme.apply(chart);
2006        return chart;
2007
2008    }
2009
2010    /**
2011     * Creates a stepped XY plot with default settings.
2012     *
2013     * @param title  the chart title (<code>null</code> permitted).
2014     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2015     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2016     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2017     *
2018     * @return A chart.
2019     * 
2020     * @since 1.0.16
2021     */
2022    public static JFreeChart createXYStepChart(String title, String xAxisLabel,
2023            String yAxisLabel, XYDataset dataset) {
2024        return createXYStepChart(title, xAxisLabel, yAxisLabel, dataset,
2025                PlotOrientation.VERTICAL, true, true, false);
2026    }
2027    
2028    /**
2029     * Creates a stepped XY plot with default settings.
2030     *
2031     * @param title  the chart title (<code>null</code> permitted).
2032     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2033     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2034     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2035     * @param orientation  the plot orientation (horizontal or vertical)
2036     *                     (<code>null</code> NOT permitted).
2037     * @param legend  a flag specifying whether or not a legend is required.
2038     * @param tooltips  configure chart to generate tool tips?
2039     * @param urls  configure chart to generate URLs?
2040     *
2041     * @return A chart.
2042     */
2043    public static JFreeChart createXYStepChart(String title, String xAxisLabel,
2044            String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
2045            boolean legend, boolean tooltips, boolean urls) {
2046
2047        ParamChecks.nullNotPermitted(orientation, "orientation");
2048        DateAxis xAxis = new DateAxis(xAxisLabel);
2049        NumberAxis yAxis = new NumberAxis(yAxisLabel);
2050        yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
2051
2052        XYToolTipGenerator toolTipGenerator = null;
2053        if (tooltips) {
2054            toolTipGenerator = new StandardXYToolTipGenerator();
2055        }
2056
2057        XYURLGenerator urlGenerator = null;
2058        if (urls) {
2059            urlGenerator = new StandardXYURLGenerator();
2060        }
2061        XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator,
2062                urlGenerator);
2063
2064        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
2065        plot.setRenderer(renderer);
2066        plot.setOrientation(orientation);
2067        plot.setDomainCrosshairVisible(false);
2068        plot.setRangeCrosshairVisible(false);
2069        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2070                plot, legend);
2071        currentTheme.apply(chart);
2072        return chart;
2073
2074    }
2075
2076    /**
2077     * Creates a filled stepped XY plot with default settings.
2078     *
2079     * @param title  the chart title (<code>null</code> permitted).
2080     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2081     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2082     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2083     *
2084     * @return A chart.
2085     * 
2086     * @since 1.0.16
2087     */
2088    public static JFreeChart createXYStepAreaChart(String title,
2089            String xAxisLabel, String yAxisLabel, XYDataset dataset) {
2090        return createXYStepAreaChart(title, xAxisLabel, yAxisLabel, dataset,
2091                PlotOrientation.VERTICAL, true, true, false);   
2092    }
2093 
2094    /**
2095     * Creates a filled stepped XY plot with default settings.
2096     *
2097     * @param title  the chart title (<code>null</code> permitted).
2098     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2099     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2100     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2101     * @param orientation  the plot orientation (horizontal or vertical)
2102     *                     (<code>null</code> NOT permitted).
2103     * @param legend  a flag specifying whether or not a legend is required.
2104     * @param tooltips  configure chart to generate tool tips?
2105     * @param urls  configure chart to generate URLs?
2106     *
2107     * @return A chart.
2108     */
2109    public static JFreeChart createXYStepAreaChart(String title, 
2110            String xAxisLabel, String yAxisLabel, XYDataset dataset,
2111            PlotOrientation orientation, boolean legend, boolean tooltips,
2112            boolean urls) {
2113
2114        ParamChecks.nullNotPermitted(orientation, "orientation");
2115        NumberAxis xAxis = new NumberAxis(xAxisLabel);
2116        xAxis.setAutoRangeIncludesZero(false);
2117        NumberAxis yAxis = new NumberAxis(yAxisLabel);
2118
2119        XYToolTipGenerator toolTipGenerator = null;
2120        if (tooltips) {
2121            toolTipGenerator = new StandardXYToolTipGenerator();
2122        }
2123
2124        XYURLGenerator urlGenerator = null;
2125        if (urls) {
2126            urlGenerator = new StandardXYURLGenerator();
2127        }
2128        XYItemRenderer renderer = new XYStepAreaRenderer(
2129                XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
2130                urlGenerator);
2131
2132        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
2133        plot.setRenderer(renderer);
2134        plot.setOrientation(orientation);
2135        plot.setDomainCrosshairVisible(false);
2136        plot.setRangeCrosshairVisible(false);
2137        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2138                plot, legend);
2139        currentTheme.apply(chart);
2140        return chart;
2141    }
2142
2143    /**
2144     * Creates and returns a time series chart.  A time series chart is an
2145     * {@link XYPlot} with a {@link DateAxis} for the x-axis and a
2146     * {@link NumberAxis} for the y-axis.  The default renderer is an
2147     * {@link XYLineAndShapeRenderer}.
2148     * <P>
2149     * A convenient dataset to use with this chart is a
2150     * {@link org.jfree.data.time.TimeSeriesCollection}.
2151     *
2152     * @param title  the chart title (<code>null</code> permitted).
2153     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2154     *                       permitted).
2155     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2156     *                        permitted).
2157     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2158     *
2159     * @return A time series chart.
2160     * 
2161     * @since 1.0.16
2162     */
2163    public static JFreeChart createTimeSeriesChart(String title, 
2164            String timeAxisLabel, String valueAxisLabel, XYDataset dataset) {
2165        return createTimeSeriesChart(title, timeAxisLabel, valueAxisLabel, 
2166                dataset, true, true, false);
2167    }
2168    
2169    /**
2170     * Creates and returns a time series chart.  A time series chart is an
2171     * {@link XYPlot} with a {@link DateAxis} for the x-axis and a
2172     * {@link NumberAxis} for the y-axis.  The default renderer is an
2173     * {@link XYLineAndShapeRenderer}.
2174     * <P>
2175     * A convenient dataset to use with this chart is a
2176     * {@link org.jfree.data.time.TimeSeriesCollection}.
2177     *
2178     * @param title  the chart title (<code>null</code> permitted).
2179     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2180     *                       permitted).
2181     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2182     *                        permitted).
2183     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2184     * @param legend  a flag specifying whether or not a legend is required.
2185     * @param tooltips  configure chart to generate tool tips?
2186     * @param urls  configure chart to generate URLs?
2187     *
2188     * @return A time series chart.
2189     */
2190    public static JFreeChart createTimeSeriesChart(String title,
2191            String timeAxisLabel, String valueAxisLabel, XYDataset dataset,
2192            boolean legend, boolean tooltips, boolean urls) {
2193
2194        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
2195        timeAxis.setLowerMargin(0.02);  // reduce the default margins
2196        timeAxis.setUpperMargin(0.02);
2197        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2198        valueAxis.setAutoRangeIncludesZero(false);  // override default
2199        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
2200
2201        XYToolTipGenerator toolTipGenerator = null;
2202        if (tooltips) {
2203            toolTipGenerator
2204                = StandardXYToolTipGenerator.getTimeSeriesInstance();
2205        }
2206
2207        XYURLGenerator urlGenerator = null;
2208        if (urls) {
2209            urlGenerator = new StandardXYURLGenerator();
2210        }
2211
2212        XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true,
2213                false);
2214        renderer.setBaseToolTipGenerator(toolTipGenerator);
2215        renderer.setURLGenerator(urlGenerator);
2216        plot.setRenderer(renderer);
2217
2218        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2219                plot, legend);
2220        currentTheme.apply(chart);
2221        return chart;
2222
2223    }
2224
2225    /**
2226     * Creates and returns a default instance of a candlesticks chart.
2227     *
2228     * @param title  the chart title (<code>null</code> permitted).
2229     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2230     *                       permitted).
2231     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2232     *                        permitted).
2233     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2234     * @param legend  a flag specifying whether or not a legend is required.
2235     *
2236     * @return A candlestick chart.
2237     */
2238    public static JFreeChart createCandlestickChart(String title,
2239            String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset,
2240            boolean legend) {
2241
2242        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
2243        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2244        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
2245        plot.setRenderer(new CandlestickRenderer());
2246        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2247                plot, legend);
2248        currentTheme.apply(chart);
2249        return chart;
2250
2251    }
2252
2253    /**
2254     * Creates and returns a default instance of a high-low-open-close chart.
2255     *
2256     * @param title  the chart title (<code>null</code> permitted).
2257     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2258     *                       permitted).
2259     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2260     *                        permitted).
2261     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2262     * @param legend  a flag specifying whether or not a legend is required.
2263     *
2264     * @return A high-low-open-close chart.
2265     */
2266    public static JFreeChart createHighLowChart(String title,
2267            String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset,
2268            boolean legend) {
2269
2270        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
2271        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2272        HighLowRenderer renderer = new HighLowRenderer();
2273        renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
2274        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
2275        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2276                plot, legend);
2277        currentTheme.apply(chart);
2278        return chart;
2279
2280    }
2281
2282    /**
2283     * Creates and returns a default instance of a high-low-open-close chart
2284     * with a special timeline. This timeline can be a
2285     * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
2286     * through Friday timeline that will remove Saturdays and Sundays from
2287     * the axis.
2288     *
2289     * @param title  the chart title (<code>null</code> permitted).
2290     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2291     *                       permitted).
2292     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2293     *                        permitted).
2294     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2295     * @param timeline  the timeline.
2296     * @param legend  a flag specifying whether or not a legend is required.
2297     *
2298     * @return A high-low-open-close chart.
2299     */
2300    public static JFreeChart createHighLowChart(String title,
2301            String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset,
2302            Timeline timeline, boolean legend) {
2303
2304        DateAxis timeAxis = new DateAxis(timeAxisLabel);
2305        timeAxis.setTimeline(timeline);
2306        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2307        HighLowRenderer renderer = new HighLowRenderer();
2308        renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
2309        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
2310        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2311                plot, legend);
2312        currentTheme.apply(chart);
2313        return chart;
2314
2315    }
2316
2317    /**
2318     * Creates a bubble chart with default settings.  The chart is composed of
2319     * an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
2320     * a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
2321     * to draw the data items.
2322     *
2323     * @param title  the chart title (<code>null</code> permitted).
2324     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2325     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2326     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2327     *
2328     * @return A bubble chart.
2329     * 
2330     * @since 1.0.16
2331     */
2332    public static JFreeChart createBubbleChart(String title, String xAxisLabel,
2333            String yAxisLabel, XYZDataset dataset) {
2334        return createBubbleChart(title, xAxisLabel, yAxisLabel, dataset,
2335                PlotOrientation.VERTICAL, true, true, false);
2336    }
2337    
2338    /**
2339     * Creates a bubble chart with default settings.  The chart is composed of
2340     * an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
2341     * a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
2342     * to draw the data items.
2343     *
2344     * @param title  the chart title (<code>null</code> permitted).
2345     * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
2346     * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
2347     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2348     * @param orientation  the orientation (horizontal or vertical)
2349     *                     (<code>null</code> NOT permitted).
2350     * @param legend  a flag specifying whether or not a legend is required.
2351     * @param tooltips  configure chart to generate tool tips?
2352     * @param urls  configure chart to generate URLs?
2353     *
2354     * @return A bubble chart.
2355     */
2356    public static JFreeChart createBubbleChart(String title, String xAxisLabel,
2357            String yAxisLabel, XYZDataset dataset, PlotOrientation orientation,
2358            boolean legend, boolean tooltips, boolean urls) {
2359
2360        ParamChecks.nullNotPermitted(orientation, "orientation");
2361        NumberAxis xAxis = new NumberAxis(xAxisLabel);
2362        xAxis.setAutoRangeIncludesZero(false);
2363        NumberAxis yAxis = new NumberAxis(yAxisLabel);
2364        yAxis.setAutoRangeIncludesZero(false);
2365
2366        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
2367
2368        XYItemRenderer renderer = new XYBubbleRenderer(
2369                XYBubbleRenderer.SCALE_ON_RANGE_AXIS);
2370        if (tooltips) {
2371            renderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator());
2372        }
2373        if (urls) {
2374            renderer.setURLGenerator(new StandardXYZURLGenerator());
2375        }
2376        plot.setRenderer(renderer);
2377        plot.setOrientation(orientation);
2378
2379        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2380                plot, legend);
2381        currentTheme.apply(chart);
2382        return chart;
2383
2384    }
2385
2386    /**
2387     * Creates a histogram chart.  This chart is constructed with an
2388     * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
2389     * axes are {@link NumberAxis} instances.
2390     *
2391     * @param title  the chart title (<code>null</code> permitted).
2392     * @param xAxisLabel  the x axis label (<code>null</code> permitted).
2393     * @param yAxisLabel  the y axis label (<code>null</code> permitted).
2394     * @param dataset  the dataset (<code>null</code> permitted).
2395     * @param orientation  the orientation (horizontal or vertical)
2396     *                     (<code>null</code> NOT permitted).
2397     * @param legend  create a legend?
2398     * @param tooltips  display tooltips?
2399     * @param urls  generate URLs?
2400     *
2401     * @return The chart.
2402     */
2403    public static JFreeChart createHistogram(String title,
2404            String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset,
2405            PlotOrientation orientation, boolean legend, boolean tooltips,
2406            boolean urls) {
2407
2408        ParamChecks.nullNotPermitted(orientation, "orientation");
2409        NumberAxis xAxis = new NumberAxis(xAxisLabel);
2410        xAxis.setAutoRangeIncludesZero(false);
2411        ValueAxis yAxis = new NumberAxis(yAxisLabel);
2412
2413        XYItemRenderer renderer = new XYBarRenderer();
2414        if (tooltips) {
2415            renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
2416        }
2417        if (urls) {
2418            renderer.setURLGenerator(new StandardXYURLGenerator());
2419        }
2420
2421        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
2422        plot.setOrientation(orientation);
2423        plot.setDomainZeroBaselineVisible(true);
2424        plot.setRangeZeroBaselineVisible(true);
2425        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2426                plot, legend);
2427        currentTheme.apply(chart);
2428        return chart;
2429
2430    }
2431
2432    /**
2433     * Creates and returns a default instance of a box and whisker chart
2434     * based on data from a {@link BoxAndWhiskerCategoryDataset}.
2435     *
2436     * @param title  the chart title (<code>null</code> permitted).
2437     * @param categoryAxisLabel  a label for the category axis
2438     *     (<code>null</code> permitted).
2439     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2440     *     permitted).
2441     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2442     * @param legend  a flag specifying whether or not a legend is required.
2443     *
2444     * @return A box and whisker chart.
2445     *
2446     * @since 1.0.4
2447     */
2448    public static JFreeChart createBoxAndWhiskerChart(String title,
2449            String categoryAxisLabel, String valueAxisLabel,
2450            BoxAndWhiskerCategoryDataset dataset, boolean legend) {
2451
2452        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
2453        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2454        valueAxis.setAutoRangeIncludesZero(false);
2455
2456        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
2457        renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
2458
2459        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
2460                renderer);
2461        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2462                plot, legend);
2463        currentTheme.apply(chart);
2464        return chart;
2465    }
2466
2467    /**
2468     * Creates and returns a default instance of a box and whisker chart.
2469     *
2470     * @param title  the chart title (<code>null</code> permitted).
2471     * @param timeAxisLabel  a label for the time axis (<code>null</code>
2472     *                       permitted).
2473     * @param valueAxisLabel  a label for the value axis (<code>null</code>
2474     *                        permitted).
2475     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2476     * @param legend  a flag specifying whether or not a legend is required.
2477     *
2478     * @return A box and whisker chart.
2479     */
2480    public static JFreeChart createBoxAndWhiskerChart(String title,
2481            String timeAxisLabel, String valueAxisLabel,
2482            BoxAndWhiskerXYDataset dataset, boolean legend) {
2483
2484        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
2485        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
2486        valueAxis.setAutoRangeIncludesZero(false);
2487        XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0);
2488        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
2489        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2490                plot, legend);
2491        currentTheme.apply(chart);
2492        return chart;
2493
2494    }
2495
2496    /**
2497     * Creates a wind plot with default settings.
2498     *
2499     * @param title  the chart title (<code>null</code> permitted).
2500     * @param xAxisLabel  a label for the x-axis (<code>null</code> permitted).
2501     * @param yAxisLabel  a label for the y-axis (<code>null</code> permitted).
2502     * @param dataset  the dataset for the chart (<code>null</code> permitted).
2503     * @param legend  a flag that controls whether or not a legend is created.
2504     * @param tooltips  configure chart to generate tool tips?
2505     * @param urls  configure chart to generate URLs?
2506     *
2507     * @return A wind plot.
2508     *
2509     */
2510    public static JFreeChart createWindPlot(String title, String xAxisLabel,
2511            String yAxisLabel, WindDataset dataset, boolean legend,
2512            boolean tooltips, boolean urls) {
2513
2514        ValueAxis xAxis = new DateAxis(xAxisLabel);
2515        ValueAxis yAxis = new NumberAxis(yAxisLabel);
2516        yAxis.setRange(-12.0, 12.0);
2517
2518        WindItemRenderer renderer = new WindItemRenderer();
2519        if (tooltips) {
2520            renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
2521        }
2522        if (urls) {
2523            renderer.setURLGenerator(new StandardXYURLGenerator());
2524        }
2525        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
2526        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2527                plot, legend);
2528        currentTheme.apply(chart);
2529        return chart;
2530
2531    }
2532
2533    /**
2534     * Creates a wafer map chart.
2535     *
2536     * @param title  the chart title (<code>null</code> permitted).
2537     * @param dataset  the dataset (<code>null</code> permitted).
2538     * @param orientation  the plot orientation (horizontal or vertical)
2539     *                     (<code>null</code> NOT permitted.
2540     * @param legend  display a legend?
2541     * @param tooltips  generate tooltips?
2542     * @param urls  generate URLs?
2543     *
2544     * @return A wafer map chart.
2545     */
2546    public static JFreeChart createWaferMapChart(String title,
2547            WaferMapDataset dataset, PlotOrientation orientation,
2548            boolean legend, boolean tooltips, boolean urls) {
2549
2550        ParamChecks.nullNotPermitted(orientation, "orientation");
2551        WaferMapPlot plot = new WaferMapPlot(dataset);
2552        WaferMapRenderer renderer = new WaferMapRenderer();
2553        plot.setRenderer(renderer);
2554
2555        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
2556                plot, legend);
2557        currentTheme.apply(chart);
2558        return chart;
2559    }
2560
2561}