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);

-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBand(double from, double to, int rgb) Adds a coloured zone to the scale.protected voidRecords a zero baseline as the start of the entry animation.protected voidRecords the values currently on screen as the start of the next transition.voidcollectTableRows(List<String[]> rows) Adds this series' data to an accessible table, one{series, item, value}row per point.getPoint(ChartContext ctx, int index) The point atindexfor a shared tooltip, or null.intThe number of points along x, for a shared tooltip; -1 when not index aligned.doubleThe end of the scale.doubleThe start of the scale.doublegetValue()The current value.hitTest(ChartContext ctx, int x, int y, int radius) Finds the data point nearest a screen position.booleanTrue for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.voidpaint(ChartContext ctx) Paints the series.setNeedle(boolean n) Shows a needle over the bands instead of a filled arc.setRange(double min, double max) Changes the scale.setSweep(double deg) The angle the scale spans; 180 is a semicircle, 240 the default, 360 a ring.Text appended to the value, such as "%" or " km/h".setValue(double v) Sets the value, animated from the current one.Methods inherited from class Series
attached, dataChanged, detached, formatTooltip, formatValue, getChart, getColor, getLegendEntryCount, getLegendEntryName, getName, getSelectablePointCount, getValueFormatter, getVisibilityFraction, getXBounds, getXBoundsWithin, getYBounds, handleTap, isGap, isLegendEntryVisible, isPointCountFromLayout, isSecondaryAxis, isShowValues, isVisible, lerp, paintLegendEntrySymbol, paintLegendSymbol, repaintChart, setColor, setName, setSecondaryAxis, setShowValues, setValueFormatter, setVisible, toggleLegendEntry, transitionEnded
-
Constructor Details
-
GaugeSeries
Creates a gauge.
Parameters
-
name: the label under the value -
min: the start of the scale -
max: the end of the scale
-
-
-
Method Details
-
isCartesian
public boolean isCartesian()Description copied from class:SeriesTrue for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.- Specified by:
isCartesianin classSeries
-
setValue
Sets the value, animated from the current one.
Parameters
v: the new value, clamped to the scale
Returns
this series
-
getValue
public double getValue()The current value. -
setRange
Changes the scale. Ends given in the wrong order are swapped, so
setRange(100, 0)is the scale from 0 to 100.Parameters
-
min: the start of the scale -
max: the end of the scale
Returns
this series
-
-
getRangeMin
public double getRangeMin()The start of the scale.
Returns
the smaller end
-
getRangeMax
public double getRangeMax()The end of the scale.
Returns
the larger end
-
addBand
Adds a coloured zone to the scale.
Parameters
-
from: where the zone starts -
to: where the zone ends -
rgb: its colour
Returns
this series
-
-
setSweep
The angle the scale spans; 180 is a semicircle, 240 the default, 360 a ring.
Parameters
deg: the sweep in degrees
Returns
this series
-
setNeedle
Shows a needle over the bands instead of a filled arc.
Parameters
n: true for a needle
Returns
this series
-
setUnit
Text appended to the value, such as "%" or " km/h".
Parameters
unit: the suffix
Returns
this series
-
captureTransitionStart
protected void captureTransitionStart()Description copied from class:SeriesRecords the values currently on screen as the start of the next transition. Called by the chart before data changes; a subclass with animated data overrides it.- Overrides:
captureTransitionStartin classSeries
-
captureEntryStart
protected void captureEntryStart()Description copied from class:SeriesRecords a zero baseline as the start of the entry animation.- Overrides:
captureEntryStartin classSeries
-
paint
Description copied from class:SeriesPaints the series.
Parameters
ctx: the current frame: graphics, plot area, axes and animation progress
-
hitTest
Description copied from class:SeriesFinds the data point nearest a screen position.
Parameters
-
ctx: the frame the series was last painted in -
x: chart relative x -
y: chart relative y -
radius: how far from the point a touch may land and still hit it
Returns
the point, or null
-
-
getPointCount
public int getPointCount()Description copied from class:SeriesThe number of points along x, for a shared tooltip; -1 when not index aligned.- Overrides:
getPointCountin classSeries
-
getPoint
Description copied from class:SeriesThe point atindexfor a shared tooltip, or null. -
collectTableRows
Description copied from class:SeriesAdds this series' data to an accessible table, one
{series, item, value}row per point. Used byChart.toTable()and the chart's accessibility text.Parameters
rows: the list to append rows to
- Overrides:
collectTableRowsin classSeries
-