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

public final class Annotation

  1. Object
  2. Annotation

A reference line, shaded band or label laid over a cartesian chart: a target, a threshold, a weekend, a release date.

Chart chart = new Chart();
double start = 2, end = 4;
chart.addAnnotation(Annotation.valueLine(100, "Target"));
chart.addAnnotation(Annotation.xBand(start, end, "Outage").setColor(0xEF5350));

A value line, a value band and an x band

Methods

public static Annotation valueLine(double value, String label)A line across the plot at a value.
public static Annotation valueBand(double from, double to, String label)A shaded band between two values.
public static Annotation xLine(double x, String label)A line across the plot at an x position (a date, a category index).
public static Annotation xBand(double from, double to, String label)A shaded band between two x positions.
public Annotation setColor(int rgb)Sets the colour; the theme’s axis colour by default.
public Annotation setDashed(boolean dashed)Draws a line solid instead of dashed.
public Annotation setBehindSeries(boolean behind)Draws behind the series instead of over them; bands default to behind.
public Annotation setIncludeInRange(boolean include)Whether a value line or band widens the value axis so it is always visible.
public Annotation setSecondaryAxis(boolean secondary)Measures a value line or band against the chart’s secondary y axis, for a threshold that belongs to a series drawn on that axis.

Inherited methods

Method details

valueLine

public static Annotation valueLine(double value, String label)
A line across the plot at a value.

valueBand

public static Annotation valueBand(double from, double to, String label)
A shaded band between two values.

xLine

public static Annotation xLine(double x, String label)
A line across the plot at an x position (a date, a category index).

xBand

public static Annotation xBand(double from, double to, String label)
A shaded band between two x positions.

setColor

public Annotation setColor(int rgb)
Sets the colour; the theme’s axis colour by default.

setDashed

public Annotation setDashed(boolean dashed)
Draws a line solid instead of dashed.

setBehindSeries

public Annotation setBehindSeries(boolean behind)
Draws behind the series instead of over them; bands default to behind.

setIncludeInRange

public Annotation setIncludeInRange(boolean include)
Whether a value line or band widens the value axis so it is always visible.

setSecondaryAxis

public Annotation setSecondaryAxis(boolean secondary)
Measures a value line or band against the chart’s secondary y axis, for a threshold that belongs to a series drawn on that axis.