21 package org.matsim.counts.algorithms.graphs;
24 import java.util.List;
26 import org.jfree.chart.ChartFactory;
27 import org.jfree.chart.JFreeChart;
28 import org.jfree.chart.axis.AxisLocation;
29 import org.jfree.chart.axis.CategoryAxis;
30 import org.jfree.chart.axis.NumberAxis;
31 import org.jfree.chart.axis.ValueAxis;
32 import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
33 import org.jfree.chart.plot.CategoryPlot;
34 import org.jfree.chart.plot.DatasetRenderingOrder;
35 import org.jfree.chart.plot.PlotOrientation;
36 import org.jfree.chart.renderer.category.LineAndShapeRenderer;
37 import org.jfree.data.category.DefaultCategoryDataset;
46 final String chartTitle) {
47 super(ccl, iteration, filename, chartTitle);
52 DefaultCategoryDataset dataset0 =
new DefaultCategoryDataset();
53 DefaultCategoryDataset dataset1 =
new DefaultCategoryDataset();
61 for (
int h = 0; h < 24; h++) {
62 meanRelError[h] *= 100;
63 dataset0.addValue(meanRelError[h],
"Mean rel error", Integer.toString(h + 1));
65 dataset1.addValue(meanBias[h],
"Mean bias", Integer.toString(h + 1));
68 this.
chart_ = ChartFactory.createLineChart(
"",
"Hour",
"Mean rel error [%]", dataset0, PlotOrientation.VERTICAL,
73 CategoryPlot plot = this.
chart_.getCategoryPlot();
74 plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
75 plot.setDataset(1, dataset1);
76 plot.mapDatasetToRangeAxis(1, 1);
78 final LineAndShapeRenderer renderer =
new LineAndShapeRenderer();
79 renderer.setSeriesToolTipGenerator(0,
new StandardCategoryToolTipGenerator());
80 plot.setRenderer(0, renderer);
82 final CategoryAxis axis1 =
new CategoryAxis(
"Hour");
83 axis1.setTickLabelFont(
new Font(
"SansSerif", Font.PLAIN, 7));
84 plot.setDomainAxis(axis1);
87 final ValueAxis axis2 =
new NumberAxis(
"Mean bias [veh/h]");
88 plot.setRangeAxis(1, axis2);
90 final ValueAxis axis3 = plot.getRangeAxis(0);
91 axis3.setRange(0.0, 100.0);
93 final LineAndShapeRenderer renderer2 =
new LineAndShapeRenderer();
94 renderer2.setSeriesToolTipGenerator(0,
new StandardCategoryToolTipGenerator());
95 renderer2.setSeriesToolTipGenerator(1,
new StandardCategoryToolTipGenerator());
97 plot.setRenderer(1, renderer2);
98 plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);
104 if (this.errorStats == null) {
105 throw new RuntimeException(
"Object not initialized correctly. Call createChart(..) first!");
111 if (this.errorStats == null) {
112 throw new RuntimeException(
"Object not initialized correctly. Call createChart(..) first!");
List< CountSimComparison > ccl_
BiasErrorGraph(final List< CountSimComparison > ccl, final int iteration, final String filename, final String chartTitle)
double [] getMeanRelError()
double [] getMeanRelError()
ComparisonErrorStatsCalculator errorStats
JFreeChart createChart(final int nbr)