Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class SankeyLayout
- Object
- SankeyLayout
Positions the nodes and links of a sankey diagram.
Nodes go into columns by their longest path from a source, with sinks pushed to the last column. Heights are proportional to the larger of a node’s inflow and outflow, using one scale for every column. Vertical positions are then relaxed towards the weighted centre of each node’s neighbours, which shortens and straightens links, and overlaps are pushed apart.
Constructors
public SankeyLayout(int nodeCount, int[] src, int[] dst, double[] value, float x, float y, float w, float h, float nodeWidth, float nodePad) | Computes a layout. |
Methods
public boolean isBackLink(int l) | True when link l closes a cycle (or is a self loop): it points back to a node at or left of its source, so it does not take part in assigning columns and runs right to left. |
public int getNodeCount() | The number of nodes this layout was computed for. |
public int getLinkCount() | The number of links this layout was computed for. |
public int getColumns() | The number of columns. |
public int getColumn(int i) | The column of node i. |
public float getNodeX(int i) | The left of node i. |
public float getNodeY(int i) | The top of node i. |
public float getNodeHeight(int i) | The height of node i. |
public float getLinkSourceY(int l) | The top of link l where it leaves its source. |
public float getLinkTargetY(int l) | The top of link l where it enters its target. |
public float getLinkWidth(int l) | The thickness of link l. |
Inherited methods
Constructor details
SankeyLayout
public SankeyLayout(int nodeCount, int[] src, int[] dst, double[] value, float x, float y, float w, float h, float nodeWidth, float nodePad)Computes a layout.
Parameters
nodeCountint- the number of nodes
srcint[]- source node of each link
dstint[]- target node of each link
valuedouble[]- value of each link
xfloat- the area’s left
yfloat- the area’s top
wfloat- the area’s width
hfloat- the area’s height
nodeWidthfloat- the width of a node bar
nodePadfloat- the vertical gap between nodes of one column
Method details
isBackLink
public boolean isBackLink(int l)True when link
l closes a cycle (or is a self loop): it points back to a node at or
left of its source, so it does not take part in assigning columns and runs right to left.Parameters
lint- the link
Returns
true for a back link
getNodeCount
public int getNodeCount()The number of nodes this layout was computed for.
getLinkCount
public int getLinkCount()The number of links this layout was computed for.
getColumns
public int getColumns()The number of columns.
getColumn
public int getColumn(int i)The column of node
i.getNodeX
public float getNodeX(int i)The left of node
i.getNodeY
public float getNodeY(int i)The top of node
i.getNodeHeight
public float getNodeHeight(int i)The height of node
i.getLinkSourceY
public float getLinkSourceY(int l)The top of link
l where it leaves its source.getLinkTargetY
public float getLinkTargetY(int l)The top of link
l where it enters its target.getLinkWidth
public float getLinkWidth(int l)The thickness of link
l.