apexsankey 1.4.0 → 1.6.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 (40) hide show
  1. package/README.md +1 -1
  2. package/apexsankey.es.min.js +1 -7931
  3. package/apexsankey.min.js +1 -1
  4. package/demo/basic-sankey.html +2 -2
  5. package/demo/css-theming.html +438 -0
  6. package/demo/sankey-alternate-node.html +1 -2
  7. package/demo/sankey-custom-fonts.html +3 -2
  8. package/demo/sankey-edge-options.html +3 -2
  9. package/demo/sankey-node-customization.html +3 -3
  10. package/demo/sankey-node-overlapping.html +3 -2
  11. package/demo/sankey-path-highlight.html +199 -0
  12. package/lib/a11y/SankeyA11y.d.ts +51 -0
  13. package/lib/graph/Graph.d.ts +35 -0
  14. package/lib/layout/edgeOrdering/orderEdges.d.ts +4 -3
  15. package/lib/layout/edgePositioning/linkLayout.d.ts +2 -1
  16. package/lib/layout/edgePositioning/utils.d.ts +5 -3
  17. package/lib/layout/layout.d.ts +54 -27
  18. package/lib/layout/nodeOrdering/addDummyNodes.d.ts +4 -2
  19. package/lib/layout/nodeOrdering/countCrossings.d.ts +5 -4
  20. package/lib/layout/nodeOrdering/initialOrdering.d.ts +3 -1
  21. package/lib/layout/nodeOrdering/ordering.d.ts +3 -2
  22. package/lib/layout/nodeOrdering/swapNodes.d.ts +3 -1
  23. package/lib/layout/nodeOrdering/weightedMedian.d.ts +6 -4
  24. package/lib/layout/nodePositioning/horizontal.d.ts +4 -2
  25. package/lib/layout/nodePositioning/justified.d.ts +53 -5
  26. package/lib/layout/rankAssignment/assignRanks.d.ts +3 -1
  27. package/lib/layout/rankAssignment/groupedGraph.d.ts +2 -2
  28. package/lib/layout/rankAssignment/initialRank.d.ts +3 -1
  29. package/lib/layout/rankAssignment/makeAcyclic.d.ts +4 -4
  30. package/lib/layout/types.d.ts +99 -0
  31. package/lib/layout/utils.d.ts +12 -2
  32. package/lib/models/Edge.d.ts +17 -2
  33. package/lib/models/Graph.d.ts +13 -6
  34. package/lib/models/Node.d.ts +15 -3
  35. package/lib/models/Options.d.ts +60 -4
  36. package/lib/models/Paper.d.ts +2 -3
  37. package/lib/models/PathHighlighter.d.ts +28 -0
  38. package/lib/models/SankeyAnimation.d.ts +12 -0
  39. package/lib/utils/cssVars.d.ts +29 -0
  40. package/package.json +5 -5
