apexsankey 1.5.0 → 1.7.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.
Files changed (48) hide show
  1. package/.github/workflows/publish.yml +8 -5
  2. package/README.md +39 -29
  3. package/apexsankey.d.ts +472 -0
  4. package/apexsankey.es.min.js +1 -1
  5. package/apexsankey.min.js +1 -1
  6. package/demo/basic-sankey.html +2 -2
  7. package/demo/css-theming.html +438 -0
  8. package/demo/sankey-alternate-node.html +1 -2
  9. package/demo/sankey-custom-fonts.html +3 -2
  10. package/demo/sankey-edge-options.html +3 -2
  11. package/demo/sankey-node-customization.html +3 -3
  12. package/demo/sankey-node-overlapping.html +3 -2
  13. package/demo/sankey-path-highlight.html +199 -0
  14. package/package.json +8 -8
  15. package/CHANGELOG.md +0 -14
  16. package/LICENSE +0 -80
  17. package/index.d.ts +0 -4
  18. package/lib/layout/edgeOrdering/index.d.ts +0 -1
  19. package/lib/layout/edgeOrdering/linkDirection.d.ts +0 -1
  20. package/lib/layout/edgeOrdering/linkTypeOrder.d.ts +0 -1
  21. package/lib/layout/edgeOrdering/orderEdges.d.ts +0 -13
  22. package/lib/layout/edgePositioning/index.d.ts +0 -1
  23. package/lib/layout/edgePositioning/linkLayout.d.ts +0 -3
  24. package/lib/layout/edgePositioning/utils.d.ts +0 -8
  25. package/lib/layout/layout.d.ts +0 -44
  26. package/lib/layout/nodeOrdering/addDummyNodes.d.ts +0 -2
  27. package/lib/layout/nodeOrdering/countCrossings.d.ts +0 -30
  28. package/lib/layout/nodeOrdering/index.d.ts +0 -2
  29. package/lib/layout/nodeOrdering/initialOrdering.d.ts +0 -1
  30. package/lib/layout/nodeOrdering/ordering.d.ts +0 -11
  31. package/lib/layout/nodeOrdering/swapNodes.d.ts +0 -1
  32. package/lib/layout/nodeOrdering/weightedMedian.d.ts +0 -7
  33. package/lib/layout/nodePositioning/horizontal.d.ts +0 -2
  34. package/lib/layout/nodePositioning/index.d.ts +0 -2
  35. package/lib/layout/nodePositioning/justified.d.ts +0 -15
  36. package/lib/layout/rankAssignment/assignRanks.d.ts +0 -4
  37. package/lib/layout/rankAssignment/groupedGraph.d.ts +0 -10
  38. package/lib/layout/rankAssignment/index.d.ts +0 -1
  39. package/lib/layout/rankAssignment/initialRank.d.ts +0 -4
  40. package/lib/layout/rankAssignment/makeAcyclic.d.ts +0 -12
  41. package/lib/layout/utils.d.ts +0 -3
  42. package/lib/models/ColorPalette.d.ts +0 -4
  43. package/lib/models/Edge.d.ts +0 -2
  44. package/lib/models/Graph.d.ts +0 -36
  45. package/lib/models/Node.d.ts +0 -4
  46. package/lib/models/Options.d.ts +0 -38
  47. package/lib/models/Paper.d.ts +0 -20
  48. package/lib/sankey.d.ts +0 -13
