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

Provides tools to plot many datasets on the same chart. More...

Public Member Functions

 MultipleDatasetChart ()
 Initializes a new MultipleDatasetChart.
 MultipleDatasetChart (String title, String XLabel, String YLabel)
 Initializes a new MultipleDatasetChart instance.
JFreeChart getJFreeChart ()
 Returns the JFreeChart variable 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 the chart.
void setAutoRange ()
 Sets chart range to automatic values.
void setManualRange (double[] axisRange)
 Sets new \(x\)-axis and \(y\)-axis bounds, with format: axisRange = [xmin, xmax, ymin, ymax].
int add (SSJXYSeriesCollection dataset)
 Adds a new dataset to the chart at the end of the list and returns its position.
SSJXYSeriesCollection get ()
 Gets the primary dataset.
void set (SSJXYSeriesCollection dataset)
 Sets the primary dataset for the plot, replacing the existing dataset if there is one.
SSJXYSeriesCollection get (int datasetNum)
 Gets the element at the specified position in the dataset list.
void set (int datasetNum, SSJXYSeriesCollection dataset)
 Replaces the element at the specified position in the dataset list with the specified element.
ArrayList< SSJXYSeriesCollectiongetList ()
 Returns the dataset list.
JFrame view (int width, int height)
 Displays chart on the screen using Swing.
void enableGrid (double xstep, double ystep)
 Puts grid on the background.
void disableGrid ()
 Disables the background grid.

LaTeX-specific method @{

String toLatex (double width, double height)
 Same as in XYChart.
void setLatexDocFlag (boolean flag)
 Same as in XYChart.

Detailed Description

Provides tools to plot many datasets on the same chart.

This class is mainly used to draw plots with different styles. Class XYChart and its subclasses are to be preferred to draw simple charts with one style. Datasets are stored in an ArrayList. The first dataset is called as the primary dataset.

Definition at line 47 of file MultipleDatasetChart.java.

Constructor & Destructor Documentation

◆ MultipleDatasetChart() [1/2]

umontreal.ssj.charts.MultipleDatasetChart.MultipleDatasetChart ( )

Initializes a new MultipleDatasetChart.

Definition at line 65 of file MultipleDatasetChart.java.

◆ MultipleDatasetChart() [2/2]

umontreal.ssj.charts.MultipleDatasetChart.MultipleDatasetChart ( String title,
String XLabel,
String YLabel )

Initializes a new MultipleDatasetChart instance.

title sets a title, XLabel is a short description of the \(x\)-axis, and YLabel is a short description of the \(y\)-axis.

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

Definition at line 93 of file MultipleDatasetChart.java.

Member Function Documentation

◆ add()

int umontreal.ssj.charts.MultipleDatasetChart.add ( SSJXYSeriesCollection dataset)

Adds a new dataset to the chart at the end of the list and returns its position.

Parameters
datasetdataset to add.
Returns
the dataset position in the list.

Definition at line 200 of file MultipleDatasetChart.java.

◆ disableGrid()

void umontreal.ssj.charts.MultipleDatasetChart.disableGrid ( )

Disables the background grid.

Definition at line 308 of file MultipleDatasetChart.java.

◆ enableGrid()

void umontreal.ssj.charts.MultipleDatasetChart.enableGrid ( double xstep,
double ystep )

Puts grid on the background.

It is important to note that the grid is always placed in such a way that it contains the axes. Thus, the grid does not always have an intersection at the corner points; this occurs only if the corner points are multiples of the stepping. xstep and ystep sets the stepping in each direction.

Parameters
xstepsets the stepping in the \(x\)-direction.
ystepsets the stepping in the \(y\)-direction.

Definition at line 299 of file MultipleDatasetChart.java.

◆ get() [1/2]

SSJXYSeriesCollection umontreal.ssj.charts.MultipleDatasetChart.get ( )

Gets the primary dataset.

Returns
dataset.

Definition at line 216 of file MultipleDatasetChart.java.

◆ get() [2/2]

SSJXYSeriesCollection umontreal.ssj.charts.MultipleDatasetChart.get ( int datasetNum)

Gets the element at the specified position in the dataset list.

Parameters
datasetNumposition in the dataset list.
Returns
dataset.

Definition at line 238 of file MultipleDatasetChart.java.

◆ getJFreeChart()

JFreeChart umontreal.ssj.charts.MultipleDatasetChart.getJFreeChart ( )

Returns the JFreeChart variable associated with this chart.

Returns
the associated JFreeChart variable.

Definition at line 115 of file MultipleDatasetChart.java.

◆ getList()

ArrayList< SSJXYSeriesCollection > umontreal.ssj.charts.MultipleDatasetChart.getList ( )

Returns the dataset list.

Returns
dataset list.

Definition at line 260 of file MultipleDatasetChart.java.

◆ getTitle()

String umontreal.ssj.charts.MultipleDatasetChart.getTitle ( )

Gets the current chart title.

Returns
Chart title.

Definition at line 142 of file MultipleDatasetChart.java.

◆ getXAxis()

Axis umontreal.ssj.charts.MultipleDatasetChart.getXAxis ( )

Returns the chart’s domain axis ( \(x\)-axis) object.

Returns
chart’s domain axis ( \(x\)-axis) object.

Definition at line 124 of file MultipleDatasetChart.java.

◆ getYAxis()

Axis umontreal.ssj.charts.MultipleDatasetChart.getYAxis ( )

Returns the chart’s range axis ( \(y\)-axis) object.

Returns
chart’s range axis ( \(y\)-axis) object.

Definition at line 133 of file MultipleDatasetChart.java.

◆ set() [1/2]

void umontreal.ssj.charts.MultipleDatasetChart.set ( int datasetNum,
SSJXYSeriesCollection dataset )

Replaces the element at the specified position in the dataset list with the specified element.

Parameters
datasetNumposition in the dataset list.
datasetdataset list.

Definition at line 249 of file MultipleDatasetChart.java.

◆ set() [2/2]

void umontreal.ssj.charts.MultipleDatasetChart.set ( SSJXYSeriesCollection dataset)

Sets the primary dataset for the plot, replacing the existing dataset if there is one.

Parameters
datasetthe new primary dataset.

Definition at line 226 of file MultipleDatasetChart.java.

◆ setAutoRange()

void umontreal.ssj.charts.MultipleDatasetChart.setAutoRange ( )

Sets chart range to automatic values.

Definition at line 159 of file MultipleDatasetChart.java.

◆ setLatexDocFlag()

void umontreal.ssj.charts.MultipleDatasetChart.setLatexDocFlag ( boolean flag)

Same as in XYChart.

Definition at line 396 of file MultipleDatasetChart.java.

◆ setManualRange()

void umontreal.ssj.charts.MultipleDatasetChart.setManualRange ( double[] axisRange)

Sets new \(x\)-axis and \(y\)-axis bounds, with format: axisRange = [xmin, xmax, ymin, ymax].

Parameters
axisRangenew axis ranges.

Definition at line 183 of file MultipleDatasetChart.java.

◆ setTitle()

void umontreal.ssj.charts.MultipleDatasetChart.setTitle ( String title)

Sets a title to the chart.

This title will appear on the chart displayed by method view.

Parameters
titlechart title.

Definition at line 152 of file MultipleDatasetChart.java.

◆ toLatex()

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

Same as in XYChart.

Parameters
widthChart’s width in centimeters.
heightChart’s height in centimeters.

Definition at line 322 of file MultipleDatasetChart.java.

◆ view()

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

Definition at line 273 of file MultipleDatasetChart.java.


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