Class Weighted_HistogramSimulationPlotter

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

public class Weighted_HistogramSimulationPlotter extends JInternalFrame implements EventListener
A Weighted_HistogramSimulationPlotter is able to display a histogram of one or more data sources that each implements the Weight interface, and can be updated during the simulation. It is based on JFreeChart library and uses data sources based on the microsim.statistics.weighted* interfaces.
Note that the weights are taken into account by adding the weight to the count of the histogram bin corresponding to the value associated with the weight. E.g, if a weighted object has value of 1.6 and weight of 5.3, the count of 5.3 is placed in the histogram bin appropriate for the value of 1.6.

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

    • Weighted_HistogramSimulationPlotter

      public Weighted_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
    • Weighted_HistogramSimulationPlotter

      public Weighted_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, IWeightedDoubleArraySource source)
      Add a new series buffer, retrieving value from IWeightedDoubleSource 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, IWeightedFloatArraySource source)
      Add a new series buffer, retrieving value from IWeightedFloatSource 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, IWeightedIntArraySource source)
      Add a new series buffer, retrieving value from IWeightedIntArraySource 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, IWeightedLongArraySource source)
      Add a new series buffer, retrieving value from IWeightedLongSource objects in a collection.
      Parameters:
      name - The name of the series, which is shown in the legend.
      source - A collection containing the sources.