@@ -0,0 +1,438 @@
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>ApexSankey – CSS Custom Property Theming</title>
7
+ <script src="../apexsankey.min.js"></script>
8
+ <style>
9
+ *,
10
+ *::before,
11
+ *::after {
12
+ box-sizing: border-box;
13
+ margin: 0;
14
+ padding: 0;
15
+ }
16
+
17
+ body {
18
+ font-family: system-ui, sans-serif;
19
+ background: #f0f4f8;
20
+ color: #1a202c;
21
+ min-height: 100vh;
22
+ transition:
23
+ background 0.3s,
24
+ color 0.3s;
25
+ }
26
+
27
+ body[data-theme='dark'] {
28
+ background: #0d1117;
29
+ color: #e0e0e0;
30
+ }
31
+
32
+ .page-header {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ padding: 20px 32px;
37
+ background: #ffffff;
38
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
39
+ transition: background 0.3s;
40
+ }
41
+
42
+ body[data-theme='dark'] .page-header {
43
+ background: #161b22;
44
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
45
+ }
46
+
47
+ .page-header h1 {
48
+ font-size: 1.25rem;
49
+ font-weight: 600;
50
+ }
51
+
52
+ .page-header h1 span {
53
+ color: #68d391;
54
+ }
55
+
56
+ .theme-toggle {
57
+ display: flex;
58
+ align-items: center;
59
+ gap: 10px;
60
+ cursor: pointer;
61
+ padding: 8px 16px;
62
+ border: 1.5px solid #cbd5e0;
63
+ border-radius: 8px;
64
+ background: transparent;
65
+ font: inherit;
66
+ font-size: 0.9rem;
67
+ color: inherit;
68
+ transition:
69
+ border-color 0.2s,
70
+ background 0.2s;
71
+ }
72
+
73
+ .theme-toggle:hover {
74
+ background: rgba(104, 211, 145, 0.1);
75
+ border-color: #68d391;
76
+ }
77
+
78
+ .content {
79
+ max-width: 1100px;
80
+ margin: 32px auto;
81
+ padding: 0 24px;
82
+ display: flex;
83
+ flex-direction: column;
84
+ gap: 32px;
85
+ }
86
+
87
+ .demo-section {
88
+ background: #ffffff;
89
+ border-radius: 12px;
90
+ padding: 24px;
91
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
92
+ transition:
93
+ background 0.3s,
94
+ box-shadow 0.3s;
95
+ }
96
+
97
+ body[data-theme='dark'] .demo-section {
98
+ background: #161b22;
99
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
100
+ }
101
+
102
+ .demo-section h2 {
103
+ font-size: 1rem;
104
+ font-weight: 600;
105
+ margin-bottom: 6px;
106
+ }
107
+
108
+ .demo-section p {
109
+ font-size: 0.875rem;
110
+ color: #718096;
111
+ margin-bottom: 20px;
112
+ line-height: 1.6;
113
+ }
114
+
115
+ body[data-theme='dark'] .demo-section p {
116
+ color: #8b9cbf;
117
+ }
118
+
119
+ .chart-wrapper {
120
+ border-radius: 8px;
121
+ overflow: hidden;
122
+ border: 1px solid #e2e8f0;
123
+ transition:
124
+ border-color 0.3s,
125
+ background 0.3s;
126
+ }
127
+
128
+ body[data-theme='dark'] .chart-wrapper {
129
+ border-color: #30363d;
130
+ background: #0d1117;
131
+ }
132
+
133
+ code {
134
+ font-family: 'Fira Code', monospace;
135
+ font-size: 0.8rem;
136
+ background: #f7fafc;
137
+ border: 1px solid #e2e8f0;
138
+ border-radius: 6px;
139
+ padding: 14px 18px;
140
+ display: block;
141
+ overflow-x: auto;
142
+ line-height: 1.7;
143
+ white-space: pre;
144
+ transition:
145
+ background 0.3s,
146
+ border-color 0.3s;
147
+ }
148
+
149
+ body[data-theme='dark'] code {
150
+ background: #0d1117;
151
+ border-color: #30363d;
152
+ color: #c9d1d9;
153
+ }
154
+
155
+ .token-grid {
156
+ display: grid;
157
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
158
+ gap: 10px;
159
+ margin-top: 16px;
160
+ }
161
+
162
+ .token-item {
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 10px;
166
+ padding: 10px 14px;
167
+ background: #f7fafc;
168
+ border: 1px solid #e2e8f0;
169
+ border-radius: 8px;
170
+ font-size: 0.8rem;
171
+ transition:
172
+ background 0.3s,
173
+ border-color 0.3s;
174
+ }
175
+
176
+ body[data-theme='dark'] .token-item {
177
+ background: #1c2128;
178
+ border-color: #30363d;
179
+ color: #c9d1d9;
180
+ }
181
+
182
+ .token-swatch {
183
+ width: 20px;
184
+ height: 20px;
185
+ border-radius: 4px;
186
+ border: 1px solid rgba(0, 0, 0, 0.1);
187
+ flex-shrink: 0;
188
+ }
189
+
190
+ .token-name {
191
+ font-family: monospace;
192
+ color: #38a169;
193
+ font-size: 0.75rem;
194
+ }
195
+
196
+ body[data-theme='dark'] .token-name {
197
+ color: #68d391;
198
+ }
199
+
200
+ /* ── CSS Custom Property Theming tokens ─────────────────────── */
201
+ #sankey-live {
202
+ --apex-sankey-edge-opacity: 0.5;
203
+ --apex-sankey-edge-gradient: true;
204
+ --apex-sankey-label-color: #2d3748;
205
+ --apex-sankey-label-font-size: 12px;
206
+ --apex-sankey-font-family: system-ui, sans-serif;
207
+ --apex-sankey-node-width: 16;
208
+ --apex-sankey-node-border-color: transparent;
209
+ --apex-sankey-node-border-width: 0;
210
+ --apex-sankey-tooltip-bg: #ffffff;
211
+ --apex-sankey-tooltip-border-color: #e2e8f0;
212
+ }
213
+
214
+ body[data-theme='dark'] #sankey-live {
215
+ --apex-sankey-edge-opacity: 0.4;
216
+ --apex-sankey-label-color: #c9d1d9;
217
+ --apex-sankey-tooltip-bg: #161b22;
218
+ --apex-sankey-tooltip-border-color: #30363d;
219
+ }
220
+
221
+ /* ── prefers-color-scheme: dark (no JS required) ────────────── */
222
+ @media (prefers-color-scheme: dark) {
223
+ #sankey-os-dark {
224
+ --apex-sankey-edge-opacity: 0.4;
225
+ --apex-sankey-edge-gradient: true;
226
+ --apex-sankey-label-color: #c9d1d9;
227
+ --apex-sankey-label-font-size: 12px;
228
+ --apex-sankey-font-family: system-ui, sans-serif;
229
+ --apex-sankey-node-width: 16;
230
+ --apex-sankey-node-border-color: transparent;
231
+ --apex-sankey-node-border-width: 0;
232
+ --apex-sankey-tooltip-bg: #161b22;
233
+ --apex-sankey-tooltip-border-color: #30363d;
234
+ }
235
+ }
236
+ </style>
237
+ </head>
238
+ <body>
239
+ <!-- ── Header ─────────────────────────────────────────────────── -->
240
+ <header class="page-header">
241
+ <h1>ApexSankey — <span>CSS Custom Property Theming</span></h1>
242
+ <button class="theme-toggle" onclick="toggleTheme()">
243
+ <span id="themeIcon">🌙</span>
244
+ <span id="themeLabel">Switch to Dark Mode</span>
245
+ </button>
246
+ </header>
247
+
248
+ <main class="content">
249
+ <!-- ── 1. Live Toggle Demo ────────────────────────────────────── -->
250
+ <section class="demo-section">
251
+ <h2>🎨 Live Theme Toggle</h2>
252
+ <p>
253
+ Use the toggle in the header to switch between light and dark mode. The Sankey diagram responds to CSS custom
254
+ properties defined on its container element — no JavaScript options are changed.
255
+ </p>
256
+ <div class="chart-wrapper">
257
+ <div id="sankey-live" style="width: 100%; height: 420px"></div>
258
+ </div>
259
+ </section>
260
+
261
+ <!-- ── 2. OS Dark Mode Demo (no JS) ─────────────────────────── -->
262
+ <section class="demo-section">
263
+ <h2>🌑 Dark Mode via <code style="display: inline; padding: 2px 6px">prefers-color-scheme</code> (no JS)</h2>
264
+ <p>
265
+ This chart is themed entirely via a CSS
266
+ <code style="display: inline; padding: 2px 6px">@media (prefers-color-scheme: dark)</code>
267
+ block — no JavaScript required. Switch your OS appearance to dark mode to see it update automatically.
268
+ </p>
269
+ <div class="chart-wrapper">
270
+ <div id="sankey-os-dark" style="width: 100%; height: 420px"></div>
271
+ </div>
272
+ </section>
273
+
274
+ <!-- ── 3. Code snippet ─────────────────────────────────────── -->
275
+ <section class="demo-section">
276
+ <h2>📋 How it works</h2>
277
+ <p>
278
+ Set CSS custom properties on the container element (or any ancestor) to override the default JS option values.
279
+ The chart reads these at render time.
280
+ </p>
281
+ <code
282
+ >/* Light mode tokens on the container */ #my-sankey { --apex-sankey-edge-opacity: 0.5;
283
+ --apex-sankey-edge-gradient: true; --apex-sankey-label-color: #2d3748; --apex-sankey-label-font-size: 12px;
284
+ --apex-sankey-font-family: system-ui, sans-serif; --apex-sankey-node-width: 16;
285
+ --apex-sankey-node-border-color: transparent; --apex-sankey-node-border-width: 0; --apex-sankey-tooltip-bg:
286
+ #ffffff; --apex-sankey-tooltip-border-color: #e2e8f0; } /* Dark mode — via OS preference (no JS required) */
287
+ @media (prefers-color-scheme: dark) { #my-sankey { --apex-sankey-edge-opacity: 0.4; --apex-sankey-label-color:
288
+ #c9d1d9; --apex-sankey-tooltip-bg: #161b22; --apex-sankey-tooltip-border-color: #30363d; } } /* Dark mode —
289
+ via a manual [data-theme] toggle */ [data-theme="dark"] #my-sankey { --apex-sankey-edge-opacity: 0.4;
290
+ --apex-sankey-label-color: #c9d1d9; --apex-sankey-tooltip-bg: #161b22; --apex-sankey-tooltip-border-color:
291
+ #30363d; }</code
292
+ >
293
+ </section>
294
+
295
+ <!-- ── 3. Token Reference ───────────────────────────────────── -->
296
+ <section class="demo-section">
297
+ <h2>📖 Token Reference</h2>
298
+ <p>All supported CSS custom properties for ApexSankey.</p>
299
+ <div class="token-grid">
300
+ <div class="token-item">
301
+ <div class="token-swatch" style="background: rgba(100, 160, 255, 0.5)"></div>
302
+ <div>
303
+ <div class="token-name">--apex-sankey-edge-opacity</div>
304
+ <div>Flow edge opacity (0–1, default 0.4)</div>
305
+ </div>
306
+ </div>
307
+ <div class="token-item">
308
+ <div class="token-swatch" style="background: transparent; border-style: dashed"></div>
309
+ <div>
310
+ <div class="token-name">--apex-sankey-edge-gradient</div>
311
+ <div>Edge gradient fill ('true'/'false', default true)</div>
312
+ </div>
313
+ </div>
314
+ <div class="token-item">
315
+ <div class="token-swatch" style="background: #2d3748"></div>
316
+ <div>
317
+ <div class="token-name">--apex-sankey-label-color</div>
318
+ <div>Node label text color</div>
319
+ </div>
320
+ </div>
321
+ <div class="token-item">
322
+ <div class="token-swatch" style="background: transparent; border-style: dashed"></div>
323
+ <div>
324
+ <div class="token-name">--apex-sankey-label-font-size</div>
325
+ <div>Node label font size (e.g. 12px)</div>
326
+ </div>
327
+ </div>
328
+ <div class="token-item">
329
+ <div class="token-swatch" style="background: transparent; border-style: dashed"></div>
330
+ <div>
331
+ <div class="token-name">--apex-sankey-font-family</div>
332
+ <div>Font family for all labels</div>
333
+ </div>
334
+ </div>
335
+ <div class="token-item">
336
+ <div class="token-swatch" style="background: transparent; border-style: dashed"></div>
337
+ <div>
338
+ <div class="token-name">--apex-sankey-node-width</div>
339
+ <div>Node rectangle width in px (default 20)</div>
340
+ </div>
341
+ </div>
342
+ <div class="token-item">
343
+ <div class="token-swatch" style="background: transparent; border: 2px solid #a0aec0"></div>
344
+ <div>
345
+ <div class="token-name">--apex-sankey-node-border-color</div>
346
+ <div>Node border color (default: node color)</div>
347
+ </div>
348
+ </div>
349
+ <div class="token-item">
350
+ <div class="token-swatch" style="background: transparent; border-style: dashed"></div>
351
+ <div>
352
+ <div class="token-name">--apex-sankey-node-border-width</div>
353
+ <div>Node border width in px (default 1)</div>
354
+ </div>
355
+ </div>
356
+ <div class="token-item">
357
+ <div class="token-swatch" style="background: #ffffff; border: 1px solid #e2e8f0"></div>
358
+ <div>
359
+ <div class="token-name">--apex-sankey-tooltip-bg</div>
360
+ <div>Tooltip background color (default #FFFFFF)</div>
361
+ </div>
362
+ </div>
363
+ <div class="token-item">
364
+ <div class="token-swatch" style="background: #bcbcbc"></div>
365
+ <div>
366
+ <div class="token-name">--apex-sankey-tooltip-border-color</div>
367
+ <div>Tooltip border color (default #BCBCBC)</div>
368
+ </div>
369
+ </div>
370
+ </div>
371
+ </section>
372
+ </main>
373
+
374
+ <script>
375
+ // ── Sankey data — energy flow diagram ───────────────────────
376
+ const sankeyData = {
377
+ nodes: [
378
+ {id: 'Solar', title: 'Solar'},
379
+ {id: 'Wind', title: 'Wind'},
380
+ {id: 'Grid', title: 'Grid'},
381
+ {id: 'Battery', title: 'Battery'},
382
+ {id: 'Home', title: 'Home'},
383
+ {id: 'EV', title: 'EV Charging'},
384
+ {id: 'Export', title: 'Grid Export'},
385
+ {id: 'Lighting', title: 'Lighting'},
386
+ {id: 'Appliances', title: 'Appliances'},
387
+ {id: 'Heating', title: 'Heating'},
388
+ ],
389
+ edges: [
390
+ {source: 'Solar', target: 'Battery', value: 30},
391
+ {source: 'Solar', target: 'Home', value: 45},
392
+ {source: 'Solar', target: 'Export', value: 15},
393
+ {source: 'Wind', target: 'Grid', value: 60},
394
+ {source: 'Grid', target: 'Home', value: 25},
395
+ {source: 'Grid', target: 'EV', value: 20},
396
+ {source: 'Battery', target: 'Home', value: 20},
397
+ {source: 'Battery', target: 'EV', value: 10},
398
+ {source: 'Home', target: 'Lighting', value: 20},
399
+ {source: 'Home', target: 'Appliances', value: 40},
400
+ {source: 'Home', target: 'Heating', value: 30},
401
+ ],
402
+ options: {},
403
+ };
404
+
405
+ const sankeyOptions = {
406
+ width: 800,
407
+ height: 420,
408
+ nodeWidth: 14,
409
+ edgeGradientFill: true,
410
+ enableTooltip: true,
411
+ enableToolbar: false,
412
+ };
413
+
414
+ // ── Instantiate charts ────────────────────────────────────────
415
+ const sankey = new ApexSankey(document.getElementById('sankey-live'), sankeyOptions);
416
+ sankey.render(sankeyData);
417
+
418
+ const sankeyOsDark = new ApexSankey(document.getElementById('sankey-os-dark'), sankeyOptions);
419
+ sankeyOsDark.render(sankeyData);
420
+
421
+ // ── Theme toggle logic ────────────────────────────────────────
422
+ function toggleTheme() {
423
+ const isDark = document.body.getAttribute('data-theme') === 'dark';
424
+ if (isDark) {
425
+ document.body.removeAttribute('data-theme');
426
+ document.getElementById('themeIcon').textContent = '🌙';
427
+ document.getElementById('themeLabel').textContent = 'Switch to Dark Mode';
428
+ } else {
429
+ document.body.setAttribute('data-theme', 'dark');
430
+ document.getElementById('themeIcon').textContent = '☀️';
431
+ document.getElementById('themeLabel').textContent = 'Switch to Light Mode';
432
+ }
433
+ // Re-render so the chart picks up the new CSS vars
434
+ sankey.render(sankeyData);
435
+ }
436
+ </script>
437
+ </body>
438
+ </html>
@@ -5,7 +5,6 @@
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>
9
8
  <script src="../apexsankey.min.js"></script>
10
9
  </head>
11
10
  <body>
@@ -87,7 +86,7 @@
87
86
  ],
88
87
  };
89
88
  const graphOptions = {
90
- width: '90%',
89
+ width: 800,
91
90
  fontFamily: 'Quicksand, sans-serif',
92
91
  fontWeight: '600',
93
92
  nodeWidth: 5,
@@ -5,12 +5,11 @@
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>
9
8
  <script src="../apexsankey.min.js"></script>
10
9
  </head>
11
10
 
12
11
  <body>
13
- <div id="svg-sankey" style="margin: 0 auto; width: 800px; height: 700px"></div>
12
+ <div id="svg-sankey" style="margin: 0 auto"></div>
14
13
  <script>
15
14
  const data = {
16
15
  nodes: [
@@ -163,6 +162,8 @@
163
162
  fontFamily: 'Satisfy, "cursive"',
164
163
  fontWeight: '600',
165
164
  fontColor: '#E37816',
165
+ width: 800,
166
+ height: 700,
166
167
  };
167
168
  const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
168
169
  s.render(data);
@@ -5,11 +5,10 @@
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>
9
8
  <script src="../apexsankey.min.js"></script>
10
9
  </head>
11
10
  <body>
12
- <div id="svg-sankey" style="width: 800px; height: 700px; margin: 0 auto"></div>
11
+ <div id="svg-sankey" style="margin: 0 auto"></div>
13
12
  <script>
14
13
  const data = {
15
14
  nodes: [
@@ -97,6 +96,8 @@
97
96
  fontFamily: 'Quicksand, sans-serif',
98
97
  fontWeight: '600',
99
98
  edgeOpacity: 0.2,
99
+ width: 800,
100
+ height: 600,
100
101
  };
101
102
  const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
102
103
  s.render(data);
@@ -5,11 +5,10 @@
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>
9
8
  <script src="../apexsankey.min.js"></script>
10
9
  </head>
11
10
  <body>
12
- <div id="svg-sankey" style="margin: 0 auto; width: 800px; height: 700px"></div>
11
+ <div id="svg-sankey" style="margin: 0 auto"></div>
13
12
  <script>
14
13
  const data = {
15
14
  nodes: [
@@ -96,7 +95,8 @@
96
95
  ],
97
96
  };
98
97
  const graphOptions = {
99
- width: '90%',
98
+ width: 800,
99
+ height: 700,
100
100
  fontFamily: 'Quicksand, sans-serif',
101
101
  fontWeight: '600',
102
102
  nodeWidth: 5,
@@ -5,11 +5,10 @@
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>
9
8
  <script src="../apexsankey.min.js"></script>
10
9
  </head>
11
10
  <body>
12
- <div id="svg-sankey" style="margin: 0 auto; width: 800px; height: 600px"></div>
11
+ <div id="svg-sankey" style="margin: 0 auto"></div>
13
12
  <script>
14
13
  const data = {
15
14
  nodes: [
@@ -420,6 +419,8 @@
420
419
  fontWeight: '600',
421
420
  fontSize: '10px',
422
421
  spacing: 20,
422
+ width: 800,
423
+ height: 600,
423
424
  };
424
425
  const s = new ApexSankey(document.getElementById('svg-sankey'), graphOptions);
425
426
  s.render(data);