21 package org.matsim.counts.algorithms.graphs;
23 import java.awt.Color;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.jfree.chart.JFreeChart;
29 import org.jfree.chart.axis.CategoryAxis;
30 import org.jfree.chart.axis.CategoryLabelPositions;
31 import org.jfree.chart.axis.NumberAxis;
32 import org.jfree.chart.labels.BoxAndWhiskerToolTipGenerator;
33 import org.jfree.chart.plot.CategoryPlot;
34 import org.jfree.chart.plot.CombinedDomainCategoryPlot;
35 import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer;
36 import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset;
42 final String chartTitle) {
43 super(ccl, iteration, filename, chartTitle);
49 DefaultBoxAndWhiskerCategoryDataset dataset0 =
new DefaultBoxAndWhiskerCategoryDataset();
50 DefaultBoxAndWhiskerCategoryDataset dataset1 =
new DefaultBoxAndWhiskerCategoryDataset();
52 final ArrayList<Double>[] listRel =
new ArrayList[24];
53 final ArrayList<Double>[] listAbs =
new ArrayList[24];
56 for (
int i = 0; i < 24; i++) {
57 listRel[i] =
new ArrayList<Double>();
58 listAbs[i] =
new ArrayList<Double>();
63 int hour = cc.getHour() - 1;
64 listRel[hour].add(cc.calculateNormalizedRelativeError() * 100);
65 listAbs[hour].add(cc.getSimulationValue() - cc.getCountValue());
69 for (
int i = 0; i < 24; i++) {
70 dataset0.add(listRel[i],
"Rel Norm Error", Integer.toString(i + 1));
71 dataset1.add(listAbs[i],
"Abs Error", Integer.toString(i + 1));
74 String title =
"Iteration: " + this.
iteration_;
76 final CombinedDomainCategoryPlot plot =
new CombinedDomainCategoryPlot();
78 final CategoryAxis xAxis =
new CategoryAxis(
"Hour");
79 final NumberAxis yAxis0 =
new NumberAxis(
"Norm. Rel. Error [%]");
80 final NumberAxis yAxis1 =
new NumberAxis(
"Signed Abs. Error [veh]");
81 yAxis0.setAutoRangeIncludesZero(
false);
82 yAxis1.setAutoRangeIncludesZero(
false);
84 final BoxAndWhiskerRenderer renderer =
new BoxAndWhiskerRenderer();
85 renderer.setFillBox(
false);
86 renderer.setSeriesPaint(0, Color.blue);
87 renderer.setSeriesToolTipGenerator(0,
new BoxAndWhiskerToolTipGenerator());
89 CategoryPlot subplot0 =
new CategoryPlot(dataset0, xAxis, yAxis0, renderer);
90 CategoryPlot subplot1 =
new CategoryPlot(dataset1, xAxis, yAxis1, renderer);
95 final CategoryAxis axis1 =
new CategoryAxis(
"hour");
96 axis1.setTickLabelFont(
new Font(
"SansSerif", Font.PLAIN, 7));
97 axis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
98 plot.setDomainAxis(axis1);
100 this.
chart_ =
new JFreeChart(title,
new Font(
"SansSerif", Font.BOLD, 14), plot,
false);
List< CountSimComparison > ccl_
BoxPlotNormalizedErrorGraph(final List< CountSimComparison > ccl, final int iteration, final String filename, final String chartTitle)
JFreeChart createChart(final int nbr)