SSJ
V. 2.6.

umontreal.iro.lecuyer.charts
Class HistogramSeriesCollection

java.lang.Object
  extended by umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
      extended by umontreal.iro.lecuyer.charts.HistogramSeriesCollection

public class HistogramSeriesCollection
extends SSJXYSeriesCollection

Stores data used in a HistogramChart. HistogramSeriesCollection provides complementary tools to draw histograms. One may add observation sets, define histogram bins, set plot color and plot style, enable/disable filled shapes, and set margin between shapes for each series. This class is linked with class CustomHistogramDataset to store data plots, and linked with JFreeChart XYBarRenderer to render the plot. CustomHistogramDataset has been developed at the Université de Montréal to extend the JFreeChart API, and is used to manage histogram datasets in a JFreeChart chart.


Constructor Summary
HistogramSeriesCollection()
          Creates a new HistogramSeriesCollection instance with empty dataset.
HistogramSeriesCollection(CustomHistogramDataset data)
          Creates a new HistogramSeriesCollection instance.
HistogramSeriesCollection(double[]... data)
          Creates a new HistogramSeriesCollection instance with given data series.
HistogramSeriesCollection(double[] data, int numPoints)
          Creates a new HistogramSeriesCollection instance with the given data series data.
HistogramSeriesCollection(cern.colt.list.DoubleArrayList... data)
          Creates a new HistogramSeriesCollection.
HistogramSeriesCollection(TallyHistogram... tallies)
          Creates a new HistogramSeriesCollection instance with default parameters and given data.
HistogramSeriesCollection(TallyStore... tallies)
          Creates a new HistogramSeriesCollection instance with default parameters and given data.
 
Method Summary
 int add(double[] data)
          Adds a data series into the series collection.
 int add(double[] data, int numPoints)
          Adds a data series into the series collection.
 int add(cern.colt.list.DoubleArrayList observationSet)
          Adds a data series into the series collection.
 int add(TallyStore tally)
          Adds a data series into the series collection.
 List getBins(int series)
          Returns the bins for a series.
 boolean getFilled(int series)
          Returns the filled flag associated with the series-th data series.
 double getMargin()
          Returns the margin which is a percentage amount by which the bars are trimmed.
 double getOutlineWidth(int series)
          Returns the outline width in pt.
 CustomHistogramDataset getSeriesCollection()
          Returns the CustomHistogramDataset object associated with the current variable.
 double[] getValues(int series)
          Returns the values for a series.
 List getValuesList(int series)
          Returns the values for a series.
 void setBins(int series, HistogramBin[] binsTable)
          Links bins given by table binsTable to a series.
 void setBins(int series, int bins)
          Sets bins periodic bins from the observation minimum values to the observation maximum value for a series.
 void setBins(int series, int bins, double minimum, double maximum)
          Sets bins periodic bins from minimum to maximum for a series.
 void setFilled(int series, boolean filled)
          Sets the filled flag.
 void setMargin(double margin)
          Sets the margin which is a percentage amount by which the bars are trimmed for all series.
 void setOutlineWidth(int series, double outline)
          Sets the outline width in pt.
 void setValues(int series, double[] values)
          Sets a new values set to a series from a table.
 void setValues(int series, List valuesList)
          Sets a new values set to a series from a List variable.
 String toLatex(double XScale, double YScale, double XShift, double YShift, double xmin, double xmax, double ymin, double ymax)
          Formats and returns a string containing a LATEX-compatible source code which represents this data series collection.
 
Methods inherited from class umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
getColor, getDomainBounds, getRangeBounds, getRenderer, getX, getY, setColor, setRenderer, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HistogramSeriesCollection

public HistogramSeriesCollection()
Creates a new HistogramSeriesCollection instance with empty dataset.


HistogramSeriesCollection

public HistogramSeriesCollection(double[]... data)
Creates a new HistogramSeriesCollection instance with given data series. Bins the elements of data in equally spaced containers (the number of bins can be changed using the method setBins). Each input parameter represents a data series.

Parameters:
data - series of point sets.

HistogramSeriesCollection

public HistogramSeriesCollection(double[] data,
                                 int numPoints)
Creates a new HistogramSeriesCollection instance with the given data series data. Bins the elements of data in equally spaced containers (the number of bins can be changed using the method setBins). Only the first numPoints of data will be taken into account.

Parameters:
data - Point set
numPoints - Number of points to plot

HistogramSeriesCollection

public HistogramSeriesCollection(cern.colt.list.DoubleArrayList... data)
Creates a new HistogramSeriesCollection. Bins the elements of data in equally spaced containers (the number of bins can be changed using the method setBins). The input parameter represents a set of data plots. Each DoubleArrayList variable corresponds to a histogram on the chart.

Parameters:
data - series of observation sets.

HistogramSeriesCollection

public HistogramSeriesCollection(TallyStore... tallies)
Creates a new HistogramSeriesCollection instance with default parameters and given data. The input parameter represents a collection of data observation sets. Each TallyStore input parameter represents an observation set.

Parameters:
tallies - series of point sets.

HistogramSeriesCollection

