Package org.jfree.data.statistics
Class DefaultBoxAndWhiskerXYDataset
java.lang.Object
org.jfree.data.AbstractDataset
org.jfree.data.AbstractSeriesDataset
org.jfree.data.AbstractXYDataset
org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset
- All Implemented Interfaces:
ObjectInputValidation
,Serializable
,Cloneable
,EventListener
,Dataset
,RangeInfo
,SeriesChangeListener
,SeriesDataset
,BoxAndWhiskerXYDataset
,XYDataset
public class DefaultBoxAndWhiskerXYDataset extends AbstractXYDataset implements BoxAndWhiskerXYDataset, RangeInfo
A simple implementation of the
BoxAndWhiskerXYDataset
.- Author:
- David Browning
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DefaultBoxAndWhiskerXYDataset(String seriesName)
Constructs a new box and whisker dataset. -
Method Summary
Modifier and Type Method Description void
add(Date date, BoxAndWhiskerItem item)
Adds an item to the dataset.double
getFaroutCoefficient()
Returns the value used as the farout coefficient.int
getItemCount(int series)
Returns the number of items in the specified series.Number
getMaximumRangeValue()
Returns the maximum value in the dataset's range (or null if all the values in the range are null).Number
getMaxOutlier(int series, int item)
Returns the maximum value which is not a farout, ie Q3 + (interquartile range * farout coefficient).Number
getMaxRegularValue(int series, int item)
Returns the max-value for the specified series and item.Number
getMeanValue(int series, int item)
Returns the mean for the specified series and item.Number
getMedianValue(int series, int item)
Returns the median-value for the specified series and item.Number
getMinimumRangeValue()
Returns the minimum value in the dataset's range (or null if all the values in the range are null).Number
getMinOutlier(int series, int item)
Returns the minimum value which is not a farout.Number
getMinRegularValue(int series, int item)
Returns the min-value for the specified series and item.double
getOutlierCoefficient()
Returns the value used as the outlier coefficient.List
getOutliers(int series, int item)
Returns an array of outliers for the specified series and item.Number
getQ1Value(int series, int item)
Returns the Q1 median-value for the specified series and item.Number
getQ3Value(int series, int item)
Returns the Q3 median-value for the specified series and item.int
getSeriesCount()
Returns the number of series in the dataset.String
getSeriesName(int i)
Returns the name of the series stored in this dataset.Range
getValueRange()
Returns the range of the values in this dataset's range.Date
getXDate(int series, int item)
Returns the x-value for one item in a series, as a Date.Number
getXValue(int series, int item)
Returns the x-value for one item in a series.Number
getYValue(int series, int item)
Returns the y-value for one item in a series.void
setFaroutCoefficient(double faroutCoefficient)
Sets the value used as the farouts coefficient.void
setOutlierCoefficient(double outlierCoefficient)
Sets the value used as the outlier coefficientMethods inherited from class org.jfree.data.AbstractXYDataset
getX, getY
Methods inherited from class org.jfree.data.AbstractSeriesDataset
seriesChanged
Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, clone, getGroup, removeChangeListener, setGroup, validateObject
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
DefaultBoxAndWhiskerXYDataset
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:
seriesName
- the name of the series.
-
-
Method Details
-
add
Adds an item to the dataset.- Parameters:
date
- the date.item
- the item.
-
getSeriesName
Returns the name of the series stored in this dataset.- Specified by:
getSeriesName
in interfaceSeriesDataset
- Specified by:
getSeriesName
in classAbstractSeriesDataset
- Parameters:
i
- the index of the series. Currently ignored.- Returns:
- the name of this series.
-
getXValue
Returns the x-value for one item in a series.The value returned is a Long object generated from the underlying Date object.
-
getXDate
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.
-
getYValue
Returns the y-value for one item in a series.This method (from the XYDataset interface) is mapped to the getMaxNonOutlierValue(...) method.
-
getMeanValue
Returns the mean for the specified series and item.- Specified by:
getMeanValue
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- the mean for the specified series and item.
-
getMedianValue
Returns the median-value for the specified series and item.- Specified by:
getMedianValue
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- the median-value for the specified series and item.
-
getQ1Value
Returns the Q1 median-value for the specified series and item.- Specified by:
getQ1Value
in interfaceBoxAndWhiskerXYDataset
- 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
Returns the Q3 median-value for the specified series and item.- Specified by:
getQ3Value
in interfaceBoxAndWhiskerXYDataset
- 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
Returns the min-value for the specified series and item.- Specified by:
getMinRegularValue
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- the min-value for the specified series and item.
-
getMaxRegularValue
Returns the max-value for the specified series and item.- Specified by:
getMaxRegularValue
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- the max-value for the specified series and item.
-
getMinOutlier
Returns the minimum value which is not a farout.- Specified by:
getMinOutlier
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- a
Number
representing the maximum non-farout value.
-
getMaxOutlier
Returns the maximum value which is not a farout, ie Q3 + (interquartile range * farout coefficient).- Specified by:
getMaxOutlier
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- a
Number
representing the maximum non-farout value.
-
getOutliers
Returns an array of outliers for the specified series and item.- Specified by:
getOutliers
in interfaceBoxAndWhiskerXYDataset
- Parameters:
series
- the series (zero-based index).item
- the item (zero-based index).- Returns:
- the array of outliers for the specified series and item.
-
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:
getOutlierCoefficient
in interfaceBoxAndWhiskerXYDataset
- Returns:
- a
double
representing the value used to calculate outliers
-
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:
getFaroutCoefficient
in interfaceBoxAndWhiskerXYDataset
- Returns:
- a
double
representing the value used to calculate farouts
-
getSeriesCount
public int getSeriesCount()Returns the number of series in the dataset.This implementation only allows one series.
- Specified by:
getSeriesCount
in interfaceSeriesDataset
- Specified by:
getSeriesCount
in classAbstractSeriesDataset
- Returns:
- the number of series.
-
getItemCount
public int getItemCount(int series)Returns the number of items in the specified series.- Specified by:
getItemCount
in interfaceXYDataset
- Parameters:
series
- the index (zero-based) of the series.- Returns:
- the number of items in the specified series.
-
setOutlierCoefficient
public void setOutlierCoefficient(double outlierCoefficient)Sets the value used as the outlier coefficient- Parameters:
outlierCoefficient
- being adouble
representing the value used to calculate outliers
-
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 adouble
representing the value used to calculate farouts
-
getMinimumRangeValue
Returns the minimum value in the dataset's range (or null if all the values in the range are null).- Specified by:
getMinimumRangeValue
in interfaceRangeInfo
- Returns:
- the minimum value.
-
getMaximumRangeValue
Returns the maximum value in the dataset's range (or null if all the values in the range are null).- Specified by:
getMaximumRangeValue
in interfaceRangeInfo
- Returns:
- the maximum value.
-
getValueRange
Returns the range of the values in this dataset's range.- Specified by:
getValueRange
in interfaceRangeInfo
- Returns:
- the range.
-