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

public class RangeBarSeries

  1. Object
  2. Series
  3. XYSeries
  4. BarSeries
  5. RangeBarSeries

Floating bars that span from a start value to an end value: schedules, temperature ranges, price ranges. Combine with Chart.setRotated(true) for a timeline.

double[] lows = {4, 6, 9}, highs = {12, 15, 19};
new RangeBarSeries("Temperature").setRanges(null, lows, highs);

Range bars

Constructors

public RangeBarSeries(String name)Creates an empty series.

Methods

protected double auxDefault(int channel, double y)A range added by add(x, y) or setData starts at zero, so its bar spans 0..y.
public RangeBarSeries setRanges(double[] x, double[] start, double[] end)Replaces all ranges.
public RangeBarSeries addRange(double x, double start, double end)Appends one range.
public double getStart(int i)The start of range i.
public double getEnd(int i)The end of range i.
public double getBase(int i)The base this series’ point i rests on: 0, or the stacked sum of the earlier series in its group.
protected boolean consumesStackBase()True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).
protected boolean hasOwnBase()True for a series whose base is its own data (a range bar’s start, a waterfall’s running total) rather than a stack: it is drawn from that base but is no layer of a stack.
protected double targetBase(int i)The base point i settles on once the running transition ends: the stack of the earlier layers weighted by the fraction each ends at, or getBase(int) outside a stack group.
public double[] getYBounds()The extent of the data along y, {min, max}, or null when empty or not cartesian.
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

RangeBarSeries

public RangeBarSeries(String name)
Creates an empty series.

Parameters

name String
the series name

Method details

auxDefault

protected double auxDefault(int channel, double y)
A range added by add(x, y) or setData starts at zero, so its bar spans 0..y.

setRanges

public RangeBarSeries setRanges(double[] x, double[] start, double[] end)
Replaces all ranges.

Parameters

x double[]
the x value of each bar, or null for 0, 1, 2…
start double[]
where each bar starts
end double[]
where each bar ends

Returns

this series

addRange

public RangeBarSeries addRange(double x, double start, double end)
Appends one range.

Parameters

x double
the x value
start double
the start value
end double
the end value

Returns

this series

getStart

public double getStart(int i)
The start of range i.

getEnd

public double getEnd(int i)
The end of range i.

getBase

public double getBase(int i)
The base this series’ point i rests on: 0, or the stacked sum of the earlier series in its group.

consumesStackBase

protected boolean consumesStackBase()
True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).

Returns

false by default

hasOwnBase

protected boolean hasOwnBase()
True for a series whose base is its own data (a range bar’s start, a waterfall’s running total) rather than a stack: it is drawn from that base but is no layer of a stack.

Returns

false by default

targetBase

protected double targetBase(int i)

The base point i settles on once the running transition ends: the stack of the earlier layers weighted by the fraction each ends at, or getBase(int) outside a stack group. A series whose base is its own data (a range bar’s start, a waterfall’s running total) overrides this to answer that, so the tween ends exactly where the settled value is.

  • i: the point index

Returns

the settled base

getYBounds

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

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