org.jfree.data.xy

## Class XYBarDataset

- java.lang.Object
- - org.jfree.data.general.AbstractDataset
  - - org.jfree.data.general.AbstractSeriesDataset
    - - org.jfree.data.xy.AbstractXYDataset
      - - org.jfree.data.xy.AbstractIntervalXYDataset
        - - org.jfree.data.xy.XYBarDataset

All Implemented Interfaces:
  java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Dataset, DatasetChangeListener, SeriesChangeListener, SeriesDataset, IntervalXYDataset, XYDataset, org.jfree.util.PublicCloneable

    public class XYBarDataset
    extends AbstractIntervalXYDataset
    implements IntervalXYDataset, DatasetChangeListener, org.jfree.util.PublicCloneable

A dataset wrapper class that converts a standard `XYDataset` into an `IntervalXYDataset` suitable for use in creating XY bar charts.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`XYBarDataset(XYDataset underlying, double barWidth)` Creates a new dataset.

### Method Summary

Methods
`java.lang.Object` `clone()` Returns an independent copy of the dataset.
`void` `datasetChanged(DatasetChangeEvent event)` Receives notification of an dataset change event.
`boolean` `equals(java.lang.Object obj)` Tests this dataset for equality with an arbitrary object.
`double` `getBarWidth()` Returns the bar width.
`java.lang.Number` `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.
`java.lang.Number` `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` `getSeriesCount()` Returns the number of series in the dataset.
`java.lang.Comparable` `getSeriesKey(int series)` Returns the key for a series.
`java.lang.Number` `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.
`java.lang.Number` `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.
`XYDataset` `getUnderlyingDataset()` Returns the underlying dataset that was specified via the constructor.
`java.lang.Number` `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.
`java.lang.Number` `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 a `DatasetChangeEvent` 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, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject`

### Methods inherited from class java.lang.Object

`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.jfree.data.xy.XYDataset

`getDomainOrder`

### Methods inherited from interface org.jfree.data.general.SeriesDataset

`indexOf`

### Methods inherited from interface org.jfree.data.general.Dataset

`addChangeListener, getGroup, removeChangeListener, setGroup`

### Constructor Detail

#### XYBarDataset

    public XYBarDataset(XYDataset underlying,
                double barWidth)

Creates a new dataset.

Parameters:
  `underlying` - the underlying dataset (`null` not permitted).
  `barWidth` - the width of the bars.

### Method Detail

#### getUnderlyingDataset

    public XYDataset getUnderlyingDataset()

Returns the underlying dataset that was specified via the constructor.

Returns:
  The underlying dataset (never `null`).
Since:
  1.0.4

#### getBarWidth

    public double getBarWidth()

Returns the bar width.

Returns:
  The bar width.
Since:
  1.0.4
See Also:
  `setBarWidth(double)`

#### setBarWidth

    public void setBarWidth(double barWidth)

Sets the bar width and sends a `DatasetChangeEvent` to all registered listeners.

Parameters:
  `barWidth` - the bar width.
Since:
  1.0.4
See Also:
  `getBarWidth()`

#### 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 series count.

#### getSeriesKey

    public java.lang.Comparable getSeriesKey(int series)

Returns the key for a series.

Specified by:
  `getSeriesKey` in interface `SeriesDataset`
Specified by:
  `getSeriesKey` in class `AbstractSeriesDataset`
Parameters:
  `series` - the series index (in the range `0` to `getSeriesCount() - 1`).
Returns:
  The series key.

#### getItemCount

    public int getItemCount(int series)

Returns the number of items in a series.

Specified by:
  `getItemCount` in interface `XYDataset`
Parameters:
  `series` - the series index (zero-based).
Returns:
  The item count.

#### getX

    public java.lang.Number getX(int series,
                        int item)

Returns the x-value for an item within a series.

Specified by:
  `getX` in interface `XYDataset`
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:
  `getXValue` in interface `XYDataset`
Overrides:
  `getXValue` in class `AbstractXYDataset`
Parameters:
  `series` - the series index (zero-based).
  `item` - the item index (zero-based).
Returns:
  The value.
See Also:
  `getX(int, int)`

#### getY

    public java.lang.Number getY(int series,
                        int item)

Returns the y-value for an item within a series.

Specified by:
  `getY` in interface `XYDataset`
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:
  `getYValue` in interface `XYDataset`
Overrides:
  `getYValue` in class `AbstractXYDataset`
Parameters:
  `series` - the series index (zero-based).
  `item` - the item index (zero-based).
Returns:
  The value.
See Also:
  `getY(int, int)`

#### getStartX

    public java.lang.Number getStartX(int series,
                             int item)

Returns the starting X value for the specified series and item.

Specified by:
  `getStartX` in interface `IntervalXYDataset`
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 interface `IntervalXYDataset`
Overrides:
  `getStartXValue` in class `AbstractIntervalXYDataset`
Parameters:
  `series` - the series index (zero-based).
  `item` - the item index (zero-based).
Returns:
  The value.
See Also:
  `getXValue(int, int)`

#### getEndX

    public java.lang.Number getEndX(int series,
                           int item)

Returns the ending X value for the specified series and item.

Specified by:
  `getEndX` in interface `IntervalXYDataset`
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 interface `IntervalXYDataset`
Overrides:
  `getEndXValue` in class `AbstractIntervalXYDataset`
Parameters:
  `series` - the series index (zero-based).
  `item` - the item index (zero-based).
Returns:
  The value.
See Also:
  `getXValue(int, int)`

#### getStartY

    public java.lang.Number getStartY(int series,
                             int item)

Returns the starting Y value for the specified series and item.

Specified by:
  `getStartY` in interface `IntervalXYDataset`
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 interface `IntervalXYDataset`
Overrides:
  `getStartYValue` in class `AbstractIntervalXYDataset`
Parameters:
  `series` - the series index (zero-based).
  `item` - the item index (zero-based).
Returns:
  The value.
See Also:
  `getYValue(int, int)`

#### getEndY

    public java.lang.Number getEndY(int series,
                           int item)

Returns the ending Y value for the specified series and item.

Specified by:
  `getEndY` in interface `IntervalXYDataset`
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 interface `IntervalXYDataset`
Overrides:
  `getEndYValue` in class `AbstractIntervalXYDataset`
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:
  `datasetChanged` in interface `DatasetChangeListener`
Parameters:
  `event` - information about the event.

#### equals

    public boolean equals(java.lang.Object obj)

Tests this dataset for equality with an arbitrary object.

Overrides:
  `equals` in class `java.lang.Object`
Parameters:
  `obj` - the object (`null` permitted).
Returns:
  A boolean.

#### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

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 interface `org.jfree.util.PublicCloneable`
Overrides:
  `clone` in class `AbstractDataset`
Returns:
  An independent copy of the dataset.
Throws:
  `java.lang.CloneNotSupportedException` - if the dataset cannot be cloned for any reason.