SankeyDiagramOptions

New in version 5.0.10

SankeyDiagramOptions ( nodeSortFlag ;​ linkSortFlag ;​ maxIterations ;​ curveFactor )

Argument Type Range Default Note
nodeSortFlag int -1..2 0 0...automatic
linkSortFlag int -1..2 0 0...automatic
maxIterations int 0..50 8
curveFactor num 0..1 1
Examples
Description

The first argument nodeSortFlag can be used to define the sorting order of the nodes within a layer (column). Four sort options are available for this. If nodeSortFlag is not defined or set 0 (default), xmCHART tries to rearrange the nodes to minimize the number of crossing links.
nodeSortFlag =​ –1: No sorting.
nodeSortFlag =​  0: Automatic (default).
nodeSortFlag =​  1: Sort nodes in descending order (node with greatest value first).
nodeSortFlag =​  2: Sort nodes in ascending order (node with smallest value first).

The second argument linkSortFlag can be used to define the sorting order of the links connected to a node. Four sort options are available for this. If linkSortFlag is not defined or set 0 (default), xmCHART tries to rearrange the links to minimize the number of crossing links.
linkSortFlag =​ –1: No sorting.
linkSortFlag =​  0: Automatic (default).
linkSortFlag =​  1: Sort links in descending order (link with greatest value first).
linkSortFlag =​  2: Sort links in ascending order (link with smallest value first).

SANKEY_DIAGRAM_OPTIONS_01
1

OpenDrawing(400;​400)

2

SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(-1;​-1) /* No sorting. */

4

SankeyDiagramData(1;​

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

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

16

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_01
SANKEY_DIAGRAM_OPTIONS_02
1

OpenDrawing(400;​400)

2

SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(0;​0) /* Automatic sorting. */

4

SankeyDiagramData(1;​

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

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

16

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_02
SANKEY_DIAGRAM_OPTIONS_03
1

OpenDrawing(400;​400)

2

SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(1;​1) /* Sort nodes and links in descending order. */

4

SankeyDiagramData(1;​

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

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

16

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_03
SANKEY_DIAGRAM_OPTIONS_04
1

OpenDrawing(400;​400)

2

SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(2;​2) /* Sort nodes and links in ascending order. */

4

SankeyDiagramData(1;​

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

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

16

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_04

With the 3rd argument maxIterations the number of attemps to find a pleasant node layout with a minimum number of crossing links can be controlled. The larger the number of iterations, the more pleasing the layout of complex Sankey diagrams. The default number of iterations is 8.

SANKEY_DIAGRAM_OPTIONS_05
1

OpenDrawing(600;​300)

2

SankeyDiagram(label;​12;​5;​2) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(0;​0;​0;​0.6) /* No iteration. */

4

SankeyDiagramData(2;​

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

SankeyDiagramNodeColorScheme(5)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_05
SANKEY_DIAGRAM_OPTIONS_06
1

OpenDrawing(600;​300)

2

SankeyDiagram(label;​12;​5;​2) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(0;​0;​8;​0.6) /* 8 iterations (default). */

4

SankeyDiagramData(2;​

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

SankeyDiagramNodeColorScheme(5)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_06

As the 4th argument curveFactor the curvature of the links can be controlled by a value between 0 and 1. A value of 0 gives straight connecting lines.

SANKEY_DIAGRAM_OPTIONS_07
1

OpenDrawing(600;​300)

2

SankeyDiagram(label;​12;​5;​2) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(0;​0;​20;​1) /* Curve factor = 1 */

4

SankeyDiagramData(2;​

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

SankeyDiagramNodeColorScheme(5)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_07
SANKEY_DIAGRAM_OPTIONS_08
1

OpenDrawing(300;​200)

2

SankeyDiagram(label;​10;​3;​1%) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramOptions(;​;​;​0) /* Curve factor = 0 */

4

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

5

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

6

CloseDrawing()

SANKEY_DIAGRAM_OPTIONS_08

Please note that SankeyDiagramOptions() should be listed after function SankeyDiagram() . This rule generally applies: Function SankeyDiagram() should always be listed first before other Sankey functions are called.

Scroll to Top