Class 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.
-
Constructor Summary
ConstructorsConstructorDescriptionSankeyLayout(int nodeCount, int[] src, int[] dst, double[] value, float x, float y, float w, float h, float nodeWidth, float nodePad) Computes a layout. -
Method Summary
Modifier and TypeMethodDescriptionintgetColumn(int i) The column of nodei.intThe number of columns.intThe number of links this layout was computed for.floatgetLinkSourceY(int l) The top of linklwhere it leaves its source.floatgetLinkTargetY(int l) The top of linklwhere it enters its target.floatgetLinkWidth(int l) The thickness of linkl.intThe number of nodes this layout was computed for.floatgetNodeHeight(int i) The height of nodei.floatgetNodeX(int i) The left of nodei.floatgetNodeY(int i) The top of nodei.booleanisBackLink(int l) True when linklcloses 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.
-
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
-
nodeCount: the number of nodes -
src: source node of each link -
dst: target node of each link -
value: value of each link -
x: the area's left -
y: the area's top -
w: the area's width -
h: the area's height -
nodeWidth: the width of a node bar -
nodePad: the vertical gap between nodes of one column
-
-
-
Method Details
-
isBackLink
public boolean isBackLink(int l) True when link
lcloses 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
l: 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 nodei. -
getNodeX
public float getNodeX(int i) The left of nodei. -
getNodeY
public float getNodeY(int i) The top of nodei. -
getNodeHeight
public float getNodeHeight(int i) The height of nodei. -
getLinkSourceY
public float getLinkSourceY(int l) The top of linklwhere it leaves its source. -
getLinkTargetY
public float getLinkTargetY(int l) The top of linklwhere it enters its target. -
getLinkWidth
public float getLinkWidth(int l) The thickness of linkl.
-