com.jrefinery.data
Class CombinedXYDataset

java.lang.Object
  extended by com.jrefinery.data.AbstractDataset
      extended by com.jrefinery.data.AbstractSeriesDataset
          extended by com.jrefinery.data.CombinedXYDataset
All Implemented Interfaces:
CombinationDataset, Dataset, SeriesChangeListener, SeriesDataset, XYDataset

public class CombinedXYDataset
extends AbstractSeriesDataset
implements XYDataset, CombinationDataset

This class can combine XYDatasets, HighLowDatasets and IntervalXYDatasets together exposing the union of all the series under one Dataset. This is required when using a CombinedPlot with a combination of XYPlots, HighLowPlots, TimeSeriesPlot's and VerticalXYBarPlots.

Author:
Bill Kelemen (bill@kelemen-usa.com)
See Also:
com.jrefinery.chart.CombinedPlot

Field Summary
 
Fields inherited from class com.jrefinery.data.AbstractDataset
listeners
 
Constructor Summary
CombinedXYDataset()
          Default constructor for an empty combination.
CombinedXYDataset(SeriesDataset[] data)
          Creates a CombinedDataset initialized with an array of SeriesDatasets.
 
Method Summary
 void add(SeriesDataset data)
          Adds one SeriesDataset to the combination.
 void add(SeriesDataset[] data)
          Adds an array of SeriesDataset's to the combination.
 void add(SeriesDataset data, int series)
          Adds one series from a SeriesDataset to the combination.
 void addXYData(int series, java.lang.Object xObject, java.lang.Object yObject, int n)
           
 java.lang.Object get(int no)
           
 int getChildPosition(Dataset child)
           
 int getItemCount(int series)
          Returns the number of items in a series.
 int[] getMap()
          Returns a map or indirect indexing form our series into parent's series.
 SeriesDataset getParent()
          Returns the parent Dataset of this combination.
 int getSeriesCount()
          Returns the number of series in the dataset.
 java.lang.String getSeriesName(int series)
          Returns the name of a series.
 java.lang.Number getXValue(int series, int item)
          Returns the X-value for the specified series and item.
 java.lang.Number getYValue(int series, int item)
          Returns the Y-value for the specified series and item.
 
Methods inherited from class com.jrefinery.data.AbstractSeriesDataset
getLegendItemCount, getLegendItemLabels, seriesChanged
 
Methods inherited from class com.jrefinery.data.AbstractDataset
addChangeListener, fireDatasetChanged, notifyListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.data.Dataset
addChangeListener, removeChangeListener
 

Constructor Detail

CombinedXYDataset

public CombinedXYDataset()
Default constructor for an empty combination.


CombinedXYDataset

public CombinedXYDataset(SeriesDataset[] data)
Creates a CombinedDataset initialized with an array of SeriesDatasets.

Parameters:
data - Array of SeriesDataset that contains the SeriesDatasets to combine.
Method Detail

add

public void add(SeriesDataset data)
Adds one SeriesDataset to the combination. Listeners are notified of the change.

Parameters:
data - SeriesDataset to add.

add

public void add(SeriesDataset[] data)
Adds an array of SeriesDataset's to the combination. Listeners are notified of the change.

Parameters:
data - Array of SeriesDataset to add

add

public void add(SeriesDataset data,
                int series)
Adds one series from a SeriesDataset to the combination. Listeners are notified of the change.

Parameters:
data - SeriesDataset where series is contained
series - to add

addXYData

public void addXYData(int series,
                      java.lang.Object xObject,
                      java.lang.Object yObject,
                      int n)

getSeriesCount

public int getSeriesCount()
Returns the number of series in the dataset.

Specified by:
getSeriesCount in interface SeriesDataset
Specified by:
getSeriesCount in class AbstractSeriesDataset
Returns:
The number of series in the dataset.

getSeriesName

public java.lang.String getSeriesName(int series)
Returns the name of a series.

Specified by:
getSeriesName in interface SeriesDataset
Specified by:
getSeriesName in class AbstractSeriesDataset
Parameters:
series - The series (zero-based index).

getXValue

public java.lang.Number getXValue(int series,
                                  int item)
Returns the X-value for the specified series and item.

Specified by:
getXValue in interface XYDataset
Parameters:
series - The index of the series of interest (zero-based);
item - The index of the item of interest (zero-based).
Returns:
The x-value for an item within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

getYValue

public java.lang.Number getYValue(int series,
                                  int item)
Returns the Y-value for the specified series and item.

Specified by:
getYValue in interface XYDataset
Parameters:
series - The index of the series of interest (zero-based);
item - The index of the item of interest (zero-based).
Returns:
The y-value for an item within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

getItemCount

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

Specified by:
getItemCount in interface XYDataset
Parameters:
series - The index of the series of interest (zero-based);
Returns:
The number of items within a series.
Throws:
java.lang.ClassCastException - if the series if not from a XYDataset

getParent

public SeriesDataset 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 returns null.

Specified by:
getParent in interface CombinationDataset

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:
getMap in interface CombinationDataset
See Also:
getParent()

getChildPosition

public int getChildPosition(Dataset child)

get

public java.lang.Object get(int no)


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.