SSJ
V. 2.6.

umontreal.iro.lecuyer.charts
Class HistogramChart

java.lang.Object
  extended by umontreal.iro.lecuyer.charts.XYChart
      extended by umontreal.iro.lecuyer.charts.HistogramChart

public class HistogramChart
extends XYChart

This class provides tools to create and manage histograms. The HistogramChart class is the simplest way to produce histograms. Each HistogramChart object is linked with an HistogramSeriesCollection dataset.


Constructor Summary
HistogramChart()
          Initializes a new HistogramChart instance with an empty data set.
HistogramChart(String title, String XLabel, String YLabel, CustomHistogramDataset data)
          Initializes a new HistogramChart instance with data data.
HistogramChart(String title, String XLabel, String YLabel, double[]... data)
          Initializes a new HistogramChart instance with input data.
HistogramChart(String title, String XLabel, String YLabel, double[] data, int numPoints)
          Initializes a new HistogramChart instance with input data.
HistogramChart(String title, String XLabel, String YLabel, cern.colt.list.DoubleArrayList... data)
          Initializes a new HistogramChart instance with data data.
HistogramChart(String title, String XLabel, String YLabel, int[] count, double[] bound)
          Initializes a new HistogramChart instance with data count and bound.
HistogramChart(String title, String XLabel, String YLabel, TallyHistogram... tallies)
          Initializes a new HistogramChart instance with data arrays contained in each TallyHistogram object.
HistogramChart(String title, String XLabel, String YLabel, TallyStore... tallies)
          Initializes a new HistogramChart instance with data arrays contained in each TallyStore object.
 
Method Summary
 HistogramSeriesCollection getSeriesCollection()
          Returns the chart's dataset.
 void setAutoRange(boolean right, boolean top)
          The x and the y ranges of the chart are set automatically.
 void setManuelRange(double[] range, boolean right, boolean top)
           
 void setSeriesCollection(HistogramSeriesCollection dataset)
          Links a new dataset to the current chart.
 void setTicksSynchro(int s)
          Synchronizes x-axis ticks to the s-th histogram bins if the number of bins is not larger than 10; otherwise, choose approximately 10 ticks.
 String toLatex(double width, double height)
          Exports the chart to a LATEX source code using PGF/TikZ.
 JFrame view(int width, int height)
          Displays chart on the screen using Swing.
 
Methods inherited from class umontreal.iro.lecuyer.charts.XYChart
disableGrid, drawVerticalLine, enableGrid, getChartMargin, getJFreeChart, getTitle, getXAxis, getYAxis, setAutoRange, setAutoRange00, setChartMargin, setLatexDocFlag, setManualRange, setManualRange, setManualRange00, setprobFlag, setTitle, toLatexFile
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HistogramChart

public HistogramChart()
Initializes a new HistogramChart instance with an empty data set.


HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      double[]... data)
Initializes a new HistogramChart instance with input data. title is a title, XLabel is a short description of the x-axis, and YLabel a short description of the y-axis. The input parameter data represents a collection of observation sets. Therefore data [i], i = 0,…, n - 1, is used to plot the ith histogram.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
data - series of point sets.

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      double[] data,
                      int numPoints)
Initializes a new HistogramChart instance with input data. title is a title, XLabel is a short description of the x-axis, and YLabel a short description of the y-axis. The input parameter data represents an observation set. Only the first numPoints of data will be considered to plot the histogram.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
data - series of point sets.
numPoints - Number of points to plot

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      cern.colt.list.DoubleArrayList... data)
Initializes a new HistogramChart instance with data data. Each DoubleArrayList input parameter represents a collection of observation sets. DoubleArrayList is from the Colt library and is used to store data.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
data - series of observation sets.

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      TallyStore... tallies)
Initializes a new HistogramChart instance with data arrays contained in each TallyStore object. The input parameter tallies represents a collection of observation sets.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
tallies - series of observation sets.

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      CustomHistogramDataset data)
Initializes a new HistogramChart instance with data data. The input parameter data represents a set of plotting data. CustomHistogramDataset is a JFreeChart-like container class that stores and manages observation sets.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
data - series collection.

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      int[] count,
                      double[] bound)
Initializes a new HistogramChart instance with data count and bound. The adjacent categories (or bins) are specified as non-overlapping intervals: bin[j] contains the values in the interval [bound[j], bound[j+1]], and count[j] is the number of such values. Thus the length of bound must be equal to the length of count plus one: the last value of bound is the right boundary of the last bin.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
count - the number of observation between each bound.
bound - the bounds of the observations

HistogramChart

public HistogramChart(String title,
                      String XLabel,
                      String YLabel,
                      TallyHistogram... tallies)
Initializes a new HistogramChart instance with data arrays contained in each TallyHistogram object. The input parameter tallies represents a collection of observation sets. The 2 extra bins at the beginning and at the end of the tallies are not counted nor represented in the chart.

Parameters:
title - chart title.
XLabel - Label on x-axis.
YLabel - Label on y-axis.
tallies - series of observation sets.
Method Detail

setAutoRange

public void setAutoRange(boolean right,
                         boolean top)
Description copied from class: XYChart
The x and the y ranges of the chart are set automatically. If right is true, the vertical axis will be on the left of the points, otherwise on the right. If top is true, the horizontal axis will be under the points, otherwise above the points.

Overrides:
setAutoRange in class XYChart
Parameters:
right - true if the x-values on the right of axis.
top - true if the y-values on the top of axis.

setManuelRange

public void setManuelRange(double[] range,
                           boolean right,
                           boolean top)

getSeriesCollection

public HistogramSeriesCollection getSeriesCollection()
Returns the chart's dataset.

Returns:
the chart's dataset.

setSeriesCollection

public void setSeriesCollection(HistogramSeriesCollection dataset)
Links a new dataset to the current chart.

Parameters:
dataset - new dataset.

setTicksSynchro

public void setTicksSynchro(int s)
Synchronizes x-axis ticks to the s-th histogram bins if the number of bins is not larger than 10; otherwise, choose approximately 10 ticks.

Specified by:
setTicksSynchro in class XYChart
Parameters:
s - selects histogram used to define ticks.

view

public JFrame view(int width,
                   int height)
Displays chart on the screen using Swing. This method creates an application containing a chart panel displaying the chart. The created frame is positioned on-screen, and displayed before it is returned. The width and the height of the chart are measured in pixels.

Specified by:
view in class XYChart
Parameters:
width - frame width in pixels.
height - frame height in pixels.
Returns:
frame containing the chart.

toLatex

public String toLatex(double width,
                      double height)
Description copied from class: XYChart
Exports the chart to a LATEX source code using PGF/TikZ. This method constructs and returns a string that can be written to a LATEX document to render the plot. width and height represents the width and the height of the produced chart. These dimensions do not take into account the axes and labels extra space. The width and the height of the chart are measured in centimeters.

Specified by:
toLatex in class XYChart
Parameters:
width - Chart's width in centimeters.
height - Chart's height in centimeters.
Returns:
LaTeX source code.

SSJ
V. 2.6.

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