@@ -0,0 +1,199 @@
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>Sankey – Connected Path Highlight on Hover</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600&display=swap" rel="stylesheet" />
8
+ <script src="../apexsankey.min.js"></script>
9
+ <style>
10
+ body {
11
+ font-family: 'Quicksand', sans-serif;
12
+ margin: 0;
13
+ padding: 24px;
14
+ background: #f5f6fa;
15
+ color: #212121;
16
+ }
17
+
18
+ h1 {
19
+ font-size: 1.4rem;
20
+ font-weight: 600;
21
+ margin: 0 0 4px;
22
+ }
23
+
24
+ p.subtitle {
25
+ margin: 0 0 20px;
26
+ font-size: 0.9rem;
27
+ color: #555;
28
+ }
29
+
30
+ .controls {
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ gap: 24px;
34
+ align-items: center;
35
+ background: #fff;
36
+ border: 1px solid #dde1e7;
37
+ border-radius: 8px;
38
+ padding: 16px 20px;
39
+ margin-bottom: 20px;
40
+ max-width: 860px;
41
+ }
42
+
43
+ .control-group {
44
+ display: flex;
45
+ align-items: center;
46
+ gap: 10px;
47
+ }
48
+
49
+ .control-group label {
50
+ font-weight: 600;
51
+ font-size: 0.875rem;
52
+ white-space: nowrap;
53
+ }
54
+
55
+ .toggle-btn {
56
+ cursor: pointer;
57
+ padding: 6px 16px;
58
+ border-radius: 6px;
59
+ border: 2px solid #008ffb;
60
+ background: #008ffb;
61
+ color: #fff;
62
+ font-family: 'Quicksand', sans-serif;
63
+ font-weight: 600;
64
+ font-size: 0.875rem;
65
+ transition:
66
+ background 0.15s,
67
+ color 0.15s;
68
+ }
69
+
70
+ .toggle-btn.off {
71
+ background: #fff;
72
+ color: #008ffb;
73
+ }
74
+
75
+ input[type='range'] {
76
+ width: 140px;
77
+ accent-color: #008ffb;
78
+ }
79
+
80
+ #opacity-value {
81
+ font-weight: 600;
82
+ min-width: 36px;
83
+ text-align: right;
84
+ }
85
+
86
+ .hint {
87
+ font-size: 0.8rem;
88
+ color: #777;
89
+ margin-bottom: 12px;
90
+ }
91
+
92
+ #svg-sankey {
93
+ margin: 0 auto;
94
+ }
95
+ </style>
96
+ </head>
97
+ <body>
98
+ <h1>Connected Path Highlight on Hover</h1>
99
+ <p class="subtitle">
100
+ Hover over any <strong>node</strong> or <strong>edge</strong> to highlight its connected flow path and dim
101
+ unrelated elements. Use the controls below to explore the options.
102
+ </p>
103
+
104
+ <div class="controls">
105
+ <div class="control-group">
106
+ <label for="toggle-highlight">highlightConnectedPath</label>
107
+ <button id="toggle-highlight" class="toggle-btn" aria-pressed="true">Enabled</button>
108
+ </div>
109
+ <div class="control-group">
110
+ <label for="dim-opacity">dimOpacity</label>
111
+ <input type="range" id="dim-opacity" min="0" max="0.5" step="0.05" value="0.15" />
112
+ <span id="opacity-value">0.15</span>
113
+ </div>
114
+ </div>
115
+
116
+ <p class="hint">💡 Hover a node or an edge in the diagram to see the effect.</p>
117
+
118
+ <div id="svg-sankey"></div>
119
+
120
+ <script>
121
+ const data = {
122
+ nodes: [
123
+ {id: 'Solar', title: 'Solar'},
124
+ {id: 'Wind', title: 'Wind'},
125
+ {id: 'Hydro', title: 'Hydro'},
126
+ {id: 'Gas', title: 'Gas'},
127
+ {id: 'Coal', title: 'Coal'},
128
+ {id: 'Electricity', title: 'Electricity'},
129
+ {id: 'Heat', title: 'Heat'},
130
+ {id: 'Transport', title: 'Transport'},
131
+ {id: 'Industry', title: 'Industry'},
132
+ {id: 'Homes', title: 'Homes'},
133
+ {id: 'Losses', title: 'Losses'},
134
+ ],
135
+ edges: [
136
+ {source: 'Solar', target: 'Electricity', value: 30},
137
+ {source: 'Wind', target: 'Electricity', value: 25},
138
+ {source: 'Hydro', target: 'Electricity', value: 20},
139
+ {source: 'Gas', target: 'Electricity', value: 15},
140
+ {source: 'Gas', target: 'Heat', value: 20},
141
+ {source: 'Coal', target: 'Electricity', value: 10},
142
+ {source: 'Coal', target: 'Heat', value: 10},
143
+ {source: 'Electricity', target: 'Transport', value: 25},
144
+ {source: 'Electricity', target: 'Industry', value: 35},
145
+ {source: 'Electricity', target: 'Homes', value: 25},
146
+ {source: 'Electricity', target: 'Losses', value: 15},
147
+ {source: 'Heat', target: 'Industry', value: 18},
148
+ {source: 'Heat', target: 'Homes', value: 12},
149
+ ],
150
+ };
151
+
152
+ let highlightEnabled = true;
153
+ let dimOpacity = 0.2;
154
+ let sankeyInstance = null;
155
+
156
+ function buildOptions() {
157
+ return {
158
+ nodeWidth: 20,
159
+ fontFamily: 'Quicksand, sans-serif',
160
+ fontWeight: '600',
161
+ height: 520,
162
+ width: 860,
163
+ edgeOpacity: 0.4,
164
+ enableToolbar: false,
165
+ highlightConnectedPath: highlightEnabled,
166
+ dimOpacity: dimOpacity,
167
+ };
168
+ }
169
+
170
+ function render() {
171
+ const container = document.getElementById('svg-sankey');
172
+ container.innerHTML = '';
173
+ sankeyInstance = new ApexSankey(container, buildOptions());
174
+ sankeyInstance.render(data);
175
+ }
176
+
177
+ render();
178
+
179
+ // Toggle button
180
+ const toggleBtn = document.getElementById('toggle-highlight');
181
+ toggleBtn.addEventListener('click', () => {
182
+ highlightEnabled = !highlightEnabled;
183
+ toggleBtn.textContent = highlightEnabled ? 'Enabled' : 'Disabled';
184
+ toggleBtn.classList.toggle('off', !highlightEnabled);
185
+ toggleBtn.setAttribute('aria-pressed', String(highlightEnabled));
186
+ render();
187
+ });
188
+
189
+ // Opacity slider
190
+ const opacitySlider = document.getElementById('dim-opacity');
191
+ const opacityValue = document.getElementById('opacity-value');
192
+ opacitySlider.addEventListener('input', () => {
193
+ dimOpacity = parseFloat(opacitySlider.value);
194
+ opacityValue.textContent = dimOpacity.toFixed(2);
195
+ render();
196
+ });
197
+ </script>
198
+ </body>
199
+ </html>
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "apexsankey",
3
- "version": "1.5.0",
4
- "dependencies": {
5
- "defined": "^1.0.1",
6
- "graphlib": "~2.1.0",
7
- "lodash": "^4.17.21"
3
+ "version": "1.7.0",
4
+ "dependencies": {},
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/apexcharts/apexsankey"
8
8
  },
