Package org.jfree.data
Class CombinedDataset
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,CombinationDataset,Dataset,HighLowDataset,IntervalXYDataset,SeriesChangeListener,SeriesDataset,XYDataset
public class CombinedDataset extends AbstractIntervalXYDataset implements XYDataset, HighLowDataset, IntervalXYDataset, CombinationDataset
This class can combine instances of
XYDataset, HighLowDataset
and IntervalXYDataset together exposing the union of all the series
under one dataset.- Author:
- Bill Kelemen (bill@kelemen-usa.com)
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CombinedDataset()Default constructor for an empty combination.CombinedDataset(SeriesDataset[] data)Creates a CombinedDataset initialized with an array of SeriesDatasets. -
Method Summary
Modifier and Type Method Description voidadd(SeriesDataset data)Adds one SeriesDataset to the combination.voidadd(SeriesDataset[] data)Adds an array of SeriesDataset's to the combination.voidadd(SeriesDataset data, int series)Adds one series from a SeriesDataset to the combination.intgetChildPosition(Dataset child)Returns the child position.doublegetClose(int series, int item)Returns the close-value (as a double primitive) for an item within a series.NumbergetCloseValue(int series, int item)Returns the close-value for the specified series and item.NumbergetEndXValue(int series, int item)Returns the ending X value for the specified series and item.NumbergetEndYValue(int series, int item)Returns the ending Y value for the specified series and item.doublegetHigh(int series, int item)Returns the high-value (as a double primitive) for an item within a series.NumbergetHighValue(int series, int item)Returns the high-value for the specified series and item.intgetItemCount(int series)Returns the number of items in a series.doublegetLow(int series, int item)Returns the low-value (as a double primitive) for an item within a series.NumbergetLowValue(int series, int item)Returns the low-value for the specified series and item.int[]getMap()Returns a map or indirect indexing form our series into parent's series.doublegetOpen(int series, int item)Returns the open-value (as a double primitive) for an item within a series.NumbergetOpenValue(int series, int item)Returns the open-value for the specified series and item.SeriesDatasetgetParent()Returns the parent Dataset of this combination.intgetSeriesCount()Returns the number of series in the dataset.StringgetSeriesName(int series)Returns the name of a series.NumbergetStartXValue(int series, int item)Returns the starting X value for the specified series and item.NumbergetStartYValue(int series, int item)Returns the starting Y value for the specified series and item.doublegetVolume(int series, int item)Returns the volume-value (as a double primitive) for an item within a series.NumbergetVolumeValue(int series, int item)Returns the volume value for the specified series and item.NumbergetXValue(int series, int item)Returns the X-value for the specified series and item.NumbergetYValue(int series, int item)Returns the Y-value for the specified series and item.Methods inherited from class org.jfree.data.AbstractIntervalXYDataset
getEndX, getEndY, getStartX, getStartYMethods inherited from class org.jfree.data.AbstractXYDataset
getX, getYMethods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChangedMethods inherited from class org.jfree.data.AbstractDataset
addChangeListener, clone, getGroup, removeChangeListener, setGroup, validateObjectMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroupMethods inherited from interface org.jfree.data.IntervalXYDataset
getEndX, getEndY, getStartX, getStartY
-
Constructor Details
-
CombinedDataset
public CombinedDataset()Default constructor for an empty combination. -
CombinedDataset
Creates a CombinedDataset initialized with an array of SeriesDatasets.- Parameters:
data- array of SeriesDataset that contains the SeriesDatasets to combine.
-
-
Method Details
-
add
Adds one SeriesDataset to the combination. Listeners are notified of the change.- Parameters:
data- the SeriesDataset to add.
-
add
Adds an array of SeriesDataset's to the combination. Listeners are notified of the change.- Parameters:
data- array of SeriesDataset to add
-
add
Adds one series from a SeriesDataset to the combination. Listeners are notified of the change.- Parameters:
data- the SeriesDataset where series is containedseries- series to add
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.- Specified by:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The number of series in the dataset.
-
getSeriesName
Returns the name of a series.- Specified by:
getSeriesNamein interfaceSeriesDataset- Specified by:
getSeriesNamein classAbstractSeriesDataset- Parameters:
series- the series (zero-based index).- Returns:
- the name of a series.
-
getXValue
Returns the X-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aXYDataset. -
getYValue
Returns the Y-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aXYDataset. -
getItemCount
public int getItemCount(int series)Returns the number of items in a series.Note: throws
ClassCastExceptionif the series is not from aXYDataset.- Specified by:
getItemCountin interfaceXYDataset- Parameters:
series- the index of the series of interest (zero-based).- Returns:
- the number of items in a series.
-
getHighValue
Returns the high-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aHighLowDataset.- Specified by:
getHighValuein interfaceHighLowDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the high-value for the specified series and item.
-
getHigh
public double getHigh(int series, int item)Returns the high-value (as a double primitive) for an item within a series.- Specified by:
getHighin interfaceHighLowDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The high-value.
-
getLowValue
Returns the low-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aHighLowDataset.- Specified by:
getLowValuein interfaceHighLowDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the low-value for the specified series and item.
-
getLow
public double getLow(int series, int item)Returns the low-value (as a double primitive) for an item within a series.- Specified by:
getLowin interfaceHighLowDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The low-value.
-
getOpenValue
Returns the open-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aHighLowDataset.- Specified by:
getOpenValuein interfaceHighLowDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the open-value for the specified series and item.
-
getOpen
public double getOpen(int series, int item)Returns the open-value (as a double primitive) for an item within a series.- Specified by:
getOpenin interfaceHighLowDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The open-value.
-
getCloseValue
Returns the close-value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aHighLowDataset.- Specified by:
getCloseValuein interfaceHighLowDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the close-value for the specified series and item.
-
getClose
public double getClose(int series, int item)Returns the close-value (as a double primitive) for an item within a series.- Specified by:
getClosein interfaceHighLowDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The close-value.
-
getVolumeValue
Returns the volume value for the specified series and item.Note: throws
ClassCastExceptionif the series is not from aHighLowDataset.- Specified by:
getVolumeValuein interfaceHighLowDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the volume value for the specified series and item.
-
getVolume
public double getVolume(int series, int item)Returns the volume-value (as a double primitive) for an item within a series.- Specified by:
getVolumein interfaceHighLowDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The volume-value.
-
getStartXValue
Returns the starting X value for the specified series and item.- Specified by:
getStartXValuein interfaceIntervalXYDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the starting X value for the specified series and item.
-
getEndXValue
Returns the ending X value for the specified series and item.- Specified by:
getEndXValuein interfaceIntervalXYDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the ending X value for the specified series and item.
-
getStartYValue
Returns the starting Y value for the specified series and item.- Specified by:
getStartYValuein interfaceIntervalXYDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the starting Y value for the specified series and item.
-
getEndYValue
Returns the ending Y value for the specified series and item.- Specified by:
getEndYValuein interfaceIntervalXYDataset- Parameters:
series- the index of the series of interest (zero-based).item- the index of the item of interest (zero-based).- Returns:
- the ending Y value for the specified series and item.
-
getParent
Returns the parent Dataset of this combination. If there is more than one parent, or a child is found that is not a CombinationDataset, then returnsnull.- Specified by:
getParentin interfaceCombinationDataset- Returns:
- the parent Dataset of this combination or
null.
-
getMap
public int[] getMap()Returns a map or indirect indexing form our series into parent's series. Prior to calling this method, the client should check getParent() to make sure the CombinationDataset uses the same parent. If not, the map returned by this method will be invalid or null.- Specified by:
getMapin interfaceCombinationDataset- Returns:
- a map or indirect indexing form our series into parent's series.
- See Also:
getParent()
-
getChildPosition
Returns the child position.- Parameters:
child- the child dataset.- Returns:
- the position.
-