Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class SunburstSeries
- Object
- Series
- HierarchySeries
- 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));
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
From HierarchySeries
isCartesian, setRoot, attached, detached, getRoot, getCurrent, setCurrent, setDrillDown, setMaxDepth, getMaxDepth, captureEntryStart, captureTransitionStart, transitionEnded, tween, growth, colorOf, paintBreadcrumb, record, isPointCountFromLayout, getPointCount, getPoint, getNode, handleTap, formatTooltip, collectTableRows
From Series
getName, setName, getColor, setColor, isVisible, setVisible, isSecondaryAxis, setSecondaryAxis, isShowValues, setShowValues, getValueFormatter, setValueFormatter, getChart, getXBounds, getXBoundsWithin, getYBounds, getSelectablePointCount, paintLegendSymbol, getLegendEntryCount, getLegendEntryName, paintLegendEntrySymbol, isLegendEntryVisible, toggleLegendEntry, formatValue, dataChanged, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
SunburstSeries
public SunburstSeries(String name, TreeNode root)Parameters
nameString- the series name
rootTreeNode- the tree’s root
Method details
paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
crumbContains
protected boolean crumbContains(float ax, float ay)Parameters
axfloat- the x coordinate
ayfloat- the y coordinate
Returns
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
collapsed
protected float[] collapsed(float[] r)Parameters
rfloat[]- the node’s geometry after the change
Returns
contains
protected boolean contains(float[] geo, float x, float y)Parameters
geofloat[]- a recorded geometry
xfloat- absolute x
yfloat- absolute y
Returns
anchor
protected float[] anchor(float[] geo){x, y} absolute.Parameters
geofloat[]- a recorded geometry