apexsankey 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -75
- package/apexsankey.es.min.js +6101 -15848
- package/apexsankey.min.js +1 -9
- package/demo/basic-sankey.html +40 -29
- package/demo/sankey-alternate-node.html +102 -0
- package/demo/sankey-custom-fonts.html +4 -3
- package/demo/sankey-edge-options.html +4 -3
- package/demo/sankey-node-customization.html +5 -4
- package/demo/sankey-node-overlapping.html +428 -0
- package/lib/layout/edgePositioning/linkLayout.d.ts +1 -5
- package/lib/layout/edgePositioning/utils.d.ts +1 -0
- package/lib/layout/layout.d.ts +12 -17
- package/lib/layout/nodeOrdering/addDummyNodes.d.ts +1 -0
- package/lib/layout/nodeOrdering/index.d.ts +1 -1
- package/lib/layout/nodePositioning/justified.d.ts +2 -2
- package/lib/layout/rankAssignment/groupedGraph.d.ts +1 -0
- package/lib/layout/rankAssignment/makeAcyclic.d.ts +2 -1
- package/lib/layout/utils.d.ts +1 -0
- package/lib/models/Edge.d.ts +2 -1
- package/lib/models/Graph.d.ts +9 -10
- package/lib/models/Node.d.ts +3 -2
- package/lib/models/Options.d.ts +15 -12
- package/lib/models/Paper.d.ts +10 -6
- package/lib/sankey.d.ts +4 -3
- package/package.json +13 -6
- package/lib/models/GraphUtils.d.ts +0 -5
- package/lib/models/svgUtils.d.ts +0 -37
package/demo/basic-sankey.html
CHANGED
|
@@ -4,79 +4,90 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Document</title>
|
|
7
|
-
<link
|
|
7
|
+
<link
|
|
8
|
+
href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap"
|
|
9
|
+
rel="stylesheet"
|
|
10
|
+
/>
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js"></script>
|
|
8
12
|
<script src="../apexsankey.min.js"></script>
|
|
9
13
|
</head>
|
|
10
14
|
<body>
|
|
11
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
id="svg-sankey"
|
|
17
|
+
style="margin: 0 auto; width: 800px; height: 600px"
|
|
18
|
+
></div>
|
|
12
19
|
<script>
|
|
13
20
|
const data = {
|
|
14
21
|
nodes: [
|
|
15
22
|
{
|
|
16
|
-
id:
|
|
17
|
-
title:
|
|
23
|
+
id: "Oil",
|
|
24
|
+
title: "Oil",
|
|
18
25
|
},
|
|
19
26
|
{
|
|
20
|
-
id:
|
|
21
|
-
title:
|
|
27
|
+
id: "Natural Gas",
|
|
28
|
+
title: "Natural Gas",
|
|
22
29
|
},
|
|
23
30
|
{
|
|
24
|
-
id:
|
|
25
|
-
title:
|
|
31
|
+
id: "Coal",
|
|
32
|
+
title: "Coal",
|
|
26
33
|
},
|
|
27
34
|
{
|
|
28
|
-
id:
|
|
29
|
-
title:
|
|
35
|
+
id: "Fossil Fuels",
|
|
36
|
+
title: "Fossil Fuels",
|
|
30
37
|
},
|
|
31
38
|
{
|
|
32
|
-
id:
|
|
33
|
-
title:
|
|
39
|
+
id: "Electricity",
|
|
40
|
+
title: "Electricity",
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
|
-
id:
|
|
37
|
-
title:
|
|
43
|
+
id: "Energy",
|
|
44
|
+
title: "Energy",
|
|
38
45
|
},
|
|
39
46
|
],
|
|
40
47
|
edges: [
|
|
41
48
|
{
|
|
42
|
-
source:
|
|
43
|
-
target:
|
|
49
|
+
source: "Oil",
|
|
50
|
+
target: "Fossil Fuels",
|
|
44
51
|
value: 15,
|
|
45
52
|
},
|
|
46
53
|
{
|
|
47
|
-
source:
|
|
48
|
-
target:
|
|
54
|
+
source: "Natural Gas",
|
|
55
|
+
target: "Fossil Fuels",
|
|
49
56
|
value: 20,
|
|
50
57
|
},
|
|
51
58
|
{
|
|
52
|
-
source:
|
|
53
|
-
target:
|
|
59
|
+
source: "Coal",
|
|
60
|
+
target: "Fossil Fuels",
|
|
54
61
|
value: 25,
|
|
55
62
|
},
|
|
56
63
|
{
|
|
57
|
-
source:
|
|
58
|
-
target:
|
|
64
|
+
source: "Coal",
|
|
65
|
+
target: "Electricity",
|
|
59
66
|
value: 25,
|
|
60
67
|
},
|
|
61
68
|
{
|
|
62
|
-
source:
|
|
63
|
-
target:
|
|
69
|
+
source: "Fossil Fuels",
|
|
70
|
+
target: "Energy",
|
|
64
71
|
value: 60,
|
|
65
72
|
},
|
|
66
73
|
{
|
|
67
|
-
source:
|
|
68
|
-
target:
|
|
74
|
+
source: "Electricity",
|
|
75
|
+
target: "Energy",
|
|
69
76
|
value: 25,
|
|
70
77
|
},
|
|
71
78
|
],
|
|
72
79
|
};
|
|
73
80
|
const graphOptions = {
|
|
74
81
|
nodeWidth: 20,
|
|
75
|
-
fontFamily:
|
|
76
|
-
fontWeight: 600,
|
|
82
|
+
fontFamily: "Quicksand, sans-serif",
|
|
83
|
+
fontWeight: "600",
|
|
77
84
|
height: 600,
|
|
85
|
+
enableToolbar: true,
|
|
78
86
|
};
|
|
79
|
-
const s = new ApexSankey(
|
|
87
|
+
const s = new ApexSankey(
|
|
88
|
+
document.getElementById("svg-sankey"),
|
|
89
|
+
graphOptions
|
|
90
|
+
);
|
|
80
91
|
s.render(data);
|
|
81
92
|
</script>
|
|
82
93
|
</body>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Document</title>
|
|
7
|
+
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap" rel="stylesheet" />
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js"></script>
|
|
9
|
+
<script src="../apexsankey.min.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="svg-sankey" style="margin: 0 auto"></div>
|
|
13
|
+
<script>
|
|
14
|
+
const data = {
|
|
15
|
+
nodes: [
|
|
16
|
+
{
|
|
17
|
+
id: 'John',
|
|
18
|
+
title: 'John',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'Raoul',
|
|
22
|
+
title: 'Raoul',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'Jane',
|
|
26
|
+
title: 'Jane',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'Marcel',
|
|
30
|
+
title: 'Marcel',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'Ibrahim',
|
|
34
|
+
title: 'Ibrahim',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'Junko',
|
|
38
|
+
title: 'Junko',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
edges: [
|
|
42
|
+
{
|
|
43
|
+
source: 'Marcel',
|
|
44
|
+
target: 'Ibrahim',
|
|
45
|
+
value: 72,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
source: 'Marcel',
|
|
49
|
+
target: 'Raoul',
|
|
50
|
+
value: 155,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
source: 'Raoul',
|
|
54
|
+
target: 'John',
|
|
55
|
+
value: 109,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
source: 'Raoul',
|
|
59
|
+
target: 'Ibrahim',
|
|
60
|
+
value: 100,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
source: 'Ibrahim',
|
|
64
|
+
target: 'Jane',
|
|
65
|
+
value: 100,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
source: 'Ibrahim',
|
|
69
|
+
target: 'Junko',
|
|
70
|
+
value: 127,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
source: 'Ibrahim',
|
|
74
|
+
target: 'John',
|
|
75
|
+
value: 67,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
source: 'Junko',
|
|
79
|
+
target: 'Jane',
|
|
80
|
+
value: 140,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
source: 'Junko',
|
|
84
|
+
target: 'John',
|
|
85
|
+
value: 93,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
const graphOptions = {
|
|
90
|
+
width: '90%',
|
|
91
|
+
fontFamily: 'Quicksand, sans-serif',
|
|
92
|
+
fontWeight: '600',
|
|
93
|
+
nodeWidth: 5,
|
|
94
|
+
nodeBorderWidth: 2,
|
|
95
|
+
nodeBorderColor: '#111',
|
|
96
|
+
edgeGradientFill: false,
|
|
97
|
+
};
|
|
98
|
+
const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
|
|
99
|
+
s.render(data);
|
|
100
|
+
</script>
|
|
101
|
+
</body>
|
|
102
|
+
</html>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Document</title>
|
|
7
7
|
<link href="https://fonts.googleapis.com/css2?family=Satisfy&display=swap" rel="stylesheet" />
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js"></script>
|
|
8
9
|
<script src="../apexsankey.min.js"></script>
|
|
9
10
|
</head>
|
|
10
11
|
|
|
11
12
|
<body>
|
|
12
|
-
<div id="svg-sankey" style="
|
|
13
|
+
<div id="svg-sankey" style="margin: 0 auto; width: 800px; height: 700px"></div>
|
|
13
14
|
<script>
|
|
14
15
|
const data = {
|
|
15
16
|
nodes: [
|
|
@@ -160,7 +161,7 @@
|
|
|
160
161
|
nodeWidth: 10,
|
|
161
162
|
fontSize: '20px',
|
|
162
163
|
fontFamily: 'Satisfy, "cursive"',
|
|
163
|
-
fontWeight: 600,
|
|
164
|
+
fontWeight: '600',
|
|
164
165
|
fontColor: '#E37816',
|
|
165
166
|
};
|
|
166
167
|
const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Document</title>
|
|
7
7
|
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap" rel="stylesheet" />
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js"></script>
|
|
8
9
|
<script src="../apexsankey.min.js"></script>
|
|
9
10
|
</head>
|
|
10
11
|
<body>
|
|
11
|
-
<div id="svg-sankey" style="
|
|
12
|
+
<div id="svg-sankey" style="width: 800px; height: 700px; margin: 0 auto"></div>
|
|
12
13
|
<script>
|
|
13
14
|
const data = {
|
|
14
15
|
nodes: [
|
|
@@ -94,7 +95,7 @@
|
|
|
94
95
|
const graphOptions = {
|
|
95
96
|
nodeWidth: 20,
|
|
96
97
|
fontFamily: 'Quicksand, sans-serif',
|
|
97
|
-
fontWeight: 600,
|
|
98
|
+
fontWeight: '600',
|
|
98
99
|
edgeOpacity: 0.2,
|
|
99
100
|
};
|
|
100
101
|
const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Document</title>
|
|
7
7
|
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap" rel="stylesheet" />
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js"></script>
|
|
8
9
|
<script src="../apexsankey.min.js"></script>
|
|
9
10
|
</head>
|
|
10
11
|
<body>
|
|
11
|
-
<div id="svg-sankey" style="
|
|
12
|
+
<div id="svg-sankey" style="margin: 0 auto; width: 800px; height: 700px"></div>
|
|
12
13
|
<script>
|
|
13
14
|
const data = {
|
|
14
15
|
nodes: [
|
|
@@ -95,9 +96,9 @@
|
|
|
95
96
|
],
|
|
96
97
|
};
|
|
97
98
|
const graphOptions = {
|
|
98
|
-
width:
|
|
99
|
+
width: '90%',
|
|
99
100
|
fontFamily: 'Quicksand, sans-serif',
|
|
100
|
-
fontWeight: 600,
|
|
101
|
+
fontWeight: '600',
|
|
101
102
|
nodeWidth: 5,
|
|
102
103
|
nodeBorderWidth: 2,
|
|
103
104
|
nodeBorderColor: '#111',
|