Class HistogramSimulationPlotter

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, EventListener

public class HistogramSimulationPlotter extends JInternalFrame implements EventListener
A HistogramSimulationPlotter is able to display a histogram of one or more data sources, which can be updated during the simulation. It is based on JFreeChart library and uses data sources based on the microsim.statistics.* interfaces.

Title: JAS-mine

Description: Java Agent-based Simulation library

Copyright (C) 2017 Ross Richardson

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Author:
Ross Richardson

See Also:
  • Constructor Details

    • HistogramSimulationPlotter

      public HistogramSimulationPlotter(String title, String xaxis, org.jfree.data.statistics.HistogramType type, int bins)
      Constructor for histogram chart objects with chart legend displayed by default and all data samples shown, showing only the latest population data as time moves forward. Note - values falling on the boundary of adjacent bins will be assigned to the higher indexed bin. If it is desired set the minimum and maximum values displayed, or to turn the legend off, use the constructor: HistogramSimulationPlotter(String title, String xaxis, HistogramType type, int bins, double minimum, double maximum, boolean includeLegend)
      Parameters:
      title - - title of the chart
      xaxis - - name of the x-axis
      type - - the type of the histogram: either FREQUENCY, RELATIVE_FREQUENCY, or SCALE_AREA_TO_1
      bins - - the number of bins in the histogram
    • HistogramSimulationPlotter

      public HistogramSimulationPlotter(String title, String xaxis, org.jfree.data.statistics.HistogramType type, int bins, Double minimum, Double maximum, boolean includeLegend)
      Constructor for scatterplot chart objects, featuring a toggle to hide the chart legend and to set the minimum and maximum values displayed in the chart, with values below the minimum assigned to the first bin, and values above the maximum assigned to the last bin. Note - values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.
      Parameters:
      title - - title of the chart
      xaxis - - name of the x-axis
      type - - the type of the histogram: either FREQUENCY, RELATIVE_FREQUENCY, or SCALE_AREA_TO_1
      bins - - the number of bins in the histogram
      minimum - - any data value less than minimum will be assigned to the first bin
      maximum - - any data value greater than maximum will be assigned to the last bin
      includeLegend - - toggles whether to include the legend. If displaying a very large number of different series in the chart, it may be useful to turn the legend off as it will occupy a lot of space in the GUI.
  • Method Details

    • onEvent

      public void onEvent(Enum<?> type)
      Specified by:
      onEvent in interface EventListener
    • update

      public void update()
    • addCollectionSource

      public void addCollectionSource(String name, IDoubleArraySource source)
      Add a new series buffer, retrieving value from IDoubleSource objects in a collection.
      Parameters:
      name - The name of the series, which is shown in the legend.
      source - A collection containing the sources.
    • addCollectionSource

      public void addCollectionSource(String name, IFloatArraySource source)
      Add a new series buffer, retrieving value from IDoubleSource objects in a collection.
      Parameters:
      name - The name of the series, which is shown in the legend.
      source - A collection containing the sources.
    • addCollectionSource

      public void addCollectionSource(String name, IIntArraySource source)
      Add a new series buffer, retrieving value from IDoubleSource objects in a collection.
      Parameters:
      name - The name of the series, which is shown in the legend.
      source - A collection containing the sources.
    • addCollectionSource

      public void addCollectionSource(String name, ILongArraySource source)
      Add a new series buffer, retrieving value from IDoubleSource objects in a collection.
      Parameters:
      name - The name of the series, which is shown in the legend.
      source - A collection containing the sources.