/**
   * Creates a chart.
   *
   * @param dataset the data for the chart.
   * @return a chart.
   */
  private JFreeChart createChart(XYDataset dataset) {
    // create the chart...

    JFreeChart chart =
        ChartFactory.createXYLineChart(
            region + ", flows " + flowlist + " " + baselist, // chart
            // title
            "timestamp",
            getYaxis(), // y axis label
            dataset, // data
            PlotOrientation.VERTICAL,
            true, // include legend
            true, // tooltips
            false // urls
            );

    if (subtitle != null) {
      final TextTitle s = new TextTitle(subtitle);
      s.setFont(new Font("SansSerif", Font.PLAIN, 12));
      s.setPosition(RectangleEdge.TOP);
      //        subtitle.setSpacer(new Spacer(Spacer.RELATIVE, 0.05, 0.05, 0.05, 0.05));
      //  s.setVerticalAlignment(VerticalAlignment.TOP);
      chart.addSubtitle(s);
    }
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // chart.setBackgroundPaint(Color.white);
    chart.setBackgroundImageAlpha(1.0f);
    // chart.addSubtitle(new TextTitle(file.getName()));
    // get a reference to the plot for further customisation...
    XYPlot plot = (XYPlot) chart.getPlot();

    plot.setBackgroundPaint(Color.black);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.gray);
    plot.setRangeGridlinePaint(Color.gray);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setShapesVisible(false);
    renderer.setShapesFilled(false);

    // change the auto tick unit selection to integer units only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    ValueAxis va = plot.getDomainAxis();
    va.setAutoRangeMinimumSize(1000);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.
    return chart;
  }