Example usage for org.jfree.chart JFreeChart addSubtitle

List of usage examples for org.jfree.chart JFreeChart addSubtitle

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart addSubtitle.

Prototype

public void addSubtitle(Title subtitle) 

Source Link

Document

Adds a chart subtitle, and notifies registered listeners that the chart has been modified.

Usage

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample time series chart that will be displayed in a scroll pane.
 *
 * @return a sample time series chart./* w w w.  j a  v a 2  s.c om*/
 */
public JFreeChart createTimeSeriesChartInScrollPane() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("test.scroll.title");
    final String domain = this.resources.getString("test.scroll.domain");
    final String range = this.resources.getString("test.scroll.range");
    final String subtitleStr = this.resources.getString("test.scroll.subtitle");
    final XYDataset data = DemoDatasetFactory.createTimeSeriesCollection2();
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, domain, range, data, true, true, false);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.gray));
    return chart;

}

From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java

private byte[] createMonthlyLoginChart(int width, int height) {
    IntervalXYDataset dataset1 = getMonthlyLoginsDataSet();
    IntervalXYDataset dataset3 = getMonthlySiteUserDataSet();

    if ((dataset1 == null) || (dataset3 == null)) {
        return generateNoDataChart(width, height);
    }/*w w w.j  a va2 s  . c om*/

    // create plot ...
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesPaint(0, Color.RED);

    DateAxis domainAxis = new DateAxis("");
    domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1, new SimpleDateFormat("yyyy-MM")));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.START);
    domainAxis.setVerticalTickLabels(true);
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);

    NumberAxis axis1 = new NumberAxis("Total Logins");
    axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    axis1.setLabelPaint(Color.RED);
    axis1.setTickLabelPaint(Color.RED);

    XYPlot plot1 = new XYPlot(dataset1, null, axis1, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // AXIS 2
    /*
    NumberAxis axis2 = new NumberAxis("Total Unique Users");
    axis2.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());
    axis2.setLabelPaint(Color.BLUE);
    axis2.setTickLabelPaint(Color.BLUE);
    plot1.setRangeAxis(1, axis2);
            
    plot1.setDataset(1, dataset2);
    plot1.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesStroke(0, new BasicStroke(2.0f, 
        BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer2.setSeriesPaint (0, Color.BLUE);
    plot1.setRenderer(1, renderer2);
    */

    // add a third dataset and renderer...
    XYItemRenderer renderer3 = new XYLineAndShapeRenderer(true, false);
    renderer3.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer3.setSeriesPaint(0, Color.GREEN);
    renderer3.setSeriesPaint(1, Color.BLACK);
    renderer3.setSeriesPaint(2, Color.CYAN);

    axis1 = new NumberAxis("count");
    axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    XYPlot plot2 = new XYPlot(dataset3, null, axis1, renderer3);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);

    // set background
    chart.setBackgroundPaint(parseColor(statsManager.getChartBackgroundColor()));

    // set chart border
    chart.setPadding(new RectangleInsets(10, 5, 5, 5));
    chart.setBorderVisible(true);
    chart.setBorderPaint(parseColor("#cccccc"));

    // set anti alias
    chart.setAntiAlias(true);

    BufferedImage img = chart.createBufferedImage(width, height);
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        ImageIO.write(img, "png", out);
    } catch (IOException e) {
        log.warn("Error occurred while generating SiteStats chart image data", e);
    }
    return out.toByteArray();
}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample time series chart.
 *
 * @return a sample time series chart./*from  w ww .ja  v  a 2 s.  c o  m*/
 */
public JFreeChart createTimeSeries2Chart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("timeseries.sample2.title");
    final String subtitleStr = this.resources.getString("timeseries.sample2.subtitle");
    final String domain = this.resources.getString("timeseries.sample2.domain");
    final String range = this.resources.getString("timeseries.sample2.range");
    final XYDataset data = DemoDatasetFactory.createTimeSeriesCollection4();
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, domain, range, data, true, true, false);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    final XYPlot plot = chart.getXYPlot();
    final LogarithmicAxis rangeAxis = new LogarithmicAxis(range);
    plot.setRangeAxis(rangeAxis);
    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample overlaid chart.
 * <P>//from  w  w  w  .j a  v a2s . c  om
 * Note:  with the introduction of multiple secondary datasets in JFreeChart version 0.9.10,
 * the overlaid chart facility has been removed.  You can achieve the same results using
 * a regular XYPlot with multiple datasets.
 *
 * @return an overlaid chart.
 */
