SankeyDiagramNodeLabel
New in version 5.0.10
SankeyDiagramNodeLabel ( nodeID ; position ; text ; font ; size ; style ; color ; alignment ; orientation ; textWidthMax ; textHeightMax ; shadowEffect ; shadowColor )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
nodeID | str | 0..1000 | ||
position | num | -10..10 | auto | |
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
SankeyDiagramNodeLabel(;auto;"|u|";Arial;10.5)
SankeyDiagramNodeLabel("A";-1.05;"{NODE_ID} |u|";Verdana;12;bold;red)
SankeyDiagramNodeLabel("B";auto;"ID \"{NODE_ID}\"\n|u| (|f1|%)";Arial;12;;;;-90)
Description
By using the SankeyDiagramNodeLabel() function it is possible to add labels to nodes. Important: To display labels, set in function SankeyDiagram() the 1st argument appearanceConstants = label.
The 1st argument nodeID defines which node the function refers to. If argument nodeID is empty, then the function is applied to all nodes.
By using the 2nd argument position the position of the labels can be controlled.
position = –1: Labels are placed left of the nodes.
position = 0: Labels are placed in the middle of the nodes.
position = 1: Labels are placed right of the nodes.
If position = auto (default) labels are placed right of the nodes on the left half of the layers (columns) and left of the nodes on the right half of the layers (columns). Position values other than -1,0,1 can be used to customize the label positions, e.g. 1.1, -1.5, etc.
| SANKEY_DIAGRAM_NODE_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 | SankeyDiagramNodeStyle(;darkRed) |
7 | SankeyDiagramNodeLabel(;1;"{NODE_ID}") |
8 | SankeyDiagramNodeLabel("A";-1;"{NODE_ID}") |
9 | SankeyDiagramNodeLabel("B";-1;"{NODE_ID}") |
10 | |
11 | Background(white;;1;gray) |
12 |
| SANKEY_DIAGRAM_NODE_LABEL_02 |
1 | OpenDrawing(600;400) |
2 | SankeyDiagram(label;15;4) /* Function SankeyDiagram(...) is always listed first. */ |
3 | SankeyDiagramOptions(0;0;;0.6) |
4 | |
5 | "Brazil" "Portugal" 5; "Brazil" "France" 1; "Brazil" "Spain" 1; "Brazil" "England" 1; "Canada" "Portugal" 1; "Canada" "France" 5; "Canada" "England" 1; "Mexico" "Portugal" 1; "Mexico" "France" 1; "Mexico" "Spain" 5; "Mexico" "England" 1; "USA" "Portugal" 1; "USA" "France" 1; "USA" "Spain" 1; "USA" "England" 5; "Portugal" "Angola" 2; "Portugal" "Senegal" 1; "Portugal" "Morocco" 1; "Portugal" "South Africa" 3; "France" "Angola" 1; "France" "Senegal" 3; "France" "Mali" 3; "France" "Morocco" 3; "France" "South Africa" 1; "Spain" "Senegal" 1; "Spain" "Morocco" 3; "Spain" "South Africa" 1; "England" "Angola" 1; "England" "Senegal" 1; "England" "Morocco" 2; "England" "South Africa" 7; "South Africa" "China" 5; "South Africa" "India" 1; "South Africa" "Japan" 3; "Angola" "China" 5; "Angola" "India" 1; "Angola" "Japan" 3; "Senegal" "China" 5; "Senegal" "India" 1; "Senegal" "Japan" 3; "Mali" "China" 5; "Mali" "India" 1; "Mali" "Japan" 3; "Morocco" "China" 5; "Morocco" "India" 1; "Morocco" "Japan" 3) |
6 | SankeyDiagramLinkStyle(;;#0002) |
7 | |
8 | SankeyDiagramNodeLabel(;0;"{NODE_ID}";Arial;10;bold;white;2;-90) |
9 |
The label text can be controlled by the 3rd argument text. The name of a node can be inserted by using the placeholder {NODE_ID}. Furthermore, by adding a format specifier, e.g. "|u|" or "|f1|" the value of a node, i.e. the sum of the incoming or outgoing link values will be shown. A detailed explanation of all format specifiers, including numerous examples, can be found in Numbers.
It is also possible to represent both, absolute values and percentage values (percentage in relation to the corresponding layer). This can be done by specifying two format specifiers. The first specifier defines the format of the absolute values; the second format specifier serves to format the percentage values. If only the percentage values are to be represented, the output of the absolute values has to be suppressed by an empty format specifier "||". Multi-line texts are possible by entering a line feed "\n". Examples:
| SANKEY_DIAGRAM_NODE_LABEL_03 |
1 | OpenDrawing(300;300) |
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 | SankeyDiagramNodeStyle(;darkRed) |
7 | SankeyDiagramNodeLabel(;1;"{NODE_ID}\n|u|") |
8 | SankeyDiagramNodeLabel("A";-1;"{NODE_ID}\n|u|") |
9 | SankeyDiagramNodeLabel("B";-1;"{NODE_ID}\n|u|") |
10 | |
11 | Background(white;;1;gray) |
12 |
| SANKEY_DIAGRAM_NODE_LABEL_04 |
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 | SankeyDiagramNodeStyle(;darkRed) |
7 | SankeyDiagramNodeLabel(;1;"{NODE_ID}\n||(|f1|%)") |
8 | SankeyDiagramNodeLabel("A";-1;"{NODE_ID}\n||(|f1|%)") |
9 | SankeyDiagramNodeLabel("B";-1;"{NODE_ID}\n||(|f1|%)") |
10 | |
11 | Background(white;;1;gray) |
12 |
Two additional placeholders are available for Sankey diagram data in the format inputFormat = 1 in function SankeyDiagramData() . The placeholder {SOURCE_ID} refers to the nodes of the source layer, placeholder {TARGET_ID} to the nodes of the target layer. For example:
| SANKEY_DIAGRAM_NODE_LABEL_05 |
1 | OpenDrawing(400;300) |
2 | |
3 | SankeyDiagram(label) /* Function SankeyDiagram(...) always listed first. */ |
4 | |
5 | "Africa" 314 0 211 0 54 16 0 0 0 67; |
6 | "East Asia" 0 163 60 0 97 33 0 38 0 87; |
7 | "Europe" 0 0 240 0 0 0 0 0 0 0; |
8 | "Latin America" 0 0 176 88 363 0 0 0 0 0; |
9 | "North America" 0 0 122 28 0 0 0 0 0 0; |
10 | "Oceania" 0 0 17 0 0 19 0 0 0 0; |
11 | "South Asia" 0 53 139 0 151 35 131 0 0 490; |
12 | "South East Asia" 0 15 47 0 106 28 0 78 0 0; |
13 | "Soviet Union" 0 0 61 0 0 0 0 0 187 0; |
14 | "West Asia" 0 0 45 0 17 0 0 0 0 93) |
15 | SankeyDiagramLinkColorScheme(1;0.25) |
16 | SankeyDiagramNodeColorScheme(5;shaded) |
17 | SankeyDiagramNodeLabel(;1;"{NODE_ID}";Arial;8) |
18 | SankeyDiagramNodeLabel(“Africa"; -1;"{SOURCE_ID}";Arial;8) |
19 | SankeyDiagramNodeLabel(“East Asia"; -1;"{SOURCE_ID}";Arial;8) |
20 | SankeyDiagramNodeLabel(“Europe"; -1;"{SOURCE_ID}";Arial;8) |
21 | SankeyDiagramNodeLabel(“Latin America"; -1;"{SOURCE_ID}";Arial;8) |
22 | SankeyDiagramNodeLabel(“North America"; -1;"{SOURCE_ID}";Arial;8) |
23 | SankeyDiagramNodeLabel(“Oceania"; -1;"{SOURCE_ID}";Arial;8) |
24 | SankeyDiagramNodeLabel(“South Asia"; -1;"{SOURCE_ID}";Arial;8) |
25 | SankeyDiagramNodeLabel(“South East Asia";-1;"{SOURCE_ID}";Arial;8) |
26 | SankeyDiagramNodeLabel(“Soviet Union"; -1;"{SOURCE_ID}";Arial;8) |
27 | SankeyDiagramNodeLabel(“West Asia"; -1;"{SOURCE_ID}";Arial;8) |
28 | |
29 |
All text style arguments are discussed in combination with the LabelStyle() function.
Please note that SankeyDiagramNodeLabel() should be listed after function SankeyDiagram() . This rule generally applies: Function SankeyDiagram() should always be listed first before other Sankey functions are called.