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

This class provides additional tools to create and manage empirical plots. More...

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

Public Member Functions

 EmpiricalChart ()
 Initializes a new EmpiricalChart instance with an empty data set.
 
 EmpiricalChart (String title, String XLabel, String YLabel, double[]... data)
 Initializes a new EmpiricalChart instance with data data. More...
 
 EmpiricalChart (String title, String XLabel, String YLabel, double[] data, int numPoints)
 Initializes a new EmpiricalChart instance with a set of points data. More...
 
 EmpiricalChart (String title, String XLabel, String YLabel, DoubleArrayList... data)
 Similar to the above constructor, but with DoubleArrayList. More...
 
 EmpiricalChart (String title, String XLabel, String YLabel, TallyStore... tallies)
 Initializes a new EmpiricalChart instance with data arrays contained in each umontreal.ssj.stat.TallyStore object. More...
 
 EmpiricalChart (String title, String XLabel, String YLabel, XYSeriesCollection data)
 Initializes a new EmpiricalChart instance with data data. More...
 
EmpiricalSeriesCollection getSeriesCollection ()
 Returns the chart’s dataset. More...
 
void setSeriesCollection (EmpiricalSeriesCollection dataset)
 Links a new dataset to the current chart. More...
 
void setTicksSynchro (int s)
 Synchronizes \(x\)-axis ticks to the \(s\)-th series \(x\)-values. 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 additional tools to create and manage empirical plots.

Empirical plots are used to plot empirical distributions. The EmpiricalChart class is the simplest way to produce empirical plots only. Each EmpiricalChart object is linked with an umontreal.ssj.charts.EmpiricalSeriesCollection data set.

Constructor & Destructor Documentation

◆ EmpiricalChart() [1/5]

EmpiricalChart ( String  title,
String  XLabel,
String  YLabel,
double... []  data 
)

Initializes a new EmpiricalChart instance with data 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 vectors data represents a collection of observation sets. Each vector of data represents a \(x\)-coordinates set. Therefore data \([i], i = 0,…,n-1\), is used to draw the \(i\)-th plot. The values of each observation set data \([i]\) must be sorted in increasing order.

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

◆ EmpiricalChart() [2/5]

EmpiricalChart ( String  title,
String  XLabel,
String  YLabel,
double []  data,
int  numPoints 
)

Initializes a new EmpiricalChart instance with a set of points data.

title is a title, XLabel is a short description of the \(x\)-axis and YLabel a short description of the \(y\)-axis. Vector data represents a \(x\)-coordinates set. The values of this observation set must be sorted in increasing order. Only the first numPoints of data will be considered to plot.

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

◆ EmpiricalChart() [3/5]

EmpiricalChart ( String  title,
String  XLabel,
String  YLabel,
DoubleArrayList...  data 
)

Similar to the above constructor, but with DoubleArrayList.

A DoubleArrayList from the Colt library is used to store data. The values of each observation set data \([i]\) must be sorted in increasing order.

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

◆ EmpiricalChart() [4/5]

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

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

The input parameter tallies represents a collection of observation sets. Therefore, the \(i\)-th tallies is used to draw the \(i\)-th plot.

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

◆ EmpiricalChart() [5/5]

EmpiricalChart ( String  title,
String  XLabel,
String  YLabel,
XYSeriesCollection  data 
)

Initializes a new EmpiricalChart instance with data data.

The input parameter data represents a set of plotting data. XYSeriesCollection is a JFreeChart-like container class used to store and manage observation sets.

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

Member Function Documentation

◆ getSeriesCollection()

EmpiricalSeriesCollection getSeriesCollection ( )

Returns the chart’s dataset.

Returns
the chart’s dataset.

◆ setSeriesCollection()

void setSeriesCollection ( EmpiricalSeriesCollection  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 series \(x\)-values.

Parameters
sseries 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: