SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.charts.HistogramChart Class Reference

Provides tools to create and manage histograms. More...

Inheritance diagram for umontreal.ssj.charts.HistogramChart:
umontreal.ssj.charts.XYChart

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

Additional Inherited Members

Detailed Description

Provides tools to create and manage histograms.

Each HistogramChart object is linked with an HistogramSeriesCollection dataset.

Definition at line 49 of file HistogramChart.java.

Constructor & Destructor Documentation

◆ HistogramChart() [1/8]

umontreal.ssj.charts.HistogramChart.HistogramChart ( )

Initializes a new HistogramChart instance with an empty data set.

Definition at line 71 of file HistogramChart.java.

◆ HistogramChart() [2/8]

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

Definition at line 90 of file HistogramChart.java.

◆ HistogramChart() [3/8]

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

Definition at line 110 of file HistogramChart.java.

◆ HistogramChart() [4/8]

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

Definition at line 128 of file HistogramChart.java.

◆ HistogramChart() [5/8]

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

Definition at line 144 of file HistogramChart.java.

◆ HistogramChart() [6/8]

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

Definition at line 162 of file HistogramChart.java.

◆ HistogramChart() [7/8]

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

Definition at line 182 of file HistogramChart.java.

◆ HistogramChart() [8/8]

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

Definition at line 224 of file HistogramChart.java.

Member Function Documentation

◆ getSeriesCollection()

HistogramSeriesCollection umontreal.ssj.charts.HistogramChart.getSeriesCollection ( )

Returns the chart’s dataset.

Returns
the chart’s dataset.

Definition at line 245 of file HistogramChart.java.

◆ setAutoRange()

void umontreal.ssj.charts.HistogramChart.setAutoRange ( boolean right,
boolean top )

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.

Parameters
righttrue if the x-values on the right of axis.
toptrue if the y-values on the top of axis.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 230 of file HistogramChart.java.

◆ setSeriesCollection()

void umontreal.ssj.charts.HistogramChart.setSeriesCollection ( HistogramSeriesCollection dataset)

Links a new dataset to the current chart.

Parameters
datasetnew dataset.

Definition at line 254 of file HistogramChart.java.

◆ setTicksSynchro()

void umontreal.ssj.charts.HistogramChart.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.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 265 of file HistogramChart.java.

◆ toLatex()

String umontreal.ssj.charts.HistogramChart.toLatex ( double width,
double height )

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.

Parameters
widthChart’s width in centimeters.
heightChart’s height in centimeters.
Returns
LaTeX source code.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 328 of file HistogramChart.java.

◆ view()

JFrame umontreal.ssj.charts.HistogramChart.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.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 309 of file HistogramChart.java.


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