Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class 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);
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
From XYSeries
setRows, addRow, getAux, isCartesian, setData, setValues, add, add, set, clear, setMaxPoints, setStackGroup, getStackGroup, size, getX, getY, dataChanged, isGapAt, isAscending, nearestIndexOfX, animatedY, animatedAux, isAuxRelative, animatedBase, captureTransitionStart, transitionEnded, captureEntryStart, getXBoundsWithin, getMinXSpacing, lowerBound, visibleRange, screenPosition, nearestScreenIndex, 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
RangeBarSeries
public RangeBarSeries(String name)Parameters
nameString- the series name
Method details
auxDefault
protected double auxDefault(int channel, double y)add(x, y) or setData starts at zero, so its bar spans 0..y.setRanges
public RangeBarSeries setRanges(double[] x, double[] start, double[] end)Parameters
xdouble[]- the x value of each bar, or null for 0, 1, 2…
startdouble[]- where each bar starts
enddouble[]- where each bar ends
Returns
addRange
public RangeBarSeries addRange(double x, double start, double end)Parameters
xdouble- the x value
startdouble- the start value
enddouble- the end value
Returns
getStart
public double getStart(int i)i.getEnd
public double getEnd(int i)i.getBase
public double getBase(int i)i rests on: 0, or the stacked sum of the earlier series
in its group.consumesStackBase
protected boolean consumesStackBase()Returns
hasOwnBase
protected boolean hasOwnBase()Returns
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
getYBounds
public double[] getYBounds(){min, max}, or null when empty or not cartesian.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