SankeyDiagramLinkLabel
New in version 5.0.10
SankeyDiagramLinkLabel ( sourceNodeID ; targetNodeID ; position ; text ; font ; size ; style ; color ; alignment ; orientation ; textWidthMax ; textHeightMax ; shadowEffect ; shadowColor )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
sourceNodeID | str | 0..1000 | ||
targetNodeID | str | 0..1000 | ||
position | num | -10..10 | 0 | |
text | styt | 0..1000 | ||
font | str | 0..1000 | ApplFont | |
size | num | 0..1000 | 9 | |
style | int | 0..7 | plain | |
color | rgba | 0..255 | black | |
alignment | int | 1..3 | 2 | |
orientation | num | -360..360 | 0 | Dimension:[deg] |
textWidthMax | num | -1..10000 | -1 | -1...No limit |
textHeightMax | num | -1..10000 | -1 | -1...No limit |
shadowEffect | num[] | -1000..1000 | 0 | |
shadowColor | rgba | 0..255 | #888a |
Examples
SankeyDiagramLinkLabel(;;0;"{SOURCE_ID}-{TARGET_ID}\n|u|";Arial;10.5)
SankeyDiagramLinkLabel("A";"Z";1;"|f2|";Verdana;12;bold;red)
SankeyDiagramLinkLabel(;"X";-0.95;"|u|";Arial;12)
Description
By using the SankeyDiagramLinkLabel() function it is possible to add labels to links. Important: To display labels, set in function SankeyDiagram() the 1st argument appearanceConstants = label.
The arguments sourceNodeID and targetNodeID define which link the function refers to. If argument sourceNodeID is empty, then the function is applied to all links with the target node defined in argument targetNodeID. If argument targetNodeID is empty, then the function is applied to all links with the source node defined in argument sourceNodeID. If both arguments, sourceNodeID and targetNodeID are empty, then the function is applied to all links.
By using the 3rd argument position the position of the labels can be controlled.
position = –1: Labels are placed right of the source nodes.
position = 0: Labels are placed in the middle of the links (default).
position = 1: Labels are placed left of the target nodes.
Position values other than -1,0,1 can be used to customize the label positions, e.g. 1.05, -0.5, etc.
The label text can be controlled by the 4th argument text. The name of a source node or target node can be inserted by using the placeholders {SOURCE_ID} and {TARGET_ID}. Furthermore, by adding a format specifier, e.g. "|u|" or "|f1|" the value (weight) of a link will be shown. A detailed explanation of all format specifiers, including numerous examples, can be found in Numbers. Multi-line texts are possible by entering a line feed "\n". Examples:
| SANKEY_DIAGRAM_LINK_LABEL_01 |
1 | OpenDrawing(300;200) |
2 | |
3 | SankeyDiagram(label;16;4) /* Function SankeyDiagram(...) is always listed first. */ |
4 | SankeyDiagramData(2;"A" "X" 5; "A" "Y" 7; "A" "Z" 6; "B" "X" 2; "B" "Y" 9; "B" "Z" 4) |
5 | SankeyDiagramLinkStyle(;;#AE210933) |
6 | SankeyDiagramLinkLabel(;;-0.95;"|u|") |
7 | SankeyDiagramNodeStyle(;darkRed) |
8 | SankeyDiagramNodeLabel(;1;"{NODE_ID}\n|u|") |
9 | SankeyDiagramNodeLabel("A";-1;"{NODE_ID}\n|u|") |
10 | SankeyDiagramNodeLabel("B";-1;"{NODE_ID}\n|u|") |
11 | |
12 |
| SANKEY_DIAGRAM_LINK_LABEL_02 |
1 | OpenDrawing(300;200) |
2 | |
3 | SankeyDiagram(label;16;4) /* Function SankeyDiagram(...) is always listed first. */ |
4 | SankeyDiagramData(2;"A" "X" 5; "A" "Y" 7; "A" "Z" 6; "B" "X" 2; "B" "Y" 9; "B" "Z" 4) |
5 | SankeyDiagramLinkStyle("A";;#AE210933) |
6 | SankeyDiagramLinkLabel("A";;-0.95;"{SOURCE_ID} \u2192 {TARGET_ID}: |u|") |
7 | SankeyDiagramNodeStyle(;darkRed) |
8 | SankeyDiagramNodeStyle("B";gray) |
9 | SankeyDiagramNodeLabel(;1;"{NODE_ID}") |
10 | SankeyDiagramNodeLabel("A";-1;"{NODE_ID}") |
11 | SankeyDiagramNodeLabel("B";-1;"{NODE_ID}") |
12 | |
13 |
All text style arguments are discussed in combination with the LabelStyle() function.
Please note that SankeyDiagramLinkLabel() should be listed after function SankeyDiagram() . This rule generally applies: Function SankeyDiagram() should always be listed first before other Sankey functions are called.