- 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.XYBarDataset<S>
-
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,Dataset,DatasetChangeListener,SeriesChangeListener,SeriesDataset<S>,IntervalXYDataset<S>,XYDataset<S>
public class XYBarDataset<S extends Comparable<S>> extends AbstractIntervalXYDataset<S> implements IntervalXYDataset<S>, DatasetChangeListener, PublicCloneable
A dataset wrapper class that converts a standardXYDatasetinto anIntervalXYDatasetsuitable for use in creating XY bar charts.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XYBarDataset(XYDataset<S> underlying, double barWidth)Creates a new dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns an independent copy of the dataset.voiddatasetChanged(DatasetChangeEvent event)Receives notification of an dataset change event.booleanequals(Object obj)Tests this dataset for equality with an arbitrary object.doublegetBarWidth()Returns the bar width.NumbergetEndX(int series, int item)Returns the ending X value for the specified series and item.doublegetEndXValue(int series, int item)Returns the ending x-value (as a double primitive) for an item within a series.NumbergetEndY(int series, int item)Returns the ending Y value for the specified series and item.doublegetEndYValue(int series, int item)Returns the ending y-value (as a double primitive) for an item within a series.intgetItemCount(int series)Returns the number of items in a series.intgetSeriesCount()Returns the number of series in the dataset.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.doublegetStartXValue(int series, int item)Returns the starting x-value (as a double primitive) for an item within a series.NumbergetStartY(int series, int item)Returns the starting Y value for the specified series and item.doublegetStartYValue(int series, int item)Returns the starting y-value (as a double primitive) for an item within a series.XYDataset<S>getUnderlyingDataset()Returns the underlying dataset that was specified via the constructor.NumbergetX(int series, int item)Returns the x-value for an item within a series.doublegetXValue(int series, int item)Returns the x-value (as a double primitive) for an item within a series.NumbergetY(int series, int item)Returns the y-value for an item within a series.doublegetYValue(int series, int item)Returns the y-value (as a double primitive) for an item within a series.voidsetBarWidth(double barWidth)Sets the bar width and sends aDatasetChangeEventto all registered listeners.-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder
-
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, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, removeChangeListener
-
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
-
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder
-
-
-
-
Constructor Detail
-
XYBarDataset
public XYBarDataset(XYDataset<S> underlying, double barWidth)
Creates a new dataset.- Parameters:
underlying- the underlying dataset (nullnot permitted).barWidth- the width of the bars.
-
-
Method Detail
-
getUnderlyingDataset
public XYDataset<S> getUnderlyingDataset()
Returns the underlying dataset that was specified via the constructor.- Returns:
- The underlying dataset (never
null).
-
getBarWidth
public double getBarWidth()
Returns the bar width.- Returns:
- The bar width.
- See Also:
setBarWidth(double)
-
setBarWidth
public void setBarWidth(double barWidth)
Sets the bar width and sends aDatasetChangeEventto all registered listeners.- Parameters:
barWidth- the bar width.- See Also:
getBarWidth()
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the dataset.- Specified by:
getSeriesCountin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesCountin classAbstractSeriesDataset<S extends Comparable<S>>- Returns:
- The series count.
-
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 series key.
-
getItemCount
public int getItemCount(int series)
Returns the number of items in a series.- Specified by:
getItemCountin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).- Returns:
- The item count.
-
getX
public Number getX(int series, int item)
Returns the x-value for an item within a series.- Specified by:
getXin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The x-value.
- See Also:
getXValue(int, int)
-
getXValue
public double getXValue(int series, int item)
Returns the x-value (as a double primitive) for an item within a series.- Specified by:
getXValuein interfaceXYDataset<S extends Comparable<S>>- Overrides:
getXValuein classAbstractXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getX(int, int)
-
getY
public Number getY(int series, int item)
Returns the y-value for an item within a series.- Specified by:
getYin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The y-value (possibly
null). - See Also:
getYValue(int, int)
-
getYValue
public double getYValue(int series, int item)
Returns the y-value (as a double primitive) for an item within a series.- Specified by:
getYValuein interfaceXYDataset<S extends Comparable<S>>- Overrides:
getYValuein classAbstractXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getY(int, int)
-
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 index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getStartXValue
public double getStartXValue(int series, int item)
Returns the starting x-value (as a double primitive) for an item within a series.- Specified by:
getStartXValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getStartXValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getXValue(int, int)
-
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 index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getEndXValue
public double getEndXValue(int series, int item)
Returns the ending x-value (as a double primitive) for an item within a series.- Specified by:
getEndXValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getEndXValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getXValue(int, int)
-
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 index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getStartYValue
public double getStartYValue(int series, int item)
Returns the starting y-value (as a double primitive) for an item within a series.- Specified by:
getStartYValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getStartYValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getYValue(int, int)
-
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 index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getEndYValue
public double getEndYValue(int series, int item)
Returns the ending y-value (as a double primitive) for an item within a series.- Specified by:
getEndYValuein interfaceIntervalXYDataset<S extends Comparable<S>>- Overrides:
getEndYValuein classAbstractIntervalXYDataset<S extends Comparable<S>>- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
- See Also:
getYValue(int, int)
-
datasetChanged
public void datasetChanged(DatasetChangeEvent event)
Receives notification of an dataset change event.- Specified by:
datasetChangedin interfaceDatasetChangeListener- Parameters:
event- information about the event.
-
clone
public Object clone() throws CloneNotSupportedException
Returns an independent copy of the dataset. Note that:- the underlying dataset is only cloned if it implements the
PublicCloneableinterface; - the listeners registered with this dataset are not carried over to the cloned dataset.
- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- An independent copy of the dataset.
- Throws:
CloneNotSupportedException- if the dataset cannot be cloned for any reason.
- the underlying dataset is only cloned if it implements the
-
-