- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset<S>
-
- org.jfree.data.xy.AbstractXYDataset<S>
-
- org.jfree.data.xy.AbstractIntervalXYDataset<S>
-
- org.jfree.data.xy.XYSeriesCollection<S>
-
- All Implemented Interfaces:
VetoableChangeListener,ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,DomainInfo,Dataset,SeriesChangeListener,SeriesDataset<S>,RangeInfo,IntervalXYDataset<S>,XYDataset<S>
public class XYSeriesCollection<S extends Comparable<S>> extends AbstractIntervalXYDataset<S> implements IntervalXYDataset<S>, DomainInfo, RangeInfo, VetoableChangeListener, PublicCloneable, Serializable
Represents a collection ofXYSeriesobjects that can be used as a dataset.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XYSeriesCollection()Constructs an empty dataset.XYSeriesCollection(XYSeries<S> series)Constructs a dataset and populates it with a single series.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSeries(XYSeries<S> series)Adds a series to the collection and sends aDatasetChangeEventto all registered listeners.Objectclone()Returns a clone of this instance.booleanequals(Object obj)Tests this collection for equality with an arbitrary object.RangegetDomainBounds(boolean includeInterval)Returns the range of the values in this dataset's domain.doublegetDomainLowerBound(boolean includeInterval)Returns the minimum x-value in the dataset.DomainOrdergetDomainOrder()Returns the order of the domain (X) values, if this is known.doublegetDomainUpperBound(boolean includeInterval)Returns the maximum x-value in the dataset.NumbergetEndX(int series, int item)Returns the ending X value for the specified series and item.NumbergetEndY(int series, int item)Returns the ending Y value for the specified series and item.doublegetIntervalPositionFactor()Returns the interval position factor.doublegetIntervalWidth()Returns the interval width.intgetItemCount(int series)Returns the number of items in the specified series.RangegetRangeBounds(boolean includeInterval)Returns the range of the values in this dataset's range.doublegetRangeLowerBound(boolean includeInterval)Returns the minimum y-value in the dataset.doublegetRangeUpperBound(boolean includeInterval)Returns the maximum y-value in the dataset.List<XYSeries<S>>getSeries()Returns a list of all the series in the collection.XYSeries<S>getSeries(int series)Returns a series from the collection.XYSeries<S>getSeries(S key)Returns a series from the collection.intgetSeriesCount()Returns the number of series in the collection.intgetSeriesIndex(S key)Returns the index of the series with the specified key, or -1 if no series has that key.SgetSeriesKey(int series)Returns the key for a series.NumbergetStartX(int series, int item)Returns the starting X value for the specified series and item.NumbergetStartY(int series, int item)Returns the starting Y value for the specified series and item.NumbergetX(int series, int item)Returns the x-value for the specified series and item.NumbergetY(int series, int index)Returns the y-value for the specified series and item.inthashCode()Returns a hash code.intindexOf(XYSeries<S> series)Returns the index of the specified series, or -1 if that series is not present in the dataset.booleanisAutoWidth()Returns whether the interval width is automatically calculated or not.voidremoveAllSeries()Removes all the series from the collection and sends aDatasetChangeEventto all registered listeners.voidremoveSeries(int series)Removes a series from the collection and sends aDatasetChangeEventto all registered listeners.voidremoveSeries(XYSeries<S> series)Removes a series from the collection and sends aDatasetChangeEventto all registered listeners.voidsetAutoWidth(boolean b)Sets the flag that indicates whether the interval width is automatically calculated or not.voidsetIntervalPositionFactor(double factor)Sets the interval position factor.voidsetIntervalWidth(double width)Sets the interval width and sends aDatasetChangeEventto all registered listeners.voidvetoableChange(PropertyChangeEvent e)Receives notification that the key for one of the series in the collection has changed, and vetos it if the key is already present in the collection.-
Methods inherited from class org.jfree.data.xy.AbstractIntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getXValue, getYValue
-
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, fireDatasetChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotify, validateObject
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, removeChangeListener
-
Methods inherited from interface org.jfree.data.xy.IntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
-
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
-
-
-
-
Constructor Detail
-
XYSeriesCollection
public XYSeriesCollection()
Constructs an empty dataset.
-
XYSeriesCollection
public XYSeriesCollection(XYSeries<S> series)
Constructs a dataset and populates it with a single series.- Parameters:
series- the series (nullignored).
-
-
Method Detail
-
getDomainOrder
public DomainOrder getDomainOrder()
Returns the order of the domain (X) values, if this is known.- Specified by:
getDomainOrderin interfaceXYDataset<S extends Comparable<S>>- Overrides:
getDomainOrderin classAbstractXYDataset<S extends Comparable<S>>- Returns:
- The domain order.
-
addSeries
public void addSeries(XYSeries<S> series)
Adds a series to the collection and sends aDatasetChangeEventto all registered listeners.- Parameters:
series- the series (nullnot permitted).- Throws:
IllegalArgumentException- if the key for the series is null or not unique within the dataset.
-
removeSeries
public void removeSeries(int series)
Removes a series from the collection and sends aDatasetChangeEventto all registered listeners.- Parameters:
series- the series index (zero-based).
-
removeSeries
public void removeSeries(XYSeries<S> series)
Removes a series from the collection and sends aDatasetChangeEventto all registered listeners.- Parameters:
series- the series (nullnot permitted).
-
removeAllSeries
public void removeAllSeries()
Removes all the series from the collection and sends aDatasetChangeEventto all registered listeners.
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the collection.- Specified by:
getSeriesCountin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesCountin classAbstractSeriesDataset<S extends Comparable<S>>- Returns:
- The series count.
-
getSeries
public List<XYSeries<S>> getSeries()
Returns a list of all the series in the collection.- Returns:
- The list (never
null).
-
indexOf
public int indexOf(XYSeries<S> series)
Returns the index of the specified series, or -1 if that series is not present in the dataset.- Parameters:
series- the series (nullnot permitted).- Returns:
- The series index.
- Since:
- 1.0.6
-
getSeries
public XYSeries<S> getSeries(int series)
Returns a series from the collection.- Parameters:
series- the series index (zero-based).- Returns:
- The series.
- Throws:
IllegalArgumentException- ifseriesis not in the range0togetSeriesCount() - 1.
-
getSeries
public XYSeries<S> getSeries(S key)
Returns a series from the collection.- Parameters:
key- the key (nullnot permitted).- Returns:
- The series with the specified key.
- Throws:
UnknownKeyException- ifkeyis not found in the collection.- Since:
- 1.0.9
-
getSeriesKey
public S getSeriesKey(int series)
Returns the key for a series.- Specified by:
getSeriesKeyin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesKeyin classAbstractSeriesDataset<S extends Comparable<S>>- Parameters:
series- the series index (in the range0togetSeriesCount() - 1).- Returns:
- The key for a series.
- Throws:
IllegalArgumentException- ifseriesis not in the specified range.
-
getSeriesIndex
public int getSeriesIndex(S key)
Returns the index of the series with the specified key, or -1 if no series has that key.- Parameters:
key- the key (nullnot permitted).- Returns:
- The index.
- Since:
- 1.0.14
-
getItemCount
public int getItemCount(int series)
Returns the number of items in the specified series.- Specified by:
getItemCountin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).- Returns:
- The item count.
- Throws:
IllegalArgumentException- ifseriesis not in the range0togetSeriesCount() - 1.
-
getX
public Number getX(int series, int item)
Returns the x-value for the specified series and item.- Specified by:
getXin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The value.
-
getStartX
public Number getStartX(int series, int item)
Returns the starting X value for the specified series and item.- Specified by:
getStartXin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The starting X value.
-
getEndX
public Number getEndX(int series, int item)
Returns the ending X value for the specified series and item.- Specified by:
getEndXin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The ending X value.
-
getY
public Number getY(int series, int index)
Returns the y-value for the specified series and item.- Specified by:
getYin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).index- the index of the item of interest (zero-based).- Returns:
- The value (possibly
null).
-
getStartY
public Number getStartY(int series, int item)
Returns the starting Y value for the specified series and item.- Specified by:
getStartYin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The starting Y value.
-
getEndY
public Number getEndY(int series, int item)
Returns the ending Y value for the specified series and item.- Specified by:
getEndYin interfaceIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The ending Y value.
-
equals
public boolean equals(Object obj)
Tests this collection for equality with an arbitrary object.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of this instance.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if there is a problem.
-
hashCode
public int hashCode()
Returns a hash code.
-
getDomainLowerBound
public double getDomainLowerBound(boolean includeInterval)
Returns the minimum x-value in the dataset.- Specified by:
getDomainLowerBoundin interfaceDomainInfo- Parameters:
includeInterval- a flag that determines whether or not the x-interval is taken into account.- Returns:
- The minimum value.
-
getDomainUpperBound
public double getDomainUpperBound(boolean includeInterval)
Returns the maximum x-value in the dataset.- Specified by:
getDomainUpperBoundin interfaceDomainInfo- Parameters:
includeInterval- a flag that determines whether or not the x-interval is taken into account.- Returns:
- The maximum value.
-
getDomainBounds
public Range getDomainBounds(boolean includeInterval)
Returns the range of the values in this dataset's domain.- Specified by:
getDomainBoundsin interfaceDomainInfo- Parameters:
includeInterval- a flag that determines whether or not the x-interval is taken into account.- Returns:
- The range (or
nullif the dataset contains no values).
-
getIntervalWidth
public double getIntervalWidth()
Returns the interval width. This is used to calculate the start and end x-values, if/when the dataset is used as anIntervalXYDataset.- Returns:
- The interval width.
-
setIntervalWidth
public void setIntervalWidth(double width)
Sets the interval width and sends aDatasetChangeEventto all registered listeners.- Parameters:
width- the width (negative values not permitted).
-
getIntervalPositionFactor
public double getIntervalPositionFactor()
Returns the interval position factor.- Returns:
- The interval position factor.
-
setIntervalPositionFactor
public void setIntervalPositionFactor(double factor)
Sets the interval position factor. This controls where the x-value is in relation to the interval surrounding the x-value (0.0 means the x-value will be positioned at the start, 0.5 in the middle, and 1.0 at the end).- Parameters:
factor- the factor.
-
isAutoWidth
public boolean isAutoWidth()
Returns whether the interval width is automatically calculated or not.- Returns:
- Whether the width is automatically calculated or not.
-
setAutoWidth
public void setAutoWidth(boolean b)
Sets the flag that indicates whether the interval width is automatically calculated or not.- Parameters:
b- a boolean.
-
getRangeBounds
public Range getRangeBounds(boolean includeInterval)
Returns the range of the values in this dataset's range.- Specified by:
getRangeBoundsin interfaceRangeInfo- Parameters:
includeInterval- ignored.- Returns:
- The range (or
nullif the dataset contains no values).
-
getRangeLowerBound
public double getRangeLowerBound(boolean includeInterval)
Returns the minimum y-value in the dataset.- Specified by:
getRangeLowerBoundin interfaceRangeInfo- Parameters:
includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The minimum value.
-
getRangeUpperBound
public double getRangeUpperBound(boolean includeInterval)
Returns the maximum y-value in the dataset.- Specified by:
getRangeUpperBoundin interfaceRangeInfo- Parameters:
includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The maximum value.
-
vetoableChange
public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException
Receives notification that the key for one of the series in the collection has changed, and vetos it if the key is already present in the collection.- Specified by:
vetoableChangein interfaceVetoableChangeListener- Parameters:
e- the event.- Throws:
PropertyVetoException- Since:
- 1.0.14
-
-