Class XYListSeriesCollection
- java.lang.Object
-
- umontreal.iro.lecuyer.charts.SSJXYSeriesCollection
-
- umontreal.iro.lecuyer.charts.XYListSeriesCollection
-
- Direct Known Subclasses:
- YListSeriesCollection
public class XYListSeriesCollection extends SSJXYSeriesCollection
This class extendsSSJXYSeriesCollection. 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
Constructors Constructor and Description 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(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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intadd(double[][] data)Adds a data series into the series collection.intadd(double[][] data, int numPoints)Adds data series into the series collection.intadd(double[] x, double[] y)Adds a data series into the series collection.intadd(double[] x, double[] y, int numPoints)Adds a data series into the series collection.intadd(DoubleArrayList data)Adds a data series into the series collection.voiddisableAutoCompletion()Disables auto completion option.voidenableAutoCompletion()Enables the auto completion option.java.lang.StringgetDashPattern(int series)Returns the dash pattern associated with the seriesth data series.java.lang.StringgetMarksType(int series)Returns the mark type associated with the seriesth data series.java.lang.StringgetName(int series)Gets the current name of the selected series.java.lang.StringgetPlotStyle(int series)Gets the current plot style for the selected series.voidsetDashPattern(int series, java.lang.String dashPattern)Selects dash pattern for a data series.voidsetMarksType(int series, java.lang.String marksType)Adds marks on points to a data series.voidsetName(int series, java.lang.String name)Sets the name of the selected series.voidsetPlotStyle(int series, java.lang.String plotStyle)Selects the plot style for a given series.java.lang.StringtoLatex(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
-
-
-
-
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(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). EachDoubleArrayListvariable 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(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 java.lang.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, java.lang.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 java.lang.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, java.lang.String marksType)Adds marks on points to a data series. It is possible to use all the marks provided by the TikZ package, some of which are *, + and x. A blank character, used by default, will disable marks. The PGF/TikZ documentation provides more information about placing marks on plots.- Parameters:
series- series index.marksType- mark type.
-
getDashPattern
public java.lang.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, java.lang.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 and loosely dashed.- Parameters:
series- series index.dashPattern- dash style.
-
getPlotStyle
public java.lang.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, java.lang.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 java.lang.String toLatex(double XScale, double YScale, double XShift, double YShift, double xmin, double xmax, double ymin, double ymax)Description copied from class:SSJXYSeriesCollectionFormats 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:
toLatexin classSSJXYSeriesCollection- 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG