3) Creating Charts

MATSim uses the JFreeChart library to generate charts (see http://www.jfree.org/jfreechart/ for additional information). The library is somewhat complex to understand, but we have included the most useful tools in:

org.matsim.core.utils.charts

A simple chart may be created like this:

public class MyChartCreator {
    public static void main(String[] args) {
    XYLineChart chart = new XYLineChart("Title","x-axis","y-axis");
    chart.addSeries("SeriesTitle", new double[]{1.0,2.0,2.4}, new double[]{1.0,2.0,4.0});

    //adds a Series to the chart
    charta.saveAsPng("a-chart.png", 800, 600); //File Export
    }
}

 

Now, try to use a chart in your EventHandler:
Try to collect the number of vehicles on link 6 per hour and write them to a chart.
You will find the solution in MyEventHandler3.

 

 


Warning: Table 'watchdog' is read only query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;sessions&amp;#039; is read only\nquery: UPDATE sessions SET uid = 0, cache = 0, hostname = &amp;#039;38.107.179.230&amp;#039;, session = &amp;#039;&amp;#039;, timestamp = 1328356307 WHERE sid = &amp;#039;e972b2ab7dd755a2094beea8ac708f02&amp;#039;</em> in <em>/home01/vsp_access/matsimwww/includes/database.mysql.inc</em> on line <em>174</em>.', 2, '', 'http://matsim.org/node/354', '', '38.107.179.230', 1328356307) in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174