Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class BoxPlotSeries
Box and whisker plots: the median, the interquartile box and the whiskers of each group.
Give it the five numbers directly or let it compute them from raw samples:
double[] mondaySamples = {120, 135, 150, 180, 240};
double[] tuesdaySamples = {110, 125, 140, 160, 300};
BoxPlotSeries s = new BoxPlotSeries("Latency");
s.addSamples(0, mondaySamples);
s.addSamples(1, tuesdaySamples);
Constructors
public BoxPlotSeries(String name) | Creates an empty series. |
Methods
public BoxPlotSeries addBox(double x, double min, double q1, double median, double q3, double max) | Appends a box from its five numbers. |
public BoxPlotSeries addSamples(double x, double[] samples) | Appends a box computed from raw samples. |
public double[] getOutliers(int i) | The outliers of box i: the samples addSamples placed beyond the whiskers. |
public double getMin(int i) | The lower whisker of box i. |
public double getMax(int i) | The upper whisker of box i. |
protected void dataChanged() | Forgets the outliers of boxes that are no longer in the series, such as one a slide dropped; they are dropped when the outliers are next read. |
public static double quantile(double[] sorted, double q) | Linear interpolated quantile of sorted data. |
public BoxPlotSeries setBoxFraction(float f) | The fraction of each slot a box takes. |
public double[] getYBounds() | The extent of the data along y, {min, max}, or null when empty or not cartesian. |
public double[] getXBounds() | The extent of the data along x, {min, max}, or null when empty or not cartesian. |
public void paint(ChartContext ctx) | Paints the series. |
public String formatTooltip(ChartContext ctx, ChartPoint p) | The tooltip row for a point: the series or point name and its formatted value. |
protected String tableValue(int i) | The text of point i in the accessible data table. |
Inherited methods
From XYSeries
setRows, addRow, auxDefault, getAux, isCartesian, setData, setValues, add, add, set, clear, setMaxPoints, setStackGroup, getStackGroup, size, getX, getY, getBase, isGapAt, isAscending, nearestIndexOfX, animatedY, consumesStackBase, animatedAux, isAuxRelative, animatedBase, targetBase, hasOwnBase, captureTransitionStart, transitionEnded, captureEntryStart, getXBoundsWithin, getMinXSpacing, lowerBound, visibleRange, screenPosition, nearestScreenIndex, hitTest, collectTableRows, getPointCount, getPoint
From Series
getName, setName, getColor, setColor, isVisible, setVisible, isSecondaryAxis, setSecondaryAxis, isShowValues, setShowValues, getValueFormatter, setValueFormatter, getChart, getSelectablePointCount, isPointCountFromLayout, paintLegendSymbol, getLegendEntryCount, getLegendEntryName, paintLegendEntrySymbol, isLegendEntryVisible, toggleLegendEntry, formatValue, handleTap, attached, detached, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
BoxPlotSeries
public BoxPlotSeries(String name)Parameters
nameString- the series name
Method details
addBox
public BoxPlotSeries addBox(double x, double min, double q1, double median, double q3, double max)Parameters
xdouble- the group’s x value
mindouble- the lower whisker
q1double- the first quartile
mediandouble- the median
q3double- the third quartile
maxdouble- the upper whisker
Returns
addSamples
public BoxPlotSeries addSamples(double x, double[] samples)getOutliers(int).Parameters
xdouble- the group’s x value
samplesdouble[]- the values; the array is not modified
Returns
getOutliers
public double[] getOutliers(int i)i: the samples addSamples placed beyond the whiskers. A box given
by addBox has none.Parameters
iint- the box index
Returns
getMin
public double getMin(int i)i.Parameters
iint- the box index
Returns
getMax
public double getMax(int i)i.Parameters
iint- the box index
Returns
dataChanged
protected void dataChanged()quantile
public static double quantile(double[] sorted, double q)Parameters
sorteddouble[]- ascending values
qdouble- the quantile, 0 to 1
Returns
setBoxFraction
public BoxPlotSeries setBoxFraction(float f)Parameters
ffloat- 0.1 to 1
Returns
getYBounds
public double[] getYBounds(){min, max}, or null when empty or not cartesian.getXBounds
public double[] getXBounds(){min, max}, or null when empty or not cartesian.paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
formatTooltip
public String formatTooltip(ChartContext ctx, ChartPoint p)Parameters
ctxChartContext- the last paint context
pChartPoint- the point
Returns
tableValue
protected String tableValue(int i)i in the accessible data table.Parameters
iint- the point index