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

This class extends umontreal.ssj.charts.SSJXYSeriesCollection. More...

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

Public Member Functions

 XYListSeriesCollection ()
 Creates a new XYListSeriesCollection instance with an empty dataset.
 
 XYListSeriesCollection (double[][]... data)
 Creates a new XYListSeriesCollection instance with default parameters and given data series. More...
 
 XYListSeriesCollection (double[][] data, int numPoints)
 Creates a new XYListSeriesCollection instance with default parameters and given points data. More...
 
 XYListSeriesCollection (DoubleArrayList... data)
 Creates a new XYListSeriesCollection instance with default parameters and given data. More...
 
 XYListSeriesCollection (XYSeriesCollection data)
 Creates a new XYListSeriesCollection instance with default parameters and given data series. More...
 
Data control methods
int add (double[] x, double[] y)
 Adds a data series into the series collection. More...
 
int add (double[] x, double[] y, int numPoints)
 Adds a data series into the series collection. More...
 
int add (double[][] data)
 Adds a data series into the series collection. More...
 
int add (double[][] data, int numPoints)
 Adds data series into the series collection. More...
 
int add (DoubleArrayList data)
 Adds a data series into the series collection. More...
 
String getName (int series)
 Gets the current name of the selected series. More...
 
void setName (int series, String name)
 Sets the name of the selected series. More...
 
- Public Member Functions inherited from SSJXYSeriesCollection
double getX (int series, int index)
 Returns the \(x\)-value at the specified index in the specified series. More...
 
double getY (int series, int index)
 Returns the \(y\)-value at the specified index in the specified series. More...
 
XYDataset getSeriesCollection ()
 Returns the XYDataset object associated with the current object. More...
 
double [] getDomainBounds ()
 Returns domain ( \(x\)-coordinates) min and max values. More...
 
double [] getRangeBounds ()
 Returns range ( \(y\)-coordinates) min and max values. More...
 
String toString ()
 Returns in a String all data contained in the current object. More...
 
XYItemRenderer getRenderer ()
 Returns the XYItemRenderer object associated with the current object. More...
 
void setRenderer (XYItemRenderer renderer)
 Sets the XYItemRenderer object associated with the current variable. More...
 
Color getColor (int series)
 Gets the current plotting color of the selected series. More...
 
void setColor (int series, Color color)
 Sets a new plotting color to the series \(series\). More...
 
abstract String toLatex (double XScale, double YScale, double XShift, double YShift, double xmin, double xmax, double ymin, double ymax)
 Formats and returns a string containing a LaTeX-compatible source code which represents this data series collection. More...
 

Protected Attributes

String [] marksType
 
String [] dashPattern
 
String [] plotStyle
 
- Protected Attributes inherited from SSJXYSeriesCollection
XYItemRenderer renderer
 
XYDataset seriesCollection
 

Rendering methods

void enableAutoCompletion ()
 Enables the auto completion option. More...
 
void disableAutoCompletion ()
 Disables auto completion option. More...
 
String getMarksType (int series)
 Returns the mark type associated with the seriesth data series. More...
 
void setMarksType (int series, String marksType)
 Adds marks on the points of a data series. More...
 
String getDashPattern (int series)
 Returns the dash pattern associated with the seriesth data series. More...
 
void setDashPattern (int series, String dashPattern)
 Selects dash pattern for a data series. More...
 
String getPlotStyle (int series)
 Gets the current plot style for the selected series. More...
 
void setPlotStyle (int series, String plotStyle)
 Selects the plot style for a given series. More...
 
String toLatex (double XScale, double YScale, double XShift, double YShift, double xmin, double xmax, double ymin, double ymax)
 

Additional Inherited Members

- Static Protected Member Functions inherited from SSJXYSeriesCollection
static String detectXColorClassic (Color color)
 Converts a java Color object into a friendly and readable LaTeX/xcolor string. More...
 
static Color getDefaultColor (int index)
 Gives the default color associated with a series. More...
 
