SankeyDiagramLinkColorScheme
New in version 5.0.10
SankeyDiagramLinkColorScheme ( colorScheme ; opacity )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
colorScheme | int | 1..3 | 1 | |
opacity | num | 0..1 | 0.4 |
Examples
Description
The appearance of the links can be controlled by using the functions SankeyDiagramLinkColorScheme() and SankeyDiagramLinkStyle() . By using the SankeyDiagramLinkColorScheme() function, 3 special color schemes can be applied to links. If argument colorScheme is not defined, color scheme 1 is used by default. The transparency of the colors can be controlled by using the 2nd argument opacity. The opacity can be set between 0 (fully transparent) and 1 (completely opaque) — default is 0.4.
colorScheme = 1: Apply the fill color of the source nodes to the links (default), for example:
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_01 |
1 | OpenDrawing(300;200) |
2 | SankeyDiagram(label;16;3;1%) /* Function SankeyDiagram(...) is always listed first. */ |
3 | SankeyDiagramData(2;"A" "X" 5; "A" "Y" 7; "A" "Z" 6; "B" "X" 2; "B" "Y" 9; "B" "Z" 4) |
4 | SankeyDiagramLinkColorScheme(1;0.25) |
5 | |
6 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
7 |
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_02 |
1 | OpenDrawing(600;300) |
2 | SankeyDiagram(label;10) /* 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 | SankeyDiagramLinkColorScheme(1;0.25) |
7 | |
8 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
9 |
colorScheme = 2: Apply the fill color of the target nodes to the links, for example:
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_03 |
1 | OpenDrawing(300;200) |
2 | SankeyDiagram(label;16;3;1%) /* Function SankeyDiagram(...) is always listed first. */ |
3 | SankeyDiagramData(2;"A" "X" 5; "A" "Y" 7; "A" "Z" 6; "B" "X" 2; "B" "Y" 9; "B" "Z" 4) |
4 | SankeyDiagramLinkColorScheme(2;0.25) |
5 | |
6 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
7 |
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_04 |
1 | OpenDrawing(600;300) |
2 | SankeyDiagram(label;10) /* 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 | SankeyDiagramLinkColorScheme(2;0.25) |
7 | |
8 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
9 |
colorScheme = 3: Apply the color gradient between source and target node colors to the links, for example:
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_05 |
1 | OpenDrawing(300;200) |
2 | SankeyDiagram(label;16;3;1%) /* Function SankeyDiagram(...) is always listed first. */ |
3 | SankeyDiagramData(2;"A" "X" 5; "A" "Y" 7; "A" "Z" 6; "B" "X" 2; "B" "Y" 9; "B" "Z" 4) |
4 | SankeyDiagramLinkColorScheme(3;0.25) |
5 | |
6 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
7 |
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_06 |
1 | OpenDrawing(600;300) |
2 | SankeyDiagram(label;10) /* 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 | SankeyDiagramLinkColorScheme(3;0.25) |
7 | |
8 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
9 |
Function SankeyDiagramLinkColorScheme() can be customized by using the corresponding SankeyDiagramLinkStyle() function. The color scheme function should be listed before the style function(s).
| SANKEY_DIAGRAM_LINK_COLOR_SCHEME_07 |
1 | OpenDrawing(400;400) |
2 | SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */ |
3 | |
4 | "Africa" 314 0 211 0 54 16 0 0 0 67; |
5 | "East Asia" 0 163 60 0 97 33 0 38 0 87; |
6 | "Europe" 0 0 240 0 0 0 0 0 0 0; |
7 | "Latin America" 0 0 176 88 363 0 0 0 0 0; |
8 | "North America" 0 0 122 28 0 0 0 0 0 0; |
9 | "Oceania" 0 0 17 0 0 19 0 0 0 0; |
10 | "South Asia" 0 53 139 0 151 35 131 0 0 490; |
11 | "South East Asia" 0 15 47 0 106 28 0 78 0 0; |
12 | "Soviet Union" 0 0 61 0 0 0 0 0 187 0; |
13 | "West Asia" 0 0 45 0 17 0 0 0 0 93) |
14 | SankeyDiagramLinkColorScheme(1;0.1) |
15 | SankeyDiagramLinkStyle("Africa";;#192f8366) /* After SankeyDiagramLinkColorScheme() */ |
16 | |
17 | SankeyDiagramNodeLabel(;auto;"{NODE_ID}") |
18 |
Please note that SankeyDiagramLinkColorScheme() should be listed after function SankeyDiagram() . This rule generally applies: Function SankeyDiagram() should always be listed first before other Sankey functions are called.