Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfree.data.xy
Class XYSeries  view XYSeries download XYSeries.java

java.lang.Object
  extended byorg.jfree.data.general.Series
      extended byorg.jfree.data.xy.XYSeries
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class XYSeries
extends org.jfree.data.general.Series
implements java.lang.Cloneable, java.io.Serializable

Represents a sequence of zero or more data items in the form (x, y). By default, items in the series will be sorted into ascending order by x-value, and duplicate x-values are permitted. Both the sorting and duplicate defaults can be changed in the constructor. Y-values can be null to represent missing values.


Field Summary
private  boolean allowDuplicateXValues
          A flag that controls whether or not duplicate x-values are allowed.
private  boolean autoSort
          A flag that controls whether the items are automatically sorted.
protected  java.util.List data
          Storage for the data items in the series.
private  int maximumItemCount
          The maximum number of items for the series.
(package private) static long serialVersionUID
          For serialization.
 
Fields inherited from class org.jfree.data.general.Series
 
Constructor Summary
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.
 
Method Summary
 void add(double x, double y)
          Adds a data item to the series and sends a org.jfree.data.general.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 org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void add(double x, java.lang.Number y)
          Adds a data item to the series and sends a org.jfree.data.general.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 org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void add(java.lang.Number x, java.lang.Number y)
          Adds new data to the series and sends a org.jfree.data.general.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 org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void add(XYDataItem item)
          Adds a data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void add(XYDataItem item, boolean notify)
          Adds a data item to the series and, if requested, sends a org.jfree.data.general.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 org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void clear()
          Removes all data items from the series.
 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 org.jfree.data.general.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.
 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 org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 XYDataItem remove(java.lang.Number x)
          Removes the item with the specified x-value and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void setMaximumItemCount(int maximum)
          Sets the maximum number of items that will be retained in the series.
 void update(int index, java.lang.Number y)
          Updates the value of an item in the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.
 void update(java.lang.Number x, java.lang.Number y)
          Updates an item in the series.
 
Methods inherited from class org.jfree.data.general.Series
addChangeListener, addPropertyChangeListener, firePropertyChange, fireSeriesChanged, getDescription, getKey, getNotify, notifyListeners, removeChangeListener, removePropertyChangeListener, setDescription, setKey, setNotify
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
For serialization.

See Also:
Constant Field Values

data

protected java.util.List data
Storage for the data items in the series.


maximumItemCount

private int maximumItemCount
The maximum number of items for the series.


autoSort

private boolean autoSort
A flag that controls whether the items are automatically sorted.


allowDuplicateXValues

private boolean allowDuplicateXValues
A flag that controls whether or not duplicate x-values are allowed.

Constructor Detail

XYSeries

public XYSeries(java.lang.Comparable key)
Creates a new empty series. By default, items added to the series will be sorted into ascending order by x-value, and duplicate x-values will be allowed (these defaults can be modified with another constructor.


XYSeries

public 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

public XYSeries(java.lang.Comparable key,
                boolean autoSort,
                boolean allowDuplicateXValues)
Constructs a new xy-series that contains no data. You can specify whether or not duplicate x-values are allowed for the series.

Method Detail

getAutoSort

public boolean getAutoSort()
Returns the flag that controls whether the items in the series are automatically sorted. There is no setter for this flag, it must be defined in the series constructor.


getAllowDuplicateXValues

public boolean getAllowDuplicateXValues()
Returns a flag that controls whether duplicate x-values are allowed. This flag can only be set in the constructor.


getItemCount

public int getItemCount()
Returns the number of items in the series.


getItems

public java.util.List getItems()
Returns the list of data items for the series (the list contains XYDataItem objects and is unmodifiable).


getMaximumItemCount

public int getMaximumItemCount()
Returns the maximum number of items that will be retained in the series. The default value is Integer.MAX_VALUE.


setMaximumItemCount

public void setMaximumItemCount(int maximum)
Sets the maximum number of items that will be retained in the series. If you add a new item to the series such that the number of items will exceed the maximum item count, then the first element in the series is automatically removed, ensuring that the maximum item count is not exceeded.

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 org.jfree.data.general.SeriesChangeEvent will be sent to all registered listeners.


add

public void add(XYDataItem item)
Adds a data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


add

public void add(double x,
                double y)
Adds a data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


add

public void add(double x,
                double y,
                boolean notify)
Adds a data item to the series and, if requested, sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


add

public void add(double x,
                java.lang.Number y)
Adds a data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners. The unusual pairing of parameter types is to make it easier to add null y-values.


add

public void add(double x,
                java.lang.Number y,
                boolean notify)
Adds a data item to the series and, if requested, sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners. The unusual pairing of parameter types is to make it easier to add null y-values.


add

public void add(java.lang.Number x,
                java.lang.Number y)
Adds new data to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.

Throws an exception if the x-value is a duplicate AND the allowDuplicateXValues flag is false.


add

public void add(java.lang.Number x,
                java.lang.Number y,
                boolean notify)
Adds new data to the series and, if requested, sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.

Throws an exception if the x-value is a duplicate AND the allowDuplicateXValues flag is false.


add

public void add(XYDataItem item,
                boolean notify)
Adds a data item to the series and, if requested, sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


delete

public void delete(int start,
                   int end)
Deletes a range of items from the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


remove

public XYDataItem remove(int index)
Removes the item at the specified index and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


remove

public XYDataItem remove(java.lang.Number x)
Removes the item with the specified x-value and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


clear

public void clear()
Removes all data items from the series.


getDataItem

public XYDataItem getDataItem(int index)
Return the data item with the specified index.


getX

public java.lang.Number getX(int index)
Returns the x-value at the specified index.


getY

public java.lang.Number getY(int index)
Returns the y-value at the specified index.


update

public void update(int index,
                   java.lang.Number y)
Updates the value of an item in the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


update

public void update(java.lang.Number x,
                   java.lang.Number y)
Updates an item in the series.


addOrUpdate

public XYDataItem addOrUpdate(java.lang.Number x,
                              java.lang.Number y)
Adds or updates an item in the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.


indexOf

public 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. Be aware that for an unsorted series, the index is found by iterating through all items in the series.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the series.


createCopy

public XYSeries createCopy(int start,
                           int end)
                    throws java.lang.CloneNotSupportedException
Creates a new series by copying a subset of the data in this time series.


equals

public boolean equals(java.lang.Object obj)
Tests this series for equality with an arbitrary object.


hashCode

public int hashCode()
Returns a hash code.