public JFreeChart createOverlaidChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("combined.overlaid.title");
    final String subtitleStr = this.resources.getString("combined.overlaid.subtitle");
    final String domainAxisLabel = this.resources.getString("combined.overlaid.domain");
    final String rangeAxisLabel = this.resources.getString("combined.overlaid.range");

    // create high-low and moving average dataset
    final DefaultHighLowDataset highLowData = DemoDatasetFactory.createHighLowDataset();

    // make an overlaid plot
    final ValueAxis domainAxis = new DateAxis(domainAxisLabel);
    final NumberAxis rangeAxis = new NumberAxis(rangeAxisLabel);
    rangeAxis.setAutoRangeIncludesZero(false);
    final XYItemRenderer renderer1 = new HighLowRenderer();
    renderer1.setToolTipGenerator(new HighLowItemLabelGenerator());

    final XYPlot plot = new XYPlot(highLowData, domainAxis, rangeAxis, renderer1);

    // overlay a moving average dataset
    final XYDataset maData = MovingAverage.createMovingAverage(highLowData, " (Moving Average)",
            5 * 24 * 60 * 60 * 1000L, 5 * 24 * 60 * 60 * 1000L);
    plot.setDataset(1, maData);
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setToolTipGenerator(
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0,000.0")));
    plot.setRenderer(1, renderer2);

    // make the top level JFreeChart object
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));

    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates a horizontally combined chart.
 *
 * @return a horizontally combined chart.
 */// w w w .j a v a2 s . c o m
public JFreeChart createHorizontallyCombinedChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("combined.horizontal.title");
    final String subtitleStr = this.resources.getString("combined.horizontal.subtitle");
    final String[] domains = this.resources.getStringArray("combined.horizontal.domains");
    final String rangeAxisLabel = this.resources.getString("combined.horizontal.range");

    final TimeSeriesCollection dataset0 = new TimeSeriesCollection();
    final TimeSeries eur = DemoDatasetFactory.createEURTimeSeries();
    dataset0.addSeries(eur);

    final TimeSeriesCollection dataset1 = new TimeSeriesCollection();
    final TimeSeries mav = MovingAverage.createMovingAverage(eur, "EUR/GBP (30 Day MA)", 30, 30);
    dataset1.addSeries(eur);
    dataset1.addSeries(mav);

    final TimeSeriesCollection dataset2 = new TimeSeriesCollection();
    dataset2.addSeries(eur);

    // make a combined range plot
    final NumberAxis valueAxis = new NumberAxis(rangeAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false); // override default
    final CombinedRangeXYPlot parent = new CombinedRangeXYPlot(valueAxis);
    parent.setRenderer(new StandardXYItemRenderer());

    // add subplots
    final int[] weight = { 1, 1, 1 }; // controls space assigned to each subplot

    // add subplot 1...
    final XYPlot subplot1 = new XYPlot(dataset0, new DateAxis(domains[0]), null, new StandardXYItemRenderer());
    parent.add(subplot1, weight[0]);

    // add subplot 2...
    final XYPlot subplot2 = new XYPlot(dataset1, new DateAxis(domains[1]), null, new StandardXYItemRenderer());
    parent.add(subplot2, weight[1]);

    // add subplot 3...
    final XYPlot subplot3 = new XYPlot(dataset2, new DateAxis(domains[2]), null, new XYBarRenderer(0.20));
    parent.add(subplot3, weight[2]);

    // now make the top level JFreeChart
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, parent, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample time series chart.
 *
 * @return a sample time series chart./*  w ww .java 2 s . co  m*/
 */
public JFreeChart createTimeSeriesWithMAChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("timeseries.sample3.title");
    final String domain = this.resources.getString("timeseries.sample3.domain");
    final String range = this.resources.getString("timeseries.sample3.range");
    final String subtitleStr = this.resources.getString("timeseries.sample3.subtitle");
    final TimeSeries jpy = DemoDatasetFactory.createJPYTimeSeries();
    final TimeSeries mav = MovingAverage.createMovingAverage(jpy, "30 Day Moving Average", 30, 30);
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(jpy);
    dataset.addSeries(mav);
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, domain, range, dataset, true, true,
            false);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Displays an XY chart that is periodically updated by a background thread.  This is to
 * demonstrate the event notification system that automatically updates charts as required.
 *
 * @return a chart./*from  w  w w  .  j  a v a2  s.  co  m*/
 */
