Module org.jfree.chart
Package org.jfree.data.statistics
Class DefaultBoxAndWhiskerXYDataset<S extends Comparable<S>>
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- org.jfree.data.general.AbstractSeriesDataset<S>
-
- org.jfree.data.xy.AbstractXYDataset<S>
-
- org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset<S>
-
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,EventListener,Dataset,SeriesChangeListener,SeriesDataset<S>,RangeInfo,BoxAndWhiskerXYDataset<S>,XYDataset<S>
public class DefaultBoxAndWhiskerXYDataset<S extends Comparable<S>> extends AbstractXYDataset<S> implements BoxAndWhiskerXYDataset<S>, RangeInfo
A simple implementation of theBoxAndWhiskerXYDatasetinterface. This dataset implementation can hold only one series.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultBoxAndWhiskerXYDataset(S seriesKey)Constructs a new box and whisker dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Date date, BoxAndWhiskerItem item)Adds an item to the dataset and sends aDatasetChangeEventto all registered listeners.Objectclone()Returns a clone of the plot.booleanequals(Object obj)Tests this dataset for equality with an arbitrary object.doublegetFaroutCoefficient()Returns the value used as the farout coefficient.BoxAndWhiskerItemgetItem(int series, int item)Return an item from within the dataset.intgetItemCount(int series)Returns the number of items in the specified series.NumbergetMaxOutlier(int series, int item)Returns the maximum value which is not a farout, ie Q3 + (interquartile range * farout coefficient).NumbergetMaxRegularValue(int series, int item)Returns the max-value for the specified series and item.NumbergetMeanValue(int series, int item)Returns the mean for the specified series and item.NumbergetMedianValue(int series, int item)Returns the median-value for the specified series and item.NumbergetMinOutlier(int series, int item)Returns the minimum value which is not a farout.NumbergetMinRegularValue(int series, int item)Returns the min-value for the specified series and item.doublegetOutlierCoefficient()Returns the value used as the outlier coefficient.ListgetOutliers(int series, int item)Returns a list of outliers for the specified series and item.NumbergetQ1Value(int series, int item)Returns the Q1 median-value for the specified series and item.NumbergetQ3Value(int series, int item)Returns the Q3 median-value for the specified series and item.RangegetRangeBounds(boolean includeInterval)Returns the range of the values in this dataset's range.doublegetRangeLowerBound(boolean includeInterval)Returns the minimum y-value in the dataset.doublegetRangeUpperBound(boolean includeInterval)Returns the maximum y-value in the dataset.intgetSeriesCount()Returns the number of series in the dataset.SgetSeriesKey(int i)Returns the name of the series stored in this dataset.NumbergetX(int series, int item)Returns the x-value for one item in a series.DategetXDate(int series, int item)Returns the x-value for one item in a series, as a Date.NumbergetY(int series, int item)Returns the y-value for one item in a series.inthashCode()voidsetFaroutCoefficient(double faroutCoefficient)Sets the value used as the farouts coefficient.voidsetOutlierCoefficient(double outlierCoefficient)Sets the value used as the outlier coefficient-
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getDomainOrder, getXValue, getYValue
-
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, 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, getXValue, getYValue
-
-
-
-
Constructor Detail
-
DefaultBoxAndWhiskerXYDataset
public DefaultBoxAndWhiskerXYDataset(S seriesKey)
Constructs a new box and whisker dataset.The current implementation allows only one series in the dataset. This may be extended in a future version.
- Parameters:
seriesKey- the key for the series.
-
-
Method Detail
-
getOutlierCoefficient
public double getOutlierCoefficient()
Returns the value used as the outlier coefficient. The outlier coefficient gives an indication of the degree of certainty in an unskewed distribution. Increasing the coefficient increases the number of values included. Currently only used to ensure farout coefficient is greater than the outlier coefficient- Specified by:
getOutlierCoefficientin interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Returns:
- A
doublerepresenting the value used to calculate outliers. - See Also:
setOutlierCoefficient(double)
-
setOutlierCoefficient
public void setOutlierCoefficient(double outlierCoefficient)
Sets the value used as the outlier coefficient- Parameters:
outlierCoefficient- being adoublerepresenting the value used to calculate outliers.- See Also:
getOutlierCoefficient()
-
getFaroutCoefficient
public double getFaroutCoefficient()
Returns the value used as the farout coefficient. The farout coefficient allows the calculation of which values will be off the graph.- Specified by:
getFaroutCoefficientin interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Returns:
- A
doublerepresenting the value used to calculate farouts. - See Also:
setFaroutCoefficient(double)
-
setFaroutCoefficient
public void setFaroutCoefficient(double faroutCoefficient)
Sets the value used as the farouts coefficient. The farout coefficient must b greater than the outlier coefficient.- Parameters:
faroutCoefficient- being adoublerepresenting the value used to calculate farouts.- See Also:
getFaroutCoefficient()
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the dataset.This implementation only allows one series.
- Specified by:
getSeriesCountin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesCountin classAbstractSeriesDataset<S extends Comparable<S>>- Returns:
- The number of series.
-
getItemCount
public int getItemCount(int series)
Returns the number of items in the specified series.- Specified by:
getItemCountin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the index (zero-based) of the series.- Returns:
- The number of items in the specified series.
-
add
public void add(Date date, BoxAndWhiskerItem item)
Adds an item to the dataset and sends aDatasetChangeEventto all registered listeners.- Parameters:
date- the date (nullnot permitted).item- the item (nullnot permitted).
-
getSeriesKey
public S getSeriesKey(int i)
Returns the name of the series stored in this dataset.- Specified by:
getSeriesKeyin interfaceSeriesDataset<S extends Comparable<S>>- Specified by:
getSeriesKeyin classAbstractSeriesDataset<S extends Comparable<S>>- Parameters:
i- the index of the series. Currently ignored.- Returns:
- The name of this series.
-
getItem
public BoxAndWhiskerItem getItem(int series, int item)
Return an item from within the dataset.- Parameters:
series- the series index (ignored, since this dataset contains only one series).item- the item within the series (zero-based index)- Returns:
- The item.
-
getX
public Number getX(int series, int item)
Returns the x-value for one item in a series.The value returned is a Long object generated from the underlying Date object.
- Specified by:
getXin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The x-value.
-
getXDate
public Date getXDate(int series, int item)
Returns the x-value for one item in a series, as a Date.This method is provided for convenience only.
- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The x-value as a Date.
-
getY
public Number getY(int series, int item)
Returns the y-value for one item in a series.This method (from the XYDataset interface) is mapped to the getMeanValue() method.
- Specified by:
getYin interfaceXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The y-value.
-
getMeanValue
public Number getMeanValue(int series, int item)
Returns the mean for the specified series and item.- Specified by:
getMeanValuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The mean for the specified series and item.
-
getMedianValue
public Number getMedianValue(int series, int item)
Returns the median-value for the specified series and item.- Specified by:
getMedianValuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The median-value for the specified series and item.
-
getQ1Value
public Number getQ1Value(int series, int item)
Returns the Q1 median-value for the specified series and item.- Specified by:
getQ1Valuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The Q1 median-value for the specified series and item.
-
getQ3Value
public Number getQ3Value(int series, int item)
Returns the Q3 median-value for the specified series and item.- Specified by:
getQ3Valuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The Q3 median-value for the specified series and item.
-
getMinRegularValue
public Number getMinRegularValue(int series, int item)
Returns the min-value for the specified series and item.- Specified by:
getMinRegularValuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The min-value for the specified series and item.
-
getMaxRegularValue
public Number getMaxRegularValue(int series, int item)
Returns the max-value for the specified series and item.- Specified by:
getMaxRegularValuein interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The max-value for the specified series and item.
-
getMinOutlier
public Number getMinOutlier(int series, int item)
Returns the minimum value which is not a farout.- Specified by:
getMinOutlierin interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- A
Numberrepresenting the maximum non-farout value.
-
getMaxOutlier
public Number getMaxOutlier(int series, int item)
Returns the maximum value which is not a farout, ie Q3 + (interquartile range * farout coefficient).- Specified by:
getMaxOutlierin interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- A
Numberrepresenting the maximum non-farout value.
-
getOutliers
public List getOutliers(int series, int item)
Returns a list of outliers for the specified series and item.- Specified by:
getOutliersin interfaceBoxAndWhiskerXYDataset<S extends Comparable<S>>- Parameters:
series- the series (zero-based index).item- the item (zero-based index).- Returns:
- The list of outliers for the specified series and item
(possibly
null).
-
getRangeLowerBound
public double getRangeLowerBound(boolean includeInterval)
Returns the minimum y-value in the dataset.- Specified by:
getRangeLowerBoundin interfaceRangeInfo- Parameters:
includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The minimum value.
-
getRangeUpperBound
public double getRangeUpperBound(boolean includeInterval)
Returns the maximum y-value in the dataset.- Specified by:
getRangeUpperBoundin interfaceRangeInfo- Parameters:
includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The maximum value.
-
getRangeBounds
public Range getRangeBounds(boolean includeInterval)
Returns the range of the values in this dataset's range.- Specified by:
getRangeBoundsin interfaceRangeInfo- Parameters:
includeInterval- a flag that determines whether or not the y-interval is taken into account.- Returns:
- The range.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of the plot.- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the cloning is not supported.
-
-