if (forecaster instanceof WekaForecaster && hasConfidenceIntervals) {
double confPerc = ((WekaForecaster) forecaster).getConfidenceLevel() * 100.0;
title += " [" + Utils.doubleToString(confPerc, 0) + "% conf. intervals]";
}
XYErrorRenderer renderer = new XYErrorRenderer();
// renderer.setShapesFilled(true);
XYPlot plot = new XYPlot(xyDataset, timeAxis, valueAxis, renderer);
// renderer = (XYErrorRenderer)plot.getRenderer();
if (history != null) {
for (String targetName : targetNames) {
XYIntervalSeries predSeries = null;
int predIndex = xyDataset.indexOf(targetName + "-predicted");
predSeries = xyDataset.getSeries(predIndex);
XYIntervalSeries actualSeries = null;
int actualIndex = xyDataset.indexOf(targetName);
actualSeries = xyDataset.getSeries(actualIndex);
if (actualSeries != null && predSeries != null) {
// match the color of the actual series
java.awt.Paint actualPaint = renderer.lookupSeriesPaint(actualIndex);
renderer.setSeriesPaint(predIndex, actualPaint);
// now set the line style to dashed
BasicStroke dashed = new BasicStroke(1.5f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, new float[] { 5.0f }, 0.0f);
renderer.setSeriesStroke(predIndex, dashed);
}
}
}
renderer.setBaseLinesVisible(true);
renderer.setDrawXError(false);
renderer.setDrawYError(true);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, true);
chart.setBackgroundPaint(java.awt.Color.white);
TextTitle chartTitle = chart.getTitle();