public JFreeChart createCombinedAndOverlaidDynamicXYChart() {

    // chart title and axis labels...
    final String title = this.resources.getString("combined.dynamic.title");
    final String subtitleStr = this.resources.getString("combined.dynamic.subtitle");
    final String domainAxisLabel = this.resources.getString("combined.dynamic.domain");
    final String[] ranges = this.resources.getStringArray("combined.dynamic.ranges");

    // setup sample base 2-series dataset
    final SampleXYDataset data = new SampleXYDataset();

    // create some SubSeriesDatasets and CombinedDatasets to test events
    final XYDataset series0 = new SubSeriesDataset(data, 0);
    final XYDataset series1 = new SubSeriesDataset(data, 1);

    final CombinedDataset combinedData = new CombinedDataset();
    combinedData.add(series0);
    combinedData.add(series1);

    // create common time axis
    final NumberAxis timeAxis = new NumberAxis(domainAxisLabel);
    timeAxis.setTickMarksVisible(true);
    timeAxis.setAutoRangeIncludesZero(false);

    // make one vertical axis for each (vertical) chart
    final NumberAxis[] valueAxis = new NumberAxis[4];
    for (int i = 0; i < valueAxis.length; i++) {
        valueAxis[i] = new NumberAxis(ranges[i]);
        valueAxis[i].setAutoRangeIncludesZero(false);
    }

    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(timeAxis);

    // add subplot1...
    final XYItemRenderer renderer0 = new StandardXYItemRenderer();
    final XYPlot subplot0 = new XYPlot(series0, null, valueAxis[0], renderer0);
    plot.add(subplot0, 1);

    // add subplot2...
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final XYPlot subplot1 = new XYPlot(series1, null, valueAxis[1], renderer1);
    plot.add(subplot1, 1);

    // add subplot3...
    final XYPlot subplot2 = new XYPlot(series0, null, valueAxis[2], new StandardXYItemRenderer());
    subplot2.setDataset(1, series1);
    subplot2.setRenderer(1, new StandardXYItemRenderer());
    plot.add(subplot2, 1);

    // add subplot4...
    final XYItemRenderer renderer3 = new StandardXYItemRenderer();
    final XYPlot subplot3 = new XYPlot(data, null, valueAxis[3], renderer3);
    plot.add(subplot3, 1);

    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.cyan));

    // setup thread to update base Dataset
    final SampleXYDatasetThread update = new SampleXYDatasetThread(data);
    final Thread thread = new Thread(update);
    thread.start();

    return chart;

}

From source file:org.operamasks.faces.render.graph.ChartRenderer.java

protected void setChartTitles(JFreeChart chart, UIChart comp) {
    String titleText = comp.getTitle();
    if (titleText != null) {
        chart.setTitle(titleText);/*from w  w w . jav a 2  s  .  c  o m*/
    }

    for (UIComponent kid : comp.getChildren()) {
        if (kid.isRendered() && (kid instanceof UITitle)) {
            TextTitle title = createTitle((UITitle) kid);
            if (chart.getTitle() == null) {
                chart.setTitle(title);
            } else {
                chart.addSubtitle(title);
            }
        }
    }
}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample vertically combined chart.
 *
 * @return a sample vertically combined chart.
 *///w w w  .ja v a  2 s.  c  om
public JFreeChart createVerticallyCombinedChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("combined.vertical.title");
    final String subtitleStr = this.resources.getString("combined.vertical.subtitle");
    final String domain = this.resources.getString("combined.vertical.domain");
    final String[] ranges = this.resources.getStringArray("combined.vertical.ranges");

    final TimeSeriesCollection dataset0 = new TimeSeriesCollection();
    final TimeSeries eur = DemoDatasetFactory.createEURTimeSeries();
    dataset0.addSeries(eur);

    final TimeSeriesCollection dataset1 = new TimeSeriesCollection();
    final TimeSeries jpy = DemoDatasetFactory.createJPYTimeSeries();
    final TimeSeries mav = MovingAverage.createMovingAverage(jpy, "JPY/GBP (30 Day MA)", 30, 30);
    dataset1.addSeries(jpy);
    dataset1.addSeries(mav);

    final XYDataset dataset2 = DemoDatasetFactory.createHighLowDataset();

    final TimeSeriesCollection dataset3 = new TimeSeriesCollection();
    dataset3.addSeries(eur);

    // make one shared horizontal axis
    final ValueAxis timeAxis = new DateAxis(domain);

    // make a vertically CombinedPlot that will contain the sub-plots
    final CombinedDomainXYPlot multiPlot = new CombinedDomainXYPlot(timeAxis);

    final int[] weight = { 1, 1, 1, 1 }; // control vertical space allocated to each sub-plot

    // add subplot1...
    final XYPlot subplot1 = new XYPlot(dataset0, null, new NumberAxis(ranges[0]), new StandardXYItemRenderer());
    final NumberAxis range1 = (NumberAxis) subplot1.getRangeAxis();
    range1.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    range1.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    range1.setAutoRangeIncludesZero(false);
    multiPlot.add(subplot1, weight[0]);

    // add subplot2...
    final XYPlot subplot2 = new XYPlot(dataset1, null, new NumberAxis(ranges[1]), new StandardXYItemRenderer());
    final NumberAxis range2 = (NumberAxis) subplot2.getRangeAxis();
    range2.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    range2.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    range2.setAutoRangeIncludesZero(false);
    multiPlot.add(subplot2, weight[1]);

    // add subplot3...
    final XYPlot subplot3 = new XYPlot(dataset2, null, new NumberAxis(ranges[2]), null);
    final XYItemRenderer renderer3 = new HighLowRenderer();
    subplot3.setRenderer(renderer3);
    final NumberAxis range3 = (NumberAxis) subplot3.getRangeAxis();
    range3.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    range3.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    range3.setAutoRangeIncludesZero(false);
    multiPlot.add(subplot3, weight[2]);

    // add subplot4...
    final XYPlot subplot4 = new XYPlot(dataset3, null, new NumberAxis(ranges[3]), null);
    final XYItemRenderer renderer4 = new XYBarRenderer();
    subplot4.setRenderer(renderer4);
    final NumberAxis range4 = (NumberAxis) subplot4.getRangeAxis();
    range4.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    range4.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    range4.setAutoRangeIncludesZero(false);
    multiPlot.add(subplot4, weight[3]);

    // now make the top level JFreeChart that contains the CombinedPlot
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, multiPlot, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates a combined and overlaid chart.
 * <p>/* w  w w .j  a  v a 2s  .  c  o m*/
 * Note: from version 0.9.10, the overlaid chart is no longer supported (you can achieve
 * the same result using a regular XYPlot with multiple datasets and renderers).
 *
 * @return a combined and overlaid chart.
 */