public HistogramSeriesCollection(TallyHistogram... tallies)
Creates a new HistogramSeriesCollection instance with default parameters and given data. The input parameter represents a collection of data observation sets. Each TallyHistogram input parameter represents an observation set. The 2 extra bins at the beginning and at the end of the tallies are not counted nor represented in the chart.

Parameters:
tallies - series of point sets.

HistogramSeriesCollection

public HistogramSeriesCollection(CustomHistogramDataset data)
Creates a new HistogramSeriesCollection instance. The input parameter represents a set of plotting data. Each series of the given collection corresponds to a histogram.

Parameters:
data - series of point sets.
Method Detail

add

public int add(double[] data)
Adds a data series into the series collection.

Parameters:
data - new series.
Returns:
Integer that represent the new point set.

add

public int add(double[] data,
               int numPoints)
Adds a data series into the series collection. Only the first numPoints of data will be added to the new series.

Parameters:
data - new series.
numPoints - Number of points to add
Returns:
Integer that represent the new point set.

add

public int add(cern.colt.list.DoubleArrayList observationSet)
Adds a data series into the series collection.

Parameters:
observationSet - new series values.
Returns:
Integer that represent the new point set's position in the CustomHistogramDataset object.

add

public int add(TallyStore tally)
Adds a data series into the series collection.

Parameters:
tally - TallyStore to add values.
Returns:
Integer that represent the new point set's position in the CustomHistogramDataset object.

getSeriesCollection

public CustomHistogramDataset getSeriesCollection()
Returns the CustomHistogramDataset object associated with the current variable.

Overrides:
getSeriesCollection in class SSJXYSeriesCollection
Returns:
CustomHistogramDataset object associated with the current variable.

getBins

public List getBins(int series)
Returns the bins for a series.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
A list of bins. IndexOutOfBoundsExceptionif series is outside the specified range.

setBins

public void setBins(int series,
                    int bins)
Sets bins periodic bins from the observation minimum values to the observation maximum value for a series.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
bins - the number of periodic bins. IndexOutOfBoundsExceptionif series is outside the specified range.

setBins

public void setBins(int series,
                    int bins,
                    double minimum,
                    double maximum)
Sets bins periodic bins from minimum to maximum for a series. Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
bins - the number of periodic bins.
minimum - minimum value.
maximum - maximum value. IndexOutOfBoundsExceptionif series is outside the specified range.

setBins

public void setBins(int series,
                    HistogramBin[] binsTable)
Links bins given by table binsTable to a series. Values falling on the boundary of adjacent bins will be assigned to the higher indexed bin.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
binsTable - new bins table. IndexOutOfBoundsExceptionif series is outside the specified range.

getValuesList

public List getValuesList(int series)
Returns the values for a series.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
A list of values. (IndexOutOfBoundsExceptionif <code>series</code> is outside the specified range.

getValues

public double[] getValues(int series)
Returns the values for a series.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
Returns:
A list of values. (IndexOutOfBoundsExceptionif <code>series</code> is outside the specified range.

setValues

public void setValues(int series,
                      List valuesList)
Sets a new values set to a series from a List variable.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
valuesList - new values list.

setValues

public void setValues(int series,
                      double[] values)
Sets a new values set to a series from a table.

Parameters:
series - the series index (in the range 0 to getSeriesCount() - 1).
values - new values table.

getFilled

public boolean getFilled(int series)
Returns the filled flag associated with the series-th data series.

Parameters:
series - series index.
Returns:
fill flag.

setFilled

public void setFilled(int series,
                      boolean filled)
Sets the filled flag. This option fills histogram rectangular. The fill color is the current series color, alpha's color parameter will be used to draw transparency.

Parameters:
series - series index.
filled - fill flag.

getMargin

public double getMargin()
Returns the margin which is a percentage amount by which the bars are trimmed.


setMargin

public void setMargin(double margin)
Sets the margin which is a percentage amount by which the bars are trimmed for all series.

Parameters:
margin - margin percentage amount.

getOutlineWidth

public double getOutlineWidth(int series)
Returns the outline width in pt.

Parameters:
series - series index.

setOutlineWidth

public void setOutlineWidth(int series,
                            double outline)
Sets the outline width in pt.

Parameters:
series - series index.
outline - outline width.

toLatex

public String toLatex(double XScale,
                      double YScale,
                      double XShift,
                      double YShift,
                      double xmin,
                      double xmax,
                      double ymin,
                      double ymax)
Description copied from class: SSJXYSeriesCollection
Formats and returns a string containing a LATEX-compatible source code which represents this data series collection. The original datasets are shifted and scaled with the XShift, YShift, XScale and YScale parameters. xmin, xmax, ymin and ymax represent the chart bounds.

Specified by:
toLatex in class SSJXYSeriesCollection
Parameters:
XScale - Domain original data scale.
YScale - Range original data scale.
XShift - Domain original data shift value.
YShift - Range original data shift value.
xmin - Domain min bound.
xmax - Domain nax bound.
ymin - Range min bound.
ymax - Range nax bound.
Returns:
TikZ code.

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.