Package org.jfree.data.statistics
Class SimpleHistogramDataset
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.statistics.SimpleHistogramDataset
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,PublicCloneable,Dataset,SeriesChangeListener,SeriesDataset,IntervalXYDataset,XYDataset
public class SimpleHistogramDataset
extends AbstractIntervalXYDataset
implements IntervalXYDataset, Cloneable, PublicCloneable, Serializable
A dataset used for creating simple histograms with custom defined bins.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBin(SimpleHistogramBin bin) Adds a bin to the dataset.voidaddObservation(double value) Adds an observation to the dataset (by incrementing the item count for the appropriate bin).voidaddObservation(double value, boolean notify) Adds an observation to the dataset (by incrementing the item count for the appropriate bin).voidaddObservations(double[] values) Adds a set of values to the dataset and sends aDatasetChangeEventto all registered listeners.voidRemoves all current observation data and sends aDatasetChangeEventto all registered listeners.clone()Returns a clone of the dataset.booleanCompares the dataset for equality with an arbitrary object.booleanReturns a flag that controls whether or not the bin count is divided by the bin size in thegetXValue(int, int)method.Returns the order of the domain (or X) values returned by the dataset.getEndX(int series, int item) Returns the ending X value for the specified series and item.doublegetEndXValue(int series, int item) Returns the end 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.doublegetEndYValue(int series, int item) Returns the end y-value (as a double primitive) for an item within a series.intgetItemCount(int series) Returns the number of items in a series.intReturns the number of series in the dataset (always 1 for this 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.doublegetStartXValue(int series, int item) Returns the start 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.doublegetStartYValue(int series, int item) Returns the start y-value (as a double primitive) for an item within a series.getX(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.getY(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.voidRemoves all bins and sends aDatasetChangeEventto all registered listeners.voidsetAdjustForBinSize(boolean adjust) Sets the flag that controls whether or not the bin count is divided by the bin size in thegetYValue(int, int)method, and sends aDatasetChangeEventto all registered listeners.Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChangedMethods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, fireDatasetChanged, getGroup, getNotify, hashCode, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroupMethods inherited from interface org.jfree.data.general.SeriesDataset
indexOf
-
Constructor Details
-
SimpleHistogramDataset
Creates a new histogram dataset. Note that theadjustForBinSizeflag defaults totrue.- Parameters:
key- the series key (nullnot permitted).
-
-
Method Details
-
getAdjustForBinSize
Returns a flag that controls whether or not the bin count is divided by the bin size in thegetXValue(int, int)method.- Returns:
- A boolean.
- See Also:
-
setAdjustForBinSize
Sets the flag that controls whether or not the bin count is divided by the bin size in thegetYValue(int, int)method, and sends aDatasetChangeEventto all registered listeners.- Parameters:
adjust- the flag.- See Also:
-
getSeriesCount
Returns the number of series in the dataset (always 1 for this dataset).- Specified by:
getSeriesCountin interfaceSeriesDataset- Specified by:
getSeriesCountin classAbstractSeriesDataset- Returns:
- The series count.
-
getSeriesKey
Returns the key for a series. Since this dataset only stores a single series, theseriesargument is ignored.- Specified by:
getSeriesKeyin interfaceSeriesDataset- Specified by:
getSeriesKeyin classAbstractSeriesDataset- Parameters:
series- the series (zero-based index, ignored in this dataset).- Returns:
- The key for the series.
-
getDomainOrder
Returns the order of the domain (or X) values returned by the dataset.- Specified by:
getDomainOrderin interfaceXYDataset- Overrides:
getDomainOrderin classAbstractXYDataset- Returns:
- The order (never
null).
-
getItemCount
Returns the number of items in a series. Since this dataset only stores a single series, theseriesargument is ignored.- Specified by:
getItemCountin interfaceXYDataset- Parameters:
series- the series index (zero-based, ignored in this dataset).- Returns:
- The item count.
-
addBin
Adds a bin to the dataset. An exception is thrown if the bin overlaps with any existing bin in the dataset.- Parameters:
bin- the bin (nullnot permitted).- See Also:
-
addObservation
Adds an observation to the dataset (by incrementing the item count for the appropriate bin). A runtime exception is thrown if the value does not fit into any bin.- Parameters:
value- the value.
-
addObservation
Adds an observation to the dataset (by incrementing the item count for the appropriate bin). A runtime exception is thrown if the value does not fit into any bin.- Parameters:
value- the value.notify- sendDatasetChangeEventto listeners?
-
addObservations
Adds a set of values to the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
values- the values (nullnot permitted).- See Also:
-
clearObservations
Removes all current observation data and sends aDatasetChangeEventto all registered listeners.- See Also:
-
removeAllBins
Removes all bins and sends aDatasetChangeEventto all registered listeners.- See Also:
-
getX
Returns the x-value for an item within a series. The x-values may or may not be returned in ascending order, that is up to the class implementing the interface. -
getXValue
Returns the x-value (as a double primitive) for an item within a series.- Specified by:
getXValuein interfaceXYDataset- Overrides:
getXValuein classAbstractXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The x-value.
-
getY
Returns the y-value for an item within a series. -
getYValue
Returns the y-value (as a double primitive) for an item within a series.- Specified by:
getYValuein interfaceXYDataset- Overrides:
getYValuein classAbstractXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The y-value.
- See Also:
-
getStartX
Returns the starting X value for the specified series and item.- Specified by:
getStartXin interfaceIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getStartXValue
Returns the start x-value (as a double primitive) for an item within a series.- Specified by:
getStartXValuein interfaceIntervalXYDataset- Overrides:
getStartXValuein classAbstractIntervalXYDataset- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The start x-value.
- See Also:
-
getEndX
Returns the ending X value for the specified series and item.- Specified by:
getEndXin interfaceIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getEndXValue
Returns the end x-value (as a double primitive) for an item within a series.- Specified by:
getEndXValuein interfaceIntervalXYDataset- Overrides:
getEndXValuein classAbstractIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The end x-value.
- See Also:
-
getStartY
Returns the starting Y value for the specified series and item.- Specified by:
getStartYin interfaceIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getStartYValue
Returns the start y-value (as a double primitive) for an item within a series.- Specified by:
getStartYValuein interfaceIntervalXYDataset- Overrides:
getStartYValuein classAbstractIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The start y-value.
- See Also:
-
getEndY
Returns the ending Y value for the specified series and item.- Specified by:
getEndYin interfaceIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The value.
-
getEndYValue
Returns the end y-value (as a double primitive) for an item within a series.- Specified by:
getEndYValuein interfaceIntervalXYDataset- Overrides:
getEndYValuein classAbstractIntervalXYDataset- Parameters:
series- the series index (zero-based).item- the item index (zero-based).- Returns:
- The end y-value.
- See Also:
-
equals
Compares the dataset for equality with an arbitrary object.- Overrides:
equalsin classAbstractDataset- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
clone
Returns a clone of the dataset.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- not thrown by this class, but maybe by subclasses (if any).
-