public JFreeChart createCombinedAndOverlaidChart1() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("combined.combined-overlaid.title");
    final String subtitleStr = this.resources.getString("combined.combined-overlaid.subtitle");
    final String domain = this.resources.getString("combined.combined-overlaid.domain");
    final String[] ranges = this.resources.getStringArray("combined.combined-overlaid.ranges");

    final TimeSeries jpy = DemoDatasetFactory.createJPYTimeSeries();
    final TimeSeries mav = MovingAverage.createMovingAverage(jpy, "30 Day Moving Average", 30, 30);

    final TimeSeriesCollection dataset0 = new TimeSeriesCollection();
    dataset0.addSeries(jpy);

    final TimeSeriesCollection dataset1 = new TimeSeriesCollection();
    dataset1.addSeries(jpy);
    dataset1.addSeries(mav);

    final DefaultHighLowDataset highLowDataset = DemoDatasetFactory.createHighLowDataset();
    final XYDataset highLowDatasetMA = MovingAverage.createMovingAverage(highLowDataset, " (MA)",
            5 * 24 * 60 * 60 * 1000L, 5 * 24 * 60 * 60 * 1000L);

    // make one vertical axis for each (vertical) chart
    final NumberAxis[] valueAxis = new NumberAxis[3];
    for (int i = 0; i < valueAxis.length; i++) {
        valueAxis[i] = new NumberAxis(ranges[i]);
        if (i <= 1) {
            valueAxis[i].setAutoRangeIncludesZero(false); // override default
        }
    }

    // create CombinedPlot...
    final CombinedDomainXYPlot parent = new CombinedDomainXYPlot(new DateAxis(domain));

    final int[] weight = { 1, 2, 2 };

    // add subplot1...
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final XYPlot subplot1 = new XYPlot(dataset0, null, new NumberAxis(ranges[0]), renderer1);
    final NumberAxis axis1 = (NumberAxis) subplot1.getRangeAxis();
    axis1.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    axis1.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    axis1.setAutoRangeIncludesZero(false);
    parent.add(subplot1, weight[0]);

    // add subplot2 (an overlaid plot)...
    final XYPlot subplot2 = new XYPlot(dataset0, null, new NumberAxis(ranges[1]), new StandardXYItemRenderer());
    final NumberAxis axis2 = (NumberAxis) subplot2.getRangeAxis();
    axis2.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    axis2.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    axis2.setAutoRangeIncludesZero(false);
    subplot2.setDataset(1, dataset1);
    subplot2.setRenderer(1, new StandardXYItemRenderer());

    parent.add(subplot2, weight[1]);

    // add subplot3 (an overlaid plot)...
    final XYItemRenderer renderer3 = new HighLowRenderer();
    final XYPlot subplot3 = new XYPlot(highLowDataset, null, new NumberAxis(ranges[2]), renderer3);
    final NumberAxis axis3 = (NumberAxis) subplot3.getRangeAxis();
    axis3.setTickLabelFont(new Font("Monospaced", Font.PLAIN, 7));
    axis3.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    axis3.setAutoRangeIncludesZero(false);
    subplot3.setDataset(1, highLowDatasetMA);
    subplot3.setRenderer(1, new StandardXYItemRenderer());

    parent.add(subplot3, weight[2]);

    // now create the master JFreeChart object
    final JFreeChart chart = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 12), parent, true);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 10));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;

}