- java.lang.Object
-
- org.jfree.data.statistics.BoxAndWhiskerCalculator
-
public abstract class BoxAndWhiskerCalculator extends Object
A utility class that calculates the mean, median, quartiles Q1 and Q3, plus a list of outlier values...all from an arbitrary list ofNumberobjects.
-
-
Constructor Summary
Constructors Constructor Description BoxAndWhiskerCalculator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BoxAndWhiskerItemcalculateBoxAndWhiskerStatistics(List<? extends Number> values)Calculates the statistics required for aBoxAndWhiskerItemfrom a list ofNumberobjects.static BoxAndWhiskerItemcalculateBoxAndWhiskerStatistics(List<? extends Number> values, boolean stripNullAndNaNItems)Calculates the statistics required for aBoxAndWhiskerItemfrom a list ofNumberobjects.static doublecalculateQ1(List values)Calculates the first quartile for a list of numbers in ascending order.static doublecalculateQ3(List values)Calculates the third quartile for a list of numbers in ascending order.
-
-
-
Constructor Detail
-
BoxAndWhiskerCalculator
public BoxAndWhiskerCalculator()
-
-
Method Detail
-
calculateBoxAndWhiskerStatistics
public static BoxAndWhiskerItem calculateBoxAndWhiskerStatistics(List<? extends Number> values)
Calculates the statistics required for aBoxAndWhiskerItemfrom a list ofNumberobjects. Any items in the list that arenull, not an instance ofNumber, or equivalent toDouble.NaN, will be ignored.- Parameters:
values- a list of numbers (anulllist is not permitted).- Returns:
- A box-and-whisker item.
-
calculateBoxAndWhiskerStatistics
public static BoxAndWhiskerItem calculateBoxAndWhiskerStatistics(List<? extends Number> values, boolean stripNullAndNaNItems)
Calculates the statistics required for aBoxAndWhiskerItemfrom a list ofNumberobjects. Any items in the list that arenull, not an instance ofNumber, or equivalent toDouble.NaN, will be ignored.- Parameters:
values- a list of numbers (anulllist is not permitted).stripNullAndNaNItems- a flag that controls the handling of null and NaN items.- Returns:
- A box-and-whisker item.
- Since:
- 1.0.3
-
calculateQ1
public static double calculateQ1(List values)
Calculates the first quartile for a list of numbers in ascending order. If the items in the list are not in ascending order, the result is unspecified. If the list contains items that arenull, not an instance ofNumber, or equivalent toDouble.NaN, the result is unspecified.- Parameters:
values- the numbers in ascending order (nullnot permitted).- Returns:
- The first quartile.
-
calculateQ3
public static double calculateQ3(List values)
Calculates the third quartile for a list of numbers in ascending order. If the items in the list are not in ascending order, the result is unspecified. If the list contains items that arenull, not an instance ofNumber, or equivalent toDouble.NaN, the result is unspecified.- Parameters:
values- the list of values (nullnot permitted).- Returns:
- The third quartile.
-
-