Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class ErrorBarSeries

  1. Object
  2. Series
  3. XYSeries
  4. ErrorBarSeries

Values with an uncertainty interval, drawn as a marker with whiskers. Layer it over a bar or line series of the same values to add error bars to them.

double[] mean = {5, 7, 6}, low = {4, 6, 4.5}, high = {6, 8.5, 7};
new ErrorBarSeries("Mean").setIntervals(null, mean, low, high);

Error bars

Constructors

public ErrorBarSeries(String name)Creates an empty series.

Methods

public ErrorBarSeries setIntervals(double[] x, double[] value, double[] low, double[] high)Replaces all values.
public ErrorBarSeries setMarkers(boolean m)Shows or hides the marker at the central value, for overlaying on bars.
public double getLow(int i)The lower end of interval i.
public double getHigh(int i)The upper end of interval i.
public double[] getYBounds()The extent of the data along y, {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

Constructor details

ErrorBarSeries

public ErrorBarSeries(String name)
Creates an empty series.

Parameters

name String
the series name

Method details

setIntervals

public ErrorBarSeries setIntervals(double[] x, double[] value, double[] low, double[] high)
Replaces all values.

Parameters

x double[]
x values, or null for 0, 1, 2…
value double[]
the central values
low double[]
the lower end of each interval
high double[]
the upper end of each interval

Returns

this series

setMarkers

public ErrorBarSeries setMarkers(boolean m)
Shows or hides the marker at the central value, for overlaying on bars.

Parameters

m boolean
true to draw markers

Returns

this series

getLow

public double getLow(int i)
The lower end of interval i.

getHigh

public double getHigh(int i)
The upper end of interval i.

getYBounds

public double[] getYBounds()
The extent of the data along y, {min, max}, or null when empty or not cartesian.

paint

public void paint(ChartContext ctx)
Paints the series.

Parameters

ctx ChartContext
the current frame: graphics, plot area, axes and animation progress

formatTooltip

public String formatTooltip(ChartContext ctx, ChartPoint p)
The tooltip row for a point: the series or point name and its formatted value. Series with several values per point (open/high/low/close, ranges, box plots) override this.

Parameters

ctx ChartContext
the last paint context
p ChartPoint
the point

Returns

one line of text

tableValue

protected String tableValue(int i)
The text of point i in the accessible data table.

Parameters

i int
the point index

Returns

the formatted value