public class XYSeries extends Series implements java.lang.Cloneable, java.io.Serializable
null
to represent missing values.Modifier and Type | Field and Description |
---|---|
protected java.util.List |
data
Storage for the data items in the series.
|
Constructor and Description |
---|
XYSeries(java.lang.Comparable key)
Creates a new empty series.
|
XYSeries(java.lang.Comparable key,
boolean autoSort)
Constructs a new empty series, with the auto-sort flag set as requested,
and duplicate values allowed.
|
XYSeries(java.lang.Comparable key,
boolean autoSort,
boolean allowDuplicateXValues)
Constructs a new xy-series that contains no data.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double x,
double y)
Adds a data item to the series and sends a
SeriesChangeEvent to
all registered listeners. |
void |
add(double x,
double y,
boolean notify)
Adds a data item to the series and, if requested, sends a
SeriesChangeEvent to all registered listeners. |
void |
add(double x,
java.lang.Number y)
Adds a data item to the series and sends a
SeriesChangeEvent to
all registered listeners. |
void |
add(double x,
java.lang.Number y,
boolean notify)
Adds a data item to the series and, if requested, sends a
SeriesChangeEvent to all registered listeners. |
void |
add(java.lang.Number x,
java.lang.Number y)
Adds a new data item to the series (in the correct position if the
autoSort flag is set for the series) and sends a
SeriesChangeEvent to all registered listeners. |
void |
add(java.lang.Number x,
java.lang.Number y,
boolean notify)
Adds new data to the series and, if requested, sends a
SeriesChangeEvent to all registered listeners. |
void |
add(XYDataItem item)
Adds a data item to the series and sends a
SeriesChangeEvent to
all registered listeners. |
void |
add(XYDataItem item,
boolean notify)
Adds a data item to the series and, if requested, sends a
SeriesChangeEvent to all registered listeners. |
XYDataItem |
addOrUpdate(double x,
double y)
Adds or updates an item in the series and sends a
SeriesChangeEvent to all registered listeners. |
XYDataItem |
addOrUpdate(java.lang.Number x,
java.lang.Number y)
Adds or updates an item in the series and sends a
SeriesChangeEvent to all registered listeners. |
XYDataItem |
addOrUpdate(XYDataItem item)
Adds or updates an item in the series and sends a
SeriesChangeEvent to all registered listeners. |
void |
clear()
Removes all data items from the series and sends a
SeriesChangeEvent to all registered listeners. |
java.lang.Object |
clone()
Returns a clone of the series.
|
XYSeries |
createCopy(int start,
int end)
Creates a new series by copying a subset of the data in this time series.
|
void |
delete(int start,
int end)
Deletes a range of items from the series and sends a
SeriesChangeEvent to all registered listeners. |
boolean |
equals(java.lang.Object obj)
Tests this series for equality with an arbitrary object.
|
boolean |
getAllowDuplicateXValues()
Returns a flag that controls whether duplicate x-values are allowed.
|
boolean |
getAutoSort()
Returns the flag that controls whether the items in the series are
automatically sorted.
|
XYDataItem |
getDataItem(int index)
Return the data item with the specified index.
|
int |
getItemCount()
Returns the number of items in the series.
|
java.util.List |
getItems()
Returns the list of data items for the series (the list contains
XYDataItem objects and is unmodifiable). |
int |
getMaximumItemCount()
Returns the maximum number of items that will be retained in the series.
|
double |
getMaxX()
Returns the largest x-value in the series, ignoring any Double.NaN
values.
|
double |
getMaxY()
Returns the largest y-value in the series, ignoring any Double.NaN
values.
|
double |
getMinX()
Returns the smallest x-value in the series, ignoring any Double.NaN
values.
|
double |
getMinY()
Returns the smallest y-value in the series, ignoring any null and
Double.NaN values.
|
java.lang.Number |
getX(int index)
Returns the x-value at the specified index.
|
java.lang.Number |
getY(int index)
Returns the y-value at the specified index.
|
int |
hashCode()
Returns a hash code.
|
int |
indexOf(java.lang.Number x)
Returns the index of the item with the specified x-value, or a negative
index if the series does not contain an item with that x-value.
|
XYDataItem |
remove(int index)
Removes the item at the specified index and sends a
SeriesChangeEvent to all registered listeners. |
XYDataItem |
remove(java.lang.Number x)
Removes an item with the specified x-value and sends a
SeriesChangeEvent to all registered listeners. |
void |
setMaximumItemCount(int maximum)
Sets the maximum number of items that will be retained in the series.
|
double[][] |
toArray()
Returns a new array containing the x and y values from this series.
|
void |
update(int index,
java.lang.Number y)
Deprecated.
Renamed
updateByIndex(int, Number) to avoid
confusion with the update(Number, Number) method. |
void |
update(java.lang.Number x,
java.lang.Number y)
Updates an item in the series.
|
void |
updateByIndex(int index,
java.lang.Number y)
Updates the value of an item in the series and sends a
SeriesChangeEvent to all registered listeners. |
addChangeListener, addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireSeriesChanged, fireVetoableChange, getDescription, getKey, getNotify, isEmpty, notifyListeners, removeChangeListener, removePropertyChangeListener, removeVetoableChangeListener, setDescription, setKey, setNotify
protected java.util.List data
public XYSeries(java.lang.Comparable key)
key
- the series key (null
not permitted).public XYSeries(java.lang.Comparable key, boolean autoSort)
key
- the series key (null
not permitted).autoSort
- a flag that controls whether or not the items in the
series are sorted.public XYSeries(java.lang.Comparable key, boolean autoSort, boolean allowDuplicateXValues)
key
- the series key (null
not permitted).autoSort
- a flag that controls whether or not the items in the
series are sorted.allowDuplicateXValues
- a flag that controls whether duplicate
x-values are allowed.public double getMinX()
getMaxX()
public double getMaxX()
getMinX()
public double getMinY()
getMaxY()
public double getMaxY()
getMinY()
public boolean getAutoSort()
public boolean getAllowDuplicateXValues()
public int getItemCount()
getItemCount
in class Series
getItems()
public java.util.List getItems()
XYDataItem
objects and is unmodifiable).public int getMaximumItemCount()
Integer.MAX_VALUE
.setMaximumItemCount(int)
public void setMaximumItemCount(int maximum)
Typically this value is set before the series is populated with data,
but if it is applied later, it may cause some items to be removed from
the series (in which case a SeriesChangeEvent
will be sent to
all registered listeners).
maximum
- the maximum number of items for the series.public void add(XYDataItem item)
SeriesChangeEvent
to
all registered listeners.item
- the (x, y) item (null
not permitted).public void add(double x, double y)
SeriesChangeEvent
to
all registered listeners.x
- the x value.y
- the y value.public void add(double x, double y, boolean notify)
SeriesChangeEvent
to all registered listeners.x
- the x value.y
- the y value.notify
- a flag that controls whether or not a
SeriesChangeEvent
is sent to all registered
listeners.public void add(double x, java.lang.Number y)
SeriesChangeEvent
to
all registered listeners. The unusual pairing of parameter types is to
make it easier to add null
y-values.x
- the x value.y
- the y value (null
permitted).public void add(double x, java.lang.Number y, boolean notify)
SeriesChangeEvent
to all registered listeners. The unusual
pairing of parameter types is to make it easier to add null y-values.x
- the x value.y
- the y value (null
permitted).notify
- a flag that controls whether or not a
SeriesChangeEvent
is sent to all registered
listeners.public void add(java.lang.Number x, java.lang.Number y)
autoSort
flag is set for the series) and sends a
SeriesChangeEvent
to all registered listeners.
Throws an exception if the x-value is a duplicate AND the allowDuplicateXValues flag is false.
x
- the x-value (null
not permitted).y
- the y-value (null
permitted).SeriesException
- if the x-value is a duplicate and the
allowDuplicateXValues
flag is not set for this series.public void add(java.lang.Number x, java.lang.Number y, boolean notify)
SeriesChangeEvent
to all registered listeners.
Throws an exception if the x-value is a duplicate AND the allowDuplicateXValues flag is false.
x
- the x-value (null
not permitted).y
- the y-value (null
permitted).notify
- a flag the controls whether or not a
SeriesChangeEvent
is sent to all registered
listeners.public void add(XYDataItem item, boolean notify)
SeriesChangeEvent
to all registered listeners.item
- the (x, y) item (null
not permitted).notify
- a flag that controls whether or not a
SeriesChangeEvent
is sent to all registered
listeners.public void delete(int start, int end)
SeriesChangeEvent
to all registered listeners.start
- the start index (zero-based).end
- the end index (zero-based).public XYDataItem remove(int index)
SeriesChangeEvent
to all registered listeners.index
- the index.public XYDataItem remove(java.lang.Number x)
SeriesChangeEvent
to all registered listeners. Note that when
a series permits multiple items with the same x-value, this method
could remove any one of the items with that x-value.x
- the x-value.public void clear()
SeriesChangeEvent
to all registered listeners.public XYDataItem getDataItem(int index)
index
- the index.public java.lang.Number getX(int index)
index
- the index (zero-based).null
).public java.lang.Number getY(int index)
index
- the index (zero-based).null
).public void update(int index, java.lang.Number y)
updateByIndex(int, Number)
to avoid
confusion with the update(Number, Number)
method.SeriesChangeEvent
to all registered listeners.index
- the item (zero based index).y
- the new value (null
permitted).public void updateByIndex(int index, java.lang.Number y)
SeriesChangeEvent
to all registered listeners.index
- the item (zero based index).y
- the new value (null
permitted).public void update(java.lang.Number x, java.lang.Number y)
x
- the x-value (null
not permitted).y
- the y-value (null
permitted).SeriesException
- if there is no existing item with the specified
x-value.public XYDataItem addOrUpdate(double x, double y)
SeriesChangeEvent
to all registered listeners.x
- the x-value.y
- the y-value.public XYDataItem addOrUpdate(java.lang.Number x, java.lang.Number y)
SeriesChangeEvent
to all registered listeners.x
- the x-value (null
not permitted).y
- the y-value (null
permitted).null
if no
item was overwritten.public XYDataItem addOrUpdate(XYDataItem item)
SeriesChangeEvent
to all registered listeners.item
- the data item (null
not permitted).null
if no
item was overwritten.public int indexOf(java.lang.Number x)
x
- the x-value (null
not permitted).public double[][] toArray()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public XYSeries createCopy(int start, int end) throws java.lang.CloneNotSupportedException
start
- the index of the first item to copy.end
- the index of the last item to copy.java.lang.CloneNotSupportedException
- if there is a cloning problem.public boolean equals(java.lang.Object obj)