Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class SankeySeries
A sankey diagram: flows between stages drawn as bands whose thickness is the flow’s value.
Nodes are created by name as links mention them.
SankeySeries s = new SankeySeries("Energy");
s.addLink("Solar", "Grid", 40).addLink("Gas", "Grid", 60).addLink("Grid", "Homes", 55).addLink("Grid", "Industry", 45);
Constructors
public SankeySeries(String name) | Creates an empty diagram. |
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, captureTransitionStart, transitionEnded, formatValue, handleTap, attached, detached, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
SankeySeries
public SankeySeries(String name)Parameters
nameString- the series name
Method details
isCartesian
public boolean isCartesian()addLink
public SankeySeries addLink(String source, String target, double value)Parameters
sourceString- the source node’s name
targetString- the target node’s name
valuedouble- the amount that flows
Returns
clear
public SankeySeries clear()Returns
setLinkAlpha
public SankeySeries setLinkAlpha(float a)Parameters
afloat- 0 to 1
Returns
getNodeCount
public int getNodeCount()getLinkCount
public int getLinkCount()captureEntryStart
protected void captureEntryStart()dataChanged
protected void dataChanged()paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
getPointCount
public int getPointCount()getPoint
public ChartPoint getPoint(ChartContext ctx, int index)0..nodeCount-1 are nodes, the rest are links.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
formatTooltip
public String formatTooltip(ChartContext ctx, ChartPoint p)Parameters
ctxChartContext- the last paint context
pChartPoint- the point
Returns
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