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

public class SankeySeries

  1. Object
  2. Series
  3. 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);

A Sankey diagram

Constructors

public SankeySeries(String name)Creates an empty diagram.

Methods

public boolean isCartesian()True for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.
public SankeySeries addLink(String source, String target, double value)Adds a flow, creating its nodes if needed.
public SankeySeries clear()Removes all nodes and links.
public SankeySeries setLinkAlpha(float a)The opacity of the link bands.
public int getNodeCount()The number of nodes.
public int getLinkCount()The number of links.
protected void captureEntryStart()Records a zero baseline as the start of the entry animation.
protected void dataChanged()Tells the chart this series’ data changed, which animates the new values in.
public void paint(ChartContext ctx)Paints the series.
public int getPointCount()The number of points along x, for a shared tooltip; -1 when not index aligned.
public ChartPoint getPoint(ChartContext ctx, int index)Points 0..nodeCount-1 are nodes, the rest are links.
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)Finds the data point nearest a screen position.
public String formatTooltip(ChartContext ctx, ChartPoint p)The tooltip row for a point: the series or point name and its formatted value.
public void collectTableRows(List<String[]> rows)Adds this series’ data to an accessible table, one {series, item, value} row per point.

Inherited methods

Constructor details

SankeySeries

public SankeySeries(String name)
Creates an empty diagram.

Parameters

name String
the series name

Method details

isCartesian

public boolean isCartesian()
True for series drawn against x and y axes; false for pies, treemaps and other series that fill the plot themselves.

addLink

public SankeySeries addLink(String source, String target, double value)
Adds a flow, creating its nodes if needed.

Parameters

source String
the source node’s name
target String
the target node’s name
value double
the amount that flows

Returns

this series

clear

public SankeySeries clear()
Removes all nodes and links.

Returns

this series

setLinkAlpha

public SankeySeries setLinkAlpha(float a)
The opacity of the link bands.

Parameters

a float
0 to 1

Returns

this series

getNodeCount

public int getNodeCount()
The number of nodes.

getLinkCount

public int getLinkCount()
The number of links.

captureEntryStart

protected void captureEntryStart()
Records a zero baseline as the start of the entry animation.

dataChanged

protected void dataChanged()
Tells the chart this series’ data changed, which animates the new values in.

paint

public void paint(ChartContext ctx)
Paints the series.

Parameters

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

getPointCount

public int getPointCount()
The number of points along x, for a shared tooltip; -1 when not index aligned.

getPoint

public ChartPoint getPoint(ChartContext ctx, int index)
Points 0..nodeCount-1 are nodes, the rest are links.

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

formatTooltip

public String formatTooltip(ChartContext ctx, ChartPoint p)
The tooltip row for a point: the series or point name and its formatted value. Series with several values per point (open/high/low/close, ranges, box plots) override this.

Parameters

ctx ChartContext
the last paint context
p ChartPoint
the point

Returns

one line of text

collectTableRows

public void collectTableRows(List<String[]> rows)
Adds this series’ data to an accessible table, one {series, item, value} row per point. Used by Chart.toTable() and the chart’s accessibility text.

Parameters

rows List<String[]>
the list to append rows to