- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,PublicCloneable
,Dataset
,DatasetChangeListener
,SeriesChangeListener
,SeriesDataset
,IntervalXYDataset
,XYDataset
public class XYBarDataset
extends AbstractIntervalXYDataset
implements IntervalXYDataset, DatasetChangeListener, PublicCloneable
A dataset wrapper class that converts a standard
XYDataset
into an
IntervalXYDataset
suitable for use in creating XY bar charts.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns an independent copy of the dataset.void
datasetChanged
(DatasetChangeEvent event) Receives notification of an dataset change event.boolean
Tests this dataset for equality with an arbitrary object.double
Returns the bar width.getEndX
(int series, int item) Returns the ending X value for the specified series and item.double
getEndXValue
(int series, int item) Returns the ending x-value (as a double primitive) for an item within a series.getEndY
(int series, int item) Returns the ending Y value for the specified series and item.double
getEndYValue
(int series, int item) Returns the ending y-value (as a double primitive) for an item within a series.int
getItemCount
(int series) Returns the number of items in a series.int
Returns the number of series in the dataset.getSeriesKey
(int series) Returns the key for a series.getStartX
(int series, int item) Returns the starting X value for the specified series and item.double
getStartXValue
(int series, int item) Returns the starting x-value (as a double primitive) for an item within a series.getStartY
(int series, int item) Returns the starting Y value for the specified series and item.double
getStartYValue
(int series, int item) Returns the starting y-value (as a double primitive) for an item within a series.Returns the underlying dataset that was specified via the constructor.getX
(int series, int item) Returns the x-value for an item within a series.double
getXValue
(int series, int item) Returns the x-value (as a double primitive) for an item within a series.getY
(int series, int item) Returns the y-value for an item within a series.double
getYValue
(int series, int item) Returns the y-value (as a double primitive) for an item within a series.void
setBarWidth
(double barWidth) Sets the bar width and sends aDatasetChangeEvent
to 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, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, 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, getGroup, removeChangeListener, setGroup
Methods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
Methods inherited from interface org.jfree.data.xy.XYDataset
getDomainOrder
-
Constructor Details
-
XYBarDataset
Creates a new dataset.- Parameters:
underlying
- the underlying dataset (null
not permitted).barWidth
- the width of the bars.
-
-
Method Details
-
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
public void setBarWidth(double barWidth) Sets the bar width and sends aDatasetChangeEvent
to all registered listeners.- Parameters:
barWidth
- the bar width.- See Also:
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- The series count.
-
getSeriesKey
Returns the key for a series.- Specified by:
getSeriesKey
in interfaceSeriesDataset
- Specified by:
getSeriesKey
in classAbstractSeriesDataset
- Parameters:
series
- the series index (in the range0
togetSeriesCount() - 1
).- Returns:
- The series key.
-
getItemCount
public int getItemCount(int series) Returns the number of items in a series.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- the series index (zero-based).- Returns:
- The item count.
-
getX
Returns the x-value for an item within a series. -
getXValue
public double getXValue(int series, int item) Returns the x-value (as a double primitive) for an item within a series.- Specified by:
getXValue
in interfaceXYDataset
- Overrides:
getXValue
in classAbstractXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
getY
Returns the y-value for an item within a series. -
getYValue
public double getYValue(int series, int item) Returns the y-value (as a double primitive) for an item within a series.- Specified by:
getYValue
in interfaceXYDataset
- Overrides:
getYValue
in classAbstractXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
getStartX
Returns the starting X value for the specified series and item.- Specified by:
getStartX
in interfaceIntervalXYDataset
- 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:
getStartXValue
in interfaceIntervalXYDataset
- Overrides:
getStartXValue
in classAbstractIntervalXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
getEndX
Returns the ending X value for the specified series and item.- Specified by:
getEndX
in interfaceIntervalXYDataset
- 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:
getEndXValue
in interfaceIntervalXYDataset
- Overrides:
getEndXValue
in classAbstractIntervalXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
getStartY
Returns the starting Y value for the specified series and item.- Specified by:
getStartY
in interfaceIntervalXYDataset
- 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:
getStartYValue
in interfaceIntervalXYDataset
- Overrides:
getStartYValue
in classAbstractIntervalXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
getEndY
Returns the ending Y value for the specified series and item.- Specified by:
getEndY
in interfaceIntervalXYDataset
- 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:
getEndYValue
in interfaceIntervalXYDataset
- Overrides:
getEndYValue
in classAbstractIntervalXYDataset
- Parameters:
series
- the series index (zero-based).item
- the item index (zero-based).- Returns:
- The value.
- See Also:
-
datasetChanged
Receives notification of an dataset change event.- Specified by:
datasetChanged
in interfaceDatasetChangeListener
- Parameters:
event
- information about the event.
-
equals
Tests this dataset for equality with an arbitrary object. -
clone
Returns an independent copy of the dataset. Note that:- the underlying dataset is only cloned if it implements the
PublicCloneable
interface; - the listeners registered with this dataset are not carried over to the cloned dataset.
- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in 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
-