Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class GaugeSeries
A gauge: one value on a curved scale, with optional coloured bands such as green / amber / red zones. The needle or the filled arc animates to each new value.
GaugeSeries cpu = new GaugeSeries("CPU", 0, 100).setValue(72);
cpu.addBand(0, 60, 0x009E73).addBand(60, 85, 0xE69F00).addBand(85, 100, 0xD55E00);
Constructors
public GaugeSeries(String name, double min, double max) | Creates a gauge. |
Methods
Inherited methods
From Series
getName, setName, getColor, setColor, isVisible, setVisible, isSecondaryAxis, setSecondaryAxis, isShowValues, setShowValues, getValueFormatter, setValueFormatter, getChart, getXBounds, getXBoundsWithin, getYBounds, getSelectablePointCount, isPointCountFromLayout, paintLegendSymbol, getLegendEntryCount, getLegendEntryName, paintLegendEntrySymbol, isLegendEntryVisible, toggleLegendEntry, transitionEnded, formatValue, formatTooltip, handleTap, attached, detached, dataChanged, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
GaugeSeries
public GaugeSeries(String name, double min, double max)Parameters
nameString- the label under the value
mindouble- the start of the scale
maxdouble- the end of the scale
Method details
isCartesian
public boolean isCartesian()setValue
public GaugeSeries setValue(double v)Parameters
vdouble- the new value, clamped to the scale
Returns
getValue
public double getValue()setRange
public GaugeSeries setRange(double min, double max)setRange(100, 0) is
the scale from 0 to 100.Parameters
mindouble- the start of the scale
maxdouble- the end of the scale
Returns
getRangeMin
public double getRangeMin()Returns
getRangeMax
public double getRangeMax()Returns
addBand
public GaugeSeries addBand(double from, double to, int rgb)Parameters
fromdouble- where the zone starts
todouble- where the zone ends
rgbint- its colour
Returns
setSweep
public GaugeSeries setSweep(double deg)Parameters
degdouble- the sweep in degrees
Returns
setNeedle
public GaugeSeries setNeedle(boolean n)Parameters
nboolean- true for a needle
Returns
setUnit
public GaugeSeries setUnit(String unit)Parameters
unitString- the suffix
Returns
captureTransitionStart
protected void captureTransitionStart()captureEntryStart
protected void captureEntryStart()paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
hitTest
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)Parameters
ctxChartContext- the frame the series was last painted in
xint- chart relative x
yint- chart relative y
radiusint- how far from the point a touch may land and still hit it
Returns
getPointCount
public int getPointCount()getPoint
public ChartPoint getPoint(ChartContext ctx, int index)index for a shared tooltip, or null.collectTableRows
public void collectTableRows(List<String[]> rows){series, item, value} row per point.
Used by Chart.toTable() and the chart’s accessibility text.Parameters
rowsList<String[]>- the list to append rows to