umontreal.iro.lecuyer.charts
Class HistogramSeriesCollection
- java.lang.Object
-
- umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
-
- 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
Constructors Constructor and Description 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(DoubleArrayList... data)Creates a new HistogramSeriesCollection.HistogramSeriesCollection(TallyStore... tallies)Creates a new HistogramSeriesCollection instance with default parameters and given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intadd(double[] data)Adds a data series into the series collection.intadd(double[] data, int numPoints)Adds a data series into the series collection.intadd(DoubleArrayList observationSet)Adds a data series into the series collection.intadd(TallyStore tally)Adds a data series into the series collection.java.util.ListgetBins(int series)Returns the bins for a series.booleangetFilled(int series)Returns the filled flag associated with the series-th data series.doublegetMargin()Returns the margin which is a percentage amount by which the bars are trimmed.doublegetOutlineWidth(int series)Returns the outline width in pt.CustomHistogramDatasetgetSeriesCollection()Returns the CustomHistogramDataset object associated with the current variable.double[]getValues(int series)Returns the values for a series.java.util.ListgetValuesList(int series)Returns the values for a series.voidsetBins(int series, HistogramBin[] binsTable)Links bins given by table binsTable to a series.voidsetBins(int series, int bins)Sets bins periodic bins from the observation minimum values to the observation maximum value for a series.voidsetBins(int series, int bins, double minimum, double maximum)Sets bins periodic bins from minimum to maximum for a series.voidsetFilled(int series, boolean filled)Sets the filled flag.voidsetMargin(double margin)Sets the margin which is a percentage amount by which the bars are trimmed for all series.voidsetOutlineWidth(int series, double outline)Sets the outline width in pt.voidsetValues(int series, double[] values)Sets a new values set to a series from a table.voidsetValues(int series, java.util.List valuesList)Sets a new values set to a series from a List variable.java.lang.StringtoLatex(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
-
-
-
-
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 methodsetBins). 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 methodsetBins). Only the first numPoints of data will be taken into account.- Parameters:
data- Point setnumPoints- Number of points to plot
-
HistogramSeriesCollection
public HistogramSeriesCollection(DoubleArrayList... data)
Creates a new HistogramSeriesCollection. Bins the elements of data in equally spaced containers (the number of bins can be changed using the methodsetBins). The input parameter represents a set of data plots. EachDoubleArrayListvariable 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(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(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-TallyStoreto 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:
getSeriesCollectionin classSSJXYSeriesCollection- Returns:
- CustomHistogramDataset object associated with the current variable.
-
getBins
public java.util.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 java.util.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, java.util.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 java.lang.String toLatex(double XScale, double YScale, double XShift, double YShift, double xmin, double xmax, double ymin, double ymax)Description copied from class:SSJXYSeriesCollectionFormats 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:
toLatexin classSSJXYSeriesCollection- 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG