public class IlvCyclicDataSet extends IlvDefaultDataSet
When new values are added, the oldest values are removed accordingly.
The data set can be managed in three modes:
LINEAR_MODE: In this mode the data indices form a
potentially infinite sequence 0, 1, 2, ... When a new data point
is added, a new data index i becomes valid, and the value
at data index i - bufferSize is dropped.ROTATE_MODE: In this mode the data indices stay between
0 and bufferSize - 1. When a new data point is added, the
values are shifted, from data index 1 to data index 0, from
data index 2 to data index 1, and so on. The new value is stored at
data index bufferSize - 1.CYCLIC_MODE: In this mode the data indices stay between
0 and bufferSize - 1 as well. When a new data point is added,
it overwrites a value at an index; this overwrite index cycles through
the values 0 to bufferSize - 1.LINEAR_MODE and ROTATE_MODE are similar in the
sense that the resulting charts look the same in either mode. However,
LINEAR_MODE has a better performance as it allows incremental
repainting of real-time charts.| Modifier and Type | Field and Description |
|---|---|
static int |
CYCLIC_MODE
In this mode the data indices stay between 0 and bufferSize - 1.
|
static int |
LINEAR_MODE
In this mode, the data indices form a potentially infinite sequence
0, 1, 2, ...
|
static int |
ROTATE_MODE
In this mode, the data indices stay between 0 and bufferSize - 1.
|
labels, xValues, yValuesDEFAULT_UNDEF_VALUE| Constructor and Description |
|---|
IlvCyclicDataSet(String name,
int bufferSize,
boolean useXValues)
Deprecated.
Please use the four-argument constructor instead, choosing an
appropriate data management mode.
|
IlvCyclicDataSet(String name,
int bufferSize,
int mode,
boolean useXValues)
Creates a new cyclic data set.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addData(double x,
double y,
String label)
Adds a data point at the end of this data set.
|
int |
getBufferSize()
Returns the number of data points that can be stored in this data set
before a wrap-around occurs.
|
IlvDataPoints |
getData()
Returns all the data points held by this data set.
|
IlvDataPoints |
getDataBetween(int iMin,
int iMax)
Returns the data points between the two specified indices.
|
int |
getDataCount()
Returns the number of data points held by this data set.
|
IlvDataPoints |
getDataInside(IlvDataWindow window,
int adjCount,
boolean continuous)
Returns the data points inside the specified data window.
|
String |
getDataLabel(int idx)
Returns the label associated with the data point at the specified index.
|
double |
getMinimumXDifference()
Returns the minimum positive difference among adjacent X values in the
sequence of X values, sorted into ascending order.
|
int |
getMode()
Returns the data management mode of this data set.
|
double |
getXData(int idx)
Returns the x-value of the data point at the specified index.
|
double |
getYData(int idx)
Returns the y-value of the data point at the specified index.
|
boolean |
isXValuesSorted()
Indicates whether the X values held by this data set are sorted
in ascending order.
|
void |
setData(double[] xValues,
double[] yValues,
int count)
Initializes the contents of this data set with a copy of the specified
values.
|
void |
setData(int idx,
double x,
double y)
Modifies the data point at the specified index.
|
void |
setDataLabel(int idx,
String label)
Sets a data point label.
|
void |
setDataLabels(String[] labels)
Specifies the data point labels.
|
void |
useXValues(boolean b)
Specifies whether x-values should be stored in the data set.
|
addData, create, dataAdded, dataChanged, getDataLabels, getXValues, getYValues, isEditable, isUsingXValues, setXData, setXValues, setYData, setYValuesaddDataSetListener, computeLimits, computeMinimumXDifference, endBatch, fireDataAddedEvent, fireDataChangedEvent, fireDataSetContentsEvent, fireDataSetPropertyEvent, getDataInside, getName, getProperty, getUndefValue, getXRange, getXRange, getYRange, getYRange, invalidateLimits, invalidateLimits, invalidateLimits, isBatched, isXRangeIncludingUndefinedPoints, putProperty, removeDataSetListener, setLimitsValid, setName, setUndefValue, setXRangeIncludingUndefinedPoints, startBatch, toStringpublic static final int LINEAR_MODE
public static final int ROTATE_MODE
public static final int CYCLIC_MODE
@Deprecated public IlvCyclicDataSet(String name, int bufferSize, boolean useXValues)
ROTATE_MODE.name - The name of this data set.bufferSize - The size of the buffer.useXValues - A boolean value indicating whether x-values should
be stored in the data set, or generated according to the data point
indices.public IlvCyclicDataSet(String name, int bufferSize, int mode, boolean useXValues)
name - The name of this data set.bufferSize - The size of the buffer.mode - The data management mode. One of LINEAR_MODE,
ROTATE_MODE, CYCLIC_MODE.useXValues - A boolean value indicating whether x-values should
be stored in the data set, or generated according to the data point
indices.public int getDataCount()
getDataCount in interface IlvDataSetgetDataCount in class IlvDefaultDataSetpublic double getXData(int idx)
Note: if x-values are not stored, the returned value takes into account the number of cycles since the creation of the data set as well as the index of the data point.
getXData in interface IlvDataSetgetXData in class IlvDefaultDataSetidx - a data point index, >= 0, < getDataCount()public double getYData(int idx)
getYData in interface IlvDataSetgetYData in class IlvDefaultDataSetidx - a data point index, >= 0, < getDataCount()public String getDataLabel(int idx)
getDataLabel in interface IlvDataSetgetDataLabel in class IlvDefaultDataSetidx - a data point index, >= 0, < getDataCount()IlvDefaultDataSet.setDataLabels(java.lang.String[])public void setData(int idx,
double x,
double y)
setData in interface IlvDataSetsetData in class IlvDefaultDataSetidx - The index of the considered data point.x - The new x-value of the data point. This value is not taken into
account if the data set does not store x-values.y - The new y-value of the data point.IlvDefaultDataSet.isUsingXValues()public void addData(double x,
double y,
String label)
IlvDefaultDataSet.create(double[][], int, java.lang.String[], java.lang.String[]) method.addData in class IlvDefaultDataSetx - The x-value of the new data point. This value is not taken into
account if the data set does not store x-values.y - The y-value of the new data point.label - The label of the new data point.IlvDefaultDataSet.isUsingXValues(),
IlvDefaultDataSet.setDataLabels(java.lang.String[])public boolean isXValuesSorted()
isXValuesSorted in interface IlvDataSetisXValuesSorted in class IlvDefaultDataSetpublic double getMinimumXDifference()
Note: This method may be slow, depending on the other characteristics of
this data set. If you want to provide this information, instead of having
it computed each time it is needed, you can do so by calling
IlvDataSetProperty.setCategory(IlvDataSet, Double).
getMinimumXDifference in class IlvAbstractDataSetpublic IlvDataPoints getData()
For optimal performance, you should dispose() the resulting
object when done with it.
getData in interface IlvDataSetgetData in class IlvAbstractDataSetIlvDataPoints representing all points.
May return null if there are no such points.public IlvDataPoints getDataBetween(int iMin, int iMax)
For optimal performance, you should dispose() the resulting
object when done with it.
getDataBetween in interface IlvDataSetgetDataBetween in class IlvAbstractDataSetiMin - a data point index, >= 0, < getDataCount()iMax - a data point index, >= iMin, < getDataCount()IlvDataPoints representing the requested points.
May return null if there are no such points.
Returns null if iMin > iMax.public IlvDataPoints getDataInside(IlvDataWindow window, int adjCount, boolean continuous)
For optimal performance, you should dispose() the resulting
object when done with it.
getDataInside in interface IlvDataSetgetDataInside in class IlvAbstractDataSetwindow - The considered data window.adjCount - The number of data points immediately outside the
data window that must be returned by the request. If this parameter
is equal to 0, only the points within the data window are
returned. A value that is not equal to 0 is only relevant
when requesting a continuous set of points (see the meaning of the
continuous parameter).continuous - Indicates whether the indices of the returned point
set may have holes or not. If false, only data points
inside the given data window are returned, and possibly
adjCount data points on each side, even if the resulting
set of indices has holes, like for example
[1 2 4 7]. If true, a set of data points
with continuous indices is returned, even if some of them lie outside
the given data window, for example [1 2 3 4 5 6 7].IlvDataPoints representing the requested points.
May return null if there are no such points.public void useXValues(boolean b)
useXValues in class IlvDefaultDataSetIlvDefaultDataSet.isUsingXValues()public void setData(double[] xValues,
double[] yValues,
int count)
DataSetContentsEvent.FULL_UPDATE event.setData in class IlvDefaultDataSetxValues - an array of at least count elements, or
nullyValues - an array of at least count elements, or
(only if count == 0) nullcount - The number of relevant elements in the xValues and
yValues arrays.public void setDataLabel(int idx,
String label)
setDataLabel in class IlvDefaultDataSetpublic void setDataLabels(String[] labels)
setDataLabels in class IlvDefaultDataSetpublic final int getBufferSize()
public final int getMode()
LINEAR_MODE, ROTATE_MODE,
CYCLIC_MODE.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.