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

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

Collaboration diagram for MultipleDatasetChart:
[legend]

Public Member Functions

 MultipleDatasetChart ()
 Initializes a new MultipleDatasetChart.
 
 MultipleDatasetChart (String title, String XLabel, String YLabel)
 Initializes a new MultipleDatasetChart instance. More...
 
JFreeChart getJFreeChart ()
 Returns the JFreeChart variable 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...
 
String getTitle ()
 Gets the current chart title. More...
 
void setTitle (String title)
 Sets a title to the chart. More...
 
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]. More...
 
int add (SSJXYSeriesCollection dataset)
 Adds a new dataset to the chart at the end of the list and returns its position. More...
 
SSJXYSeriesCollection get ()
 Gets the primary dataset. More...
 
void set (SSJXYSeriesCollection dataset)
 Sets the primary dataset for the plot, replacing the existing dataset if there is one. More...
 
SSJXYSeriesCollection get (int datasetNum)
 Gets the element at the specified position in the dataset list. More...
 
void set (int datasetNum, SSJXYSeriesCollection dataset)
 Replaces the element at the specified position in the dataset list with the specified element. More...
 
ArrayList< SSJXYSeriesCollectiongetList ()
 Returns the dataset list. More...
 
JFrame view (int width, int height)
 Displays chart on the screen using Swing. More...
 
void enableGrid (double xstep, double ystep)
 Puts grid on the background. More...
 
void disableGrid ()
 Disables the background grid.
 

Protected Attributes

ArrayList< SSJXYSeriesCollectiondatasetList
 
Axis XAxis
 
Axis YAxis
 
JFreeChart chart
 
boolean latexDocFlag = true
 
boolean autoRange = true
 
double [] manualRange
 
boolean grid = false
 
double xstepGrid
 
double ystepGrid
 

LaTeX-specific method

String toLatex (double width, double height)
 Same as in XYChart. More...
 
void setLatexDocFlag (boolean flag)
 Same as in XYChart.
 
double computeXScale (double position)
 
double computeYScale (double position)
 
double computeScale (double[] bounds)
 

Detailed Description

Provides tools to plot many datasets on the same chart.

This class is mainly used to draw plots with different styles. Class umontreal.ssj.charts.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.

Constructor & Destructor Documentation

◆ 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.

Member Function Documentation

◆ add()

int 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.

◆ enableGrid()

void 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.

◆ get() [1/2]

Gets the primary dataset.

Returns
dataset.

◆ get() [2/2]

SSJXYSeriesCollection get ( int  datasetNum)

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

Parameters
datasetNumposition in the dataset list.
Returns
dataset.

◆ getJFreeChart()

JFreeChart getJFreeChart ( )

Returns the JFreeChart variable associated with this chart.

Returns
the associated JFreeChart variable.

◆ getList()

ArrayList<SSJXYSeriesCollection> getList ( )

Returns the dataset list.

Returns
dataset list.

◆ getTitle()

String getTitle ( )

Gets the current chart title.

Returns
Chart title.

◆ getXAxis()

Axis getXAxis ( )

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

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

◆ getYAxis()

Axis getYAxis ( )

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

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

◆ set() [1/2]

void set ( SSJXYSeriesCollection  dataset)

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

Parameters
datasetthe new primary dataset.

◆ set() [2/2]

void 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.

◆ setManualRange()

void setManualRange ( double []  axisRange)

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

Parameters
axisRangenew axis ranges.

◆ setTitle()

void setTitle ( String  title)

Sets a title to the chart.

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

Parameters
titlechart title.

◆ toLatex()

String toLatex ( double  width,
double  height 
)

Same as in XYChart.

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

◆ 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.

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