static double max (double[] t)
 
static double min (double[] t)
 

Detailed Description

This class extends umontreal.ssj.charts.SSJXYSeriesCollection.

It stores data used in a XYLineChart or in other related charts. XYListSeriesCollection provides complementary tools to draw simple curves; for example, one may add or remove plots series and modify plot style. This class is linked with the JFreeChart XYSeriesCollection class to store data plots, and linked with the JFreeChart XYLineAndShapeRenderer to render the plot. Each series must contain enough points to plot a nice curve. It is recommended to use about 30 points. However, some rapidly varying functions may require many more points. This class can be used to draw scatter plots.

Constructor & Destructor Documentation

◆ XYListSeriesCollection() [1/4]

XYListSeriesCollection ( double...  data[][])

Creates a new XYListSeriesCollection instance with default parameters and given data series.

The input parameter data represents a set of plotting data.

For example, if one \(n\)-row matrix data1 is given as argument, then the first row data1 \([0]\) represents the \(x\)-coordinate vector, and every other row data1 \([i], i=1,…, n-1\), represents a \(y\)-coordinate set for the points. Therefore matrix data1 \([i][j]\), \(i=0,…, n-1\), corresponds to \(n-1\) curves, all with the same \(x\)-coordinates.

However, one may want to plot several curves with different \(x\)-coordinates. In that case, one should give the curves as matrices with two rows. For examples, if the argument data is made of three 2-row matrices data1, data2 and data3, then they represents three different curves, data* \([0]\) being the \(x\)-coordinates, and data* \([1]\) the \(y\)-coordinates of the curves.

However, we may also consider the sets of points above not as part of curves, but rather as several list of points.

Parameters
dataseries of point sets.

◆ XYListSeriesCollection() [2/4]

XYListSeriesCollection ( double  data[][],
int  numPoints 
)

Creates a new XYListSeriesCollection instance with default parameters and given points data.

If data is a \(n\)-row matrix, then the first row data \([0]\) represents the \(x\)-coordinate vector, and every other row data \([i], i=1,…, n-1\), represents a \(y\)-coordinate set of points. Therefore, if the points represents curves to be plotted, data \([i][ ]\), \(i=0,…, n-1\), corresponds to \(n-1\) curves, all with the same \(x\)-coordinates. Only the first numPoints of data will be considered for each of the set of points.

Parameters
dataseries of point sets.
numPointsNumber of points to plot

◆ XYListSeriesCollection() [3/4]

XYListSeriesCollection ( DoubleArrayList...  data)

Creates a new XYListSeriesCollection instance with default parameters and given data.

The input parameter represents a set of data plots, the constructor will count the occurrence number \(Y\) of each value \(X\) in the DoubleArrayList, and plot the point \((X, Y)\). Each DoubleArrayList variable corresponds to a curve on the chart.

Parameters
dataseries of point sets.

◆ XYListSeriesCollection() [4/4]

XYListSeriesCollection ( XYSeriesCollection  data)

Creates a new XYListSeriesCollection instance with default parameters and given data series.

The input parameter represents a set of plotting data. Each series of the given collection corresponds to a curve on the plot.

Parameters
dataseries of point sets.

Member Function Documentation

◆ add() [1/5]

int add ( double []  x,
double []  y 
)

Adds a data series into the series collection.

Vector x represents the \(x\)-coordinates and vector y represents the \(y\)-coordinates of the series.

Parameters
x\(x_i\) coordinates.
y\(y_i\) coordinates.
Returns
Integer that represent the new point set’s position in the JFreeChart XYSeriesCollection object.

◆ add() [2/5]

int add ( double []  x,
double []  y,
int  numPoints 
)

Adds a data series into the series collection.

Vector x represents the \(x\)-coordinates and vector y represents the \(y\)-coordinates of the series. Only the first numPoints of x and y will be added to the new series.

Parameters
x\(x_i\) coordinates.
y\(y_i\) coordinates.
numPointsNumber of points to add
Returns
Integer that represent the new point set’s position in the JFreeChart XYSeriesCollection object.

◆ add() [3/5]

int add ( double  data[][])

Adds a data series into the series collection.

The input format of data is described in constructor XYListSeriesCollection(double[][] data).

Parameters
datainput data.
Returns
Integer that represent the number of point sets added to the current dataset.

◆ add() [4/5]

int add ( double  data[][],
int  numPoints 
)

Adds data series into the series collection.

The input format of data is described in constructor XYListSeriesCollection(double[][] data). Only the first numPoints of data (the first numPoints columns of the matrix) will be added to each new series.

Parameters
datainput data.
numPointsNumber of points to add for each new series
Returns
Integer that represent the number of point sets added to the current dataset.

◆ add() [5/5]

int add ( DoubleArrayList  data)

Adds a data series into the series collection.

The input format of data is described in constructor XYListSeriesCollection (DoubleArrayList... data).

Parameters
datadata series.
Returns
Integer that represent the new point set’s position in the JFreeChart XYSeriesCollection object.

◆ disableAutoCompletion()

void disableAutoCompletion ( )

Disables auto completion option.

Default status is disabled.

◆ enableAutoCompletion()

void enableAutoCompletion ( )

Enables the auto completion option.

When this parameter is enabled, straight lines are used to approximate points on the chart bounds if the method isn’t able to display all points, because the user defined bounds are smaller than the most significant data point coordinate, for instance. It does not extrapolate the point sets, but simply estimates point coordinates on the curve at bound positions for a better visual rendering.

◆ getDashPattern()

String getDashPattern ( int  series)

Returns the dash pattern associated with the seriesth data series.

Parameters
seriesseries index.
Returns
mark type.

◆ getMarksType()

String getMarksType ( int  series)

Returns the mark type associated with the seriesth data series.

Parameters
seriesseries index.
Returns
mark type.

◆ getName()

String getName ( int  series)

Gets the current name of the selected series.

Parameters
seriesseries index.
Returns
current name of the series.

◆ getPlotStyle()

String getPlotStyle ( int  series)

Gets the current plot style for the selected series.

Parameters
seriesseries index.
Returns
current plot style.

◆ setDashPattern()

void setDashPattern ( int  series,
String  dashPattern 
)

Selects dash pattern for a data series.

It is possible to use all the dash options provided by the TikZ package: "<tt>solid</tt>", "<tt>dotted</tt>", "<tt>densely dotted</tt>", "<tt>loosely dotted</tt>", "<tt>dashed</tt>", "<tt>densely dashed</tt>", "<tt>loosely dashed</tt>" and "<tt>only marks</tt>". If "<tt>only marks</tt>" is chosen, then method setMarksType must be called to choose the marks (which are blank by default).

Parameters
seriesseries index.
dashPatterndash style.

◆ setMarksType()

void setMarksType ( int  series,
String  marksType 
)

Adds marks on the points of a data series.

It is possible to use any of the marks provided by the TikZ package, some of which are "<tt>*</tt>", "<tt>+</tt>" and "<tt>x</tt>". A blank character, used by default, disables marks. The PGF/TikZ documentation provides more information about placing marks on plots.

Parameters
seriesseries index.
marksTypemark type.

◆ setName()

void setName ( int  series,
String  name 
)

Sets the name of the selected series.

Parameters
seriesseries index.
namepoint set new name.

◆ setPlotStyle()

void setPlotStyle ( int  series,
String  plotStyle 
)

Selects the plot style for a given series.

It is possible to use all the plot options provided by the TikZ package. Some of which are: "<tt>sharp plot</tt>", which joins points with straight lines, "<tt>smooth</tt>", which joins points with a smoothing curve, "<tt>only marks</tt>", which does not join points, etc. The PGF/TikZ documentation provides more information about smooth plots, sharp plots and comb plots.

Parameters
seriesseries index.
plotStyleplot style.

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