9
9
  "type": "module",
10
10
  "main": "./apexsankey.min.js",
11
11
  "module": "./apexsankey.es.min.js",
12
- "types": "./index.d.ts",
12
+ "types": "./apexsankey.d.ts",
13
13
  "license": "See LICENSE in LICENSE",
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": {
17
- "types": "./index.d.ts",
17
+ "types": "./apexsankey.d.ts",
18
18
  "default": "./apexsankey.es.min.js"
19
19
  },
20
20
  "require": {
21
- "types": "./index.d.ts",
21
+ "types": "./apexsankey.d.ts",
22
22
  "default": "./apexsankey.min.js"
23
23
  }
24
24
  }
package/CHANGELOG.md DELETED
@@ -1,14 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ### [1.2.4](https://github.com/apexcharts/apexsankey/compare/v1.2.3...v1.2.4) (2025-07-27)
6
-
7
- ### [1.2.3](https://github.com/apexcharts/apexsankey/compare/v1.2.2...v1.2.3) (2025-07-27)
8
-
9
- ### 1.2.2 (2025-07-27)
10
-
11
-
12
- ### Bug Fixes
13
-
14
- * add auto versioning and release ([2cdd7f7](https://github.com/apexcharts/apexsankey/commit/2cdd7f7650e3508226106538c06f2752d90eef7a))
package/LICENSE DELETED
@@ -1,80 +0,0 @@
1
- ## 📄 License Options for ApexCharts
2
-
3
- ApexCharts is offered under a **dual-license model** to support individuals, startups, and commercial products of all sizes.
4
-
5
- ---
6
-
7
- ### 🔓 Community License (Free)
8
-
9
- For individuals, non-profits, educators, and small businesses with **less than $2 million USD in annual revenue**.
10
-
11
- ✅ What’s allowed:
12
-
13
- - Personal, educational, or non-profit use
14
- - Commercial use by small orgs (< $2M annual revenue)
15
- - Modifications and redistribution (with attribution)
16
-
17
- 🚫 Not allowed:
18
-
19
- - Use by companies or entities over $2M/year revenue
20
- - Use in competing charting products
21
- - Sublicensing under different terms
22
-
23
- ➡ By using ApexCharts under this license, you confirm that **you qualify as a Small Organization**.
24
-
25
- ---
26
-
27
- ### 💼 Commercial License (Paid)
28
-
29
- Required if **you or your affiliated organization earns $2 million USD or more per year**.
30
-
31
- ✅ What's included:
32
-
33
- - Use in internal tools and commercial applications
34
- - Modifications and app-level distribution
35
- - 12-month subscription with updates & support
36
-
37
- 🚫 Not allowed:
38
-
39
- - Redistribution in toolkits, SDKs, or platforms
40
- - Use by unlicensed developers
41
- - Competing charting products
42
-
43
- ---
44
-
45
- ### 🔄 OEM / Redistribution License (Paid)
46
-
47
- Required if you are **embedding ApexCharts into a product or platform used by other people**, such as:
48
-
49
- - No-code dashboards
50
- - Developer platforms
51
- - Embedded BI tools
52
- - White-labeled apps or SDKs
53
-
54
- ✅ What's included:
55
-
56
- - Redistribution rights for 1 application or product
57
- - 12-month subscription with updates & support
58
-
59
- ✅ OEM **not required** if your app simply renders static charts and users **cannot** configure or interact with them.
60
-
61
- ---
62
-
63
- ### ⚠️ License Acceptance
64
-
65
- By installing ApexCharts (e.g., via `npm install apexcharts`), you are agreeing to the applicable license based on your usage:
66
-
67
- - Community License (if under $2M revenue)
68
- - Commercial License (if over $2M revenue)
69
- - OEM License (if redistributing to third-party users)
70
-
71
- ---
72
-
73
- ### 🛠 Need a License or Have Questions?
74
-
75
- 📧 Contact us at [sales@apexcharts.com](mailto:sales@apexcharts.com)
76
- 📚 Read full license agreements here: [https://apexcharts.com/license](https://apexcharts.com/license)
77
-
78
- ---
79
-
80
- Thank you for supporting ApexCharts! Your licensing helps keep it free and open for individuals and small teams.
package/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { ApexSankey } from './lib/sankey';
2
-
3
- export { ApexSankey as default };
4
- export { ApexSankey };
@@ -1 +0,0 @@
1
- export { orderEdges } from './orderEdges';
@@ -1 +0,0 @@
1
- export declare function linkDirection(G: any, link: any): number;
@@ -1 +0,0 @@
1
- export declare function linkTypeOrder(G: any, u: any): any[];
@@ -1,13 +0,0 @@
1
- /** @module edge-ordering */
2
- /**
3
- * Assign incoming and outgoing edge lists to each node.
4
- *
5
- * The actual sorting of edges for smooth flow is handled in linkLayout.ts
6
- * where edges are sorted by connected node y-position before endpoint assignment.
7
- *
8
- * @param {Graph} G - The graph. Nodes must have `x` and `y` attributes.
9
- *
10
- */
11
- export declare function orderEdges(G: any, { alignLinkTypes }?: {
12
- alignLinkTypes?: boolean;
13
- }): void;
@@ -1 +0,0 @@
1
- export { linkLayout } from './linkLayout';
@@ -1,3 +0,0 @@
1
- import { SankeyOptions } from '../../models/Options';
2
-
3
- export declare function linkLayout(options: Partial<SankeyOptions>): (G: any) => any[];
@@ -1,8 +0,0 @@
1
- export declare function findFirst(links: any, p: any): any;
2
- /**
3
- * Adjust radii of curvature to avoid overlaps, as much as possible.
4
- * @param links - the list of links, ordered from outside to inside of bend
5
- * @param rr - "r0" or "r1", the side to work on
6
- */
7
- export declare function sweepCurvatureInwards(links: any, rr: any): void;
8
- export declare function addLinkEndpoints(G: any): void;
@@ -1,44 +0,0 @@
1
- import { SankeyOptions } from '../models/Options';
2
-
3
- /**
4
- * Sankey layout
5
- * @constructor sankey
6
- */
7
- export declare function sankey(options: Partial<SankeyOptions>): {
8
- (linksIn?: any, nodesIn?: any, data?: any): import('graphlib').Graph;
9
- nodes(): any[];
10
- links(): any[];
11
- order(): any;
12
- /**
13
- * Set size of layout.
14
- * @method size
15
- * @param size {[width, height]} - size
16
- * @returns {sankeyLayout|Number[]}
17
- */
18
- size(x: any): number[] | {
19
- (G: any, order: any, edgeGap?: number): any[];
20
- scaleToFit(G: any, order: any, edgeGap?: number): void;
21
- size(x?: any): number[] | any;
22
- separation(x?: any): ((a: any, b: any, c: any) => number) | any;
23
- whitespace(x?: number): number | any;
24
- scale(x?: number): any;
25
- } | any;
26
- separation(x: any): ((a: any, b: any, c: any) => number) | {
27
- (G: any, order: any, edgeGap?: number): any[];
28
- scaleToFit(G: any, order: any, edgeGap?: number): void;
29
- size(x?: any): number[] | any;
30
- separation(x?: any): ((a: any, b: any, c: any) => number) | any;
31
- whitespace(x?: number): number | any;
32
- scale(x?: number): any;
33
- } | any;
34
- whitespace(x: any): number | {
35
- (G: any, order: any, edgeGap?: number): any[];
36
- scaleToFit(G: any, order: any, edgeGap?: number): void;
37
- size(x?: any): number[] | any;
38
- separation(x?: any): ((a: any, b: any, c: any) => number) | any;
39
- whitespace(x?: number): number | any;
40
- scale(x?: number): any;
41
- } | any;
42
- edgeValue(_x: any): any;
43
- scale(x: any): any;
44
- };
@@ -1,2 +0,0 @@
1
- export declare function addDummyNodes(G: any): any;
2
- export declare function removeDummyNodes(G: any): void;
@@ -1,30 +0,0 @@
1
- /** @module node-ordering/count-crossings */
2
- /**
3
- * Count the total number of crossings between 2 layers.
4
- *
5
- * This is the sum of the countBetweenCrossings and countLoopCrossings.
6
- *
7
- * @param {Graph} G - The graph.
8
- * @param {Array} orderA - List of node ids on left side.
9
- * @param {Array} orderB - List of node ids on right side.
10
- */
11
- export declare function countCrossings(G: any, orderA: any, orderB: any): number;
12
- /**
13
- * Count the number of crossings of edges passing between 2 layers.
14
- *
15
- * Algorithm from
16
- * http://jgaa.info/accepted/2004/BarthMutzelJuenger2004.8.2.pdf
17
- *
18
- * @param {Graph} G - The graph.
19
- * @param {Array} orderA - List of node ids on left side.
20
- * @param {Array} orderB - List of node ids on right side.
21
- */
22
- export declare function countBetweenCrossings(G: any, orderA: any, orderB: any): number;
23
- /**
24
- * Count the number of crossings from within-layer edges.
25
- *
26
- * @param {Graph} G - The graph.
27
- * @param {Array} orderA - List of node ids on left side.
28
- * @param {Array} orderB - List of node ids on right side.
29
- */
30
- export declare function countLoopCrossings(G: any, orderA: any, orderB: any): number;
@@ -1,2 +0,0 @@
1
- export { addDummyNodes, removeDummyNodes } from './addDummyNodes';
2
- export { ordering } from './ordering';
@@ -1 +0,0 @@
1
- export declare function initialOrdering(G: any): any[];
@@ -1,11 +0,0 @@
1
- /** @module node-ordering */
2
- /**
3
- * Return an ordering for the graph G.
4
- *
5
- * The ordering is a list of lists of node ids, corresponding to the ranks of
6
- * the graphs, and the order of nodes within each rank.
7
- *
8
- * @param {Graph} G - The graph. Nodes must have a `rank` attribute.
9
- *
10
- */
11
- export declare function ordering(G: any, maxIterations?: number): any[];
@@ -1 +0,0 @@
1
- export declare function swapNodes(G: any, order: any): void;
@@ -1,7 +0,0 @@
1
- export declare function medianValue(positions: any): any;
2
- export declare function sortNodes(G: any, order: any, sweepDirection?: number, includeLoops?: boolean): void;
3
- export declare function neighbourPositions(G: any, order: any, i: any, j: any, u: any, includeLoops?: boolean): any[];
4
- /**
5
- * Sort arr according to order. -1 in order means stay in same position.
6
- */
7
- export declare function sortByPositions(arr: any, order: any): void;
@@ -1,2 +0,0 @@
1
- export declare function spanMinWidths(G: any, order: any): any[];
2
- export declare function positionHorizontally(G: any, order: any, width: any, minWidths: any): void;
@@ -1,2 +0,0 @@
1
- export { positionHorizontally, spanMinWidths } from './horizontal';
2
- export { justifiedPositioning } from './justified';
@@ -1,15 +0,0 @@
1
- /**
2
- * Original, full-width node positioning.
3
- *
4
- * Uses spacing and whitespace fraction to position nodes within layers.
5
- *
6
- * @module node-positioning/justified
7
- */
8
- export declare function justifiedPositioning(): {
9
- (G: any, order: any, edgeGap?: number): any[];
10
- scaleToFit(G: any, order: any, edgeGap?: number): void;
11
- size(x?: any): number[] | any;
12
- separation(x?: any): ((a: any, b: any, c: any) => number) | any;
13
- whitespace(x?: number): number | any;
14
- scale(x?: number): any;
15
- };
@@ -1,4 +0,0 @@
1
- /**
2
- * Assign ranks to the nodes in graph, according to rankSets.
3
- */
4
- export declare function assignRanks(graph: any, rankSets: any): void;
@@ -1,10 +0,0 @@
1
- import { Graph } from 'graphlib';
2
-
3
- /**
4
- * Create a new graph where nodes in the same rank set are merged into one node.
5
- *
6
- * Depends on the "direction" attribute of the nodes in G, and the "delta"
7
- * atribute of the edges.
8
- *
9
- */
10
- export declare function groupedGraph(G: any, rankSets: any): Graph;
@@ -1 +0,0 @@
1
- export { assignRanks } from './assignRanks';
@@ -1,4 +0,0 @@
1
- /**
2
- * Take an acyclic graph and assign initial ranks to the nodes
3
- */
4
- export declare function assignInitialRanks(G: any): void;
@@ -1,12 +0,0 @@
1
- import { Graph } from 'graphlib';
2
-
3
- /**
4
- * Reverse edges in G to make it acyclic
5
- */
6
- export declare function makeAcyclic(G: any, v0: any): any;
7
- export declare function findSpanningTree(G: any, v0: any): Graph;
8
- /**
9
- * Returns 1 if w is a descendent of v, -1 if v is a descendent of w, and 0 if
10
- * they are unrelated.
11
- */
12
- export declare function nodeRelationship(tree: any, v: any, w: any): 0 | 1 | -1;
@@ -1,3 +0,0 @@
1
- import { Graph } from 'graphlib';
2
-
3
- export declare function createGraph(nodes?: any[], edges?: any[]): Graph;
@@ -1,4 +0,0 @@
1
- /**
2
- * Default color palette for sankey nodes.
3
- */
4
- export declare const DefaultPalette: string[];
@@ -1,2 +0,0 @@
1
- export declare function segmentPath(edge: any): string;
2
- export declare function generatePath(d: any): string;
@@ -1,36 +0,0 @@
1
- import { Paper } from './Paper';
2
- import { SankeyOptions } from './Options';
3
- import { Graph } from 'graphlib';
4
- import { G } from '@svgdotjs/svg.js';
5
- import { ChartContext } from '../../../../graph-utils/src/index.ts';
6
-
7
- export interface GraphPoint {
8
- readonly x: number;
9
- readonly y: number;
10
- }
11
- export interface Node {
12
- readonly color?: string;
13
- readonly id: string;
14
- readonly title: string;
15
- }
16
- export interface Edge {
17
- readonly source: string;
18
- readonly target: string;
19
- readonly type: string;
20
- readonly value: number;
21
- }
22
- export interface GraphData {
23
- readonly edges: Edge[];
24
- readonly nodes: Node[];
25
- readonly options: SankeyOptions;
26
- }
27
- export declare class SankeyGraph extends Paper {
28
- graph: Graph;
29
- maxRank: number;
30
- constructor(element: HTMLElement, options: SankeyOptions, chartContext: ChartContext);
31
- construct(data: GraphData): void;
32
- render({ keepOldPosition }?: {
33
- keepOldPosition?: boolean;
34
- }): void;
35
- renderEdge(edgeObj: any, group: G): void;
36
- }
@@ -1,4 +0,0 @@
1
- import { FontOptions, NodeOptions } from './Options';
2
- import { G } from '@svgdotjs/svg.js';
3
-
4
- export declare function renderNode(graphNode: any, maxRank: number, options: Partial<FontOptions & NodeOptions>): G;
@@ -1,38 +0,0 @@
1
- export interface CommonOptions {
2
- readonly canvasStyle: string;
3
- readonly enableToolbar: boolean;
4
- readonly height: number | string;
5
- readonly spacing: number;
6
- readonly viewPortHeight: number;
7
- readonly viewPortWidth: number;
8
- readonly width: number | string;
9
- }
10
- export interface NodeOptions {
11
- readonly nodeBorderColor: string;
12
- readonly nodeBorderWidth: number;
13
- readonly nodeWidth: number;
14
- readonly onNodeClick?: (node: any) => void;
15
- }
16
- export interface EdgeOptions {
17
- readonly edgeGap: number;
18
- readonly edgeGradientFill: boolean;
19
- readonly edgeOpacity: number;
20
- }
21
- export interface LayoutOptions {
22
- readonly whitespace: number;
23
- }
24
- export interface FontOptions {
25
- readonly fontColor: string;
26
- readonly fontFamily: string;
27
- readonly fontSize: string;
28
- readonly fontWeight: string;
29
- }
30
- export interface TooltipOptions {
31
- readonly enableTooltip: boolean;
32
- readonly tooltipBGColor: string;
33
- readonly tooltipBorderColor: string;
34
- readonly tooltipId: string;
35
- readonly tooltipTemplate?: (content: any) => string;
36
- }
37
- export type SankeyOptions = CommonOptions & EdgeOptions & FontOptions & LayoutOptions & NodeOptions & TooltipOptions;
38
- export declare const DefaultOptions: SankeyOptions;