SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Protected Member Functions | List of all members
HistogramChart Class Reference

This class provides tools to create and manage histograms. More...

Inheritance diagram for HistogramChart:
[legend]
Collaboration diagram for HistogramChart:
[legend]

Public Member Functions

 HistogramChart ()
 Initializes a new HistogramChart instance with an empty data set.
 
 HistogramChart (String title, String XLabel, String YLabel, double[]... data)
 Initializes a new HistogramChart instance with input data. More...
 
 HistogramChart (String title, String XLabel, String YLabel, double[] data, int numPoints)
 Initializes a new HistogramChart instance with input data. More...
 
 HistogramChart (String title, String XLabel, String YLabel, DoubleArrayList... data)
 Initializes a new HistogramChart instance with data data. More...
 
 HistogramChart (String title, String XLabel, String YLabel, TallyStore... tallies)
 Initializes a new HistogramChart instance with data arrays contained in each umontreal.ssj.stat.TallyStore object. More...
 
 HistogramChart (String title, String XLabel, String YLabel, CustomHistogramDataset data)
 Initializes a new HistogramChart instance with data data. More...
 
 HistogramChart (String title, String XLabel, String YLabel, int[] count, double[] bound)
 Initializes a new HistogramChart instance with data count and bound. More...
 
 HistogramChart (String title, String XLabel, String YLabel, TallyHistogram... tallies)
 Initializes a new HistogramChart instance with data arrays contained in each umontreal.ssj.stat.TallyHistogram object. More...
 
void setAutoRange (boolean right, boolean top)
 
void setManuelRange (double [] range, boolean right, boolean top)
 
HistogramSeriesCollection getSeriesCollection ()
 Returns the chart’s dataset. More...
 
void setSeriesCollection (HistogramSeriesCollection dataset)
 Links a new dataset to the current chart. More...
 
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. More...
 
JFrame view (int width, int height)
 Displays chart on the screen using Swing. More...
 
LaTeX-specific method
String toLatex (double width, double height)
 
- Public Member Functions inherited from XYChart
JFreeChart getJFreeChart ()
 Returns the JFreeChart object associated with this chart. More...
 
Axis getXAxis ()
 Returns the chart’s domain axis ( \(x\)-axis) object. More...
 
Axis getYAxis ()
 Returns the chart’s range axis ( \(y\)-axis) object. More...
 
abstract JFrame view (int width, int height)
 Displays chart on the screen using Swing.
 
String getTitle ()
 Gets the current chart title. More...
 
void setTitle (String title)
 Sets a title to this chart. More...
 
void setprobFlag (boolean flag)
 Must be set true when plotting probabilities, false otherwise. More...
 
void setAutoRange ()
 The \(x\) and the \(y\) ranges of the chart are set automatically.
 
void setAutoRange (boolean right, boolean top)
 The \(x\) and the \(y\) ranges of the chart are set automatically. More...
 
void setAutoRange00 (boolean xZero, boolean yZero)
 The \(x\) and the \(y\) ranges of the chart are set automatically. More...
 
void setManualRange (double[] range)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
void setManualRange (double[] range, boolean right, boolean top)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
void setManualRange00 (double[] range, boolean xZero, boolean yZero)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
double getChartMargin ()
 Returns the chart margin, which is the fraction by which the chart is enlarged on its borders. More...
 
void setChartMargin (double margin)
 Sets the chart margin to margin. More...
 
abstract void setTicksSynchro (int s)
 Synchronizes \(x\)-axis ticks to the \(s\)-th series \(x\)-values. More...
 
void drawVerticalLine (double x, String name, double yfrac, boolean right)
 Draws a vertical line on the chart at \(x\)-coordinate x. More...
 
void enableGrid (double xstep, double ystep)
 Puts a grid on the background. More...
 
void disableGrid ()
 Disables the background grid.
 
abstract String toLatex (double width, double height)
 Exports the chart to a LaTeX source code using PGF/TikZ. More...
 
void toLatexFile (String fileName, double width, double height)
 Transforms the chart to LaTeX form and writes it in file fileName. More...
 
void setLatexDocFlag (boolean flag)
 Flag to remove the \documentclass (and other) commands in the created LaTeX files. More...
 

Protected Member Functions

void init (String title, String XLabel, String YLabel)
 
- Protected Member Functions inherited from XYChart
void setAutoRange (boolean xZero, boolean yZero, boolean right, boolean top)
 
void setTick0Flags ()
 
double computeXScale (double position)
 
double computeYScale (double position)
 
double computeScale (double[] bounds)
 

Additional Inherited Members

- Protected Attributes inherited from XYChart
Axis XAxis
 
Axis YAxis
 
SSJXYSeriesCollection dataset
 
JFreeChart chart
 
boolean latexDocFlag = true
 
boolean autoRange
 
double [] manualRange
 
boolean grid = false
 
double xstepGrid
 
double ystepGrid
 
boolean probFlag = false
 
double chartMargin = 0.02
 

Detailed Description

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 umontreal.ssj.charts.HistogramSeriesCollection dataset.

Constructor & Destructor Documentation

◆ HistogramChart() [1/7]

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 \(i\)th histogram.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of point sets.

◆ HistogramChart() [2/7]

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
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of point sets.
numPointsNumber of points to plot

◆ HistogramChart() [3/7]

HistogramChart ( String  title,
String  XLabel,
String  YLabel,
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
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of observation sets.

◆ HistogramChart() [4/7]

HistogramChart ( String  title,
String  XLabel,
String  YLabel,
TallyStore...  tallies 
)

Initializes a new HistogramChart instance with data arrays contained in each umontreal.ssj.stat.TallyStore object.

The input parameter tallies represents a collection of observation sets.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
talliesseries of observation sets.

◆ HistogramChart() [5/7]

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. umontreal.ssj.charts.CustomHistogramDataset is a JFreeChart-like container class that stores and manages observation sets.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries collection.

◆ HistogramChart() [6/7]

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
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
countthe number of observation between each bound.
boundthe bounds of the observations

◆ HistogramChart() [7/7]

HistogramChart ( String  title,
String  XLabel,
String  YLabel,
TallyHistogram...  tallies 
)

Initializes a new HistogramChart instance with data arrays contained in each umontreal.ssj.stat.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
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
talliesseries of observation sets.

Member Function Documentation

◆ getSeriesCollection()

HistogramSeriesCollection getSeriesCollection ( )

Returns the chart’s dataset.

Returns
the chart’s dataset.

◆ setSeriesCollection()

void setSeriesCollection ( HistogramSeriesCollection  dataset)

Links a new dataset to the current chart.

Parameters
datasetnew dataset.

◆ setTicksSynchro()

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.

Parameters
sselects histogram used to define ticks.

◆ view()

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.

Parameters
widthframe width in pixels.
heightframe height in pixels.
Returns
frame containing the chart.

The documentation for this class was generated from the following file: