SSJ
V. 2.6.

umontreal.iro.lecuyer.charts
Class XYListSeriesCollection

java.lang.Object
  extended by umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
      extended by umontreal.iro.lecuyer.charts.XYListSeriesCollection
Direct Known Subclasses:
YListSeriesCollection

public class XYListSeriesCollection
extends SSJXYSeriesCollection

This class extends 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 Summary
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.
XYListSeriesCollection(double[][] data, int numPoints)
          Creates a new XYListSeriesCollection instance with default parameters and given points data.
XYListSeriesCollection(cern.colt.list.DoubleArrayList... data)
          Creates a new XYListSeriesCollection instance with default parameters and given data.
XYListSeriesCollection(XYSeriesCollection data)
          Creates a new XYListSeriesCollection instance with default parameters and given data series.
 
Method Summary
 int add(double[][] data)
          Adds a data series into the series collection.
 int add(double[][] data, int numPoints)
          Adds data series into the series collection.
 int add(double[] x, double[] y)
          Adds a data series into the series collection.
 int add(double[] x, double[] y, int numPoints)
          Adds a data series into the series collection.
 int add(cern.colt.list.DoubleArrayList data)
          Adds a data series into the series collection.
 void disableAutoCompletion()
          Disables auto completion option.
 void enableAutoCompletion()
          Enables the auto completion option.
 String getDashPattern(int series)
          Returns the dash pattern associated with the seriesth data series.
 String getMarksType(int series)
          Returns the mark type associated with the seriesth data series.
 String getName(int series)
          Gets the current name of the selected series.
 String getPlotStyle(int series)
          Gets the current plot style for the selected series.
 void setDashPattern(int series, String dashPattern)
          Selects dash pattern for a data series.
 void setMarksType(int series, String marksType)
          Adds marks on the points of a data series.
 void setName(int series, String name)
          Sets the name of the selected series.
 void setPlotStyle(int series, String plotStyle)
          Selects the plot style for a given series.
 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.
 
Methods inherited from class umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
getColor, getDomainBounds, getRangeBounds, getRenderer, getSeriesCollection, getX, getY, setColor, setRenderer, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XYListSeriesCollection

public XYListSeriesCollection()
Creates a new XYListSeriesCollection instance with an empty dataset.


XYListSeriesCollection

public 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:
data - series of point sets.

XYListSeriesCollection

public 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:
data - series of point sets.
numPoints - Number of points to plot

XYListSeriesCollection

public XYListSeriesCollection(cern.colt.list.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:
data - series of point sets.

XYListSeriesCollection

public 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:
data - series of point sets.
Method Detail

add

public 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 - xi coordinates.
y - yi coordinates.
Returns:
Integer that represent the new point set's position in the JFreeChart XYSeriesCollection object.

add

public 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 - xi coordinates.
y - yi coordinates.
numPoints - Number of points to add
Returns:
Integer that represent the new point set's position in the JFreeChart XYSeriesCollection object.

add

public 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:
data - input data.
Returns:
Integer that represent the number of point sets added to the current dataset.

add

public 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:
data - input data.
numPoints - Number of points to add for each new series
Returns:
Integer that represent the number of point sets added to the current dataset.

add

public int add(cern.colt.list.DoubleArrayList data)
Adds a data series into the series collection. The input format of data is described in constructor XYListSeriesCollection (DoubleArrayList... data).

Parameters:
data - data series.
Returns:
Integer that represent the new point set's position in the JFreeChart XYSeriesCollection object.

getName

public String getName(int series)
Gets the current name of the selected series.

Parameters:
series - series index.
Returns:
current name of the series.

setName

public void setName(int series,
                    String name)
Sets the name of the selected series.

Parameters:
series - series index.
name - point set new name.

enableAutoCompletion

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


disableAutoCompletion

public void disableAutoCompletion()
Disables auto completion option. Default status is disabled.


getMarksType

public String getMarksType(int series)
Returns the mark type associated with the seriesth data series.

Parameters:
series - series index.
Returns:
mark type.

setMarksType

public 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 ``*'', ``+'' and ``x''. A blank character, used by default, disables marks. The PGF/TikZ documentation provides more information about placing marks on plots.

Parameters:
series - series index.
marksType - mark type.

getDashPattern

public String getDashPattern(int series)
Returns the dash pattern associated with the seriesth data series.

Parameters:
series - series index.
Returns:
mark type.

setDashPattern

public 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: ``solid'', ``dotted'', ``densely dotted'', ``loosely dotted'', ``dashed'', ``densely dashed'', ``loosely dashed'' and ``only marks''. If ``only marks" is chosen, then method setMarksType must be called to choose the marks (which are blank by default).

Parameters:
series - series index.
dashPattern - dash style.

getPlotStyle

public String getPlotStyle(int series)
Gets the current plot style for the selected series.

Parameters:
series - series index.
Returns:
current plot style.

setPlotStyle

public 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: ``sharp plot'', which joins points with straight lines, ``smooth'', which joins points with a smoothing curve, ``only marks'', which does not join points, etc. The PGF/TikZ documentation provides more information about smooth plots, sharp plots and comb plots.

Parameters:
series - series index.
plotStyle - plot style.

toLatex

public String toLatex(double XScale,
                      double YScale,
                      double XShift,
                      double YShift,
                      double xmin,
                      double xmax,
                      double ymin,
                      double ymax)
Description copied from class: SSJXYSeriesCollection
Formats and returns a string containing a LATEX-compatible source code which represents this data series collection. The original datasets are shifted and scaled with the XShift, YShift, XScale and YScale parameters. xmin, xmax, ymin and ymax represent the chart bounds.

Specified by:
toLatex in class SSJXYSeriesCollection
Parameters:
XScale - Domain original data scale.
YScale - Range original data scale.
XShift - Domain original data shift value.
YShift - Range original data shift value.
xmin - Domain min bound.
xmax - Domain nax bound.
ymin - Range min bound.
ymax - Range nax bound.
Returns:
TikZ code.

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.