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

public class SunburstSeries

  1. Object
  2. Series
  3. HierarchySeries
  4. SunburstSeries

A sunburst: the hierarchy as concentric rings, the root in the centre and each level one ring further out, every node’s angle proportional to its value. Tap a branch to make it the centre; tap the centre to go back up.

Chart chart = new Chart();
TreeNode root = new TreeNode("All");
root.add(new TreeNode("Photos", 40));
TreeNode apps = root.add(new TreeNode("Apps"));
apps.add(new TreeNode("Games", 15));
apps.add(new TreeNode("Tools", 10));
root.add(new TreeNode("Music", 20));
chart.addSeries(new SunburstSeries("Disk usage", root).setMaxDepth(3));

A sunburst

Constructors

public SunburstSeries(String name, TreeNode root)Creates a sunburst.

Methods

public void paint(ChartContext ctx)Paints the series.
protected boolean crumbContains(float ax, float ay)True when a point, in screen coordinates, is on the breadcrumb that goes back up.
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)Finds the data point nearest a screen position.
protected float[] collapsed(float[] r)The geometry a node added by a data change grows from: by default the geometry itself, so the node appears in place.
protected boolean contains(float[] geo, float x, float y)True if the absolute point lies in a recorded geometry.
protected float[] anchor(float[] geo)The anchor point of a recorded geometry, {x, y} absolute.

Inherited methods

Constructor details

SunburstSeries

public SunburstSeries(String name, TreeNode root)
Creates a sunburst.

Parameters

name String
the series name
root TreeNode
the tree’s root

Method details

paint

public void paint(ChartContext ctx)
Paints the series.

Parameters

ctx ChartContext
the current frame: graphics, plot area, axes and animation progress

crumbContains

protected boolean crumbContains(float ax, float ay)
True when a point, in screen coordinates, is on the breadcrumb that goes back up.

Parameters

ax float
the x coordinate
ay float
the y coordinate

Returns

true on the breadcrumb

hitTest

public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)
Finds the data point nearest a screen position.

Parameters

ctx ChartContext
the frame the series was last painted in
x int
chart relative x
y int
chart relative y
radius int
how far from the point a touch may land and still hit it

Returns

the point, or null

collapsed

protected float[] collapsed(float[] r)
The geometry a node added by a data change grows from: by default the geometry itself, so the node appears in place.

Parameters

r float[]
the node’s geometry after the change

Returns

a new array of the same length

contains

protected boolean contains(float[] geo, float x, float y)
True if the absolute point lies in a recorded geometry.

Parameters

geo float[]
a recorded geometry
x float
absolute x
y float
absolute y

Returns

true on a hit

anchor

protected float[] anchor(float[] geo)
The anchor point of a recorded geometry, {x, y} absolute.

Parameters

geo float[]
a recorded geometry

Returns

the point a tooltip points at