final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false); // override default
final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
XYToolTipGenerator toolTipGenerator = null;
if (tooltips)
{
toolTipGenerator
= StandardXYToolTipGenerator.getTimeSeriesInstance();
}
XYURLGenerator urlGenerator = null;
if (urls)
{
urlGenerator = new StandardXYURLGenerator();
}
final XYAreaRenderer2 renderer;
if (stacked)
{
renderer = new StackedXYAreaRenderer2();
}
else
{
renderer = new XYAreaRenderer2();
}
renderer.setBaseToolTipGenerator(toolTipGenerator);
renderer.setURLGenerator(urlGenerator);
plot.setRenderer(renderer);
return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
}