@cascivo/charts 0.6.0 → 0.7.1
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/dist/charts.css +1 -1
- package/dist/index.d.ts +846 -52
- package/dist/index.js +1071 -992
- package/dist/node/index.js +5094 -0
- package/package.json +10 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import './charts.css';
|
|
2
3
|
import { computed as e, createStreamBuffer as t, signal as n, useComputed as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
3
4
|
import { useId as s, useRef as c } from "react";
|
|
4
5
|
import { builtin as l, currentLocale as u, t as d } from "@cascivo/i18n";
|
|
@@ -11,21 +12,28 @@ function h(e, t) {
|
|
|
11
12
|
range: t,
|
|
12
13
|
map: (e) => o === 0 ? i : i + (e - n) / o * (a - i),
|
|
13
14
|
invert: (e) => a - i === 0 ? n : n + (e - i) / (a - i) * o,
|
|
14
|
-
ticks: (e = 5) => g(n, r, e)
|
|
15
|
+
ticks: (e = 5, t) => g(n, r, e, t)
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function g(e, t, n = 5) {
|
|
18
|
+
function g(e, t, n = 5, r) {
|
|
18
19
|
if (!Number.isFinite(e) || !Number.isFinite(t) || e === t) return [e];
|
|
19
20
|
e > t && ([e, t] = [t, e]);
|
|
20
|
-
let r = (t - e) / Math.max(1, n),
|
|
21
|
+
let i = r ?? !(Number.isInteger(e) && Number.isInteger(t)), a = (t - e) / Math.max(1, n), o = 10 ** Math.floor(Math.log10(a)), s = i ? [
|
|
21
22
|
1,
|
|
22
23
|
2,
|
|
23
24
|
2.5,
|
|
24
25
|
5,
|
|
25
26
|
10
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
] : [
|
|
28
|
+
1,
|
|
29
|
+
2,
|
|
30
|
+
5,
|
|
31
|
+
10
|
|
32
|
+
], c = a / o, l = (s.find((e) => e >= c) ?? 10) * o;
|
|
33
|
+
i || (l = Math.max(1, Math.round(l)));
|
|
34
|
+
let u = Math.ceil(e / l), d = Math.floor(t / l + 1e-9), f = [], p = Math.max(0, Math.ceil(-Math.log10(l)) + 2);
|
|
35
|
+
for (let e = u; e <= d; e++) f.push(parseFloat((e * l).toFixed(p)));
|
|
36
|
+
return f;
|
|
29
37
|
}
|
|
30
38
|
function _(e, t, n = .1) {
|
|
31
39
|
let [r, i] = t, a = e.length, o = (i - r) / Math.max(1, a + n * (a + 1)), s = o, c = o * n, l = new Map(e.map((e, t) => [e, t]));
|
|
@@ -175,15 +183,15 @@ function E(e, t = "linear") {
|
|
|
175
183
|
if (e.length === 0) return "";
|
|
176
184
|
if (e.length === 1 || t === "linear") return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
177
185
|
switch (t) {
|
|
178
|
-
case "monotone": return
|
|
186
|
+
case "monotone": return te(e);
|
|
179
187
|
case "step":
|
|
180
188
|
case "stepBefore":
|
|
181
189
|
case "stepAfter": return D(e, t);
|
|
182
|
-
case "natural": return
|
|
183
|
-
case "basis": return
|
|
184
|
-
case "cardinal": return
|
|
185
|
-
case "catmullRom": return
|
|
186
|
-
default: return
|
|
190
|
+
case "natural": return ee(e);
|
|
191
|
+
case "basis": return k(e);
|
|
192
|
+
case "cardinal": return A(e, 0);
|
|
193
|
+
case "catmullRom": return j(e, .5);
|
|
194
|
+
default: return te(e);
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
197
|
function D(e, t) {
|
|
@@ -216,14 +224,14 @@ function O(e) {
|
|
|
216
224
|
for (let n = 0; n < t - 1; n++) o[n] = 2 * e[n + 1] - a[n + 1];
|
|
217
225
|
return o[t - 1] = (e[t] + a[t - 1]) / 2, [a, o];
|
|
218
226
|
}
|
|
219
|
-
function
|
|
227
|
+
function ee(e) {
|
|
220
228
|
let t = e.length;
|
|
221
229
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
222
230
|
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = O(n), [o, s] = O(r), c = `M${n[0]},${r[0]}`;
|
|
223
231
|
for (let e = 0; e < t - 1; e++) c += `C${i[e]},${o[e]} ${a[e]},${s[e]} ${n[e + 1]},${r[e + 1]}`;
|
|
224
232
|
return c;
|
|
225
233
|
}
|
|
226
|
-
function
|
|
234
|
+
function k(e) {
|
|
227
235
|
let t = e.length;
|
|
228
236
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
229
237
|
let n = (n) => e[Math.max(0, Math.min(t - 1, n))][0], r = (n) => e[Math.max(0, Math.min(t - 1, n))][1], i = `M${n(0)},${r(0)}`;
|
|
@@ -234,7 +242,7 @@ function A(e) {
|
|
|
234
242
|
let a = e[t - 1];
|
|
235
243
|
return i += `L${a[0]},${a[1]}`, i;
|
|
236
244
|
}
|
|
237
|
-
function
|
|
245
|
+
function A(e, t) {
|
|
238
246
|
let n = e.length;
|
|
239
247
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
240
248
|
let r = (1 - t) / 6, i = (t) => e[Math.max(0, Math.min(n - 1, t))], a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -244,7 +252,7 @@ function j(e, t) {
|
|
|
244
252
|
}
|
|
245
253
|
return a;
|
|
246
254
|
}
|
|
247
|
-
function
|
|
255
|
+
function j(e, t) {
|
|
248
256
|
let n = e.length;
|
|
249
257
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
250
258
|
let r = (t) => e[Math.max(0, Math.min(n - 1, t))], i = (e, t) => Math.hypot(t[0] - e[0], t[1] - e[1]), a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -254,7 +262,7 @@ function M(e, t) {
|
|
|
254
262
|
}
|
|
255
263
|
return a;
|
|
256
264
|
}
|
|
257
|
-
function
|
|
265
|
+
function te(e) {
|
|
258
266
|
let t = e.length, n = [], r = [], i = [];
|
|
259
267
|
for (let a = 0; a < t - 1; a++) n[a] = e[a + 1][0] - e[a][0], r[a] = e[a + 1][1] - e[a][1], i[a] = n[a] === 0 ? 0 : r[a] / n[a];
|
|
260
268
|
let a = [i[0] ?? 0];
|
|
@@ -270,23 +278,23 @@ function N(e) {
|
|
|
270
278
|
}
|
|
271
279
|
return o;
|
|
272
280
|
}
|
|
273
|
-
function
|
|
281
|
+
function M(e, t, n = "linear") {
|
|
274
282
|
if (e.length === 0) return "";
|
|
275
283
|
let r = E(e, n), i = e[e.length - 1], a = e[0];
|
|
276
284
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
277
285
|
}
|
|
278
|
-
function
|
|
286
|
+
function N(e, t, n, r, i, a) {
|
|
279
287
|
let o = 2 * Math.PI;
|
|
280
288
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
281
289
|
let a = i + Math.PI;
|
|
282
|
-
return
|
|
290
|
+
return N(e, t, n, r, i, a) + N(e, t, n, r, a, i + o - 1e-9);
|
|
283
291
|
}
|
|
284
292
|
let s = (n, r) => [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = w(n), u = w(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
285
293
|
if (r <= 0) return `M${w(e)},${w(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
286
294
|
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
287
295
|
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
288
296
|
}
|
|
289
|
-
function
|
|
297
|
+
function P(e) {
|
|
290
298
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
291
299
|
return e.map((e) => e.map((e, t) => {
|
|
292
300
|
let r = n[t];
|
|
@@ -295,7 +303,7 @@ function I(e) {
|
|
|
295
303
|
}
|
|
296
304
|
//#endregion
|
|
297
305
|
//#region src/engine/stacked.ts
|
|
298
|
-
function
|
|
306
|
+
function F(e) {
|
|
299
307
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
300
308
|
for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
|
|
301
309
|
return {
|
|
@@ -317,7 +325,7 @@ function L(e) {
|
|
|
317
325
|
}
|
|
318
326
|
//#endregion
|
|
319
327
|
//#region src/engine/nearest.ts
|
|
320
|
-
function
|
|
328
|
+
function ne(e, t) {
|
|
321
329
|
if (e.length === 0) return -1;
|
|
322
330
|
if (e.length === 1) return 0;
|
|
323
331
|
let n = 0, r = e.length - 1;
|
|
@@ -329,7 +337,7 @@ function ee(e, t) {
|
|
|
329
337
|
}
|
|
330
338
|
//#endregion
|
|
331
339
|
//#region src/engine/voronoi.ts
|
|
332
|
-
function
|
|
340
|
+
function re(e, t, n) {
|
|
333
341
|
let r = -1, i = Infinity;
|
|
334
342
|
for (let a = 0; a < e.length; a++) {
|
|
335
343
|
let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
|
|
@@ -337,7 +345,7 @@ function te(e, t, n) {
|
|
|
337
345
|
}
|
|
338
346
|
return r;
|
|
339
347
|
}
|
|
340
|
-
function
|
|
348
|
+
function I(e, t, n, r, i) {
|
|
341
349
|
if (e.length === 0) return e;
|
|
342
350
|
let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
|
|
343
351
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -349,7 +357,7 @@ function ne(e, t, n, r, i) {
|
|
|
349
357
|
}
|
|
350
358
|
return a;
|
|
351
359
|
}
|
|
352
|
-
function
|
|
360
|
+
function ie(e, t) {
|
|
353
361
|
let n = [
|
|
354
362
|
[t.x0, t.y0],
|
|
355
363
|
[t.x1, t.y0],
|
|
@@ -361,21 +369,21 @@ function re(e, t) {
|
|
|
361
369
|
for (let n = 0; n < e.length && i.length > 0; n++) {
|
|
362
370
|
if (n === r) continue;
|
|
363
371
|
let a = e[n];
|
|
364
|
-
i =
|
|
372
|
+
i = I(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
|
|
365
373
|
}
|
|
366
374
|
return i;
|
|
367
375
|
});
|
|
368
376
|
}
|
|
369
|
-
function
|
|
377
|
+
function L(e) {
|
|
370
378
|
return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
|
|
371
379
|
}
|
|
372
380
|
//#endregion
|
|
373
381
|
//#region src/engine/stats.ts
|
|
374
|
-
function
|
|
382
|
+
function ae(e) {
|
|
375
383
|
let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
|
|
376
384
|
return (e[Math.floor(t * .75)] ?? 0) - n;
|
|
377
385
|
}
|
|
378
|
-
function
|
|
386
|
+
function R(e, t) {
|
|
379
387
|
if (e.length === 0) return [];
|
|
380
388
|
let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
|
|
381
389
|
if (i === a) return [{
|
|
@@ -386,7 +394,7 @@ function B(e, t) {
|
|
|
386
394
|
let o;
|
|
387
395
|
if (t !== void 0 && t > 0) o = t;
|
|
388
396
|
else {
|
|
389
|
-
let e = 2 *
|
|
397
|
+
let e = 2 * ae(n) * r ** (-1 / 3);
|
|
390
398
|
o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
|
|
391
399
|
}
|
|
392
400
|
let s = (a - i) / o, c = Array.from({ length: o }, (e, t) => ({
|
|
@@ -400,7 +408,7 @@ function B(e, t) {
|
|
|
400
408
|
}
|
|
401
409
|
return c;
|
|
402
410
|
}
|
|
403
|
-
function
|
|
411
|
+
function z(e) {
|
|
404
412
|
if (e.length === 0) return {
|
|
405
413
|
min: 0,
|
|
406
414
|
q1: 0,
|
|
@@ -422,7 +430,7 @@ function V(e) {
|
|
|
422
430
|
outliers: d
|
|
423
431
|
};
|
|
424
432
|
}
|
|
425
|
-
function
|
|
433
|
+
function B(e) {
|
|
426
434
|
if (e.length === 0) return [0, 1];
|
|
427
435
|
let t = e[0] ?? 0, n = e[0] ?? 0;
|
|
428
436
|
for (let r of e) r < t && (t = r), r > n && (n = r);
|
|
@@ -430,11 +438,11 @@ function H(e) {
|
|
|
430
438
|
}
|
|
431
439
|
//#endregion
|
|
432
440
|
//#region src/engine/treemap.ts
|
|
433
|
-
function
|
|
441
|
+
function V(e, t, n) {
|
|
434
442
|
let r = Math.max(...e), i = Math.min(...e);
|
|
435
443
|
return Math.max(t * t * r / (n * n), n * n / (t * t * i));
|
|
436
444
|
}
|
|
437
|
-
function
|
|
445
|
+
function H(e, t, n, r, i, a, o) {
|
|
438
446
|
let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
|
|
439
447
|
for (let t = 0; t < e.length; t++) {
|
|
440
448
|
let n = e[t] ?? 0, u = a[t] ?? "";
|
|
@@ -459,40 +467,40 @@ function W(e, t, n, r, i, a, o) {
|
|
|
459
467
|
}
|
|
460
468
|
}
|
|
461
469
|
}
|
|
462
|
-
function
|
|
470
|
+
function U(e, t, n, r, i, a) {
|
|
463
471
|
if (e.length === 0 || r <= 0 || i <= 0) return;
|
|
464
472
|
let o = e.reduce((e, t) => e + t.value, 0);
|
|
465
473
|
if (o === 0) return;
|
|
466
474
|
let s = r * i, c = e.map((e) => e.value / o * s), l = e.map((e) => e.id), u = [], d = [], f = Math.min(r, i), p = 0, m = 0;
|
|
467
475
|
for (; m < c.length;) {
|
|
468
476
|
let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
|
|
469
|
-
if (u.length === 0 ||
|
|
477
|
+
if (u.length === 0 || V(g, f, _) <= V(u, f, p)) u = g, d = [...d, h], p = _, m++;
|
|
470
478
|
else {
|
|
471
479
|
let o = p / s;
|
|
472
480
|
if (r >= i) {
|
|
473
481
|
let s = o * r;
|
|
474
|
-
|
|
482
|
+
H(u, t, n, s, i, d, a), U(e.slice(m), t + s, n, r - s, i, a);
|
|
475
483
|
} else {
|
|
476
484
|
let s = o * i;
|
|
477
|
-
|
|
485
|
+
H(u, t, n, r, s, d, a), U(e.slice(m), t, n + s, r, i - s, a);
|
|
478
486
|
}
|
|
479
487
|
return;
|
|
480
488
|
}
|
|
481
489
|
}
|
|
482
490
|
if (u.length > 0) {
|
|
483
491
|
let e = p / s;
|
|
484
|
-
r >= i ?
|
|
492
|
+
r >= i ? H(u, t, n, e * r, i, d, a) : H(u, t, n, r, e * i, d, a);
|
|
485
493
|
}
|
|
486
494
|
}
|
|
487
|
-
function
|
|
495
|
+
function W(e, t, n) {
|
|
488
496
|
if (e.length === 0 || t <= 0 || n <= 0) return [];
|
|
489
497
|
let r = [...e].sort((e, t) => t.value - e.value), i = [];
|
|
490
|
-
return
|
|
498
|
+
return U(r, 0, 0, t, n, i), i;
|
|
491
499
|
}
|
|
492
500
|
//#endregion
|
|
493
501
|
//#region src/engine/stream.ts
|
|
494
|
-
function
|
|
495
|
-
let n =
|
|
502
|
+
function G(e, t = "silhouette") {
|
|
503
|
+
let n = P(e);
|
|
496
504
|
if (t === "zero") return n;
|
|
497
505
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
498
506
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -510,7 +518,7 @@ function K(e) {
|
|
|
510
518
|
function q(e) {
|
|
511
519
|
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + q(t), 0) : e.value ?? 0;
|
|
512
520
|
}
|
|
513
|
-
function
|
|
521
|
+
function J(e, t = 2 * Math.PI) {
|
|
514
522
|
let n = [], r = (e, t, i, a) => {
|
|
515
523
|
if (n.push({
|
|
516
524
|
node: e,
|
|
@@ -527,12 +535,12 @@ function oe(e, t = 2 * Math.PI) {
|
|
|
527
535
|
};
|
|
528
536
|
return r(e, 0, 0, t), n;
|
|
529
537
|
}
|
|
530
|
-
function
|
|
538
|
+
function Y(e) {
|
|
531
539
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
532
540
|
}
|
|
533
541
|
//#endregion
|
|
534
542
|
//#region src/engine/sankey.ts
|
|
535
|
-
function
|
|
543
|
+
function oe(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
|
|
536
544
|
let o = /* @__PURE__ */ new Map();
|
|
537
545
|
for (let t of e) o.set(t.id, {
|
|
538
546
|
...t,
|
|
@@ -586,61 +594,61 @@ function ce(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12
|
|
|
586
594
|
links: v
|
|
587
595
|
};
|
|
588
596
|
}
|
|
589
|
-
function
|
|
597
|
+
function X(e) {
|
|
590
598
|
let t = e.source.x1, n = e.target.x0, r = (t + n) / 2, i = e.sy, a = e.sy + e.width, o = e.ty, s = e.ty + e.width;
|
|
591
599
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
592
600
|
}
|
|
593
601
|
//#endregion
|
|
594
602
|
//#region src/engine/ramp.ts
|
|
595
|
-
var
|
|
596
|
-
l:
|
|
597
|
-
c:
|
|
598
|
-
h:
|
|
599
|
-
}),
|
|
603
|
+
var se = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ce = (e, t, n) => e + (t - e) * n, le = (e, t, n) => ({
|
|
604
|
+
l: ce(e.l, t.l, n),
|
|
605
|
+
c: ce(e.c, t.c, n),
|
|
606
|
+
h: ce(e.h, t.h, n)
|
|
607
|
+
}), ue = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, de = {
|
|
600
608
|
l: .95,
|
|
601
609
|
c: .04,
|
|
602
610
|
h: 232
|
|
603
|
-
},
|
|
611
|
+
}, fe = {
|
|
604
612
|
l: .34,
|
|
605
613
|
c: .15,
|
|
606
614
|
h: 274
|
|
607
|
-
},
|
|
615
|
+
}, pe = {
|
|
608
616
|
l: .48,
|
|
609
617
|
c: .14,
|
|
610
618
|
h: 248
|
|
611
|
-
},
|
|
619
|
+
}, Z = {
|
|
612
620
|
l: .96,
|
|
613
621
|
c: .02,
|
|
614
622
|
h: 110
|
|
615
|
-
},
|
|
623
|
+
}, me = {
|
|
616
624
|
l: .52,
|
|
617
625
|
c: .15,
|
|
618
626
|
h: 42
|
|
619
627
|
};
|
|
620
|
-
function
|
|
621
|
-
return
|
|
628
|
+
function he(e) {
|
|
629
|
+
return ue(le(de, fe, se(e)));
|
|
622
630
|
}
|
|
623
|
-
function
|
|
624
|
-
let t =
|
|
625
|
-
return
|
|
631
|
+
function ge(e) {
|
|
632
|
+
let t = se(e);
|
|
633
|
+
return ue(t < .5 ? le(pe, Z, t * 2) : le(Z, me, (t - .5) * 2));
|
|
626
634
|
}
|
|
627
|
-
function
|
|
628
|
-
return e === "diverging" ?
|
|
635
|
+
function _e(e) {
|
|
636
|
+
return e === "diverging" ? ge : he;
|
|
629
637
|
}
|
|
630
|
-
function
|
|
631
|
-
let n =
|
|
638
|
+
function ve(e, t = "sequential") {
|
|
639
|
+
let n = _e(t);
|
|
632
640
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
633
641
|
}
|
|
634
|
-
function
|
|
642
|
+
function ye(e) {
|
|
635
643
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
636
644
|
return t ? Number(t[1]) : NaN;
|
|
637
645
|
}
|
|
638
646
|
//#endregion
|
|
639
647
|
//#region src/engine/polar.ts
|
|
640
|
-
function
|
|
648
|
+
function be(e, t, n, r) {
|
|
641
649
|
return [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))];
|
|
642
650
|
}
|
|
643
|
-
function
|
|
651
|
+
function xe(e, t = [0, 2 * Math.PI]) {
|
|
644
652
|
let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
|
|
645
653
|
let n = i.get(e);
|
|
646
654
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -655,25 +663,25 @@ function Ce(e, t = [0, 2 * Math.PI]) {
|
|
|
655
663
|
step: r
|
|
656
664
|
};
|
|
657
665
|
}
|
|
658
|
-
function
|
|
666
|
+
function Se(e, t) {
|
|
659
667
|
return h(e, t);
|
|
660
668
|
}
|
|
661
669
|
//#endregion
|
|
662
670
|
//#region src/engine/transform.ts
|
|
663
|
-
function
|
|
671
|
+
function Ce(e, t) {
|
|
664
672
|
return e.filter((e, n) => t(e, n));
|
|
665
673
|
}
|
|
666
|
-
function
|
|
674
|
+
function we(e, t) {
|
|
667
675
|
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
|
|
668
676
|
}
|
|
669
|
-
function
|
|
677
|
+
function Te(e, t, n = "asc") {
|
|
670
678
|
let r = typeof t == "function" ? t : (e) => e[t], i = n === "desc" ? -1 : 1;
|
|
671
679
|
return e.map((e, t) => ({
|
|
672
680
|
row: e,
|
|
673
681
|
i: t
|
|
674
|
-
})).sort((e, t) =>
|
|
682
|
+
})).sort((e, t) => we(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
|
|
675
683
|
}
|
|
676
|
-
function
|
|
684
|
+
function Ee(e, t) {
|
|
677
685
|
if (e === "count") return t.length;
|
|
678
686
|
if (t.length === 0) return 0;
|
|
679
687
|
switch (e) {
|
|
@@ -687,7 +695,7 @@ function Oe(e, t) {
|
|
|
687
695
|
}
|
|
688
696
|
}
|
|
689
697
|
}
|
|
690
|
-
function
|
|
698
|
+
function De(e, t) {
|
|
691
699
|
let n = typeof t.groupBy == "string" ? [t.groupBy] : t.groupBy, r = /* @__PURE__ */ new Map(), i = [];
|
|
692
700
|
for (let t of e) {
|
|
693
701
|
let e = n.map((e) => String(t[e])).join("\0"), a = r.get(e);
|
|
@@ -696,11 +704,11 @@ function ke(e, t) {
|
|
|
696
704
|
return i.map((e) => {
|
|
697
705
|
let i = r.get(e), a = {};
|
|
698
706
|
for (let e of n) a[e] = i[0][e];
|
|
699
|
-
for (let [e, n] of Object.entries(t.ops)) a[e] =
|
|
707
|
+
for (let [e, n] of Object.entries(t.ops)) a[e] = Ee(n, i.map((t) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)));
|
|
700
708
|
return a;
|
|
701
709
|
});
|
|
702
710
|
}
|
|
703
|
-
function
|
|
711
|
+
function Oe(e, t = {}) {
|
|
704
712
|
let n = e.filter((e) => Number.isFinite(e)), [r, i] = t.range ?? [Math.min(...n), Math.max(...n)], a = Math.max(1, t.bins ?? (Math.ceil(Math.sqrt(n.length)) || 1)), o = (i - r) / a || 1, s = Array.from({ length: a }, (e, t) => ({
|
|
705
713
|
x0: r + t * o,
|
|
706
714
|
x1: r + (t + 1) * o,
|
|
@@ -714,7 +722,7 @@ function Ae(e, t = {}) {
|
|
|
714
722
|
}
|
|
715
723
|
return s;
|
|
716
724
|
}
|
|
717
|
-
function
|
|
725
|
+
function ke(e, t) {
|
|
718
726
|
let n = t.length, r = e.map((e, n) => [...e, t[n]]);
|
|
719
727
|
for (let e = 0; e < n; e++) {
|
|
720
728
|
let t = e;
|
|
@@ -732,12 +740,12 @@ function je(e, t) {
|
|
|
732
740
|
return Math.abs(i) < 1e-12 ? 0 : r[t][n] / i;
|
|
733
741
|
});
|
|
734
742
|
}
|
|
735
|
-
function
|
|
743
|
+
function Ae(e, t) {
|
|
736
744
|
let n = e.map((e) => e[1]), r = n.reduce((e, t) => e + t, 0) / n.length, i = 0, a = 0;
|
|
737
745
|
for (let [n, o] of e) i += (o - t(n)) ** 2, a += (o - r) ** 2;
|
|
738
746
|
return a === 0 ? 1 : 1 - i / a;
|
|
739
747
|
}
|
|
740
|
-
function
|
|
748
|
+
function je(e, t = {}) {
|
|
741
749
|
let n = t.type ?? "linear", r = [...e].sort((e, t) => e[0] - t[0]), i = r.map((e) => e[0]), a = () => {
|
|
742
750
|
let e = r.length ? r.reduce((e, t) => e + t[1], 0) / r.length : 0;
|
|
743
751
|
return {
|
|
@@ -751,11 +759,11 @@ function Ne(e, t = {}) {
|
|
|
751
759
|
if (n === "exponential") {
|
|
752
760
|
let e = r.filter((e) => e[1] > 0);
|
|
753
761
|
if (e.length < 2) return a();
|
|
754
|
-
let t =
|
|
762
|
+
let t = je(e.map((e) => [e[0], Math.log(e[1])]), { type: "linear" }), n = Math.exp(t.coefficients[0]), o = t.coefficients[1], s = (e) => n * Math.exp(o * e);
|
|
755
763
|
return {
|
|
756
764
|
predict: s,
|
|
757
765
|
points: i.map((e) => [e, s(e)]),
|
|
758
|
-
r2:
|
|
766
|
+
r2: Ae(r, s),
|
|
759
767
|
coefficients: [n, o]
|
|
760
768
|
};
|
|
761
769
|
}
|
|
@@ -767,18 +775,18 @@ function Ne(e, t = {}) {
|
|
|
767
775
|
for (let t = 0; t < o; t++) s[e][t] += n[e] * n[t];
|
|
768
776
|
}
|
|
769
777
|
}
|
|
770
|
-
let l =
|
|
778
|
+
let l = ke(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
|
|
771
779
|
return {
|
|
772
780
|
predict: u,
|
|
773
781
|
points: i.map((e) => [e, u(e)]),
|
|
774
|
-
r2:
|
|
782
|
+
r2: Ae(r, u),
|
|
775
783
|
coefficients: l
|
|
776
784
|
};
|
|
777
785
|
}
|
|
778
786
|
//#endregion
|
|
779
787
|
//#region src/engine/dataset.ts
|
|
780
|
-
var
|
|
781
|
-
function
|
|
788
|
+
var Me = (e) => typeof e == "number" ? e : Number(e);
|
|
789
|
+
function Ne(e, t) {
|
|
782
790
|
let n = (e) => e.x, r = (e) => e.y;
|
|
783
791
|
if (!t.series) return {
|
|
784
792
|
series: [{
|
|
@@ -786,7 +794,7 @@ function Fe(e, t) {
|
|
|
786
794
|
label: t.label ?? t.y,
|
|
787
795
|
data: e.map((e) => ({
|
|
788
796
|
x: e[t.x],
|
|
789
|
-
y:
|
|
797
|
+
y: Me(e[t.y])
|
|
790
798
|
}))
|
|
791
799
|
}],
|
|
792
800
|
x: n,
|
|
@@ -801,7 +809,7 @@ function Fe(e, t) {
|
|
|
801
809
|
data: []
|
|
802
810
|
}, i.set(e, r), a.push(e)), r.data.push({
|
|
803
811
|
x: n[t.x],
|
|
804
|
-
y:
|
|
812
|
+
y: Me(n[t.y])
|
|
805
813
|
});
|
|
806
814
|
}
|
|
807
815
|
return {
|
|
@@ -810,15 +818,15 @@ function Fe(e, t) {
|
|
|
810
818
|
y: r
|
|
811
819
|
};
|
|
812
820
|
}
|
|
813
|
-
function
|
|
821
|
+
function Pe(e, t) {
|
|
814
822
|
return e.map((e) => ({
|
|
815
823
|
label: String(e[t.category]),
|
|
816
|
-
value:
|
|
824
|
+
value: Me(e[t.value])
|
|
817
825
|
}));
|
|
818
826
|
}
|
|
819
827
|
//#endregion
|
|
820
828
|
//#region src/engine/decimate.ts
|
|
821
|
-
function
|
|
829
|
+
function Fe(e, t) {
|
|
822
830
|
let n = e.length;
|
|
823
831
|
if (t >= n || t < 3) return e.slice();
|
|
824
832
|
let r = [e[0]], i = (n - 2) / (t - 2), a = 0;
|
|
@@ -835,7 +843,7 @@ function Le(e, t) {
|
|
|
835
843
|
}
|
|
836
844
|
return r.push(e[n - 1]), r;
|
|
837
845
|
}
|
|
838
|
-
function
|
|
846
|
+
function Ie(e, t) {
|
|
839
847
|
let n = e.length;
|
|
840
848
|
if (t >= n || t < 4) return e.slice();
|
|
841
849
|
let r = Math.max(1, Math.floor(t / 2)), i = n / r, a = [e[0]];
|
|
@@ -848,27 +856,27 @@ function Re(e, t) {
|
|
|
848
856
|
}
|
|
849
857
|
return a.push(e[n - 1]), a;
|
|
850
858
|
}
|
|
851
|
-
function
|
|
852
|
-
return n === "minmax" ?
|
|
859
|
+
function Le(e, t, n = "lttb") {
|
|
860
|
+
return n === "minmax" ? Ie(e, t) : Fe(e, t);
|
|
853
861
|
}
|
|
854
862
|
//#endregion
|
|
855
863
|
//#region src/stream/use-stream-series.ts
|
|
856
|
-
function
|
|
857
|
-
return e.length <= t.to ? e :
|
|
864
|
+
function Re(e, t) {
|
|
865
|
+
return e.length <= t.to ? e : Le(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
|
|
858
866
|
}
|
|
859
|
-
function
|
|
867
|
+
function ze(e) {
|
|
860
868
|
let { capacity: n, source: i, decimate: o } = e, s = c(t({ capacity: n })).current, l = c(i);
|
|
861
869
|
return l.current = i, a(() => {
|
|
862
870
|
let e = l.current((e) => s.append(e));
|
|
863
871
|
return () => {
|
|
864
872
|
e(), s.dispose();
|
|
865
873
|
};
|
|
866
|
-
}), r(() => o ?
|
|
874
|
+
}), r(() => o ? Re(s.signal.value, o) : s.signal.value);
|
|
867
875
|
}
|
|
868
|
-
function
|
|
876
|
+
function Be(n) {
|
|
869
877
|
let { capacity: r, source: i, decimate: a } = n, o = t({ capacity: r }), s = i((e) => o.append(e));
|
|
870
878
|
return {
|
|
871
|
-
signal: a ? e(() =>
|
|
879
|
+
signal: a ? e(() => Re(o.signal.value, a)) : o.signal,
|
|
872
880
|
stop: () => {
|
|
873
881
|
s(), o.dispose();
|
|
874
882
|
}
|
|
@@ -876,7 +884,7 @@ function He(n) {
|
|
|
876
884
|
}
|
|
877
885
|
//#endregion
|
|
878
886
|
//#region src/core/use-chart.ts
|
|
879
|
-
function
|
|
887
|
+
function Ve(e = 400, t = 300) {
|
|
880
888
|
let n = c(null), r = i(e), o = i(t);
|
|
881
889
|
return a(() => {
|
|
882
890
|
let e = n.current;
|
|
@@ -904,41 +912,47 @@ function Ue(e = 400, t = 300) {
|
|
|
904
912
|
height: o
|
|
905
913
|
};
|
|
906
914
|
}
|
|
907
|
-
var
|
|
915
|
+
var He = {
|
|
908
916
|
top: 8,
|
|
909
917
|
right: 8,
|
|
910
918
|
bottom: 24,
|
|
911
919
|
left: 36
|
|
912
|
-
},
|
|
920
|
+
}, Ue = {
|
|
913
921
|
top: 2,
|
|
914
922
|
right: 2,
|
|
915
923
|
bottom: 2,
|
|
916
924
|
left: 2
|
|
917
925
|
}, We = 6.5;
|
|
918
926
|
function Ge(e, t) {
|
|
919
|
-
if (t) return
|
|
927
|
+
if (t) return Ue.left;
|
|
920
928
|
let n = e.reduce((e, t) => Math.max(e, t.length), 0);
|
|
921
|
-
return Math.max(
|
|
929
|
+
return Math.max(He.left, Math.ceil(n * We + 12));
|
|
930
|
+
}
|
|
931
|
+
function Ke(e = {}) {
|
|
932
|
+
let { rightAxisLabels: t = [], bottomAxisLabels: n = [], plain: r } = e;
|
|
933
|
+
if (r) return Ue.right;
|
|
934
|
+
let i = t.reduce((e, t) => Math.max(e, t.length), 0), a = i > 0 ? Math.ceil(i * We + 12) : 0, o = n[n.length - 1] ?? "", s = o ? Math.ceil(o.length * We / 2 + 2) : 0;
|
|
935
|
+
return Math.max(He.right, a, s);
|
|
922
936
|
}
|
|
923
|
-
function
|
|
937
|
+
function qe(e, t) {
|
|
924
938
|
if (e.length <= 1 || t <= 0) return;
|
|
925
939
|
let n = t / e.length, r = e.reduce((e, t) => Math.max(e, t.length), 0) * We + 6;
|
|
926
940
|
if (!(n >= r)) return Math.ceil(r / n);
|
|
927
941
|
}
|
|
928
|
-
var
|
|
929
|
-
frame: "
|
|
930
|
-
"cascivo-chart-in": "_cascivo-chart-
|
|
931
|
-
fallback: "
|
|
942
|
+
var Je = {
|
|
943
|
+
frame: "_frame_1kt6d_2",
|
|
944
|
+
"cascivo-chart-in": "_cascivo-chart-in_1kt6d_1",
|
|
945
|
+
fallback: "_fallback_1kt6d_67"
|
|
932
946
|
};
|
|
933
947
|
//#endregion
|
|
934
948
|
//#region src/core/data-point.ts
|
|
935
|
-
function
|
|
949
|
+
function Ye(e) {
|
|
936
950
|
return `${e.label}: ${e.value}`;
|
|
937
951
|
}
|
|
938
952
|
//#endregion
|
|
939
953
|
//#region src/core/chart-tooltip.tsx
|
|
940
|
-
function
|
|
941
|
-
let n = t.format ? t.format(e) :
|
|
954
|
+
function Xe({ point: e, model: t }) {
|
|
955
|
+
let n = t.format ? t.format(e) : Ye(e), r = e.segments?.filter((e) => e.value !== 0);
|
|
942
956
|
return /* @__PURE__ */ p("div", {
|
|
943
957
|
role: "tooltip",
|
|
944
958
|
style: {
|
|
@@ -986,7 +1000,7 @@ function Ye({ point: e, model: t }) {
|
|
|
986
1000
|
}
|
|
987
1001
|
//#endregion
|
|
988
1002
|
//#region src/core/nearest.ts
|
|
989
|
-
function
|
|
1003
|
+
function Ze(e, t, n, r = "xy") {
|
|
990
1004
|
if (e.length === 0) return -1;
|
|
991
1005
|
let i = 0, a = Infinity;
|
|
992
1006
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -997,7 +1011,7 @@ function Xe(e, t, n, r = "xy") {
|
|
|
997
1011
|
}
|
|
998
1012
|
//#endregion
|
|
999
1013
|
//#region src/core/canvas-layer.tsx
|
|
1000
|
-
function
|
|
1014
|
+
function Qe({ size: e, paint: t }) {
|
|
1001
1015
|
let n = c(null);
|
|
1002
1016
|
return a(() => {
|
|
1003
1017
|
let { width: r, height: i } = e(), a = n.current;
|
|
@@ -1022,28 +1036,28 @@ function Ze({ size: e, paint: t }) {
|
|
|
1022
1036
|
}
|
|
1023
1037
|
});
|
|
1024
1038
|
}
|
|
1025
|
-
function
|
|
1039
|
+
function $e(e, t) {
|
|
1026
1040
|
let n = /var\((--[^,)]+)/.exec(t);
|
|
1027
1041
|
return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
|
|
1028
1042
|
}
|
|
1029
1043
|
//#endregion
|
|
1030
1044
|
//#region src/core/zoom.ts
|
|
1031
|
-
var
|
|
1032
|
-
function
|
|
1045
|
+
var et = 1;
|
|
1046
|
+
function tt(e, t, n, r) {
|
|
1033
1047
|
if (t <= 1) return [0, Math.max(0, t - 1)];
|
|
1034
1048
|
let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
|
|
1035
|
-
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s <
|
|
1049
|
+
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < et && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - et)), c = Math.min(t - 1, s + et)), [s, c];
|
|
1036
1050
|
}
|
|
1037
|
-
function
|
|
1051
|
+
function nt(e, t, n) {
|
|
1038
1052
|
let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
|
|
1039
1053
|
return [o, o + a];
|
|
1040
1054
|
}
|
|
1041
|
-
function
|
|
1055
|
+
function rt(e, t) {
|
|
1042
1056
|
return e[0] > 0 || e[1] < t - 1;
|
|
1043
1057
|
}
|
|
1044
1058
|
//#endregion
|
|
1045
1059
|
//#region src/chrome/toolbox.tsx
|
|
1046
|
-
var
|
|
1060
|
+
var it = {
|
|
1047
1061
|
display: "inline-flex",
|
|
1048
1062
|
alignItems: "center",
|
|
1049
1063
|
justifyContent: "center",
|
|
@@ -1058,7 +1072,7 @@ var rt = {
|
|
|
1058
1072
|
color: "var(--cascivo-color-foreground, inherit)",
|
|
1059
1073
|
cursor: "pointer"
|
|
1060
1074
|
};
|
|
1061
|
-
function
|
|
1075
|
+
function at({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
|
|
1062
1076
|
let o = e;
|
|
1063
1077
|
return /* @__PURE__ */ m("div", {
|
|
1064
1078
|
role: "group",
|
|
@@ -1070,26 +1084,26 @@ function it({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1070
1084
|
children: [
|
|
1071
1085
|
o.png !== !1 && /* @__PURE__ */ p("button", {
|
|
1072
1086
|
type: "button",
|
|
1073
|
-
style:
|
|
1087
|
+
style: it,
|
|
1074
1088
|
onClick: t,
|
|
1075
1089
|
children: d(l.charts.exportPng)
|
|
1076
1090
|
}),
|
|
1077
1091
|
o.svg !== !1 && /* @__PURE__ */ p("button", {
|
|
1078
1092
|
type: "button",
|
|
1079
|
-
style:
|
|
1093
|
+
style: it,
|
|
1080
1094
|
onClick: n,
|
|
1081
1095
|
children: d(l.charts.exportSvg)
|
|
1082
1096
|
}),
|
|
1083
1097
|
o.dataView !== !1 && /* @__PURE__ */ p("button", {
|
|
1084
1098
|
type: "button",
|
|
1085
|
-
style:
|
|
1099
|
+
style: it,
|
|
1086
1100
|
"aria-pressed": a,
|
|
1087
1101
|
onClick: r,
|
|
1088
1102
|
children: d(l.charts.dataView)
|
|
1089
1103
|
}),
|
|
1090
1104
|
o.restore !== !1 && /* @__PURE__ */ p("button", {
|
|
1091
1105
|
type: "button",
|
|
1092
|
-
style:
|
|
1106
|
+
style: it,
|
|
1093
1107
|
onClick: i,
|
|
1094
1108
|
children: d(l.charts.restore)
|
|
1095
1109
|
})
|
|
@@ -1098,19 +1112,19 @@ function it({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1098
1112
|
}
|
|
1099
1113
|
//#endregion
|
|
1100
1114
|
//#region src/core/export.ts
|
|
1101
|
-
var
|
|
1115
|
+
var ot = [
|
|
1102
1116
|
"fill",
|
|
1103
1117
|
"stroke",
|
|
1104
1118
|
"stop-color",
|
|
1105
1119
|
"color"
|
|
1106
1120
|
];
|
|
1107
|
-
function
|
|
1121
|
+
function st(e) {
|
|
1108
1122
|
let t = e.cloneNode(!0);
|
|
1109
1123
|
if (typeof getComputedStyle == "function") {
|
|
1110
1124
|
let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
|
|
1111
1125
|
for (let e = 0; e < n.length; e++) {
|
|
1112
1126
|
let t = getComputedStyle(n[e]), i = r[e];
|
|
1113
|
-
if (i) for (let e of
|
|
1127
|
+
if (i) for (let e of ot) {
|
|
1114
1128
|
let n = t.getPropertyValue(e);
|
|
1115
1129
|
n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
|
|
1116
1130
|
}
|
|
@@ -1118,7 +1132,7 @@ function ot(e) {
|
|
|
1118
1132
|
}
|
|
1119
1133
|
return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
|
|
1120
1134
|
}
|
|
1121
|
-
function
|
|
1135
|
+
function ct(e, t) {
|
|
1122
1136
|
if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
|
|
1123
1137
|
let n = t.dpr ?? 1, r = document.createElement("canvas");
|
|
1124
1138
|
r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
|
|
@@ -1134,14 +1148,14 @@ function st(e, t) {
|
|
|
1134
1148
|
}), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
1135
1149
|
}) : Promise.resolve(null);
|
|
1136
1150
|
}
|
|
1137
|
-
function
|
|
1151
|
+
function lt(e, t) {
|
|
1138
1152
|
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
1139
1153
|
let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1140
1154
|
i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
1141
1155
|
}
|
|
1142
1156
|
//#endregion
|
|
1143
1157
|
//#region src/core/chart-frame.tsx
|
|
1144
|
-
var
|
|
1158
|
+
var ut = {
|
|
1145
1159
|
position: "absolute",
|
|
1146
1160
|
insetInlineStart: "-9999px",
|
|
1147
1161
|
inlineSize: "1px",
|
|
@@ -1150,44 +1164,44 @@ var lt = {
|
|
|
1150
1164
|
clipPath: "inset(50%)",
|
|
1151
1165
|
whiteSpace: "nowrap"
|
|
1152
1166
|
};
|
|
1153
|
-
function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw:
|
|
1167
|
+
function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: ee, onAfterDraw: k }) {
|
|
1154
1168
|
o();
|
|
1155
|
-
let
|
|
1169
|
+
let A = s(), j = `${A}-desc`, te = `${A}-live`, { ref: M, width: N, height: P } = Ve(n ?? 400, r), F = i(null), ne = i(!1), I = c(null), ie = c(null), L = c(null), ae = c(null);
|
|
1156
1170
|
a(() => {
|
|
1157
|
-
let e =
|
|
1171
|
+
let e = ae.current;
|
|
1158
1172
|
if (!e || !T) return;
|
|
1159
1173
|
let t = (t) => {
|
|
1160
1174
|
t.preventDefault();
|
|
1161
1175
|
let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
|
|
1162
|
-
T.window.value =
|
|
1176
|
+
T.window.value = tt(T.window.value, T.count, i, r);
|
|
1163
1177
|
};
|
|
1164
1178
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1165
1179
|
});
|
|
1166
|
-
let
|
|
1180
|
+
let R = () => {
|
|
1167
1181
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1168
|
-
},
|
|
1169
|
-
let t =
|
|
1170
|
-
t &&
|
|
1171
|
-
},
|
|
1172
|
-
let t =
|
|
1173
|
-
t &&
|
|
1174
|
-
width:
|
|
1175
|
-
height:
|
|
1182
|
+
}, z = n ?? N.value, B = r ?? P.value, V = E === !0 ? {} : E || null, H = () => ie.current ? st(ie.current) : null, U = () => {
|
|
1183
|
+
let t = H();
|
|
1184
|
+
t && lt(t, `${e || "chart"}.svg`);
|
|
1185
|
+
}, W = () => {
|
|
1186
|
+
let t = H();
|
|
1187
|
+
t && ct(t, {
|
|
1188
|
+
width: z,
|
|
1189
|
+
height: B,
|
|
1176
1190
|
dpr: 2
|
|
1177
1191
|
}).then((t) => {
|
|
1178
|
-
t &&
|
|
1192
|
+
t && lt(t, `${e || "chart"}.png`);
|
|
1179
1193
|
});
|
|
1180
|
-
},
|
|
1181
|
-
|
|
1194
|
+
}, G = () => {
|
|
1195
|
+
R(), D?.();
|
|
1182
1196
|
}, K = typeof b == "function" ? b({
|
|
1183
|
-
width:
|
|
1184
|
-
height:
|
|
1197
|
+
width: z,
|
|
1198
|
+
height: B
|
|
1185
1199
|
}) : b;
|
|
1186
1200
|
a(() => {
|
|
1187
|
-
let e =
|
|
1188
|
-
if (!K || !
|
|
1201
|
+
let e = F.value;
|
|
1202
|
+
if (!K || !I.current) return;
|
|
1189
1203
|
let t = e === null ? void 0 : K.points[e];
|
|
1190
|
-
|
|
1204
|
+
I.current.textContent = t ? (K.format ?? Ye)(t) : "";
|
|
1191
1205
|
});
|
|
1192
1206
|
let q = {
|
|
1193
1207
|
position: "absolute",
|
|
@@ -1195,76 +1209,76 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1195
1209
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1196
1210
|
background: "transparent",
|
|
1197
1211
|
touchAction: T ? "none" : void 0
|
|
1198
|
-
},
|
|
1212
|
+
}, J = C === "canvas" && w !== void 0, Y = K !== void 0 || T !== void 0, oe = {};
|
|
1199
1213
|
if (O && typeof O == "object") {
|
|
1200
|
-
let e =
|
|
1214
|
+
let e = oe;
|
|
1201
1215
|
O.duration !== void 0 && (e["--cascivo-chart-anim-dur"] = `${O.duration}ms`), O.easing && (e["--cascivo-chart-anim-ease"] = O.easing), O.properties && (e["--cascivo-chart-anim-props"] = O.properties.join(", "));
|
|
1202
1216
|
}
|
|
1203
|
-
let
|
|
1204
|
-
...
|
|
1205
|
-
...
|
|
1217
|
+
let X = Y || J || V || Object.keys(oe).length > 0 ? {
|
|
1218
|
+
...oe,
|
|
1219
|
+
...Y || J || V ? { position: "relative" } : {}
|
|
1206
1220
|
} : void 0;
|
|
1207
1221
|
return /* @__PURE__ */ m("div", {
|
|
1208
|
-
ref:
|
|
1209
|
-
className: [
|
|
1210
|
-
style:
|
|
1222
|
+
ref: M,
|
|
1223
|
+
className: [Je.frame, g].filter(Boolean).join(" "),
|
|
1224
|
+
style: X,
|
|
1211
1225
|
..._ !== void 0 && { "data-state": _ },
|
|
1212
1226
|
...y === !0 && { "data-plain": "" },
|
|
1213
1227
|
...O === !1 && { "data-no-anim": "" },
|
|
1214
1228
|
children: [
|
|
1215
|
-
|
|
1229
|
+
V && /* @__PURE__ */ p("div", {
|
|
1216
1230
|
style: {
|
|
1217
1231
|
position: "absolute",
|
|
1218
1232
|
top: 4,
|
|
1219
1233
|
right: 4,
|
|
1220
1234
|
zIndex: 12
|
|
1221
1235
|
},
|
|
1222
|
-
children: /* @__PURE__ */ p(
|
|
1223
|
-
options:
|
|
1224
|
-
onPng:
|
|
1225
|
-
onSvg:
|
|
1236
|
+
children: /* @__PURE__ */ p(at, {
|
|
1237
|
+
options: V,
|
|
1238
|
+
onPng: W,
|
|
1239
|
+
onSvg: U,
|
|
1226
1240
|
onToggleData: () => {
|
|
1227
|
-
|
|
1241
|
+
ne.value = !ne.value;
|
|
1228
1242
|
},
|
|
1229
|
-
onRestore:
|
|
1230
|
-
showData:
|
|
1243
|
+
onRestore: G,
|
|
1244
|
+
showData: ne.value
|
|
1231
1245
|
})
|
|
1232
1246
|
}),
|
|
1233
|
-
|
|
1247
|
+
J && /* @__PURE__ */ p(Qe, {
|
|
1234
1248
|
size: () => ({
|
|
1235
|
-
width: n ??
|
|
1236
|
-
height: r ??
|
|
1249
|
+
width: n ?? N.value,
|
|
1250
|
+
height: r ?? P.value
|
|
1237
1251
|
}),
|
|
1238
1252
|
paint: w
|
|
1239
1253
|
}),
|
|
1240
1254
|
/* @__PURE__ */ m("svg", {
|
|
1241
|
-
ref:
|
|
1255
|
+
ref: ie,
|
|
1242
1256
|
role: "img",
|
|
1243
1257
|
"aria-label": e,
|
|
1244
|
-
"aria-describedby": t ?
|
|
1245
|
-
width:
|
|
1246
|
-
height:
|
|
1247
|
-
viewBox: `0 0 ${
|
|
1258
|
+
"aria-describedby": t ? j : void 0,
|
|
1259
|
+
width: z,
|
|
1260
|
+
height: B,
|
|
1261
|
+
viewBox: `0 0 ${z} ${B}`,
|
|
1248
1262
|
children: [
|
|
1249
1263
|
t && /* @__PURE__ */ p("desc", {
|
|
1250
|
-
id:
|
|
1264
|
+
id: j,
|
|
1251
1265
|
children: t
|
|
1252
1266
|
}),
|
|
1253
|
-
|
|
1254
|
-
width:
|
|
1255
|
-
height:
|
|
1267
|
+
ee?.({
|
|
1268
|
+
width: z,
|
|
1269
|
+
height: B
|
|
1256
1270
|
}),
|
|
1257
1271
|
h({
|
|
1258
|
-
width:
|
|
1259
|
-
height:
|
|
1272
|
+
width: z,
|
|
1273
|
+
height: B
|
|
1260
1274
|
}),
|
|
1261
|
-
|
|
1262
|
-
width:
|
|
1263
|
-
height:
|
|
1275
|
+
k?.({
|
|
1276
|
+
width: z,
|
|
1277
|
+
height: B
|
|
1264
1278
|
}),
|
|
1265
1279
|
_ === "empty" && /* @__PURE__ */ p("text", {
|
|
1266
|
-
x:
|
|
1267
|
-
y:
|
|
1280
|
+
x: z / 2,
|
|
1281
|
+
y: B / 2,
|
|
1268
1282
|
textAnchor: "middle",
|
|
1269
1283
|
dominantBaseline: "central",
|
|
1270
1284
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1275,20 +1289,20 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1275
1289
|
]
|
|
1276
1290
|
}),
|
|
1277
1291
|
u && /* @__PURE__ */ p("div", {
|
|
1278
|
-
className:
|
|
1279
|
-
style:
|
|
1292
|
+
className: Je.fallback,
|
|
1293
|
+
style: ut,
|
|
1280
1294
|
children: u
|
|
1281
1295
|
}),
|
|
1282
|
-
|
|
1296
|
+
V && ne.value && u && /* @__PURE__ */ p("div", {
|
|
1283
1297
|
"data-data-view": "",
|
|
1284
1298
|
style: { overflowX: "auto" },
|
|
1285
1299
|
children: u
|
|
1286
1300
|
}),
|
|
1287
|
-
|
|
1301
|
+
Y && /* @__PURE__ */ m(f, { children: [
|
|
1288
1302
|
K !== void 0 && /* @__PURE__ */ m(f, { children: [
|
|
1289
1303
|
/* @__PURE__ */ p("span", {
|
|
1290
|
-
id:
|
|
1291
|
-
ref:
|
|
1304
|
+
id: te,
|
|
1305
|
+
ref: I,
|
|
1292
1306
|
"aria-live": "polite",
|
|
1293
1307
|
style: {
|
|
1294
1308
|
position: "absolute",
|
|
@@ -1302,21 +1316,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1302
1316
|
border: 0
|
|
1303
1317
|
}
|
|
1304
1318
|
}),
|
|
1305
|
-
K.mode === "axis" &&
|
|
1319
|
+
K.mode === "axis" && F.value !== null && K.points[F.value] !== void 0 && /* @__PURE__ */ p("div", {
|
|
1306
1320
|
"aria-hidden": "true",
|
|
1307
1321
|
style: {
|
|
1308
1322
|
position: "absolute",
|
|
1309
|
-
left: K.points[
|
|
1323
|
+
left: K.points[F.value].cx,
|
|
1310
1324
|
top: 0,
|
|
1311
1325
|
width: 1,
|
|
1312
|
-
height:
|
|
1326
|
+
height: B,
|
|
1313
1327
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1314
1328
|
pointerEvents: "none",
|
|
1315
1329
|
zIndex: 9
|
|
1316
1330
|
}
|
|
1317
1331
|
}),
|
|
1318
|
-
|
|
1319
|
-
let e = K.points[
|
|
1332
|
+
F.value !== null && K.points[F.value] !== void 0 && (() => {
|
|
1333
|
+
let e = K.points[F.value];
|
|
1320
1334
|
return /* @__PURE__ */ p("div", {
|
|
1321
1335
|
"aria-hidden": "true",
|
|
1322
1336
|
style: {
|
|
@@ -1333,14 +1347,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1333
1347
|
}
|
|
1334
1348
|
});
|
|
1335
1349
|
})(),
|
|
1336
|
-
|
|
1337
|
-
point: K.points[
|
|
1350
|
+
F.value !== null && K.points[F.value] !== void 0 && /* @__PURE__ */ p(Xe, {
|
|
1351
|
+
point: K.points[F.value],
|
|
1338
1352
|
model: K
|
|
1339
1353
|
})
|
|
1340
1354
|
] }),
|
|
1341
|
-
T && !
|
|
1355
|
+
T && !V && rt(T.window.value, T.count) && /* @__PURE__ */ p("button", {
|
|
1342
1356
|
type: "button",
|
|
1343
|
-
onClick:
|
|
1357
|
+
onClick: R,
|
|
1344
1358
|
style: {
|
|
1345
1359
|
position: "absolute",
|
|
1346
1360
|
top: 4,
|
|
@@ -1358,71 +1372,71 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1358
1372
|
children: d(l.charts.resetZoom)
|
|
1359
1373
|
}),
|
|
1360
1374
|
/* @__PURE__ */ p("div", {
|
|
1361
|
-
ref:
|
|
1375
|
+
ref: ae,
|
|
1362
1376
|
role: "application",
|
|
1363
1377
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1364
1378
|
tabIndex: 0,
|
|
1365
1379
|
style: q,
|
|
1366
1380
|
onPointerDown: (e) => {
|
|
1367
|
-
T && (
|
|
1381
|
+
T && (L.current = {
|
|
1368
1382
|
x: e.clientX,
|
|
1369
1383
|
win: [...T.window.value]
|
|
1370
1384
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1371
1385
|
},
|
|
1372
1386
|
onPointerMove: (e) => {
|
|
1373
|
-
if (T &&
|
|
1374
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1375
|
-
T.window.value =
|
|
1387
|
+
if (T && L.current && e.buttons === 1) {
|
|
1388
|
+
let t = e.currentTarget.getBoundingClientRect(), n = L.current.win[1] - L.current.win[0] + 1, r = e.clientX - L.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1389
|
+
T.window.value = nt(L.current.win, T.count, i);
|
|
1376
1390
|
return;
|
|
1377
1391
|
}
|
|
1378
1392
|
if (!K || !K.points.length) return;
|
|
1379
1393
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1380
|
-
|
|
1394
|
+
F.value = K.mode === "axis" ? Ze(K.points, n, r, "x") : S === "voronoi" ? re(K.points.map((e) => [e.cx, e.cy]), n, r) : Ze(K.points, n, r, "xy");
|
|
1381
1395
|
},
|
|
1382
1396
|
onPointerUp: () => {
|
|
1383
|
-
|
|
1397
|
+
L.current = null;
|
|
1384
1398
|
},
|
|
1385
1399
|
onPointerLeave: () => {
|
|
1386
|
-
|
|
1400
|
+
L.current = null, K && (F.value = null);
|
|
1387
1401
|
},
|
|
1388
1402
|
onKeyDown: (e) => {
|
|
1389
1403
|
if (T) {
|
|
1390
1404
|
if (e.key === "+" || e.key === "=") {
|
|
1391
|
-
e.preventDefault(), T.window.value =
|
|
1405
|
+
e.preventDefault(), T.window.value = tt(T.window.value, T.count, 1 / 1.25, .5);
|
|
1392
1406
|
return;
|
|
1393
1407
|
}
|
|
1394
1408
|
if (e.key === "-" || e.key === "_") {
|
|
1395
|
-
e.preventDefault(), T.window.value =
|
|
1409
|
+
e.preventDefault(), T.window.value = tt(T.window.value, T.count, 1.25, .5);
|
|
1396
1410
|
return;
|
|
1397
1411
|
}
|
|
1398
1412
|
if (e.key === "0") {
|
|
1399
|
-
e.preventDefault(),
|
|
1413
|
+
e.preventDefault(), R();
|
|
1400
1414
|
return;
|
|
1401
1415
|
}
|
|
1402
1416
|
}
|
|
1403
1417
|
if (!K || !K.points.length) return;
|
|
1404
|
-
let t =
|
|
1405
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(),
|
|
1406
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(),
|
|
1407
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
1408
|
-
else if (e.key === "End") e.preventDefault(),
|
|
1409
|
-
else if (e.key === "Escape")
|
|
1418
|
+
let t = F.value;
|
|
1419
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), F.value = t === null ? 0 : Math.min(t + 1, K.points.length - 1);
|
|
1420
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), F.value = t === null ? K.points.length - 1 : Math.max(t - 1, 0);
|
|
1421
|
+
else if (e.key === "Home") e.preventDefault(), F.value = 0;
|
|
1422
|
+
else if (e.key === "End") e.preventDefault(), F.value = K.points.length - 1;
|
|
1423
|
+
else if (e.key === "Escape") F.value = null;
|
|
1410
1424
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1411
1425
|
e.preventDefault();
|
|
1412
|
-
let t =
|
|
1426
|
+
let t = F.value, n = t === null ? void 0 : K.points[t];
|
|
1413
1427
|
n && x(n);
|
|
1414
1428
|
}
|
|
1415
1429
|
},
|
|
1416
1430
|
onClick: () => {
|
|
1417
1431
|
if (!K) return;
|
|
1418
|
-
let e =
|
|
1432
|
+
let e = F.value, t = e === null ? void 0 : K.points[e];
|
|
1419
1433
|
x && t && x(t);
|
|
1420
1434
|
},
|
|
1421
1435
|
onFocus: () => {
|
|
1422
|
-
K && K.points.length > 0 &&
|
|
1436
|
+
K && K.points.length > 0 && F.value === null && (F.value = 0);
|
|
1423
1437
|
},
|
|
1424
1438
|
onBlur: () => {
|
|
1425
|
-
K && (
|
|
1439
|
+
K && (F.value = null);
|
|
1426
1440
|
}
|
|
1427
1441
|
})
|
|
1428
1442
|
] })
|
|
@@ -1431,45 +1445,49 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1431
1445
|
}
|
|
1432
1446
|
//#endregion
|
|
1433
1447
|
//#region src/core/sync.ts
|
|
1434
|
-
var
|
|
1435
|
-
function
|
|
1436
|
-
let t =
|
|
1448
|
+
var dt = /* @__PURE__ */ new Map();
|
|
1449
|
+
function ft(e) {
|
|
1450
|
+
let t = dt.get(e);
|
|
1437
1451
|
return t || (t = {
|
|
1438
1452
|
group: {
|
|
1439
1453
|
window: n(null),
|
|
1440
1454
|
hoverX: n(null)
|
|
1441
1455
|
},
|
|
1442
1456
|
refs: 0
|
|
1443
|
-
},
|
|
1457
|
+
}, dt.set(e, t)), t.refs++, t.group;
|
|
1444
1458
|
}
|
|
1445
|
-
function
|
|
1446
|
-
let t =
|
|
1447
|
-
t && (t.refs--, t.refs <= 0 &&
|
|
1459
|
+
function pt(e) {
|
|
1460
|
+
let t = dt.get(e);
|
|
1461
|
+
t && (t.refs--, t.refs <= 0 && dt.delete(e));
|
|
1448
1462
|
}
|
|
1449
|
-
function
|
|
1450
|
-
return
|
|
1463
|
+
function mt() {
|
|
1464
|
+
return dt.size;
|
|
1451
1465
|
}
|
|
1452
1466
|
//#endregion
|
|
1453
1467
|
//#region src/chrome/axis.tsx
|
|
1454
|
-
function
|
|
1468
|
+
function ht(e) {
|
|
1455
1469
|
return "bandwidth" in e;
|
|
1456
1470
|
}
|
|
1457
|
-
function
|
|
1471
|
+
function gt(e) {
|
|
1458
1472
|
return "tickInterval" in e;
|
|
1459
1473
|
}
|
|
1460
|
-
function
|
|
1474
|
+
function _t(e) {
|
|
1461
1475
|
return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
1462
1476
|
}
|
|
1463
|
-
function $({ scale: e, orientation: t, length: n, format: r =
|
|
1477
|
+
function $({ scale: e, orientation: t, length: n, format: r = _t, tickCount: i = 5, labelEvery: a, transform: o }) {
|
|
1464
1478
|
let s;
|
|
1465
|
-
if (
|
|
1466
|
-
let t = e.domain.length - 1;
|
|
1479
|
+
if (ht(e)) {
|
|
1480
|
+
let t = e.domain.length - 1, n = a != null && a > 1, i = n ? Math.floor(t / a) * a : -1, o = !1;
|
|
1481
|
+
if (n && i !== t && i >= 0) {
|
|
1482
|
+
let n = (t) => (e.map(e.domain[t]) ?? 0) + e.bandwidth / 2, a = e.domain.reduce((e, t) => Math.max(e, r(t).length), 0) * We;
|
|
1483
|
+
o = n(t) - n(i) < a;
|
|
1484
|
+
}
|
|
1467
1485
|
s = e.domain.map((t, n) => ({
|
|
1468
1486
|
position: (e.map(t) ?? 0) + e.bandwidth / 2,
|
|
1469
1487
|
label: r(t),
|
|
1470
1488
|
i: n
|
|
1471
|
-
})).filter(({ i: e }) =>
|
|
1472
|
-
} else if (
|
|
1489
|
+
})).filter(({ i: e }) => !n || e === t ? !0 : o && e === i ? !1 : e % a === 0);
|
|
1490
|
+
} else if (gt(e)) s = e.ticks(i).map((t) => ({
|
|
1473
1491
|
position: e.map(t),
|
|
1474
1492
|
label: r(t)
|
|
1475
1493
|
}));
|
|
@@ -1480,7 +1498,7 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1480
1498
|
label: r(e)
|
|
1481
1499
|
}));
|
|
1482
1500
|
}
|
|
1483
|
-
let c = t === "x";
|
|
1501
|
+
let c = t === "x", l = t === "y-right", u = c ? 0 : l ? 4 : -4, d = c ? 0 : l ? 8 : -8, f = c ? "middle" : l ? "start" : "end";
|
|
1484
1502
|
return /* @__PURE__ */ m("g", {
|
|
1485
1503
|
transform: o,
|
|
1486
1504
|
"aria-hidden": "true",
|
|
@@ -1496,14 +1514,14 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1496
1514
|
children: [/* @__PURE__ */ p("line", {
|
|
1497
1515
|
x1: 0,
|
|
1498
1516
|
y1: 0,
|
|
1499
|
-
x2:
|
|
1517
|
+
x2: u,
|
|
1500
1518
|
y2: c ? 4 : 0,
|
|
1501
1519
|
stroke: "var(--cascivo-chart-axis)",
|
|
1502
1520
|
strokeWidth: 1
|
|
1503
1521
|
}), /* @__PURE__ */ p("text", {
|
|
1504
|
-
x:
|
|
1522
|
+
x: d,
|
|
1505
1523
|
y: c ? 16 : 4,
|
|
1506
|
-
textAnchor:
|
|
1524
|
+
textAnchor: f,
|
|
1507
1525
|
fill: "var(--cascivo-chart-axis)",
|
|
1508
1526
|
fontSize: 11,
|
|
1509
1527
|
children: t
|
|
@@ -1513,7 +1531,7 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1513
1531
|
}
|
|
1514
1532
|
//#endregion
|
|
1515
1533
|
//#region src/chrome/grid-lines.tsx
|
|
1516
|
-
function
|
|
1534
|
+
function vt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
|
|
1517
1535
|
let a = e.ticks(r), o = t === "x";
|
|
1518
1536
|
return /* @__PURE__ */ p("g", {
|
|
1519
1537
|
transform: i,
|
|
@@ -1534,17 +1552,17 @@ function _t({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
|
|
|
1534
1552
|
}
|
|
1535
1553
|
//#endregion
|
|
1536
1554
|
//#region src/chrome/reference.tsx
|
|
1537
|
-
var
|
|
1538
|
-
function
|
|
1555
|
+
var yt = "var(--cascivo-color-foreground-muted)", bt = "var(--cascivo-color-accent)";
|
|
1556
|
+
function xt(e, t) {
|
|
1539
1557
|
let n = e.map(t);
|
|
1540
1558
|
if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
|
|
1541
1559
|
}
|
|
1542
|
-
function
|
|
1560
|
+
function St(e, t, n) {
|
|
1543
1561
|
let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
|
|
1544
1562
|
if (e.kind === "line") {
|
|
1545
|
-
let t =
|
|
1563
|
+
let t = xt(e.axis === "x" ? r : i, e.value);
|
|
1546
1564
|
if (t == null) return null;
|
|
1547
|
-
let s = e.color ??
|
|
1565
|
+
let s = e.color ?? yt, c = e.dash !== !1, l = e.axis === "x";
|
|
1548
1566
|
return /* @__PURE__ */ m("g", {
|
|
1549
1567
|
"data-annotation": "line",
|
|
1550
1568
|
"aria-hidden": "true",
|
|
@@ -1575,9 +1593,9 @@ function xt(e, t, n) {
|
|
|
1575
1593
|
}, n);
|
|
1576
1594
|
}
|
|
1577
1595
|
if (e.kind === "area") {
|
|
1578
|
-
let t = e.axis === "x" ? r : i, s =
|
|
1596
|
+
let t = e.axis === "x" ? r : i, s = xt(t, e.from), c = xt(t, e.to);
|
|
1579
1597
|
if (s == null || c == null) return null;
|
|
1580
|
-
let l = e.color ??
|
|
1598
|
+
let l = e.color ?? bt, u = e.axis === "x", d = Math.min(s, c), f = Math.abs(c - s);
|
|
1581
1599
|
return /* @__PURE__ */ p("g", {
|
|
1582
1600
|
"data-annotation": "area",
|
|
1583
1601
|
"aria-hidden": "true",
|
|
@@ -1593,9 +1611,9 @@ function xt(e, t, n) {
|
|
|
1593
1611
|
}, n);
|
|
1594
1612
|
}
|
|
1595
1613
|
if (e.kind === "note") {
|
|
1596
|
-
let t =
|
|
1614
|
+
let t = xt(r, e.x), s = xt(i, e.y);
|
|
1597
1615
|
if (t == null || s == null) return null;
|
|
1598
|
-
let c = e.color ??
|
|
1616
|
+
let c = e.color ?? bt, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), f = Math.max(8, Math.min(o - 2, s + u));
|
|
1599
1617
|
return /* @__PURE__ */ m("g", {
|
|
1600
1618
|
"data-annotation": "note",
|
|
1601
1619
|
children: [
|
|
@@ -1631,7 +1649,7 @@ function xt(e, t, n) {
|
|
|
1631
1649
|
if (e.kind === "threshold") {
|
|
1632
1650
|
let t = i.map(e.value);
|
|
1633
1651
|
if (t == null || Number.isNaN(t)) return null;
|
|
1634
|
-
let r = e.color ??
|
|
1652
|
+
let r = e.color ?? bt, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
|
|
1635
1653
|
return /* @__PURE__ */ p("g", {
|
|
1636
1654
|
"data-annotation": "threshold",
|
|
1637
1655
|
"aria-hidden": "true",
|
|
@@ -1646,9 +1664,9 @@ function xt(e, t, n) {
|
|
|
1646
1664
|
})
|
|
1647
1665
|
}, n);
|
|
1648
1666
|
}
|
|
1649
|
-
let s =
|
|
1667
|
+
let s = xt(r, e.x), c = xt(i, e.y);
|
|
1650
1668
|
if (s == null || c == null) return null;
|
|
1651
|
-
let l = e.color ??
|
|
1669
|
+
let l = e.color ?? bt;
|
|
1652
1670
|
return /* @__PURE__ */ m("g", {
|
|
1653
1671
|
"data-annotation": "dot",
|
|
1654
1672
|
"aria-hidden": "true",
|
|
@@ -1670,28 +1688,28 @@ function xt(e, t, n) {
|
|
|
1670
1688
|
})]
|
|
1671
1689
|
}, n);
|
|
1672
1690
|
}
|
|
1673
|
-
function
|
|
1691
|
+
function Ct(e, t) {
|
|
1674
1692
|
return !e || e.length === 0 ? null : /* @__PURE__ */ p("g", {
|
|
1675
1693
|
"data-annotations": "",
|
|
1676
|
-
children: e.map((e, n) =>
|
|
1694
|
+
children: e.map((e, n) => St(e, t, n))
|
|
1677
1695
|
});
|
|
1678
1696
|
}
|
|
1679
|
-
function
|
|
1697
|
+
function wt(e) {
|
|
1680
1698
|
return e.kind === "line" ? e.label ?? `${e.axis}=${String(e.value)}` : e.kind === "area" ? e.label ?? `${e.axis} ${String(e.from)}–${String(e.to)}` : e.kind === "threshold" ? e.label ?? `${e.side} ${e.value}` : e.kind === "note" ? e.label : e.label ?? `(${String(e.x)}, ${e.y})`;
|
|
1681
1699
|
}
|
|
1682
1700
|
//#endregion
|
|
1683
1701
|
//#region src/chrome/data-label.tsx
|
|
1684
|
-
var
|
|
1685
|
-
function
|
|
1702
|
+
var Tt = (e) => e.toLocaleString();
|
|
1703
|
+
function Et(e) {
|
|
1686
1704
|
return e ? e === !0 ? {
|
|
1687
|
-
format:
|
|
1705
|
+
format: Tt,
|
|
1688
1706
|
position: "auto"
|
|
1689
1707
|
} : {
|
|
1690
|
-
format: e.format ??
|
|
1708
|
+
format: e.format ?? Tt,
|
|
1691
1709
|
position: e.position ?? "auto"
|
|
1692
1710
|
} : null;
|
|
1693
1711
|
}
|
|
1694
|
-
function
|
|
1712
|
+
function Dt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
|
|
1695
1713
|
return /* @__PURE__ */ p("text", {
|
|
1696
1714
|
x: e,
|
|
1697
1715
|
y: t,
|
|
@@ -1707,21 +1725,21 @@ function Et({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
|
|
|
1707
1725
|
}
|
|
1708
1726
|
//#endregion
|
|
1709
1727
|
//#region src/chrome/defs.tsx
|
|
1710
|
-
function
|
|
1728
|
+
function Ot(e) {
|
|
1711
1729
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1712
1730
|
}
|
|
1713
|
-
function Ot(e, t) {
|
|
1714
|
-
return `${Dt(e)}-grad-${Dt(t)}`;
|
|
1715
|
-
}
|
|
1716
1731
|
function kt(e, t) {
|
|
1717
|
-
return `${
|
|
1732
|
+
return `${Ot(e)}-grad-${Ot(t)}`;
|
|
1718
1733
|
}
|
|
1719
|
-
function At(e, t
|
|
1720
|
-
return
|
|
1734
|
+
function At(e, t) {
|
|
1735
|
+
return `${Ot(e)}-pat-${Ot(t)}`;
|
|
1721
1736
|
}
|
|
1722
|
-
function jt(
|
|
1737
|
+
function jt(e, t, n, r) {
|
|
1738
|
+
return n === "gradient" ? `url(#${kt(e, t)})` : n === "pattern" ? `url(#${At(e, t)})` : r;
|
|
1739
|
+
}
|
|
1740
|
+
function Mt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
1723
1741
|
return n === "solid" ? null : /* @__PURE__ */ p("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ m("linearGradient", {
|
|
1724
|
-
id:
|
|
1742
|
+
id: kt(e, t.id),
|
|
1725
1743
|
x1: "0",
|
|
1726
1744
|
y1: "0",
|
|
1727
1745
|
x2: "0",
|
|
@@ -1736,7 +1754,7 @@ function jt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1736
1754
|
stopOpacity: .1
|
|
1737
1755
|
})]
|
|
1738
1756
|
}, t.id) : /* @__PURE__ */ m("pattern", {
|
|
1739
|
-
id:
|
|
1757
|
+
id: At(e, t.id),
|
|
1740
1758
|
patternUnits: "userSpaceOnUse",
|
|
1741
1759
|
width: 6,
|
|
1742
1760
|
height: 6,
|
|
@@ -1782,7 +1800,7 @@ function jt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1782
1800
|
}
|
|
1783
1801
|
//#endregion
|
|
1784
1802
|
//#region src/chrome/glyph.tsx
|
|
1785
|
-
function
|
|
1803
|
+
function Nt(e, t) {
|
|
1786
1804
|
let n = t / 2;
|
|
1787
1805
|
switch (e) {
|
|
1788
1806
|
case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
|
|
@@ -1803,7 +1821,7 @@ function Mt(e, t) {
|
|
|
1803
1821
|
default: return "";
|
|
1804
1822
|
}
|
|
1805
1823
|
}
|
|
1806
|
-
function
|
|
1824
|
+
function Pt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
|
|
1807
1825
|
let c = {
|
|
1808
1826
|
fill: i,
|
|
1809
1827
|
fillOpacity: a,
|
|
@@ -1818,33 +1836,33 @@ function Nt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
|
|
|
1818
1836
|
r: r / 2,
|
|
1819
1837
|
...c
|
|
1820
1838
|
}) : /* @__PURE__ */ p("path", {
|
|
1821
|
-
d:
|
|
1839
|
+
d: Nt(e, r),
|
|
1822
1840
|
transform: `translate(${t},${n})`,
|
|
1823
1841
|
...c
|
|
1824
1842
|
});
|
|
1825
1843
|
}
|
|
1826
1844
|
//#endregion
|
|
1827
1845
|
//#region src/chrome/text.tsx
|
|
1828
|
-
var
|
|
1829
|
-
function
|
|
1830
|
-
if (
|
|
1831
|
-
|
|
1832
|
-
let n =
|
|
1846
|
+
var Ft;
|
|
1847
|
+
function It(e, t) {
|
|
1848
|
+
if (Ft === void 0 && (Ft = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Ft) {
|
|
1849
|
+
Ft.font = `${t}px sans-serif`;
|
|
1850
|
+
let n = Ft.measureText(e).width;
|
|
1833
1851
|
if (n > 0) return n;
|
|
1834
1852
|
}
|
|
1835
1853
|
return e.length * t * .55;
|
|
1836
1854
|
}
|
|
1837
|
-
function
|
|
1855
|
+
function Lt(e, t, n) {
|
|
1838
1856
|
if (!t || t <= 0) return [e];
|
|
1839
1857
|
let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
|
|
1840
1858
|
for (let e of r) {
|
|
1841
1859
|
let r = a ? `${a} ${e}` : e;
|
|
1842
|
-
a &&
|
|
1860
|
+
a && It(r, n) > t ? (i.push(a), a = e) : a = r;
|
|
1843
1861
|
}
|
|
1844
1862
|
return a && i.push(a), i.length ? i : [e];
|
|
1845
1863
|
}
|
|
1846
|
-
function
|
|
1847
|
-
let l = r ?
|
|
1864
|
+
function Rt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
|
|
1865
|
+
let l = r ? Lt(n, r, i) : [n];
|
|
1848
1866
|
return /* @__PURE__ */ p("text", {
|
|
1849
1867
|
x: e,
|
|
1850
1868
|
y: t,
|
|
@@ -1861,7 +1879,7 @@ function Lt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
|
|
|
1861
1879
|
}
|
|
1862
1880
|
//#endregion
|
|
1863
1881
|
//#region src/chrome/brush.tsx
|
|
1864
|
-
function
|
|
1882
|
+
function zt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1865
1883
|
o();
|
|
1866
1884
|
let i = Math.max(1, e - 1), a = (e) => e / i * 100, [s, c] = n.value, l = t - 8, u = (t, r) => {
|
|
1867
1885
|
let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
|
|
@@ -1932,7 +1950,7 @@ function Rt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
1932
1950
|
}
|
|
1933
1951
|
//#endregion
|
|
1934
1952
|
//#region src/chrome/data-zoom.tsx
|
|
1935
|
-
function
|
|
1953
|
+
function Bt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1936
1954
|
o();
|
|
1937
1955
|
let a = Math.max(1, e - 1), s = (e) => e / a * 100, [c, l] = n.value, u = t - 8, d = i(0), f = (e, t) => {
|
|
1938
1956
|
let n = t.getBoundingClientRect();
|
|
@@ -2027,27 +2045,27 @@ function zt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
2027
2045
|
}
|
|
2028
2046
|
//#endregion
|
|
2029
2047
|
//#region src/chrome/visual-map.tsx
|
|
2030
|
-
var
|
|
2031
|
-
function Gt(e, t) {
|
|
2032
|
-
let n = t.pieces ?? Bt;
|
|
2033
|
-
return Math.min(n - 1, Math.max(0, Math.floor(Wt(e, t) * n)));
|
|
2034
|
-
}
|
|
2048
|
+
var Vt = 5, Ht = [3, 14], Ut = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Wt = (e, t, n) => e + (t - e) * n, Gt = (e, t) => Ut((e - t.min) / (t.max - t.min || 1));
|
|
2035
2049
|
function Kt(e, t) {
|
|
2036
|
-
let n = t.
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2050
|
+
let n = t.pieces ?? Vt;
|
|
2051
|
+
return Math.min(n - 1, Math.max(0, Math.floor(Gt(e, t) * n)));
|
|
2052
|
+
}
|
|
2053
|
+
function qt(e, t) {
|
|
2054
|
+
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Gt(e, t), a = {};
|
|
2055
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? ve(t.pieces ?? Vt, r)[Kt(e, t)] : _e(r)(i)), n === "size" || n === "both") {
|
|
2056
|
+
let [e, n] = t.sizeRange ?? Ht;
|
|
2057
|
+
a.size = Wt(e, n, i);
|
|
2040
2058
|
}
|
|
2041
2059
|
return a;
|
|
2042
2060
|
}
|
|
2043
|
-
function
|
|
2044
|
-
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(
|
|
2061
|
+
function Jt(e, t, n, r) {
|
|
2062
|
+
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Kt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
|
|
2045
2063
|
}
|
|
2046
|
-
function
|
|
2064
|
+
function Yt({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
|
|
2047
2065
|
o();
|
|
2048
2066
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2049
2067
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2050
|
-
let t = e.pieces ??
|
|
2068
|
+
let t = e.pieces ?? Vt, i = ve(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2051
2069
|
if (!n) return;
|
|
2052
2070
|
let t = new Set(n.value);
|
|
2053
2071
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2095,9 +2113,9 @@ function Jt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2095
2113
|
})
|
|
2096
2114
|
});
|
|
2097
2115
|
}
|
|
2098
|
-
let { min: s, max: c } = e, l = c - s || 1, u =
|
|
2116
|
+
let { min: s, max: c } = e, l = c - s || 1, u = ve(8, e.ramp ?? "sequential"), d = (e) => (e - s) / l * 100, h = t?.value[0] ?? s, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2099
2117
|
let n = t.getBoundingClientRect();
|
|
2100
|
-
return n.width === 0 ? s : s +
|
|
2118
|
+
return n.width === 0 ? s : s + Ut((e - n.left) / n.width) * l;
|
|
2101
2119
|
}, y = (e, n) => {
|
|
2102
2120
|
if (!t) return;
|
|
2103
2121
|
let r = Math.max(s, Math.min(c, n)), [i, a] = t.value;
|
|
@@ -2182,23 +2200,23 @@ function Jt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2182
2200
|
]
|
|
2183
2201
|
});
|
|
2184
2202
|
}
|
|
2185
|
-
var
|
|
2203
|
+
var Xt = {
|
|
2186
2204
|
legend: "_legend_zczeh_2",
|
|
2187
2205
|
item: "_item_zczeh_9",
|
|
2188
2206
|
swatch: "_swatch_zczeh_27"
|
|
2189
2207
|
};
|
|
2190
2208
|
//#endregion
|
|
2191
2209
|
//#region src/chrome/legend.tsx
|
|
2192
|
-
function
|
|
2210
|
+
function Zt({ series: e, hidden: t }) {
|
|
2193
2211
|
return o(), /* @__PURE__ */ p("div", {
|
|
2194
|
-
className:
|
|
2212
|
+
className: Xt.legend,
|
|
2195
2213
|
role: "group",
|
|
2196
2214
|
"aria-label": "Chart legend",
|
|
2197
2215
|
children: e.map((e, n) => {
|
|
2198
2216
|
let r = t.value.has(e.id);
|
|
2199
2217
|
return /* @__PURE__ */ m("button", {
|
|
2200
2218
|
type: "button",
|
|
2201
|
-
className:
|
|
2219
|
+
className: Xt.item,
|
|
2202
2220
|
"data-state": r ? "off" : "on",
|
|
2203
2221
|
"aria-pressed": !r,
|
|
2204
2222
|
"aria-label": d(l.charts.legendToggle, { name: e.label }),
|
|
@@ -2207,7 +2225,7 @@ function Xt({ series: e, hidden: t }) {
|
|
|
2207
2225
|
r ? n.delete(e.id) : n.add(e.id), t.value = n;
|
|
2208
2226
|
},
|
|
2209
2227
|
children: [/* @__PURE__ */ p("span", {
|
|
2210
|
-
className:
|
|
2228
|
+
className: Xt.swatch,
|
|
2211
2229
|
style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
|
|
2212
2230
|
"aria-hidden": "true"
|
|
2213
2231
|
}), e.label]
|
|
@@ -2217,56 +2235,68 @@ function Xt({ series: e, hidden: t }) {
|
|
|
2217
2235
|
}
|
|
2218
2236
|
//#endregion
|
|
2219
2237
|
//#region src/core/dev-warn.ts
|
|
2220
|
-
function
|
|
2238
|
+
function Qt() {
|
|
2221
2239
|
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
2222
2240
|
}
|
|
2223
|
-
var
|
|
2224
|
-
function
|
|
2225
|
-
if (
|
|
2241
|
+
var $t = /* @__PURE__ */ new Set();
|
|
2242
|
+
function en(e, t) {
|
|
2243
|
+
if (Qt() || $t.has(e)) return;
|
|
2226
2244
|
let n = 0;
|
|
2227
2245
|
for (let e of t()) Number.isFinite(e) || n++;
|
|
2228
|
-
n !== 0 && (
|
|
2246
|
+
n !== 0 && ($t.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
|
|
2247
|
+
}
|
|
2248
|
+
function tn(e, t) {
|
|
2249
|
+
Qt() || $t.has(e) || ($t.add(e), console.warn(`[cascivo charts] ${t}`));
|
|
2250
|
+
}
|
|
2251
|
+
function nn(e, t) {
|
|
2252
|
+
if (Qt()) return;
|
|
2253
|
+
let n = t.filter((e) => Number.isFinite(e.max) && e.max > 0);
|
|
2254
|
+
if (n.length < 2) return;
|
|
2255
|
+
let r = [...n].sort((e, t) => t.max - e.max), i = r[0], a = r[r.length - 1];
|
|
2256
|
+
i.max / a.max < 20 || tn(`${e}:scale-mismatch`, `${e}: "${a.label}" (max ${a.max.toLocaleString()}) is more than 20× smaller than "${i.label}" (max ${i.max.toLocaleString()}) on the same axis, so it renders as a flat line at the baseline while the legend still names both. Put the smaller series on its own scale with \`axis: 'right'\` + \`secondAxis\`, or split it into a second chart.`);
|
|
2229
2257
|
}
|
|
2230
2258
|
//#endregion
|
|
2231
2259
|
//#region src/charts/line-chart/line-chart.tsx
|
|
2232
|
-
var
|
|
2233
|
-
function
|
|
2260
|
+
var rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2261
|
+
function an(e) {
|
|
2234
2262
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2235
2263
|
}
|
|
2236
|
-
function
|
|
2264
|
+
function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: d, xTicks: g = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: w, annotations: D, labels: O, connectNulls: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: N, secondAxis: P, decimate: F, toolbox: ne, transition: re, onBeforeDraw: I, onAfterDraw: ie }) {
|
|
2237
2265
|
o();
|
|
2238
|
-
let
|
|
2266
|
+
let L = i(/* @__PURE__ */ new Set()), ae = w ? null : Et(O), R = F === !0 ? {
|
|
2239
2267
|
method: "lttb",
|
|
2240
2268
|
threshold: 1e3
|
|
2241
|
-
} :
|
|
2242
|
-
method:
|
|
2243
|
-
threshold:
|
|
2244
|
-
} : null,
|
|
2245
|
-
|
|
2246
|
-
|
|
2269
|
+
} : F ? {
|
|
2270
|
+
method: F.method ?? "lttb",
|
|
2271
|
+
threshold: F.threshold ?? 1e3
|
|
2272
|
+
} : null, z = e.reduce((e, t) => Math.max(e, t.data.length), 0), B = (A || j || te || M !== void 0) && z > 0, V = i([0, Math.max(0, z - 1)]), H = c(null);
|
|
2273
|
+
M && !H.current && (H.current = ft(M)), a(() => () => {
|
|
2274
|
+
M && pt(M);
|
|
2247
2275
|
}), a(() => {
|
|
2248
|
-
let e =
|
|
2276
|
+
let e = H.current;
|
|
2249
2277
|
if (!e) return;
|
|
2250
|
-
let t = e.window.value, n =
|
|
2251
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2278
|
+
let t = e.window.value, n = V.peek();
|
|
2279
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (V.value = t);
|
|
2252
2280
|
}), a(() => {
|
|
2253
|
-
let e =
|
|
2281
|
+
let e = H.current;
|
|
2254
2282
|
if (!e) return;
|
|
2255
|
-
let t =
|
|
2283
|
+
let t = V.value, n = e.window.peek();
|
|
2256
2284
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2257
2285
|
});
|
|
2258
|
-
let
|
|
2286
|
+
let U = B ? e.map((e) => ({
|
|
2259
2287
|
...e,
|
|
2260
|
-
data: e.data.slice(
|
|
2261
|
-
})) : e,
|
|
2262
|
-
|
|
2263
|
-
let
|
|
2264
|
-
...
|
|
2265
|
-
left: Ge(
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2288
|
+
data: e.data.slice(V.value[0], V.value[1] + 1)
|
|
2289
|
+
})) : e, W = !w && U.some((e) => e.axis === "right"), G = d ?? (w ? 48 : 300), K = w ? !1 : y ?? U.length > 1, q = (e) => e.y ?? n, J = U.flatMap((e) => e.data.map((e) => t(e))), Y = (e) => e.flatMap((e) => e.data.map((t) => q(e)(t))).filter((e) => Number.isFinite(e)), oe = Y(W ? U.filter((e) => e.axis !== "right") : U), X = W ? Y(U.filter((e) => e.axis === "right")) : [];
|
|
2290
|
+
en("LineChart", () => U.flatMap((e) => e.data.map((t) => q(e)(t))));
|
|
2291
|
+
let se = J.length > 0, ce = h(an(oe), [0, 1]).ticks(_).map((e) => e.toLocaleString()), le = se && J[0] instanceof Date, ue = W ? h(an(X), [0, 1]).ticks(_).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], de = J.filter((e) => typeof e == "number"), fe = J.filter((e) => e instanceof Date), pe = se ? le ? C([new Date(Math.min(...fe.map((e) => e.getTime()))), new Date(Math.max(...fe.map((e) => e.getTime())))], [0, 1]).ticks(g).map((e) => e.toLocaleDateString()) : h([Math.min(...de), Math.max(...de)], [0, 1]).ticks(g).map((e) => e.toLocaleString()) : [], Z = w ? Ue : {
|
|
2292
|
+
...He,
|
|
2293
|
+
left: Ge(ce, w),
|
|
2294
|
+
right: Ke({
|
|
2295
|
+
rightAxisLabels: ue,
|
|
2296
|
+
bottomAxisLabels: pe,
|
|
2297
|
+
plain: w
|
|
2298
|
+
})
|
|
2299
|
+
};
|
|
2270
2300
|
return /* @__PURE__ */ m("div", {
|
|
2271
2301
|
style: {
|
|
2272
2302
|
display: "flex",
|
|
@@ -2278,38 +2308,38 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2278
2308
|
title: r,
|
|
2279
2309
|
description: s,
|
|
2280
2310
|
width: u,
|
|
2281
|
-
height:
|
|
2311
|
+
height: G,
|
|
2282
2312
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2283
2313
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2284
|
-
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }),
|
|
2285
|
-
/* @__PURE__ */ p("tbody", { children: (
|
|
2314
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), U.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2315
|
+
/* @__PURE__ */ p("tbody", { children: (U[0]?.data ?? []).map((e, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(U[0] ? t(U[0].data[n]) : "") }), U.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : q(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2286
2316
|
] }),
|
|
2287
|
-
className:
|
|
2288
|
-
"data-state":
|
|
2289
|
-
plain:
|
|
2290
|
-
tooltip:
|
|
2291
|
-
if (
|
|
2292
|
-
let r = e -
|
|
2293
|
-
if (
|
|
2294
|
-
let e =
|
|
2317
|
+
className: S,
|
|
2318
|
+
"data-state": se ? void 0 : "empty",
|
|
2319
|
+
plain: w,
|
|
2320
|
+
tooltip: b !== !1 && se ? ({ width: e, height: n }) => {
|
|
2321
|
+
if (b === !1 || !se) return;
|
|
2322
|
+
let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(oe), [i, 0]), l = W ? h(an(X), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2323
|
+
if (N === "axis") {
|
|
2324
|
+
let e = U.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2295
2325
|
for (let r = 0; r < e; r++) {
|
|
2296
2326
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
2297
|
-
|
|
2298
|
-
if (
|
|
2327
|
+
U.forEach((n, c) => {
|
|
2328
|
+
if (L.value.has(n.id)) return;
|
|
2299
2329
|
let l = n.data[r];
|
|
2300
2330
|
if (l === void 0) return;
|
|
2301
|
-
let f =
|
|
2331
|
+
let f = q(n)(l);
|
|
2302
2332
|
if (!Number.isFinite(f)) return;
|
|
2303
2333
|
let p = t(l);
|
|
2304
2334
|
i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
|
|
2305
2335
|
label: n.label,
|
|
2306
2336
|
value: f,
|
|
2307
|
-
color: n.color ??
|
|
2337
|
+
color: n.color ?? rn[c % rn.length]
|
|
2308
2338
|
});
|
|
2309
2339
|
}), a !== 0 && n.push({
|
|
2310
2340
|
id: `x-${r}`,
|
|
2311
|
-
cx:
|
|
2312
|
-
cy:
|
|
2341
|
+
cx: Z.left + i / a,
|
|
2342
|
+
cy: Z.top + (o === Infinity ? 0 : o),
|
|
2313
2343
|
label: s,
|
|
2314
2344
|
value: s,
|
|
2315
2345
|
segments: e
|
|
@@ -2321,67 +2351,67 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2321
2351
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2322
2352
|
};
|
|
2323
2353
|
}
|
|
2324
|
-
let f =
|
|
2325
|
-
let i =
|
|
2354
|
+
let f = U.flatMap((e) => L.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2355
|
+
let i = q(e)(n);
|
|
2326
2356
|
if (!Number.isFinite(i)) return [];
|
|
2327
2357
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2328
2358
|
return {
|
|
2329
2359
|
id: `${e.id}-${r}`,
|
|
2330
|
-
cx:
|
|
2331
|
-
cy:
|
|
2360
|
+
cx: Z.left + o,
|
|
2361
|
+
cy: Z.top + c,
|
|
2332
2362
|
label: l,
|
|
2333
|
-
value:
|
|
2363
|
+
value: q(e)(n),
|
|
2334
2364
|
seriesId: e.id
|
|
2335
2365
|
};
|
|
2336
2366
|
}));
|
|
2337
|
-
return
|
|
2367
|
+
return x ? {
|
|
2338
2368
|
points: f,
|
|
2339
2369
|
format: (e) => {
|
|
2340
|
-
let t =
|
|
2341
|
-
return t && t.data[n] !== void 0 ?
|
|
2370
|
+
let t = U.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2371
|
+
return t && t.data[n] !== void 0 ? x(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2342
2372
|
}
|
|
2343
2373
|
} : { points: f };
|
|
2344
2374
|
} : void 0,
|
|
2345
2375
|
onSelect: k,
|
|
2346
|
-
zoom:
|
|
2347
|
-
window:
|
|
2348
|
-
count:
|
|
2376
|
+
zoom: te && z > 1 ? {
|
|
2377
|
+
window: V,
|
|
2378
|
+
count: z
|
|
2349
2379
|
} : void 0,
|
|
2350
|
-
toolbox:
|
|
2351
|
-
onRestore:
|
|
2352
|
-
|
|
2380
|
+
toolbox: ne,
|
|
2381
|
+
onRestore: B ? () => {
|
|
2382
|
+
V.value = [0, Math.max(0, z - 1)];
|
|
2353
2383
|
} : void 0,
|
|
2354
|
-
transition:
|
|
2355
|
-
onBeforeDraw:
|
|
2356
|
-
onAfterDraw:
|
|
2384
|
+
transition: re,
|
|
2385
|
+
onBeforeDraw: I,
|
|
2386
|
+
onAfterDraw: ie,
|
|
2357
2387
|
children: ({ width: e, height: n }) => {
|
|
2358
|
-
let r = e -
|
|
2388
|
+
let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(oe), [i, 0]), u = W ? h(an(X), [i, 0]) : c;
|
|
2359
2389
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
2360
|
-
transform: `translate(${
|
|
2390
|
+
transform: `translate(${Z.left},${Z.top})`,
|
|
2361
2391
|
children: [
|
|
2362
|
-
!
|
|
2392
|
+
!w && /* @__PURE__ */ p(vt, {
|
|
2363
2393
|
scale: c,
|
|
2364
2394
|
orientation: "y",
|
|
2365
2395
|
length: r,
|
|
2366
2396
|
tickCount: _
|
|
2367
2397
|
}),
|
|
2368
|
-
!
|
|
2398
|
+
!w && Ct(D, {
|
|
2369
2399
|
xScale: s,
|
|
2370
2400
|
yScale: c,
|
|
2371
2401
|
innerW: r,
|
|
2372
2402
|
innerH: i
|
|
2373
2403
|
}),
|
|
2374
|
-
|
|
2375
|
-
if (
|
|
2376
|
-
let r = e.color ??
|
|
2377
|
-
if (
|
|
2404
|
+
U.map((e, n) => {
|
|
2405
|
+
if (L.value.has(e.id)) return null;
|
|
2406
|
+
let r = e.color ?? rn[n % rn.length], i = e.axis === "right" ? u : c, a = (e) => s.map(e);
|
|
2407
|
+
if (R && e.data.length > R.threshold) {
|
|
2378
2408
|
let n = [];
|
|
2379
2409
|
for (let r of e.data) {
|
|
2380
|
-
let o =
|
|
2410
|
+
let o = q(e)(r);
|
|
2381
2411
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2382
2412
|
}
|
|
2383
2413
|
return /* @__PURE__ */ p("path", {
|
|
2384
|
-
d: E(
|
|
2414
|
+
d: E(Le(n, R.threshold, R.method).map((e) => [e[0], e[1]]), l),
|
|
2385
2415
|
fill: "none",
|
|
2386
2416
|
stroke: r,
|
|
2387
2417
|
strokeWidth: 2,
|
|
@@ -2391,10 +2421,10 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2391
2421
|
}, e.id);
|
|
2392
2422
|
}
|
|
2393
2423
|
let o = e.data.map((n) => {
|
|
2394
|
-
let r =
|
|
2424
|
+
let r = q(e)(n);
|
|
2395
2425
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2396
2426
|
});
|
|
2397
|
-
return /* @__PURE__ */ m("g", { children: [T(o,
|
|
2427
|
+
return /* @__PURE__ */ m("g", { children: [T(o, ee).map((t, n) => /* @__PURE__ */ p("path", {
|
|
2398
2428
|
d: E(t, l),
|
|
2399
2429
|
fill: "none",
|
|
2400
2430
|
stroke: r,
|
|
@@ -2402,22 +2432,23 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2402
2432
|
strokeLinecap: "round",
|
|
2403
2433
|
strokeLinejoin: "round",
|
|
2404
2434
|
"data-series": e.id
|
|
2405
|
-
}, n)),
|
|
2435
|
+
}, n)), ae && e.data.map((t, n) => {
|
|
2406
2436
|
let r = o[n];
|
|
2407
|
-
return r ? /* @__PURE__ */ p(
|
|
2437
|
+
return r ? /* @__PURE__ */ p(Dt, {
|
|
2408
2438
|
x: r[0],
|
|
2409
2439
|
y: r[1] - 8,
|
|
2410
|
-
text:
|
|
2440
|
+
text: ae.format(q(e)(t))
|
|
2411
2441
|
}, n) : null;
|
|
2412
2442
|
})] }, e.id);
|
|
2413
2443
|
}),
|
|
2414
|
-
!
|
|
2444
|
+
!w && /* @__PURE__ */ m(f, { children: [
|
|
2415
2445
|
/* @__PURE__ */ p($, {
|
|
2416
2446
|
scale: s,
|
|
2417
2447
|
orientation: "x",
|
|
2418
2448
|
length: r,
|
|
2419
2449
|
tickCount: g,
|
|
2420
|
-
transform: `translate(0,${i})
|
|
2450
|
+
transform: `translate(0,${i})`,
|
|
2451
|
+
...v ? { format: v } : {}
|
|
2421
2452
|
}),
|
|
2422
2453
|
/* @__PURE__ */ p($, {
|
|
2423
2454
|
scale: c,
|
|
@@ -2425,80 +2456,89 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2425
2456
|
length: i,
|
|
2426
2457
|
tickCount: _
|
|
2427
2458
|
}),
|
|
2428
|
-
|
|
2459
|
+
W && /* @__PURE__ */ p($, {
|
|
2429
2460
|
scale: u,
|
|
2430
|
-
orientation: "y",
|
|
2461
|
+
orientation: "y-right",
|
|
2431
2462
|
length: i,
|
|
2432
2463
|
tickCount: _,
|
|
2433
2464
|
transform: `translate(${r},0)`,
|
|
2434
|
-
...
|
|
2465
|
+
...P?.format ? { format: (e) => P.format(Number(e)) } : {}
|
|
2435
2466
|
})
|
|
2436
2467
|
] })
|
|
2437
2468
|
]
|
|
2438
2469
|
}) });
|
|
2439
2470
|
}
|
|
2440
2471
|
}),
|
|
2441
|
-
A && !j &&
|
|
2442
|
-
count:
|
|
2443
|
-
window:
|
|
2472
|
+
A && !j && z > 1 && /* @__PURE__ */ p(zt, {
|
|
2473
|
+
count: z,
|
|
2474
|
+
window: V,
|
|
2444
2475
|
label: "Time range"
|
|
2445
2476
|
}),
|
|
2446
|
-
j &&
|
|
2447
|
-
count:
|
|
2448
|
-
window:
|
|
2477
|
+
j && z > 1 && /* @__PURE__ */ p(Bt, {
|
|
2478
|
+
count: z,
|
|
2479
|
+
window: V,
|
|
2449
2480
|
label: "Time range"
|
|
2450
2481
|
}),
|
|
2451
|
-
|
|
2452
|
-
series:
|
|
2482
|
+
K && /* @__PURE__ */ p(Zt, {
|
|
2483
|
+
series: U.map((e, t) => ({
|
|
2453
2484
|
id: e.id,
|
|
2454
2485
|
label: e.label,
|
|
2455
|
-
color: e.color ??
|
|
2486
|
+
color: e.color ?? rn[t % rn.length]
|
|
2456
2487
|
})),
|
|
2457
|
-
hidden:
|
|
2488
|
+
hidden: L
|
|
2458
2489
|
})
|
|
2459
2490
|
]
|
|
2460
2491
|
});
|
|
2461
2492
|
}
|
|
2462
2493
|
//#endregion
|
|
2463
2494
|
//#region src/charts/area-chart/area-chart.tsx
|
|
2464
|
-
var
|
|
2465
|
-
function
|
|
2495
|
+
var sn = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" };
|
|
2496
|
+
function cn(e, t) {
|
|
2497
|
+
return t || e <= 1 ? sn : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
|
|
2498
|
+
}
|
|
2499
|
+
var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2500
|
+
function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: d = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: w, className: T, plain: D, annotations: O, labels: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: N, tooltipMode: F, secondAxis: ne, decimate: re, toolbox: I, format: ie }) {
|
|
2466
2501
|
o();
|
|
2467
|
-
let
|
|
2502
|
+
let L = s(), ae = i(/* @__PURE__ */ new Set()), R = D ? null : Et(ee), z = re === !0 ? {
|
|
2468
2503
|
method: "lttb",
|
|
2469
2504
|
threshold: 1e3
|
|
2470
|
-
} :
|
|
2471
|
-
method:
|
|
2472
|
-
threshold:
|
|
2473
|
-
} : null,
|
|
2474
|
-
|
|
2475
|
-
|
|
2505
|
+
} : re ? {
|
|
2506
|
+
method: re.method ?? "lttb",
|
|
2507
|
+
threshold: re.threshold ?? 1e3
|
|
2508
|
+
} : null, B = e.reduce((e, t) => Math.max(e, t.data.length), 0), V = (A || j || te || N !== void 0) && B > 0, H = i([0, Math.max(0, B - 1)]), U = c(null);
|
|
2509
|
+
N && !U.current && (U.current = ft(N)), a(() => () => {
|
|
2510
|
+
N && pt(N);
|
|
2476
2511
|
}), a(() => {
|
|
2477
|
-
let e =
|
|
2512
|
+
let e = U.current;
|
|
2478
2513
|
if (!e) return;
|
|
2479
|
-
let t = e.window.value, n =
|
|
2480
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2514
|
+
let t = e.window.value, n = H.peek();
|
|
2515
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (H.value = t);
|
|
2481
2516
|
}), a(() => {
|
|
2482
|
-
let e =
|
|
2517
|
+
let e = U.current;
|
|
2483
2518
|
if (!e) return;
|
|
2484
|
-
let t =
|
|
2519
|
+
let t = H.value, n = e.window.peek();
|
|
2485
2520
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2486
2521
|
});
|
|
2487
|
-
let
|
|
2522
|
+
let W = V ? e.map((e) => ({
|
|
2488
2523
|
...e,
|
|
2489
|
-
data: e.data.slice(
|
|
2490
|
-
})) : e,
|
|
2491
|
-
|
|
2492
|
-
|
|
2524
|
+
data: e.data.slice(H.value[0], H.value[1] + 1)
|
|
2525
|
+
})) : e, G = !D && !u && W.some((e) => e.axis === "right"), K = y ?? (D ? 48 : 300), q = D ? !1 : S ?? W.length > 1, J = cn(W.length, u), Y = (e) => e.y ?? n, oe = (W[0]?.data ?? []).map((e) => t(e)), X = (G ? W.filter((e) => e.axis !== "right") : W).flatMap((e) => e.data.map((t) => Y(e)(t))), se = G ? W.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Y(e)(t))) : [];
|
|
2526
|
+
!G && !u && W.length > 1 && nn("AreaChart", W.map((e) => ({
|
|
2527
|
+
label: e.label,
|
|
2528
|
+
max: Math.max(0, ...e.data.map((t) => Y(e)(t)).filter((e) => Number.isFinite(e)))
|
|
2529
|
+
}))), en("AreaChart", () => [...X, ...se]);
|
|
2530
|
+
let ce = oe.length > 0, le = ce && oe[0] instanceof Date, ue = oe.map((e) => e instanceof Date ? e.getTime() : e), de = ce ? Math.min(...ue) : 0, fe = ce ? Math.max(...ue) : 1, pe = (e) => le ? C([new Date(de), new Date(fe)], [0, e]) : h([de, fe], [0, e]), Z = (e, n) => e.map(t(n)), me = (e) => {
|
|
2493
2531
|
let n = t(e);
|
|
2494
2532
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2495
|
-
},
|
|
2496
|
-
...
|
|
2497
|
-
left: Ge(
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2533
|
+
}, he = u ? 0 : Math.min(0, ...X), ge = Math.max(...u ? (W[0]?.data ?? []).map((e, t) => W.reduce((e, n) => e + Y(n)(n.data[t]), 0)) : X), _e = G ? Math.min(0, ...se) : he, ve = G ? Math.max(...se) : ge, ye = h([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = G ? h([_e, ve], [0, 1]).ticks(x).map((e) => ne?.format ? ne.format(e) : e.toLocaleString()) : [], xe = le ? C([new Date(de), new Date(fe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : h([de, fe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Se = D ? Ue : {
|
|
2534
|
+
...He,
|
|
2535
|
+
left: Ge(ye, D),
|
|
2536
|
+
right: Ke({
|
|
2537
|
+
rightAxisLabels: be,
|
|
2538
|
+
bottomAxisLabels: xe,
|
|
2539
|
+
plain: D
|
|
2540
|
+
})
|
|
2541
|
+
};
|
|
2502
2542
|
return /* @__PURE__ */ m("div", {
|
|
2503
2543
|
style: {
|
|
2504
2544
|
display: "flex",
|
|
@@ -2510,36 +2550,36 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2510
2550
|
title: r,
|
|
2511
2551
|
description: l,
|
|
2512
2552
|
width: v,
|
|
2513
|
-
height:
|
|
2553
|
+
height: K,
|
|
2514
2554
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2515
2555
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2516
|
-
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }),
|
|
2517
|
-
/* @__PURE__ */ p("tbody", { children: (
|
|
2556
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), W.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2557
|
+
/* @__PURE__ */ p("tbody", { children: (W[0]?.data ?? []).map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: W[0] ? me(W[0].data[t]) : "" }), W.map((e) => /* @__PURE__ */ p("td", { children: e.data[t] == null ? "" : Y(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2518
2558
|
] }),
|
|
2519
2559
|
className: T,
|
|
2520
|
-
"data-state":
|
|
2560
|
+
"data-state": ce ? void 0 : "empty",
|
|
2521
2561
|
plain: D,
|
|
2522
|
-
tooltip: w !== !1 &&
|
|
2523
|
-
if (w === !1 || !
|
|
2524
|
-
let n = e -
|
|
2525
|
-
if (
|
|
2526
|
-
let e =
|
|
2562
|
+
tooltip: w !== !1 && ce ? ({ width: e, height: t }) => {
|
|
2563
|
+
if (w === !1 || !ce) return;
|
|
2564
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = G ? h([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2565
|
+
if (F === "axis") {
|
|
2566
|
+
let e = W.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2527
2567
|
for (let n = 0; n < e; n++) {
|
|
2528
|
-
let e = [], r = Infinity, a = "", o =
|
|
2529
|
-
|
|
2530
|
-
if (
|
|
2568
|
+
let e = [], r = Infinity, a = "", o = Se.left;
|
|
2569
|
+
W.forEach((t, c) => {
|
|
2570
|
+
if (ae.value.has(t.id)) return;
|
|
2531
2571
|
let l = t.data[n];
|
|
2532
2572
|
if (l === void 0) return;
|
|
2533
|
-
let u =
|
|
2534
|
-
Number.isFinite(u) && (o =
|
|
2573
|
+
let u = Y(t)(l);
|
|
2574
|
+
Number.isFinite(u) && (o = Se.left + Z(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
|
|
2535
2575
|
label: t.label,
|
|
2536
2576
|
value: u,
|
|
2537
|
-
color: t.color ??
|
|
2577
|
+
color: t.color ?? ln[c % ln.length]
|
|
2538
2578
|
}));
|
|
2539
2579
|
}), e.length !== 0 && t.push({
|
|
2540
2580
|
id: `x-${n}`,
|
|
2541
2581
|
cx: o,
|
|
2542
|
-
cy:
|
|
2582
|
+
cy: Se.top + (r === Infinity ? 0 : r),
|
|
2543
2583
|
label: a,
|
|
2544
2584
|
value: a,
|
|
2545
2585
|
segments: e
|
|
@@ -2551,56 +2591,56 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2551
2591
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2552
2592
|
};
|
|
2553
2593
|
}
|
|
2554
|
-
return { points:
|
|
2594
|
+
return { points: W.flatMap((e) => ae.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2555
2595
|
id: `${e.id}-${n}`,
|
|
2556
|
-
cx:
|
|
2557
|
-
cy:
|
|
2558
|
-
label:
|
|
2559
|
-
value:
|
|
2596
|
+
cx: Se.left + Z(i, t),
|
|
2597
|
+
cy: Se.top + s(e).map(Y(e)(t)),
|
|
2598
|
+
label: me(t),
|
|
2599
|
+
value: Y(e)(t),
|
|
2560
2600
|
seriesId: e.id
|
|
2561
2601
|
}))) };
|
|
2562
2602
|
} : void 0,
|
|
2563
|
-
onSelect:
|
|
2564
|
-
zoom:
|
|
2565
|
-
window:
|
|
2566
|
-
count:
|
|
2603
|
+
onSelect: k,
|
|
2604
|
+
zoom: te && B > 1 ? {
|
|
2605
|
+
window: H,
|
|
2606
|
+
count: B
|
|
2567
2607
|
} : void 0,
|
|
2568
|
-
toolbox:
|
|
2569
|
-
onRestore:
|
|
2570
|
-
|
|
2608
|
+
toolbox: I,
|
|
2609
|
+
onRestore: V ? () => {
|
|
2610
|
+
H.value = [0, Math.max(0, B - 1)];
|
|
2571
2611
|
} : void 0,
|
|
2572
2612
|
children: ({ width: e, height: t }) => {
|
|
2573
|
-
let n = e -
|
|
2574
|
-
return u && (s =
|
|
2575
|
-
prefix:
|
|
2613
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = G ? h([_e, ve], [r, 0]) : a, s = [];
|
|
2614
|
+
return u && (s = P(W.map((e) => e.data.map((t) => Y(e)(t))))), /* @__PURE__ */ m("g", { children: [g !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2615
|
+
prefix: L,
|
|
2576
2616
|
fill: g,
|
|
2577
2617
|
patternKind: _,
|
|
2578
|
-
series:
|
|
2618
|
+
series: W.map((e, t) => ({
|
|
2579
2619
|
id: e.id,
|
|
2580
|
-
color: e.color ??
|
|
2620
|
+
color: e.color ?? ln[t % ln.length]
|
|
2581
2621
|
}))
|
|
2582
2622
|
}), /* @__PURE__ */ m("g", {
|
|
2583
|
-
transform: `translate(${
|
|
2623
|
+
transform: `translate(${Se.left},${Se.top})`,
|
|
2584
2624
|
children: [
|
|
2585
|
-
!D && /* @__PURE__ */ p(
|
|
2625
|
+
!D && /* @__PURE__ */ p(vt, {
|
|
2586
2626
|
scale: a,
|
|
2587
2627
|
orientation: "y",
|
|
2588
2628
|
length: n,
|
|
2589
2629
|
tickCount: x
|
|
2590
2630
|
}),
|
|
2591
|
-
!D &&
|
|
2631
|
+
!D && Ct(O, {
|
|
2592
2632
|
xScale: i,
|
|
2593
2633
|
yScale: a,
|
|
2594
2634
|
innerW: n,
|
|
2595
2635
|
innerH: r
|
|
2596
2636
|
}),
|
|
2597
|
-
|
|
2598
|
-
if (
|
|
2599
|
-
let n = e.color ??
|
|
2637
|
+
W.map((e, t) => {
|
|
2638
|
+
if (ae.value.has(e.id)) return null;
|
|
2639
|
+
let n = e.color ?? ln[t % ln.length], r, c;
|
|
2600
2640
|
if (u && s[t]) {
|
|
2601
2641
|
let o = s[t];
|
|
2602
|
-
r = e.data.map((e, t) => [
|
|
2603
|
-
let l = e.data.map((e, t) => [
|
|
2642
|
+
r = e.data.map((e, t) => [Z(i, e), a.map(o[t][1])]);
|
|
2643
|
+
let l = e.data.map((e, t) => [Z(i, e), a.map(o[t][0])]);
|
|
2604
2644
|
c = a.map(0);
|
|
2605
2645
|
let u = E(r, d), f = l[l.length - 1], h = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${f[0]},${f[1]}${_}L${h[0]},${h[1]}Z`;
|
|
2606
2646
|
return /* @__PURE__ */ m("g", {
|
|
@@ -2608,8 +2648,8 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2608
2648
|
children: [
|
|
2609
2649
|
/* @__PURE__ */ p("path", {
|
|
2610
2650
|
d: v,
|
|
2611
|
-
fill:
|
|
2612
|
-
style: g === "solid" ?
|
|
2651
|
+
fill: jt(L, e.id, g, n),
|
|
2652
|
+
style: g === "solid" ? J : void 0,
|
|
2613
2653
|
stroke: "none"
|
|
2614
2654
|
}),
|
|
2615
2655
|
/* @__PURE__ */ p("path", {
|
|
@@ -2618,23 +2658,23 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2618
2658
|
stroke: n,
|
|
2619
2659
|
strokeWidth: 2
|
|
2620
2660
|
}),
|
|
2621
|
-
|
|
2661
|
+
R && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2622
2662
|
x: t[0],
|
|
2623
2663
|
y: t[1] - 8,
|
|
2624
|
-
text:
|
|
2664
|
+
text: R.format(Y(e)(e.data[n]))
|
|
2625
2665
|
}, n))
|
|
2626
2666
|
]
|
|
2627
2667
|
}, e.id);
|
|
2628
2668
|
} else {
|
|
2629
2669
|
let t = e.axis === "right" ? o : a;
|
|
2630
|
-
if (r = e.data.map((n) => [
|
|
2631
|
-
let t =
|
|
2670
|
+
if (r = e.data.map((n) => [Z(i, n), t.map(Y(e)(n))]), c = t.map(0), z && r.length > z.threshold) {
|
|
2671
|
+
let t = Le(r, z.threshold, z.method).map((e) => [e[0], e[1]]);
|
|
2632
2672
|
return /* @__PURE__ */ m("g", {
|
|
2633
2673
|
"data-series": e.id,
|
|
2634
2674
|
children: [/* @__PURE__ */ p("path", {
|
|
2635
|
-
d:
|
|
2636
|
-
fill:
|
|
2637
|
-
style: g === "solid" ?
|
|
2675
|
+
d: M(t, c, d),
|
|
2676
|
+
fill: jt(L, e.id, g, n),
|
|
2677
|
+
style: g === "solid" ? J : void 0,
|
|
2638
2678
|
stroke: "none"
|
|
2639
2679
|
}), /* @__PURE__ */ p("path", {
|
|
2640
2680
|
d: E(t, d),
|
|
@@ -2648,9 +2688,9 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2648
2688
|
"data-series": e.id,
|
|
2649
2689
|
children: [
|
|
2650
2690
|
/* @__PURE__ */ p("path", {
|
|
2651
|
-
d:
|
|
2652
|
-
fill:
|
|
2653
|
-
style: g === "solid" ?
|
|
2691
|
+
d: M(r, c, d),
|
|
2692
|
+
fill: jt(L, e.id, g, n),
|
|
2693
|
+
style: g === "solid" ? J : void 0,
|
|
2654
2694
|
stroke: "none"
|
|
2655
2695
|
}),
|
|
2656
2696
|
/* @__PURE__ */ p("path", {
|
|
@@ -2659,10 +2699,10 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2659
2699
|
stroke: n,
|
|
2660
2700
|
strokeWidth: 2
|
|
2661
2701
|
}),
|
|
2662
|
-
|
|
2702
|
+
R && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2663
2703
|
x: t[0],
|
|
2664
2704
|
y: t[1] - 8,
|
|
2665
|
-
text:
|
|
2705
|
+
text: R.format(Y(e)(e.data[n]))
|
|
2666
2706
|
}, n))
|
|
2667
2707
|
]
|
|
2668
2708
|
}, e.id);
|
|
@@ -2674,7 +2714,8 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2674
2714
|
orientation: "x",
|
|
2675
2715
|
length: n,
|
|
2676
2716
|
tickCount: b,
|
|
2677
|
-
transform: `translate(0,${r})
|
|
2717
|
+
transform: `translate(0,${r})`,
|
|
2718
|
+
...ie ? { format: ie } : {}
|
|
2678
2719
|
}),
|
|
2679
2720
|
/* @__PURE__ */ p($, {
|
|
2680
2721
|
scale: a,
|
|
@@ -2682,58 +2723,65 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2682
2723
|
length: r,
|
|
2683
2724
|
tickCount: x
|
|
2684
2725
|
}),
|
|
2685
|
-
|
|
2726
|
+
G && /* @__PURE__ */ p($, {
|
|
2686
2727
|
scale: o,
|
|
2687
|
-
orientation: "y",
|
|
2728
|
+
orientation: "y-right",
|
|
2688
2729
|
length: r,
|
|
2689
2730
|
tickCount: x,
|
|
2690
2731
|
transform: `translate(${n},0)`,
|
|
2691
|
-
...
|
|
2732
|
+
...ne?.format ? { format: (e) => ne.format(Number(e)) } : {}
|
|
2692
2733
|
})
|
|
2693
2734
|
] })
|
|
2694
2735
|
]
|
|
2695
2736
|
})] });
|
|
2696
2737
|
}
|
|
2697
2738
|
}),
|
|
2698
|
-
|
|
2699
|
-
count:
|
|
2700
|
-
window:
|
|
2739
|
+
A && !j && B > 1 && /* @__PURE__ */ p(zt, {
|
|
2740
|
+
count: B,
|
|
2741
|
+
window: H,
|
|
2701
2742
|
label: "Range"
|
|
2702
2743
|
}),
|
|
2703
|
-
|
|
2704
|
-
count:
|
|
2705
|
-
window:
|
|
2744
|
+
j && B > 1 && /* @__PURE__ */ p(Bt, {
|
|
2745
|
+
count: B,
|
|
2746
|
+
window: H,
|
|
2706
2747
|
label: "Range"
|
|
2707
2748
|
}),
|
|
2708
|
-
|
|
2709
|
-
series:
|
|
2749
|
+
q && /* @__PURE__ */ p(Zt, {
|
|
2750
|
+
series: W.map((e, t) => ({
|
|
2710
2751
|
id: e.id,
|
|
2711
2752
|
label: e.label,
|
|
2712
|
-
color: e.color ??
|
|
2753
|
+
color: e.color ?? ln[t % ln.length]
|
|
2713
2754
|
})),
|
|
2714
|
-
hidden:
|
|
2755
|
+
hidden: ae
|
|
2715
2756
|
})
|
|
2716
2757
|
]
|
|
2717
2758
|
});
|
|
2718
2759
|
}
|
|
2719
2760
|
//#endregion
|
|
2720
2761
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2721
|
-
|
|
2722
|
-
function
|
|
2762
|
+
function dn(e, t, n, r) {
|
|
2763
|
+
return typeof e == "function" ? t === void 0 ? r : e(t, n) : e ?? r;
|
|
2764
|
+
}
|
|
2765
|
+
var fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2766
|
+
function pn(e) {
|
|
2723
2767
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2724
2768
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2725
2769
|
}
|
|
2726
|
-
function
|
|
2770
|
+
function mn({ series: e, x: t, y: n, title: r, description: a, orientation: c = "vertical", mode: l = "grouped", width: u, height: d, xTicks: g = 5, yTicks: v = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: ee, onSelect: k, fill: A = "solid", patternKind: j, format: te }) {
|
|
2727
2771
|
o();
|
|
2728
|
-
let
|
|
2729
|
-
let t =
|
|
2772
|
+
let M = s(), N = D ? null : Et(ee), F = i(/* @__PURE__ */ new Set()), ne = d ?? (D ? 48 : 300), re = D ? !1 : C ?? e.length > 1, I = (e) => e.y ?? n, ie = (e[0]?.data ?? []).map((e) => t(e)), L = e.flatMap((e) => e.data.map((t) => I(e)(t))), ae = ie.length > 0, R = l === "stacked" || l === "percent", z = ie.map((t, n) => e.reduce((e, t) => e + I(t)(t.data[n]), 0)), B = () => {
|
|
2773
|
+
let t = P(e.map((e) => e.data.map((t) => I(e)(t))));
|
|
2730
2774
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2731
|
-
let r =
|
|
2775
|
+
let r = z[n] || 1;
|
|
2732
2776
|
return [e / r, t / r];
|
|
2733
2777
|
})) : t;
|
|
2734
|
-
},
|
|
2735
|
-
...
|
|
2736
|
-
left: Ge(
|
|
2778
|
+
}, V = R ? 0 : Math.min(0, ...L), H = ae ? Math.max(...z) : 1, U = l === "percent" ? 1 : l === "stacked" ? H : Math.max(1, ...L), W = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, G = c === "vertical", K = (G ? y : b) ?? v, q = (G ? b : y) ?? g, J = S ?? x, Y = G ? h([V, U], [0, 1]).ticks(K).map((e) => W ? W(e) : e.toLocaleString()) : ie.map((e) => String(e)), oe = G ? ie.map((e) => String(e)) : h([V, U], [0, 1]).ticks(q).map((e) => W ? W(e) : e.toLocaleString()), X = D ? Ue : {
|
|
2779
|
+
...He,
|
|
2780
|
+
left: Ge(Y, D),
|
|
2781
|
+
right: Ke({
|
|
2782
|
+
bottomAxisLabels: oe,
|
|
2783
|
+
plain: D
|
|
2784
|
+
})
|
|
2737
2785
|
};
|
|
2738
2786
|
return /* @__PURE__ */ m("div", {
|
|
2739
2787
|
style: {
|
|
@@ -2745,24 +2793,24 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2745
2793
|
title: r,
|
|
2746
2794
|
description: a,
|
|
2747
2795
|
width: u,
|
|
2748
|
-
height:
|
|
2796
|
+
height: ne,
|
|
2749
2797
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2750
2798
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2751
2799
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2752
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
2800
|
+
/* @__PURE__ */ p("tbody", { children: ie.map((t, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: t }), e.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : I(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2753
2801
|
] }),
|
|
2754
|
-
className:
|
|
2755
|
-
"data-state":
|
|
2756
|
-
plain:
|
|
2757
|
-
tooltip:
|
|
2758
|
-
if (!
|
|
2759
|
-
let i = n -
|
|
2760
|
-
|
|
2761
|
-
let p =
|
|
2802
|
+
className: E,
|
|
2803
|
+
"data-state": ae ? void 0 : "empty",
|
|
2804
|
+
plain: D,
|
|
2805
|
+
tooltip: w && ae ? ({ width: n, height: r }) => {
|
|
2806
|
+
if (!w || !ae) return;
|
|
2807
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, o = c === "vertical", s = _(ie, o ? [0, i] : [0, a], .2), u = h([V, U], o ? [a, 0] : [0, i]), d = e.filter((e) => !F.value.has(e.id)), f = [];
|
|
2808
|
+
R && (f = B());
|
|
2809
|
+
let p = R && !T, m = ie.map((t, n) => {
|
|
2762
2810
|
let r = d.map((t) => ({
|
|
2763
2811
|
label: t.label,
|
|
2764
|
-
value:
|
|
2765
|
-
color: t.color
|
|
2812
|
+
value: I(t)(t.data[n]),
|
|
2813
|
+
color: dn(t.color, t.data[n], n, fn[e.indexOf(t) % fn.length])
|
|
2766
2814
|
}));
|
|
2767
2815
|
return {
|
|
2768
2816
|
segs: r,
|
|
@@ -2772,79 +2820,79 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2772
2820
|
let r = e.indexOf(n), i = l === "grouped" ? s.bandwidth / d.length : s.bandwidth;
|
|
2773
2821
|
return n.data.map((e, a) => {
|
|
2774
2822
|
let c = s.map(t(e)) ?? 0, h, g;
|
|
2775
|
-
if (
|
|
2823
|
+
if (R && f[r]) {
|
|
2776
2824
|
let e = f[r][a];
|
|
2777
2825
|
h = e[1], g = e[0];
|
|
2778
|
-
} else h =
|
|
2826
|
+
} else h = I(n)(e), g = V;
|
|
2779
2827
|
let _ = d.indexOf(n), v = c + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
|
|
2780
2828
|
return {
|
|
2781
2829
|
id: `${n.id}-${a}`,
|
|
2782
|
-
cx:
|
|
2783
|
-
cy:
|
|
2830
|
+
cx: X.left + (o ? v : y),
|
|
2831
|
+
cy: X.top + (o ? y : v),
|
|
2784
2832
|
label: t(e),
|
|
2785
|
-
value: p ? m[a].total :
|
|
2833
|
+
value: p ? m[a].total : I(n)(e),
|
|
2786
2834
|
seriesId: n.id,
|
|
2787
2835
|
...p && { segments: m[a].segs }
|
|
2788
2836
|
};
|
|
2789
2837
|
});
|
|
2790
|
-
}), v =
|
|
2838
|
+
}), v = T ?? (p ? pn : void 0);
|
|
2791
2839
|
return v ? {
|
|
2792
2840
|
points: g,
|
|
2793
2841
|
format: v
|
|
2794
2842
|
} : { points: g };
|
|
2795
2843
|
} : void 0,
|
|
2796
|
-
onSelect:
|
|
2844
|
+
onSelect: k,
|
|
2797
2845
|
children: ({ width: n, height: r }) => {
|
|
2798
|
-
let i = n -
|
|
2799
|
-
return
|
|
2800
|
-
prefix:
|
|
2801
|
-
fill:
|
|
2802
|
-
patternKind:
|
|
2846
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, o = c === "vertical", s = J ?? qe(ie, o ? i : a), u = _(ie, o ? [0, i] : [0, a], .2), d = h([V, U], o ? [a, 0] : [0, i]), g = e.filter((e) => !F.value.has(e.id)), v = [];
|
|
2847
|
+
return R && (v = B()), /* @__PURE__ */ m("g", { children: [A !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2848
|
+
prefix: M,
|
|
2849
|
+
fill: A,
|
|
2850
|
+
patternKind: j,
|
|
2803
2851
|
series: e.map((e, t) => ({
|
|
2804
2852
|
id: e.id,
|
|
2805
|
-
color: e.color
|
|
2853
|
+
color: dn(e.color, e.data[0], 0, fn[t % fn.length])
|
|
2806
2854
|
}))
|
|
2807
2855
|
}), /* @__PURE__ */ m("g", {
|
|
2808
|
-
transform: `translate(${
|
|
2856
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2809
2857
|
children: [
|
|
2810
|
-
!
|
|
2858
|
+
!D && o && /* @__PURE__ */ p(vt, {
|
|
2811
2859
|
scale: d,
|
|
2812
2860
|
orientation: "y",
|
|
2813
2861
|
length: i,
|
|
2814
|
-
tickCount:
|
|
2862
|
+
tickCount: K
|
|
2815
2863
|
}),
|
|
2816
|
-
!
|
|
2864
|
+
!D && !o && /* @__PURE__ */ p(vt, {
|
|
2817
2865
|
scale: d,
|
|
2818
2866
|
orientation: "x",
|
|
2819
2867
|
length: a,
|
|
2820
|
-
tickCount:
|
|
2868
|
+
tickCount: q
|
|
2821
2869
|
}),
|
|
2822
|
-
!
|
|
2870
|
+
!D && Ct(O, {
|
|
2823
2871
|
xScale: o ? u : d,
|
|
2824
2872
|
yScale: o ? d : u,
|
|
2825
2873
|
innerW: i,
|
|
2826
2874
|
innerH: a
|
|
2827
2875
|
}),
|
|
2828
|
-
|
|
2829
|
-
let i =
|
|
2876
|
+
g.map((n, r) => {
|
|
2877
|
+
let i = fn[e.indexOf(n) % fn.length], a = e.indexOf(n), s = l === "grouped" ? u.bandwidth / g.length : u.bandwidth;
|
|
2830
2878
|
return n.data.map((e, c) => {
|
|
2831
2879
|
let f = u.map(t(e)) ?? 0, h, g;
|
|
2832
|
-
if (
|
|
2833
|
-
let e =
|
|
2880
|
+
if (R && v[a]) {
|
|
2881
|
+
let e = v[a][c];
|
|
2834
2882
|
h = e[1], g = e[0];
|
|
2835
|
-
} else h =
|
|
2836
|
-
let _ = f + (l === "grouped" ? r * s : 0),
|
|
2837
|
-
if (
|
|
2838
|
-
let t =
|
|
2839
|
-
if (o)
|
|
2883
|
+
} else h = I(n)(e), g = V;
|
|
2884
|
+
let _ = f + (l === "grouped" ? r * s : 0), y = Math.min(d.map(h), d.map(g)), b = Math.abs(d.map(h) - d.map(g)), x = null;
|
|
2885
|
+
if (N) {
|
|
2886
|
+
let t = N.format(I(n)(e)), r = _ + s / 2, i = R || b < 18 || y < 14;
|
|
2887
|
+
if (o) x = /* @__PURE__ */ p(Dt, {
|
|
2840
2888
|
x: r,
|
|
2841
|
-
y: i ?
|
|
2889
|
+
y: i ? y + 13 : y - 4,
|
|
2842
2890
|
text: t,
|
|
2843
2891
|
tone: i ? "muted" : "default"
|
|
2844
2892
|
});
|
|
2845
2893
|
else {
|
|
2846
|
-
let e =
|
|
2847
|
-
|
|
2894
|
+
let e = y + b;
|
|
2895
|
+
x = /* @__PURE__ */ p(Dt, {
|
|
2848
2896
|
x: i ? e - 4 : e + 4,
|
|
2849
2897
|
y: r + 4,
|
|
2850
2898
|
text: t,
|
|
@@ -2852,77 +2900,81 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2852
2900
|
tone: i ? "muted" : "default"
|
|
2853
2901
|
});
|
|
2854
2902
|
}
|
|
2855
|
-
|
|
2903
|
+
R && b < 14 && (x = null);
|
|
2856
2904
|
}
|
|
2905
|
+
let S = dn(n.color, e, c, i);
|
|
2857
2906
|
return /* @__PURE__ */ m("g", { children: [o ? /* @__PURE__ */ p("rect", {
|
|
2858
2907
|
x: _,
|
|
2859
|
-
y
|
|
2908
|
+
y,
|
|
2860
2909
|
width: s,
|
|
2861
|
-
height:
|
|
2862
|
-
fill:
|
|
2910
|
+
height: b,
|
|
2911
|
+
fill: jt(M, n.id, A, S),
|
|
2863
2912
|
rx: 2,
|
|
2864
|
-
"data-series": n.id
|
|
2913
|
+
"data-series": n.id,
|
|
2914
|
+
"data-x": String(t(e))
|
|
2865
2915
|
}) : /* @__PURE__ */ p("rect", {
|
|
2866
|
-
x:
|
|
2916
|
+
x: y,
|
|
2867
2917
|
y: _,
|
|
2868
|
-
width:
|
|
2918
|
+
width: b,
|
|
2869
2919
|
height: s,
|
|
2870
|
-
fill:
|
|
2920
|
+
fill: jt(M, n.id, A, S),
|
|
2871
2921
|
rx: 2,
|
|
2872
|
-
"data-series": n.id
|
|
2873
|
-
|
|
2922
|
+
"data-series": n.id,
|
|
2923
|
+
"data-x": String(t(e))
|
|
2924
|
+
}), x] }, `${n.id}-${c}`);
|
|
2874
2925
|
});
|
|
2875
2926
|
}),
|
|
2876
|
-
!
|
|
2927
|
+
!D && o && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($, {
|
|
2877
2928
|
scale: u,
|
|
2878
2929
|
orientation: "x",
|
|
2879
2930
|
length: i,
|
|
2880
|
-
tickCount:
|
|
2931
|
+
tickCount: q,
|
|
2881
2932
|
labelEvery: s,
|
|
2882
|
-
transform: `translate(0,${a})
|
|
2933
|
+
transform: `translate(0,${a})`,
|
|
2934
|
+
...te ? { format: te } : {}
|
|
2883
2935
|
}), /* @__PURE__ */ p($, {
|
|
2884
2936
|
scale: d,
|
|
2885
2937
|
orientation: "y",
|
|
2886
2938
|
length: a,
|
|
2887
|
-
tickCount:
|
|
2888
|
-
...
|
|
2939
|
+
tickCount: K,
|
|
2940
|
+
...W && { format: W }
|
|
2889
2941
|
})] }),
|
|
2890
|
-
!
|
|
2942
|
+
!D && !o && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($, {
|
|
2891
2943
|
scale: d,
|
|
2892
2944
|
orientation: "x",
|
|
2893
2945
|
length: i,
|
|
2894
|
-
tickCount:
|
|
2895
|
-
...
|
|
2946
|
+
tickCount: q,
|
|
2947
|
+
...W && { format: W },
|
|
2896
2948
|
transform: `translate(0,${a})`
|
|
2897
2949
|
}), /* @__PURE__ */ p($, {
|
|
2898
2950
|
scale: u,
|
|
2899
2951
|
orientation: "y",
|
|
2900
2952
|
length: a,
|
|
2901
|
-
tickCount:
|
|
2953
|
+
tickCount: K,
|
|
2902
2954
|
labelEvery: s
|
|
2903
2955
|
})] })
|
|
2904
2956
|
]
|
|
2905
2957
|
})] });
|
|
2906
2958
|
}
|
|
2907
|
-
}),
|
|
2959
|
+
}), re && /* @__PURE__ */ p(Zt, {
|
|
2908
2960
|
series: e.map((e, t) => ({
|
|
2909
2961
|
id: e.id,
|
|
2910
2962
|
label: e.label,
|
|
2911
|
-
color: e.color
|
|
2963
|
+
color: dn(e.color, e.data[0], 0, fn[t % fn.length])
|
|
2912
2964
|
})),
|
|
2913
|
-
hidden:
|
|
2965
|
+
hidden: F
|
|
2914
2966
|
})]
|
|
2915
2967
|
});
|
|
2916
2968
|
}
|
|
2917
2969
|
//#endregion
|
|
2918
2970
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2919
|
-
function
|
|
2971
|
+
function hn(e) {
|
|
2920
2972
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2921
2973
|
return `${e.value} (${t}%)`;
|
|
2922
2974
|
}
|
|
2923
|
-
var
|
|
2924
|
-
function
|
|
2925
|
-
let
|
|
2975
|
+
var gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2976
|
+
function _n({ data: e, title: t, description: n, donut: r = !1, width: a, height: s, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: h, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
|
|
2977
|
+
let T = x ? null : Et(S), E = typeof S == "object" && !!S && S.format != null, D = a ?? c, O = s ?? c ?? (x ? 48 : 300), ee = x ? !1 : y ?? !0;
|
|
2926
2978
|
o();
|
|
2927
2979
|
let k = i(/* @__PURE__ */ new Set()), A = e.length > 0;
|
|
2928
2980
|
return /* @__PURE__ */ m("div", {
|
|
@@ -2934,8 +2986,8 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2934
2986
|
children: [/* @__PURE__ */ p(Q, {
|
|
2935
2987
|
title: t,
|
|
2936
2988
|
description: n,
|
|
2937
|
-
width:
|
|
2938
|
-
height:
|
|
2989
|
+
width: D,
|
|
2990
|
+
height: O,
|
|
2939
2991
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2940
2992
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
2941
2993
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -2952,11 +3004,11 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2952
3004
|
] }, t.id);
|
|
2953
3005
|
}) })
|
|
2954
3006
|
] }),
|
|
2955
|
-
className:
|
|
3007
|
+
className: b,
|
|
2956
3008
|
"data-state": A ? void 0 : "empty",
|
|
2957
3009
|
emptyLabel: g,
|
|
2958
|
-
plain:
|
|
2959
|
-
tooltip: A ? ({ width: t, height: n }) => {
|
|
3010
|
+
plain: x,
|
|
3011
|
+
tooltip: _ !== !1 && A ? ({ width: t, height: n }) => {
|
|
2960
3012
|
if (!A) return;
|
|
2961
3013
|
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !k.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
|
|
2962
3014
|
return {
|
|
@@ -2970,29 +3022,29 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2970
3022
|
value: e.value,
|
|
2971
3023
|
seriesId: String(t),
|
|
2972
3024
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
2973
|
-
color: e.color ??
|
|
3025
|
+
color: e.color ?? gn[t % gn.length]
|
|
2974
3026
|
};
|
|
2975
3027
|
}),
|
|
2976
|
-
format:
|
|
3028
|
+
format: v ?? hn
|
|
2977
3029
|
};
|
|
2978
3030
|
} : void 0,
|
|
2979
|
-
onSelect:
|
|
3031
|
+
onSelect: C,
|
|
2980
3032
|
children: ({ width: t, height: n }) => {
|
|
2981
3033
|
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !k.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || h != null);
|
|
2982
3034
|
return /* @__PURE__ */ m("g", { children: [g.map((e, t) => {
|
|
2983
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
3035
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? gn[t % gn.length], u = N(i, a, o, c, v, r);
|
|
2984
3036
|
v = r;
|
|
2985
|
-
let d = _ > 0 ? e.value / _ * 100 : 0, f =
|
|
3037
|
+
let d = _ > 0 ? e.value / _ * 100 : 0, f = T && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
2986
3038
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("path", {
|
|
2987
3039
|
d: u,
|
|
2988
3040
|
fill: l,
|
|
2989
3041
|
stroke: "var(--cascivo-color-surface)",
|
|
2990
3042
|
strokeWidth: 1,
|
|
2991
3043
|
"data-series": e.id
|
|
2992
|
-
}), f && /* @__PURE__ */ p(
|
|
3044
|
+
}), f && /* @__PURE__ */ p(Dt, {
|
|
2993
3045
|
x: w(i + Math.sin(s) * h),
|
|
2994
3046
|
y: w(a - Math.cos(s) * h + 4),
|
|
2995
|
-
text:
|
|
3047
|
+
text: E ? T.format(e.value) : `${Math.round(d)}%`,
|
|
2996
3048
|
tone: "muted"
|
|
2997
3049
|
})] }, e.id);
|
|
2998
3050
|
}), y && (h == null ? /* @__PURE__ */ m("g", {
|
|
@@ -3035,11 +3087,11 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3035
3087
|
})
|
|
3036
3088
|
}))] });
|
|
3037
3089
|
}
|
|
3038
|
-
}),
|
|
3090
|
+
}), ee && /* @__PURE__ */ p(Zt, {
|
|
3039
3091
|
series: e.map((e, t) => ({
|
|
3040
3092
|
id: e.id,
|
|
3041
3093
|
label: e.label,
|
|
3042
|
-
color: e.color ??
|
|
3094
|
+
color: e.color ?? gn[t % gn.length]
|
|
3043
3095
|
})),
|
|
3044
3096
|
hidden: k
|
|
3045
3097
|
})]
|
|
@@ -3047,23 +3099,23 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3047
3099
|
}
|
|
3048
3100
|
//#endregion
|
|
3049
3101
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3050
|
-
var
|
|
3051
|
-
function
|
|
3102
|
+
var vn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3103
|
+
function yn({ series: e, title: t, description: n, r = 4, width: a, height: s, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: g, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C, format: w }) {
|
|
3052
3104
|
o();
|
|
3053
|
-
let
|
|
3054
|
-
let a = n -
|
|
3105
|
+
let T = i(/* @__PURE__ */ new Set()), E = _ ? Ue : He, D = s ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, ee = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && ee > 2e3), A = i([S?.min ?? 0, S?.max ?? 1]), j = i(/* @__PURE__ */ new Set()), te = (t, { width: n, height: i }) => {
|
|
3106
|
+
let a = n - E.left - E.right, o = i - E.top - E.bottom;
|
|
3055
3107
|
if (a <= 0 || o <= 0) return;
|
|
3056
|
-
let s = h([
|
|
3108
|
+
let s = h([F, ne], [0, a]), c = h([re, I], [o, 0]);
|
|
3057
3109
|
e.forEach((e, n) => {
|
|
3058
|
-
if (!
|
|
3059
|
-
t.fillStyle =
|
|
3110
|
+
if (!T.value.has(e.id)) {
|
|
3111
|
+
t.fillStyle = $e(t, e.color ?? vn[n % vn.length]), t.globalAlpha = .7;
|
|
3060
3112
|
for (let n of e.data) {
|
|
3061
3113
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3062
|
-
t.beginPath(), t.arc(
|
|
3114
|
+
t.beginPath(), t.arc(E.left + s.map(n.x), E.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3063
3115
|
}
|
|
3064
3116
|
}
|
|
3065
3117
|
}), t.globalAlpha = 1;
|
|
3066
|
-
},
|
|
3118
|
+
}, M = e.flatMap((e) => e.data.map((e) => e.x)), N = e.flatMap((e) => e.data.map((e) => e.y)), P = M.length > 0, F = P ? Math.min(...M) : 0, ne = P ? Math.max(...M) : 1, re = P ? Math.min(0, ...N) : 0, I = P ? Math.max(...N) : 1;
|
|
3067
3119
|
return /* @__PURE__ */ m("div", {
|
|
3068
3120
|
style: {
|
|
3069
3121
|
display: "flex",
|
|
@@ -3075,7 +3127,7 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3075
3127
|
title: t,
|
|
3076
3128
|
description: n,
|
|
3077
3129
|
width: a,
|
|
3078
|
-
height:
|
|
3130
|
+
height: D,
|
|
3079
3131
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3080
3132
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3081
3133
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3090,15 +3142,15 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3090
3142
|
] }, `${e.id}-${n}`))) })
|
|
3091
3143
|
] }),
|
|
3092
3144
|
className: g,
|
|
3093
|
-
"data-state":
|
|
3145
|
+
"data-state": P ? void 0 : "empty",
|
|
3094
3146
|
plain: _,
|
|
3095
|
-
tooltip: d !== !1 &&
|
|
3096
|
-
if (d === !1 || !
|
|
3097
|
-
let r = t -
|
|
3098
|
-
return { points: e.flatMap((e) =>
|
|
3147
|
+
tooltip: d !== !1 && P ? ({ width: t, height: n }) => {
|
|
3148
|
+
if (d === !1 || !P) return;
|
|
3149
|
+
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = h([F, ne], [0, r]), o = h([re, I], [i, 0]);
|
|
3150
|
+
return { points: e.flatMap((e) => T.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3099
3151
|
id: `${e.id}-${n}`,
|
|
3100
|
-
cx:
|
|
3101
|
-
cy:
|
|
3152
|
+
cx: E.left + a.map(t.x),
|
|
3153
|
+
cy: E.top + o.map(t.y),
|
|
3102
3154
|
label: `(${t.x}, ${t.y})`,
|
|
3103
3155
|
value: t.y,
|
|
3104
3156
|
seriesId: e.id
|
|
@@ -3107,36 +3159,36 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3107
3159
|
onSelect: y,
|
|
3108
3160
|
hover: "voronoi",
|
|
3109
3161
|
renderer: k ? "canvas" : "svg",
|
|
3110
|
-
paint: k ?
|
|
3162
|
+
paint: k ? te : void 0,
|
|
3111
3163
|
toolbox: C,
|
|
3112
3164
|
onRestore: S ? () => {
|
|
3113
3165
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3114
3166
|
} : void 0,
|
|
3115
3167
|
children: ({ width: t, height: n }) => {
|
|
3116
|
-
let i = t -
|
|
3168
|
+
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = h([F, ne], [0, i]), s = h([re, I], [a, 0]);
|
|
3117
3169
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
3118
|
-
transform: `translate(${
|
|
3170
|
+
transform: `translate(${E.left},${E.top})`,
|
|
3119
3171
|
children: [
|
|
3120
|
-
!_ && /* @__PURE__ */ p(
|
|
3172
|
+
!_ && /* @__PURE__ */ p(vt, {
|
|
3121
3173
|
scale: s,
|
|
3122
3174
|
orientation: "y",
|
|
3123
3175
|
length: i,
|
|
3124
3176
|
tickCount: l
|
|
3125
3177
|
}),
|
|
3126
|
-
!_ &&
|
|
3178
|
+
!_ && Ct(v, {
|
|
3127
3179
|
xScale: o,
|
|
3128
3180
|
yScale: s,
|
|
3129
3181
|
innerW: i,
|
|
3130
3182
|
innerH: a
|
|
3131
3183
|
}),
|
|
3132
3184
|
!k && e.map((e, t) => {
|
|
3133
|
-
if (
|
|
3134
|
-
let n = e.color ??
|
|
3185
|
+
if (T.value.has(e.id)) return null;
|
|
3186
|
+
let n = e.color ?? vn[t % vn.length];
|
|
3135
3187
|
return /* @__PURE__ */ p("g", {
|
|
3136
3188
|
"data-series": e.id,
|
|
3137
3189
|
children: e.data.map((t, i) => {
|
|
3138
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3139
|
-
return m && m !== "circle" ? /* @__PURE__ */ p(
|
|
3190
|
+
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? qt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? Jt(t.y, S, A.value, j.value) : !0, f = d ? .7 : .1, m = typeof b == "function" ? b(t, e.id) : b;
|
|
3191
|
+
return m && m !== "circle" ? /* @__PURE__ */ p(Pt, {
|
|
3140
3192
|
shape: m,
|
|
3141
3193
|
x: o.map(t.x),
|
|
3142
3194
|
y: s.map(t.y),
|
|
@@ -3162,7 +3214,8 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3162
3214
|
orientation: "x",
|
|
3163
3215
|
length: i,
|
|
3164
3216
|
tickCount: c,
|
|
3165
|
-
transform: `translate(0,${a})
|
|
3217
|
+
transform: `translate(0,${a})`,
|
|
3218
|
+
...w ? { format: w } : {}
|
|
3166
3219
|
}), /* @__PURE__ */ p($, {
|
|
3167
3220
|
scale: s,
|
|
3168
3221
|
orientation: "y",
|
|
@@ -3173,26 +3226,26 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3173
3226
|
}) });
|
|
3174
3227
|
}
|
|
3175
3228
|
}),
|
|
3176
|
-
S &&
|
|
3229
|
+
S && P && /* @__PURE__ */ p(Yt, {
|
|
3177
3230
|
options: S,
|
|
3178
3231
|
range: A,
|
|
3179
3232
|
hidden: j,
|
|
3180
3233
|
label: t
|
|
3181
3234
|
}),
|
|
3182
|
-
|
|
3235
|
+
O && /* @__PURE__ */ p(Zt, {
|
|
3183
3236
|
series: e.map((e, t) => ({
|
|
3184
3237
|
id: e.id,
|
|
3185
3238
|
label: e.label,
|
|
3186
|
-
color: e.color ??
|
|
3239
|
+
color: e.color ?? vn[t % vn.length]
|
|
3187
3240
|
})),
|
|
3188
|
-
hidden:
|
|
3241
|
+
hidden: T
|
|
3189
3242
|
})
|
|
3190
3243
|
]
|
|
3191
3244
|
});
|
|
3192
3245
|
}
|
|
3193
3246
|
//#endregion
|
|
3194
3247
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3195
|
-
function
|
|
3248
|
+
function bn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
|
|
3196
3249
|
return /* @__PURE__ */ p(Q, {
|
|
3197
3250
|
title: r ?? i,
|
|
3198
3251
|
width: t,
|
|
@@ -3230,15 +3283,15 @@ function hn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3230
3283
|
}
|
|
3231
3284
|
//#endregion
|
|
3232
3285
|
//#region src/charts/meter/meter.tsx
|
|
3233
|
-
function
|
|
3286
|
+
function xn(e, t, n, r) {
|
|
3234
3287
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3235
3288
|
let { warning: i, critical: a } = r;
|
|
3236
3289
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3237
3290
|
}
|
|
3238
|
-
function
|
|
3239
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l =
|
|
3291
|
+
function Sn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o = 200, height: s }) {
|
|
3292
|
+
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l = xn(e, t, n, a);
|
|
3240
3293
|
if (i === "gauge") {
|
|
3241
|
-
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ =
|
|
3294
|
+
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ = N(u, d, f, h, g, 2 * Math.PI), v = g + c * Math.PI, y = c > 0 ? N(u, d, f, h, g, v) : "";
|
|
3242
3295
|
return /* @__PURE__ */ m("div", {
|
|
3243
3296
|
"aria-label": r,
|
|
3244
3297
|
role: "meter",
|
|
@@ -3312,38 +3365,30 @@ function _n({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3312
3365
|
})]
|
|
3313
3366
|
});
|
|
3314
3367
|
}
|
|
3368
|
+
var Cn = {
|
|
3369
|
+
kpi: "_kpi_1k88k_7",
|
|
3370
|
+
head: "_head_1k88k_19",
|
|
3371
|
+
label: "_label_1k88k_27",
|
|
3372
|
+
valueRow: "_valueRow_1k88k_34",
|
|
3373
|
+
value: "_value_1k88k_34",
|
|
3374
|
+
delta: "_delta_1k88k_49"
|
|
3375
|
+
};
|
|
3315
3376
|
//#endregion
|
|
3316
3377
|
//#region src/charts/kpi/kpi.tsx
|
|
3317
|
-
function
|
|
3378
|
+
function wn(e, t) {
|
|
3318
3379
|
if (typeof t == "function") return t(e);
|
|
3319
3380
|
let n = e >= 0 ? "+" : "", r = e.toLocaleString(u());
|
|
3320
3381
|
return t === "percent" ? `${n}${r}%` : `${n}${r}`;
|
|
3321
3382
|
}
|
|
3322
|
-
function
|
|
3383
|
+
function Tn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabel: i, icon: a, sparkline: o, className: s }) {
|
|
3323
3384
|
let c = n != null && n >= 0, l = n != null && n < 0;
|
|
3324
3385
|
return /* @__PURE__ */ m("div", {
|
|
3325
|
-
className: s,
|
|
3326
|
-
style: {
|
|
3327
|
-
display: "flex",
|
|
3328
|
-
flexDirection: "column",
|
|
3329
|
-
gap: "var(--cascivo-space-2)",
|
|
3330
|
-
padding: "var(--cascivo-space-4)",
|
|
3331
|
-
borderRadius: "var(--cascivo-radius-surface)",
|
|
3332
|
-
border: "1px solid var(--cascivo-color-border)",
|
|
3333
|
-
background: "var(--cascivo-color-surface)"
|
|
3334
|
-
},
|
|
3386
|
+
className: [Cn.kpi, s].filter(Boolean).join(" "),
|
|
3335
3387
|
children: [
|
|
3336
3388
|
/* @__PURE__ */ m("div", {
|
|
3337
|
-
|
|
3338
|
-
display: "flex",
|
|
3339
|
-
alignItems: "center",
|
|
3340
|
-
justifyContent: "space-between"
|
|
3341
|
-
},
|
|
3389
|
+
className: Cn.head,
|
|
3342
3390
|
children: [/* @__PURE__ */ p("span", {
|
|
3343
|
-
|
|
3344
|
-
fontSize: "var(--cascivo-text-sm)",
|
|
3345
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3346
|
-
},
|
|
3391
|
+
className: Cn.label,
|
|
3347
3392
|
children: t
|
|
3348
3393
|
}), a && /* @__PURE__ */ p("span", {
|
|
3349
3394
|
"aria-hidden": "true",
|
|
@@ -3351,39 +3396,26 @@ function yn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3351
3396
|
})]
|
|
3352
3397
|
}),
|
|
3353
3398
|
/* @__PURE__ */ m("div", {
|
|
3354
|
-
|
|
3355
|
-
display: "flex",
|
|
3356
|
-
alignItems: "flex-end",
|
|
3357
|
-
gap: "var(--cascivo-space-2)"
|
|
3358
|
-
},
|
|
3399
|
+
className: Cn.valueRow,
|
|
3359
3400
|
children: [/* @__PURE__ */ p("span", {
|
|
3360
|
-
|
|
3361
|
-
fontSize: "var(--cascivo-text-2xl)",
|
|
3362
|
-
fontWeight: 700,
|
|
3363
|
-
lineHeight: 1,
|
|
3364
|
-
color: "var(--cascivo-color-foreground)"
|
|
3365
|
-
},
|
|
3401
|
+
className: Cn.value,
|
|
3366
3402
|
children: typeof e == "number" ? e.toLocaleString(u()) : e
|
|
3367
3403
|
}), n != null && /* @__PURE__ */ m("span", {
|
|
3368
3404
|
role: "img",
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
color: c ? "var(--cascivo-color-success-foreground)" : l ? "var(--cascivo-color-destructive-foreground)" : "var(--cascivo-color-foreground-muted)"
|
|
3373
|
-
},
|
|
3374
|
-
"aria-label": `Trend: ${vn(n, r)}${i ? ` ${i}` : ""}`,
|
|
3405
|
+
className: Cn.delta,
|
|
3406
|
+
"data-trend": c ? "up" : l ? "down" : "flat",
|
|
3407
|
+
"aria-label": `Trend: ${wn(n, r)}${i ? ` ${i}` : ""}`,
|
|
3375
3408
|
children: [
|
|
3376
3409
|
c ? "▲" : l ? "▼" : "–",
|
|
3377
3410
|
" ",
|
|
3378
|
-
|
|
3411
|
+
wn(n, r),
|
|
3379
3412
|
i && ` ${i}`
|
|
3380
3413
|
]
|
|
3381
3414
|
})]
|
|
3382
3415
|
}),
|
|
3383
|
-
o && o.length > 0 && /* @__PURE__ */ p(
|
|
3416
|
+
o && o.length > 0 && /* @__PURE__ */ p(bn, {
|
|
3384
3417
|
data: o,
|
|
3385
3418
|
label: `${t} trend`,
|
|
3386
|
-
width: 120,
|
|
3387
3419
|
height: 32
|
|
3388
3420
|
})
|
|
3389
3421
|
]
|
|
@@ -3391,18 +3423,18 @@ function yn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3391
3423
|
}
|
|
3392
3424
|
//#endregion
|
|
3393
3425
|
//#region src/charts/histogram/histogram.tsx
|
|
3394
|
-
function
|
|
3426
|
+
function En({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l, format: u }) {
|
|
3395
3427
|
o();
|
|
3396
|
-
let
|
|
3428
|
+
let d = l ? Ue : He, g = s ?? (l ? 48 : 300), _ = R(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3397
3429
|
return /* @__PURE__ */ p(Q, {
|
|
3398
3430
|
title: n,
|
|
3399
3431
|
description: i,
|
|
3400
3432
|
width: a,
|
|
3401
|
-
height:
|
|
3433
|
+
height: g,
|
|
3402
3434
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3403
3435
|
/* @__PURE__ */ p("caption", { children: n }),
|
|
3404
3436
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Range" }), /* @__PURE__ */ p("th", { children: "Count" })] }) }),
|
|
3405
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
3437
|
+
/* @__PURE__ */ p("tbody", { children: _.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ m("td", { children: [
|
|
3406
3438
|
e.x0.toFixed(2),
|
|
3407
3439
|
" – ",
|
|
3408
3440
|
e.x1.toFixed(2)
|
|
@@ -3410,15 +3442,15 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3410
3442
|
] }),
|
|
3411
3443
|
className: c,
|
|
3412
3444
|
plain: l,
|
|
3413
|
-
tooltip:
|
|
3414
|
-
if (
|
|
3415
|
-
let n = e -
|
|
3416
|
-
return { points:
|
|
3445
|
+
tooltip: _.length > 0 ? ({ width: e, height: t }) => {
|
|
3446
|
+
if (_.length === 0) return;
|
|
3447
|
+
let n = e - d.left - d.right, r = t - d.top - d.bottom, i = h([_[0]?.x0 ?? 0, _[_.length - 1]?.x1 ?? 1], [0, n]), a = h([0, v || 1], [r, 0]);
|
|
3448
|
+
return { points: _.map((e, t) => {
|
|
3417
3449
|
let n = i.map(e.x0), r = Math.max(0, i.map(e.x1) - n - 1);
|
|
3418
3450
|
return {
|
|
3419
3451
|
id: `bin-${t}`,
|
|
3420
|
-
cx:
|
|
3421
|
-
cy:
|
|
3452
|
+
cx: d.left + n + r / 2,
|
|
3453
|
+
cy: d.top + a.map(e.count),
|
|
3422
3454
|
label: `${e.x0.toFixed(2)}–${e.x1.toFixed(2)}`,
|
|
3423
3455
|
value: e.count
|
|
3424
3456
|
};
|
|
@@ -3426,20 +3458,20 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3426
3458
|
} : void 0,
|
|
3427
3459
|
children: ({ width: e, height: t }) => {
|
|
3428
3460
|
let n = {
|
|
3429
|
-
width: e -
|
|
3430
|
-
height: t -
|
|
3461
|
+
width: e - d.left - d.right,
|
|
3462
|
+
height: t - d.top - d.bottom
|
|
3431
3463
|
};
|
|
3432
|
-
if (n.width <= 0 ||
|
|
3433
|
-
let r = h([
|
|
3464
|
+
if (n.width <= 0 || _.length === 0) return null;
|
|
3465
|
+
let r = h([_[0]?.x0 ?? 0, _[_.length - 1]?.x1 ?? 1], [0, n.width]), i = h([0, v || 1], [n.height, 0]);
|
|
3434
3466
|
return /* @__PURE__ */ m("g", {
|
|
3435
|
-
transform: `translate(${
|
|
3467
|
+
transform: `translate(${d.left},${d.top})`,
|
|
3436
3468
|
children: [
|
|
3437
|
-
!l && /* @__PURE__ */ p(
|
|
3469
|
+
!l && /* @__PURE__ */ p(vt, {
|
|
3438
3470
|
scale: i,
|
|
3439
3471
|
orientation: "y",
|
|
3440
3472
|
length: n.width
|
|
3441
3473
|
}),
|
|
3442
|
-
|
|
3474
|
+
_.map((e, t) => {
|
|
3443
3475
|
let a = r.map(e.x0), o = Math.max(0, r.map(e.x1) - a - 1), s = i.map(e.count), c = n.height - s;
|
|
3444
3476
|
return /* @__PURE__ */ p("rect", {
|
|
3445
3477
|
x: a,
|
|
@@ -3454,7 +3486,8 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3454
3486
|
scale: r,
|
|
3455
3487
|
orientation: "x",
|
|
3456
3488
|
length: n.width,
|
|
3457
|
-
transform: `translate(0,${n.height})
|
|
3489
|
+
transform: `translate(0,${n.height})`,
|
|
3490
|
+
...u ? { format: u } : {}
|
|
3458
3491
|
}), /* @__PURE__ */ p($, {
|
|
3459
3492
|
scale: i,
|
|
3460
3493
|
orientation: "y",
|
|
@@ -3467,18 +3500,18 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3467
3500
|
}
|
|
3468
3501
|
//#endregion
|
|
3469
3502
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3470
|
-
var
|
|
3471
|
-
function
|
|
3503
|
+
var Dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3504
|
+
function On({ series: e, title: t, description: n, width: r, height: i, className: a, plain: s, format: c }) {
|
|
3472
3505
|
o();
|
|
3473
|
-
let
|
|
3506
|
+
let l = s ? Ue : He, u = i ?? (s ? 48 : 320), d = e.map((e) => ({
|
|
3474
3507
|
...e,
|
|
3475
|
-
stats:
|
|
3476
|
-
})),
|
|
3508
|
+
stats: z(e.values)
|
|
3509
|
+
})), g = e.flatMap((e) => e.values), [v, y] = g.length > 0 ? B(g) : [0, 1];
|
|
3477
3510
|
return /* @__PURE__ */ p(Q, {
|
|
3478
3511
|
title: t,
|
|
3479
3512
|
description: n,
|
|
3480
3513
|
width: r,
|
|
3481
|
-
height:
|
|
3514
|
+
height: u,
|
|
3482
3515
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3483
3516
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3484
3517
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3489,7 +3522,7 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3489
3522
|
/* @__PURE__ */ p("th", { children: "Q3" }),
|
|
3490
3523
|
/* @__PURE__ */ p("th", { children: "Max" })
|
|
3491
3524
|
] }) }),
|
|
3492
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
3525
|
+
/* @__PURE__ */ p("tbody", { children: d.map((e) => /* @__PURE__ */ m("tr", { children: [
|
|
3493
3526
|
/* @__PURE__ */ p("td", { children: e.label }),
|
|
3494
3527
|
/* @__PURE__ */ p("td", { children: e.stats.min.toFixed(2) }),
|
|
3495
3528
|
/* @__PURE__ */ p("td", { children: e.stats.q1.toFixed(2) }),
|
|
@@ -3500,39 +3533,39 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3500
3533
|
] }),
|
|
3501
3534
|
className: a,
|
|
3502
3535
|
plain: s,
|
|
3503
|
-
tooltip:
|
|
3504
|
-
if (
|
|
3505
|
-
let n = e -
|
|
3536
|
+
tooltip: d.length > 0 ? ({ width: e, height: t }) => {
|
|
3537
|
+
if (d.length === 0) return;
|
|
3538
|
+
let n = e - l.left - l.right, r = t - l.top - l.bottom;
|
|
3506
3539
|
if (n <= 0) return;
|
|
3507
|
-
let i = _(
|
|
3540
|
+
let i = _(d.map((e) => e.id), [0, n], .3), a = (y - v) * .05 || 1, o = h([v - a, y + a], [r, 0]);
|
|
3508
3541
|
return {
|
|
3509
|
-
points:
|
|
3542
|
+
points: d.map((e) => {
|
|
3510
3543
|
let t = (i.map(e.id) ?? 0) + i.bandwidth / 2;
|
|
3511
3544
|
return {
|
|
3512
3545
|
id: e.id,
|
|
3513
|
-
cx:
|
|
3514
|
-
cy:
|
|
3546
|
+
cx: l.left + t,
|
|
3547
|
+
cy: l.top + o.map(e.stats.median),
|
|
3515
3548
|
label: e.label,
|
|
3516
3549
|
value: e.stats.median
|
|
3517
3550
|
};
|
|
3518
3551
|
}),
|
|
3519
3552
|
format: (e) => {
|
|
3520
|
-
let t =
|
|
3553
|
+
let t = d.find((t) => t.id === e.id);
|
|
3521
3554
|
return t ? `${t.label}: min ${t.stats.min.toFixed(2)} / Q1 ${t.stats.q1.toFixed(2)} / med ${t.stats.median.toFixed(2)} / Q3 ${t.stats.q3.toFixed(2)} / max ${t.stats.max.toFixed(2)}` : `${e.label}: ${e.value}`;
|
|
3522
3555
|
}
|
|
3523
3556
|
};
|
|
3524
3557
|
} : void 0,
|
|
3525
3558
|
children: ({ width: e, height: t }) => {
|
|
3526
3559
|
let n = {
|
|
3527
|
-
width: e -
|
|
3528
|
-
height: t -
|
|
3560
|
+
width: e - l.left - l.right,
|
|
3561
|
+
height: t - l.top - l.bottom
|
|
3529
3562
|
};
|
|
3530
|
-
if (n.width <= 0 ||
|
|
3531
|
-
let r = _(
|
|
3563
|
+
if (n.width <= 0 || d.length === 0) return null;
|
|
3564
|
+
let r = _(d.map((e) => e.id), [0, n.width], .3), i = (y - v) * .05 || 1, a = h([v - i, y + i], [n.height, 0]);
|
|
3532
3565
|
return /* @__PURE__ */ m("g", {
|
|
3533
|
-
transform: `translate(${
|
|
3534
|
-
children: [
|
|
3535
|
-
let n =
|
|
3566
|
+
transform: `translate(${l.left},${l.top})`,
|
|
3567
|
+
children: [d.map((e, t) => {
|
|
3568
|
+
let n = Dn[t % Dn.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
|
|
3536
3569
|
return /* @__PURE__ */ m("g", { children: [
|
|
3537
3570
|
/* @__PURE__ */ p("line", {
|
|
3538
3571
|
x1: i,
|
|
@@ -3597,7 +3630,8 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3597
3630
|
scale: r,
|
|
3598
3631
|
orientation: "x",
|
|
3599
3632
|
length: n.width,
|
|
3600
|
-
transform: `translate(0,${n.height})
|
|
3633
|
+
transform: `translate(0,${n.height})`,
|
|
3634
|
+
...c ? { format: c } : {}
|
|
3601
3635
|
}), /* @__PURE__ */ p($, {
|
|
3602
3636
|
scale: a,
|
|
3603
3637
|
orientation: "y",
|
|
@@ -3609,15 +3643,15 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3609
3643
|
}
|
|
3610
3644
|
//#endregion
|
|
3611
3645
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3612
|
-
var
|
|
3613
|
-
function
|
|
3646
|
+
var kn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), An = 3, jn = 24;
|
|
3647
|
+
function Mn({ series: e, title: t, description: n, width: r, height: a, tooltip: s, className: c, plain: l, glyph: u, format: d }) {
|
|
3614
3648
|
o();
|
|
3615
|
-
let
|
|
3649
|
+
let g = i(null), _ = l ? Ue : He, y = a ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? B(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? B(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? B(b.map((e) => e.size)) : [0, 1], D = v([T, E], [An, jn]), O = b.length > 0;
|
|
3616
3650
|
return /* @__PURE__ */ p(Q, {
|
|
3617
3651
|
title: t,
|
|
3618
3652
|
description: n,
|
|
3619
3653
|
width: r,
|
|
3620
|
-
height:
|
|
3654
|
+
height: y,
|
|
3621
3655
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3622
3656
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3623
3657
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3635,18 +3669,18 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3635
3669
|
] }),
|
|
3636
3670
|
className: c,
|
|
3637
3671
|
plain: l,
|
|
3638
|
-
tooltip: s !== !1 &&
|
|
3639
|
-
if (s === !1 || !
|
|
3672
|
+
tooltip: s !== !1 && O ? ({ width: t, height: n }) => {
|
|
3673
|
+
if (s === !1 || !O) return;
|
|
3640
3674
|
let r = {
|
|
3641
|
-
width: t -
|
|
3642
|
-
height: n -
|
|
3675
|
+
width: t - _.left - _.right,
|
|
3676
|
+
height: n - _.top - _.bottom
|
|
3643
3677
|
};
|
|
3644
3678
|
if (r.width <= 0) return;
|
|
3645
|
-
let i = (
|
|
3679
|
+
let i = (S - x) * .05 || 1, a = (w - C) * .05 || 1, o = h([x - i, S + i], [0, r.width]), c = h([C - a, w + a], [r.height, 0]);
|
|
3646
3680
|
return { points: e.flatMap((e, t) => e.data.map((n, r) => ({
|
|
3647
3681
|
id: `${t}-${r}`,
|
|
3648
|
-
cx:
|
|
3649
|
-
cy:
|
|
3682
|
+
cx: _.left + o.map(n.x),
|
|
3683
|
+
cy: _.top + c.map(n.y),
|
|
3650
3684
|
label: `${e.name} (${n.x}, ${n.y})`,
|
|
3651
3685
|
value: n.y,
|
|
3652
3686
|
seriesId: e.name
|
|
@@ -3655,36 +3689,36 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3655
3689
|
hover: "voronoi",
|
|
3656
3690
|
children: ({ width: t, height: n }) => {
|
|
3657
3691
|
let r = {
|
|
3658
|
-
width: t -
|
|
3659
|
-
height: n -
|
|
3692
|
+
width: t - _.left - _.right,
|
|
3693
|
+
height: n - _.top - _.bottom
|
|
3660
3694
|
};
|
|
3661
|
-
if (r.width <= 0 ||
|
|
3662
|
-
let i = (
|
|
3695
|
+
if (r.width <= 0 || b.length === 0) return null;
|
|
3696
|
+
let i = (S - x) * .05 || 1, a = (w - C) * .05 || 1, o = h([x - i, S + i], [0, r.width]), s = h([C - a, w + a], [r.height, 0]);
|
|
3663
3697
|
return /* @__PURE__ */ m("g", {
|
|
3664
|
-
transform: `translate(${
|
|
3698
|
+
transform: `translate(${_.left},${_.top})`,
|
|
3665
3699
|
children: [
|
|
3666
|
-
!l && /* @__PURE__ */ p(
|
|
3700
|
+
!l && /* @__PURE__ */ p(vt, {
|
|
3667
3701
|
scale: s,
|
|
3668
3702
|
orientation: "y",
|
|
3669
3703
|
length: r.width
|
|
3670
3704
|
}),
|
|
3671
3705
|
e.map((e, t) => {
|
|
3672
|
-
let n =
|
|
3706
|
+
let n = kn[t % kn.length] ?? "var(--cascivo-chart-1)";
|
|
3673
3707
|
return /* @__PURE__ */ p("g", {
|
|
3674
|
-
opacity:
|
|
3708
|
+
opacity: g.value !== null && g.value !== e.name ? .2 : 1,
|
|
3675
3709
|
onMouseEnter: () => {
|
|
3676
|
-
|
|
3710
|
+
g.value = e.name;
|
|
3677
3711
|
},
|
|
3678
3712
|
onMouseLeave: () => {
|
|
3679
|
-
|
|
3713
|
+
g.value = null;
|
|
3680
3714
|
},
|
|
3681
3715
|
children: e.data.map((t, r) => {
|
|
3682
3716
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3683
|
-
return i && i !== "circle" ? /* @__PURE__ */ p("g", { children: /* @__PURE__ */ p(
|
|
3717
|
+
return i && i !== "circle" ? /* @__PURE__ */ p("g", { children: /* @__PURE__ */ p(Pt, {
|
|
3684
3718
|
shape: i,
|
|
3685
3719
|
x: o.map(t.x),
|
|
3686
3720
|
y: s.map(t.y),
|
|
3687
|
-
size:
|
|
3721
|
+
size: D(t.size) * 2,
|
|
3688
3722
|
color: n,
|
|
3689
3723
|
opacity: .6,
|
|
3690
3724
|
stroke: n,
|
|
@@ -3692,7 +3726,7 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3692
3726
|
}) }, r) : /* @__PURE__ */ p("circle", {
|
|
3693
3727
|
cx: o.map(t.x),
|
|
3694
3728
|
cy: s.map(t.y),
|
|
3695
|
-
r:
|
|
3729
|
+
r: D(t.size),
|
|
3696
3730
|
fill: n,
|
|
3697
3731
|
fillOpacity: .6,
|
|
3698
3732
|
stroke: n,
|
|
@@ -3705,7 +3739,8 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3705
3739
|
scale: o,
|
|
3706
3740
|
orientation: "x",
|
|
3707
3741
|
length: r.width,
|
|
3708
|
-
transform: `translate(0,${r.height})
|
|
3742
|
+
transform: `translate(0,${r.height})`,
|
|
3743
|
+
...d ? { format: d } : {}
|
|
3709
3744
|
}), /* @__PURE__ */ p($, {
|
|
3710
3745
|
scale: s,
|
|
3711
3746
|
orientation: "y",
|
|
@@ -3718,129 +3753,170 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3718
3753
|
}
|
|
3719
3754
|
//#endregion
|
|
3720
3755
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3721
|
-
|
|
3756
|
+
var Nn = "var(--cascivo-chart-1)", Pn = "var(--cascivo-chart-2)";
|
|
3757
|
+
function Fn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, barsLabel: s = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: g, tooltip: v, className: y, plain: b, annotations: x, format: S }) {
|
|
3722
3758
|
o();
|
|
3723
|
-
let
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3759
|
+
let C = i(/* @__PURE__ */ new Set()), w = g ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, D = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, O = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, ee = e.length > 0, k = b ? !1 : l ?? (e.length > 0 && t.length > 0);
|
|
3760
|
+
t.length > 0 && e.length > 0 && t.length !== e.length && tn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !a && t.length > 0 && e.length > 0 && nn("ComboChart", [{
|
|
3761
|
+
label: s,
|
|
3762
|
+
max: T
|
|
3763
|
+
}, {
|
|
3764
|
+
label: c,
|
|
3765
|
+
max: O
|
|
3766
|
+
}]);
|
|
3767
|
+
let A = h([0, T], [0, 1]).ticks(5).map((e) => e.toLocaleString()), j = a ? h([D, O || D + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], te = e.map((e) => e.label), M = b ? Ue : {
|
|
3768
|
+
...He,
|
|
3769
|
+
left: Ge(A, b),
|
|
3770
|
+
right: Ke({
|
|
3771
|
+
rightAxisLabels: j,
|
|
3772
|
+
plain: b
|
|
3773
|
+
})
|
|
3774
|
+
};
|
|
3775
|
+
return /* @__PURE__ */ m("div", {
|
|
3776
|
+
style: {
|
|
3777
|
+
display: "flex",
|
|
3778
|
+
flexDirection: "column",
|
|
3779
|
+
gap: "var(--cascivo-space-2)"
|
|
3780
|
+
},
|
|
3781
|
+
className: y,
|
|
3782
|
+
children: [/* @__PURE__ */ p(Q, {
|
|
3783
|
+
title: n,
|
|
3784
|
+
description: r,
|
|
3785
|
+
width: d,
|
|
3786
|
+
height: w,
|
|
3787
|
+
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3788
|
+
/* @__PURE__ */ p("caption", { children: n }),
|
|
3789
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
3790
|
+
/* @__PURE__ */ p("th", { children: "Label" }),
|
|
3791
|
+
/* @__PURE__ */ p("th", { children: s }),
|
|
3792
|
+
t.length > 0 && /* @__PURE__ */ p("th", { children: c })
|
|
3793
|
+
] }) }),
|
|
3794
|
+
/* @__PURE__ */ p("tbody", { children: e.map((e, n) => /* @__PURE__ */ m("tr", { children: [
|
|
3795
|
+
/* @__PURE__ */ p("td", { children: e.label }),
|
|
3796
|
+
/* @__PURE__ */ p("td", { children: e.value }),
|
|
3797
|
+
t.length > 0 && /* @__PURE__ */ p("td", { children: t[n]?.y ?? "" })
|
|
3798
|
+
] }, e.label)) })
|
|
3799
|
+
] }),
|
|
3800
|
+
plain: b,
|
|
3801
|
+
tooltip: v !== !1 && ee ? ({ width: n, height: r }) => {
|
|
3802
|
+
if (v === !1 || !ee) return;
|
|
3803
|
+
let i = {
|
|
3804
|
+
width: n - M.left - M.right,
|
|
3805
|
+
height: r - M.top - M.bottom
|
|
3762
3806
|
};
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
opacity: .75
|
|
3796
|
-
}, e.label);
|
|
3797
|
-
}),
|
|
3798
|
-
g && /* @__PURE__ */ p("path", {
|
|
3799
|
-
d: g,
|
|
3800
|
-
fill: "none",
|
|
3801
|
-
stroke: "var(--cascivo-chart-2)",
|
|
3802
|
-
strokeWidth: 2.5,
|
|
3803
|
-
strokeLinejoin: "round",
|
|
3804
|
-
strokeLinecap: "round"
|
|
3805
|
-
}),
|
|
3806
|
-
!u && /* @__PURE__ */ m(f, { children: [
|
|
3807
|
-
/* @__PURE__ */ p($, {
|
|
3808
|
-
scale: o,
|
|
3809
|
-
orientation: "x",
|
|
3810
|
-
length: a.width,
|
|
3811
|
-
transform: `translate(0,${a.height})`
|
|
3812
|
-
}),
|
|
3813
|
-
/* @__PURE__ */ p($, {
|
|
3807
|
+
if (i.width <= 0) return;
|
|
3808
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, T], [i.height, 0]), c = a ? h([D, O || D + 1], [i.height, 0]) : s, l = e.map((e, t) => ({
|
|
3809
|
+
id: `bar-${t}`,
|
|
3810
|
+
cx: M.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
|
|
3811
|
+
cy: M.top + s.map(e.value),
|
|
3812
|
+
label: e.label,
|
|
3813
|
+
value: e.value,
|
|
3814
|
+
seriesId: "bars"
|
|
3815
|
+
})), u = t.map((n, r) => {
|
|
3816
|
+
let a = e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1);
|
|
3817
|
+
return {
|
|
3818
|
+
id: `line-${r}`,
|
|
3819
|
+
cx: M.left + a,
|
|
3820
|
+
cy: M.top + c.map(n.y),
|
|
3821
|
+
label: e[r]?.label ?? String(n.x),
|
|
3822
|
+
value: n.y,
|
|
3823
|
+
seriesId: "line"
|
|
3824
|
+
};
|
|
3825
|
+
});
|
|
3826
|
+
return { points: [...l, ...u] };
|
|
3827
|
+
} : void 0,
|
|
3828
|
+
children: ({ width: n, height: r }) => {
|
|
3829
|
+
let i = {
|
|
3830
|
+
width: n - M.left - M.right,
|
|
3831
|
+
height: r - M.top - M.bottom
|
|
3832
|
+
};
|
|
3833
|
+
if (i.width <= 0 || e.length === 0) return null;
|
|
3834
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, T], [i.height, 0]), c = a ? h([D, O || D + 1], [i.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? E(l, "monotone") : "", g = u ?? qe(te, i.width), v = C.value.has("bars"), y = C.value.has("line");
|
|
3835
|
+
return /* @__PURE__ */ m("g", {
|
|
3836
|
+
transform: `translate(${M.left},${M.top})`,
|
|
3837
|
+
children: [
|
|
3838
|
+
!b && /* @__PURE__ */ p(vt, {
|
|
3814
3839
|
scale: s,
|
|
3815
3840
|
orientation: "y",
|
|
3816
|
-
length:
|
|
3841
|
+
length: i.width
|
|
3817
3842
|
}),
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
})
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3843
|
+
!b && Ct(x, {
|
|
3844
|
+
xScale: o,
|
|
3845
|
+
yScale: s,
|
|
3846
|
+
innerW: i.width,
|
|
3847
|
+
innerH: i.height
|
|
3848
|
+
}),
|
|
3849
|
+
!v && e.map((e) => {
|
|
3850
|
+
let t = o.map(e.label) ?? 0, n = s.map(e.value);
|
|
3851
|
+
return /* @__PURE__ */ p("rect", {
|
|
3852
|
+
x: t,
|
|
3853
|
+
y: n,
|
|
3854
|
+
width: o.bandwidth,
|
|
3855
|
+
height: Math.max(0, i.height - n),
|
|
3856
|
+
fill: Nn,
|
|
3857
|
+
opacity: .75
|
|
3858
|
+
}, e.label);
|
|
3859
|
+
}),
|
|
3860
|
+
d && !y && /* @__PURE__ */ p("path", {
|
|
3861
|
+
d,
|
|
3862
|
+
fill: "none",
|
|
3863
|
+
stroke: Pn,
|
|
3864
|
+
strokeWidth: 2.5,
|
|
3865
|
+
strokeLinejoin: "round",
|
|
3866
|
+
strokeLinecap: "round"
|
|
3867
|
+
}),
|
|
3868
|
+
!b && /* @__PURE__ */ m(f, { children: [
|
|
3869
|
+
/* @__PURE__ */ p($, {
|
|
3870
|
+
scale: o,
|
|
3871
|
+
orientation: "x",
|
|
3872
|
+
length: i.width,
|
|
3873
|
+
labelEvery: g,
|
|
3874
|
+
transform: `translate(0,${i.height})`,
|
|
3875
|
+
...S ? { format: S } : {}
|
|
3876
|
+
}),
|
|
3877
|
+
/* @__PURE__ */ p($, {
|
|
3878
|
+
scale: s,
|
|
3879
|
+
orientation: "y",
|
|
3880
|
+
length: i.height
|
|
3881
|
+
}),
|
|
3882
|
+
a && /* @__PURE__ */ p($, {
|
|
3883
|
+
scale: c,
|
|
3884
|
+
orientation: "y-right",
|
|
3885
|
+
length: i.height,
|
|
3886
|
+
transform: `translate(${i.width},0)`
|
|
3887
|
+
})
|
|
3888
|
+
] })
|
|
3889
|
+
]
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
}), k && /* @__PURE__ */ p(Zt, {
|
|
3893
|
+
series: [{
|
|
3894
|
+
id: "bars",
|
|
3895
|
+
label: s,
|
|
3896
|
+
color: Nn
|
|
3897
|
+
}, ...t.length > 0 ? [{
|
|
3898
|
+
id: "line",
|
|
3899
|
+
label: c,
|
|
3900
|
+
color: Pn
|
|
3901
|
+
}] : []],
|
|
3902
|
+
hidden: C
|
|
3903
|
+
})]
|
|
3828
3904
|
});
|
|
3829
3905
|
}
|
|
3830
3906
|
//#endregion
|
|
3831
3907
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3832
|
-
function
|
|
3908
|
+
function In({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u, format: d }) {
|
|
3833
3909
|
o();
|
|
3834
|
-
let
|
|
3910
|
+
let h = a ?? (c ? 48 : 320), g = c ? Ue : {
|
|
3835
3911
|
top: 20,
|
|
3836
3912
|
right: 20,
|
|
3837
3913
|
bottom: 60,
|
|
3838
3914
|
left: 60
|
|
3839
|
-
},
|
|
3915
|
+
}, v = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? B(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = i([l?.min ?? b, l?.max ?? x]), T = i(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ p(Q, {
|
|
3840
3916
|
title: t,
|
|
3841
3917
|
description: n,
|
|
3842
3918
|
width: r,
|
|
3843
|
-
height:
|
|
3919
|
+
height: h,
|
|
3844
3920
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3845
3921
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3846
3922
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3858,15 +3934,15 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3858
3934
|
plain: c,
|
|
3859
3935
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3860
3936
|
if (e.length === 0) return;
|
|
3861
|
-
let r = t -
|
|
3937
|
+
let r = t - g.left - g.right, i = n - g.top - g.bottom;
|
|
3862
3938
|
if (r <= 0) return;
|
|
3863
|
-
let a = _(
|
|
3939
|
+
let a = _(v, [0, r], .05), o = _(y, [0, i], .05);
|
|
3864
3940
|
return { points: e.map((e, t) => {
|
|
3865
3941
|
let n = a.map(e.x) ?? 0, r = o.map(e.y) ?? 0;
|
|
3866
3942
|
return {
|
|
3867
3943
|
id: `cell-${t}`,
|
|
3868
|
-
cx:
|
|
3869
|
-
cy:
|
|
3944
|
+
cx: g.left + n + a.bandwidth / 2,
|
|
3945
|
+
cy: g.top + r + o.bandwidth / 2,
|
|
3870
3946
|
label: `${e.x}×${e.y}`,
|
|
3871
3947
|
value: e.value
|
|
3872
3948
|
};
|
|
@@ -3874,19 +3950,19 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3874
3950
|
} : void 0,
|
|
3875
3951
|
toolbox: u,
|
|
3876
3952
|
onRestore: l ? () => {
|
|
3877
|
-
|
|
3953
|
+
w.value = [l.min, l.max], T.value = /* @__PURE__ */ new Set();
|
|
3878
3954
|
} : void 0,
|
|
3879
3955
|
children: ({ width: t, height: n }) => {
|
|
3880
3956
|
let r = {
|
|
3881
|
-
width: t -
|
|
3882
|
-
height: n -
|
|
3957
|
+
width: t - g.left - g.right,
|
|
3958
|
+
height: n - g.top - g.bottom
|
|
3883
3959
|
};
|
|
3884
3960
|
if (r.width <= 0 || e.length === 0) return null;
|
|
3885
|
-
let i = _(
|
|
3961
|
+
let i = _(v, [0, r.width], .05), a = _(y, [0, r.height], .05);
|
|
3886
3962
|
return /* @__PURE__ */ m("g", {
|
|
3887
|
-
transform: `translate(${
|
|
3963
|
+
transform: `translate(${g.left},${g.top})`,
|
|
3888
3964
|
children: [e.map((e, t) => {
|
|
3889
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(
|
|
3965
|
+
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(C(e.value) * 100), s = l ? qt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-color-neutral-100))`, c = l ? Jt(e.value, l, w.value, T.value) : !0;
|
|
3890
3966
|
return /* @__PURE__ */ p("rect", {
|
|
3891
3967
|
x: n,
|
|
3892
3968
|
y: r,
|
|
@@ -3901,7 +3977,8 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3901
3977
|
scale: i,
|
|
3902
3978
|
orientation: "x",
|
|
3903
3979
|
length: r.width,
|
|
3904
|
-
transform: `translate(0,${r.height})
|
|
3980
|
+
transform: `translate(0,${r.height})`,
|
|
3981
|
+
...d ? { format: d } : {}
|
|
3905
3982
|
}), /* @__PURE__ */ p($, {
|
|
3906
3983
|
scale: a,
|
|
3907
3984
|
orientation: "y",
|
|
@@ -3910,24 +3987,24 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3910
3987
|
});
|
|
3911
3988
|
}
|
|
3912
3989
|
});
|
|
3913
|
-
return !l || e.length === 0 ?
|
|
3990
|
+
return !l || e.length === 0 ? E : /* @__PURE__ */ m("div", {
|
|
3914
3991
|
style: {
|
|
3915
3992
|
display: "flex",
|
|
3916
3993
|
flexDirection: "column",
|
|
3917
3994
|
gap: "0.5rem"
|
|
3918
3995
|
},
|
|
3919
|
-
children: [
|
|
3996
|
+
children: [E, /* @__PURE__ */ p(Yt, {
|
|
3920
3997
|
options: l,
|
|
3921
|
-
range:
|
|
3922
|
-
hidden:
|
|
3998
|
+
range: w,
|
|
3999
|
+
hidden: T,
|
|
3923
4000
|
label: t
|
|
3924
4001
|
})]
|
|
3925
4002
|
});
|
|
3926
4003
|
}
|
|
3927
4004
|
//#endregion
|
|
3928
4005
|
//#region src/charts/treemap/treemap.tsx
|
|
3929
|
-
var
|
|
3930
|
-
function
|
|
4006
|
+
var Ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4007
|
+
function Rn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: c }) {
|
|
3931
4008
|
o();
|
|
3932
4009
|
let l = s();
|
|
3933
4010
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -3943,7 +4020,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3943
4020
|
className: a,
|
|
3944
4021
|
plain: c,
|
|
3945
4022
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3946
|
-
if (e.length !== 0) return { points:
|
|
4023
|
+
if (e.length !== 0) return { points: W(e.map((e) => ({
|
|
3947
4024
|
id: e.id,
|
|
3948
4025
|
value: e.value
|
|
3949
4026
|
})), t, n).map((t) => {
|
|
@@ -3959,7 +4036,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3959
4036
|
} : void 0,
|
|
3960
4037
|
children: ({ width: t, height: n }) => {
|
|
3961
4038
|
if (e.length === 0) return null;
|
|
3962
|
-
let r =
|
|
4039
|
+
let r = W(e.map((e) => ({
|
|
3963
4040
|
id: e.id,
|
|
3964
4041
|
value: e.value
|
|
3965
4042
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -3972,7 +4049,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3972
4049
|
height: Math.max(0, e.h - 4)
|
|
3973
4050
|
})
|
|
3974
4051
|
}, e.id)) }), r.map((e, t) => {
|
|
3975
|
-
let n =
|
|
4052
|
+
let n = Ln[t % Ln.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
3976
4053
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("rect", {
|
|
3977
4054
|
x: e.x,
|
|
3978
4055
|
y: e.y,
|
|
@@ -3996,8 +4073,8 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3996
4073
|
}
|
|
3997
4074
|
//#endregion
|
|
3998
4075
|
//#region src/charts/radar/radar.tsx
|
|
3999
|
-
var
|
|
4000
|
-
function
|
|
4076
|
+
var zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Bn = 4;
|
|
4077
|
+
function Vn(e, t, n, r, i) {
|
|
4001
4078
|
let a = e.length;
|
|
4002
4079
|
return e.map((e, o) => {
|
|
4003
4080
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -4007,7 +4084,7 @@ function Nn(e, t, n, r, i) {
|
|
|
4007
4084
|
};
|
|
4008
4085
|
});
|
|
4009
4086
|
}
|
|
4010
|
-
function
|
|
4087
|
+
function Hn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
4011
4088
|
let u = s ?? (l ? 48 : 320);
|
|
4012
4089
|
o();
|
|
4013
4090
|
let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -4039,7 +4116,7 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4039
4116
|
})) };
|
|
4040
4117
|
} : void 0,
|
|
4041
4118
|
children: ({ width: n, height: r }) => {
|
|
4042
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4119
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Bn }, (e, t) => (t + 1) / Bn * o), c = Array.from({ length: h }, (e, t) => {
|
|
4043
4120
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4044
4121
|
return {
|
|
4045
4122
|
x: w(i + Math.cos(n) * o),
|
|
@@ -4077,7 +4154,7 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4077
4154
|
}, n);
|
|
4078
4155
|
}),
|
|
4079
4156
|
t.map((e, t) => {
|
|
4080
|
-
let n =
|
|
4157
|
+
let n = Vn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = zn[t % zn.length] ?? "var(--cascivo-chart-1)";
|
|
4081
4158
|
return /* @__PURE__ */ p("polygon", {
|
|
4082
4159
|
points: n,
|
|
4083
4160
|
fill: r,
|
|
@@ -4092,12 +4169,12 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4092
4169
|
}
|
|
4093
4170
|
//#endregion
|
|
4094
4171
|
//#region src/charts/bullet/bullet.tsx
|
|
4095
|
-
var
|
|
4172
|
+
var Un = [
|
|
4096
4173
|
"var(--cascivo-color-neutral-200)",
|
|
4097
4174
|
"var(--cascivo-color-neutral-300)",
|
|
4098
4175
|
"var(--cascivo-color-neutral-400)"
|
|
4099
4176
|
];
|
|
4100
|
-
function
|
|
4177
|
+
function Wn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: s = 300, height: c = 40, className: l }) {
|
|
4101
4178
|
o();
|
|
4102
4179
|
let u = [...n].sort((e, t) => e - t), d = h([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, s]), g = c * .35, _ = (c - g) / 2, v = c * .7, y = (c - v) / 2;
|
|
4103
4180
|
return /* @__PURE__ */ m("figure", {
|
|
@@ -4124,7 +4201,7 @@ function In({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4124
4201
|
y: 0,
|
|
4125
4202
|
width: Math.max(0, r),
|
|
4126
4203
|
height: c,
|
|
4127
|
-
fill:
|
|
4204
|
+
fill: Un[t % Un.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4128
4205
|
}, t);
|
|
4129
4206
|
}),
|
|
4130
4207
|
/* @__PURE__ */ p("rect", {
|
|
@@ -4151,8 +4228,8 @@ function In({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4151
4228
|
}
|
|
4152
4229
|
//#endregion
|
|
4153
4230
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4154
|
-
var
|
|
4155
|
-
function
|
|
4231
|
+
var Gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4232
|
+
function Kn({ data: e, title: t, description: n, size: r, width: a, height: s, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: h, legend: g, className: _, plain: v }) {
|
|
4156
4233
|
o();
|
|
4157
4234
|
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, T = c ?? Math.max(1, ...e.map((e) => e.value)), E = Math.min(360, Math.max(0, l)) * Math.PI / 180, D = -E / 2, O = (t, n) => {
|
|
4158
4235
|
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = a * .32, s = e.filter((e) => !y.value.has(e.id));
|
|
@@ -4164,7 +4241,7 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4164
4241
|
span: s.length > 0 ? (a - o) / s.length : 0,
|
|
4165
4242
|
visible: s
|
|
4166
4243
|
};
|
|
4167
|
-
},
|
|
4244
|
+
}, ee = ({ width: e, height: t }) => {
|
|
4168
4245
|
if (h === !1 || !C) return;
|
|
4169
4246
|
let { cx: n, cy: r, maxR: i, span: a, visible: o } = O(e, t);
|
|
4170
4247
|
return { points: o.map((e, t) => {
|
|
@@ -4177,14 +4254,14 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4177
4254
|
value: e.value,
|
|
4178
4255
|
seriesId: e.id,
|
|
4179
4256
|
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4180
|
-
color: e.color ??
|
|
4257
|
+
color: e.color ?? Gn[t % Gn.length]
|
|
4181
4258
|
};
|
|
4182
4259
|
}) };
|
|
4183
|
-
},
|
|
4260
|
+
}, k = /* @__PURE__ */ m("table", { children: [
|
|
4184
4261
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4185
4262
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Label" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4186
4263
|
/* @__PURE__ */ p("tbody", { children: e.map((e) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: e.label }), /* @__PURE__ */ p("td", { children: e.value })] }, e.id)) })
|
|
4187
|
-
] }),
|
|
4264
|
+
] }), A = u != null || d != null || f != null;
|
|
4188
4265
|
return /* @__PURE__ */ m("div", {
|
|
4189
4266
|
style: {
|
|
4190
4267
|
display: "flex",
|
|
@@ -4196,27 +4273,27 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4196
4273
|
description: n,
|
|
4197
4274
|
width: b,
|
|
4198
4275
|
height: x,
|
|
4199
|
-
fallback:
|
|
4276
|
+
fallback: k,
|
|
4200
4277
|
className: _,
|
|
4201
4278
|
"data-state": C ? void 0 : "empty",
|
|
4202
4279
|
plain: v,
|
|
4203
|
-
tooltip: h !== !1 && C ?
|
|
4280
|
+
tooltip: h !== !1 && C ? ee : void 0,
|
|
4204
4281
|
children: ({ width: e, height: t }) => {
|
|
4205
4282
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4206
4283
|
return /* @__PURE__ */ m("g", { children: [s.map((e, t) => {
|
|
4207
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4284
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Gn[t % Gn.length], l = Math.max(0, Math.min(1, e.value / T)), u = D + E * l;
|
|
4208
4285
|
return /* @__PURE__ */ m("g", {
|
|
4209
4286
|
"data-series": e.id,
|
|
4210
4287
|
children: [/* @__PURE__ */ p("path", {
|
|
4211
|
-
d:
|
|
4288
|
+
d: N(n, r, a, s, D, D + E),
|
|
4212
4289
|
fill: "var(--cascivo-chart-grid)",
|
|
4213
4290
|
fillOpacity: .35
|
|
4214
4291
|
}), l > 0 && /* @__PURE__ */ p("path", {
|
|
4215
|
-
d:
|
|
4292
|
+
d: N(n, r, a, s, D, u),
|
|
4216
4293
|
fill: c
|
|
4217
4294
|
})]
|
|
4218
4295
|
}, e.id);
|
|
4219
|
-
}), !v &&
|
|
4296
|
+
}), !v && A && (f == null ? /* @__PURE__ */ m("g", {
|
|
4220
4297
|
"data-center": "",
|
|
4221
4298
|
children: [u != null && /* @__PURE__ */ p("text", {
|
|
4222
4299
|
x: n,
|
|
@@ -4256,11 +4333,11 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4256
4333
|
})
|
|
4257
4334
|
}))] });
|
|
4258
4335
|
}
|
|
4259
|
-
}), S && /* @__PURE__ */ p(
|
|
4336
|
+
}), S && /* @__PURE__ */ p(Zt, {
|
|
4260
4337
|
series: e.map((e, t) => ({
|
|
4261
4338
|
id: e.id,
|
|
4262
4339
|
label: e.label,
|
|
4263
|
-
color: e.color ??
|
|
4340
|
+
color: e.color ?? Gn[t % Gn.length]
|
|
4264
4341
|
})),
|
|
4265
4342
|
hidden: y
|
|
4266
4343
|
})]
|
|
@@ -4268,10 +4345,10 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4268
4345
|
}
|
|
4269
4346
|
//#endregion
|
|
4270
4347
|
//#region src/charts/funnel/funnel.tsx
|
|
4271
|
-
var
|
|
4272
|
-
function
|
|
4348
|
+
var qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4349
|
+
function Jn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: s, className: c, plain: l }) {
|
|
4273
4350
|
o();
|
|
4274
|
-
let u = l ?
|
|
4351
|
+
let u = l ? Ue : He, d = i ?? (l ? 48 : 320), f = e.length > 0, g = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4275
4352
|
return /* @__PURE__ */ p(Q, {
|
|
4276
4353
|
title: t,
|
|
4277
4354
|
description: n,
|
|
@@ -4305,7 +4382,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4305
4382
|
value: e.value,
|
|
4306
4383
|
seriesId: e.id,
|
|
4307
4384
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4308
|
-
color: e.color ??
|
|
4385
|
+
color: e.color ?? qn[t % qn.length]
|
|
4309
4386
|
})),
|
|
4310
4387
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4311
4388
|
};
|
|
@@ -4315,7 +4392,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4315
4392
|
if (r <= 0 || e.length === 0) return null;
|
|
4316
4393
|
let o = i / e.length, s = h([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4317
4394
|
return /* @__PURE__ */ p("g", { children: e.map((t, n) => {
|
|
4318
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ??
|
|
4395
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ?? qn[n % qn.length], v = [
|
|
4319
4396
|
[d - i, f],
|
|
4320
4397
|
[d + i, f],
|
|
4321
4398
|
[d + s, h],
|
|
@@ -4327,7 +4404,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4327
4404
|
points: v,
|
|
4328
4405
|
fill: _,
|
|
4329
4406
|
fillOpacity: .85
|
|
4330
|
-
}), !l && /* @__PURE__ */ p(
|
|
4407
|
+
}), !l && /* @__PURE__ */ p(Dt, {
|
|
4331
4408
|
x: d,
|
|
4332
4409
|
y: f + o / 2,
|
|
4333
4410
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4340,10 +4417,10 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4340
4417
|
}
|
|
4341
4418
|
//#endregion
|
|
4342
4419
|
//#region src/charts/stream/stream.tsx
|
|
4343
|
-
var
|
|
4344
|
-
function
|
|
4420
|
+
var Yn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4421
|
+
function Xn({ series: e, categories: t, title: n, description: r, offset: a = "silhouette", curve: s = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: g, format: v }) {
|
|
4345
4422
|
o();
|
|
4346
|
-
let
|
|
4423
|
+
let y = i(/* @__PURE__ */ new Set()), b = g ? Ue : He, x = l ?? (g ? 48 : 300), S = g ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = G(e.map((e) => e.values), a), [T, D] = K(w);
|
|
4347
4424
|
return /* @__PURE__ */ m("div", {
|
|
4348
4425
|
style: {
|
|
4349
4426
|
display: "flex",
|
|
@@ -4354,44 +4431,44 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4354
4431
|
title: n,
|
|
4355
4432
|
description: r,
|
|
4356
4433
|
width: c,
|
|
4357
|
-
height:
|
|
4434
|
+
height: x,
|
|
4358
4435
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4359
4436
|
/* @__PURE__ */ p("caption", { children: n }),
|
|
4360
4437
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
4361
4438
|
/* @__PURE__ */ p("tbody", { children: t.map((t, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(t) }), e.map((e) => /* @__PURE__ */ p("td", { children: e.values[n] ?? "" }, e.id))] }, String(t))) })
|
|
4362
4439
|
] }),
|
|
4363
4440
|
className: f,
|
|
4364
|
-
"data-state":
|
|
4441
|
+
"data-state": C ? void 0 : "empty",
|
|
4365
4442
|
plain: g,
|
|
4366
|
-
tooltip: d &&
|
|
4367
|
-
if (!d || !
|
|
4368
|
-
let i = n -
|
|
4443
|
+
tooltip: d && C ? ({ width: n, height: r }) => {
|
|
4444
|
+
if (!d || !C) return;
|
|
4445
|
+
let i = n - b.left - b.right, a = r - b.top - b.bottom, o = _(t.map(String), [0, i], 0), s = h([T, D], [a, 0]);
|
|
4369
4446
|
return { points: e.flatMap((e, n) => {
|
|
4370
|
-
if (
|
|
4371
|
-
let r =
|
|
4447
|
+
if (y.value.has(e.id)) return [];
|
|
4448
|
+
let r = w[n];
|
|
4372
4449
|
return t.map((t, i) => {
|
|
4373
4450
|
let a = (r[i][0] + r[i][1]) / 2;
|
|
4374
4451
|
return {
|
|
4375
4452
|
id: `${e.id}-${i}`,
|
|
4376
|
-
cx:
|
|
4377
|
-
cy:
|
|
4453
|
+
cx: b.left + (o.map(String(t)) ?? 0) + o.bandwidth / 2,
|
|
4454
|
+
cy: b.top + s.map(a),
|
|
4378
4455
|
label: `${e.label} · ${String(t)}`,
|
|
4379
4456
|
value: e.values[i] ?? 0,
|
|
4380
4457
|
seriesId: e.id,
|
|
4381
|
-
color: e.color ??
|
|
4458
|
+
color: e.color ?? Yn[n % Yn.length]
|
|
4382
4459
|
};
|
|
4383
4460
|
});
|
|
4384
4461
|
}) };
|
|
4385
4462
|
} : void 0,
|
|
4386
4463
|
children: ({ width: n, height: r }) => {
|
|
4387
|
-
let i = n -
|
|
4388
|
-
if (i <= 0 || !
|
|
4389
|
-
let o = _(t.map(String), [0, i], 0), c = h([
|
|
4464
|
+
let i = n - b.left - b.right, a = r - b.top - b.bottom;
|
|
4465
|
+
if (i <= 0 || !C) return null;
|
|
4466
|
+
let o = _(t.map(String), [0, i], 0), c = h([T, D], [a, 0]), l = (e) => (o.map(String(t[e])) ?? 0) + o.bandwidth / 2;
|
|
4390
4467
|
return /* @__PURE__ */ m("g", {
|
|
4391
|
-
transform: `translate(${
|
|
4468
|
+
transform: `translate(${b.left},${b.top})`,
|
|
4392
4469
|
children: [e.map((e, n) => {
|
|
4393
|
-
if (
|
|
4394
|
-
let r =
|
|
4470
|
+
if (y.value.has(e.id)) return null;
|
|
4471
|
+
let r = w[n], i = e.color ?? Yn[n % Yn.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), o = t.map((e, t) => [l(t), c.map(r[t][0])]);
|
|
4395
4472
|
return /* @__PURE__ */ p("path", {
|
|
4396
4473
|
d: `${E(a, s)}${E([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4397
4474
|
fill: i,
|
|
@@ -4402,26 +4479,27 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4402
4479
|
scale: o,
|
|
4403
4480
|
orientation: "x",
|
|
4404
4481
|
length: i,
|
|
4405
|
-
transform: `translate(0,${a})
|
|
4482
|
+
transform: `translate(0,${a})`,
|
|
4483
|
+
...v ? { format: v } : {}
|
|
4406
4484
|
})]
|
|
4407
4485
|
});
|
|
4408
4486
|
}
|
|
4409
|
-
}),
|
|
4487
|
+
}), S && /* @__PURE__ */ p(Zt, {
|
|
4410
4488
|
series: e.map((e, t) => ({
|
|
4411
4489
|
id: e.id,
|
|
4412
4490
|
label: e.label,
|
|
4413
|
-
color: e.color ??
|
|
4491
|
+
color: e.color ?? Yn[t % Yn.length]
|
|
4414
4492
|
})),
|
|
4415
|
-
hidden:
|
|
4493
|
+
hidden: y
|
|
4416
4494
|
})]
|
|
4417
4495
|
});
|
|
4418
4496
|
}
|
|
4419
4497
|
//#endregion
|
|
4420
4498
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4421
|
-
var
|
|
4422
|
-
function
|
|
4499
|
+
var Zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4500
|
+
function Qn({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4423
4501
|
o();
|
|
4424
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = q(e), h = f > 0, g =
|
|
4502
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = q(e), h = f > 0, g = J(e), _ = Math.max(1, Y(g));
|
|
4425
4503
|
return /* @__PURE__ */ p(Q, {
|
|
4426
4504
|
title: t,
|
|
4427
4505
|
description: n,
|
|
@@ -4448,7 +4526,7 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4448
4526
|
label: e.node.label,
|
|
4449
4527
|
value: e.value,
|
|
4450
4528
|
percent: f > 0 ? e.value / f * 100 : 0,
|
|
4451
|
-
color: e.node.color ??
|
|
4529
|
+
color: e.node.color ?? Zn[t % Zn.length]
|
|
4452
4530
|
};
|
|
4453
4531
|
}),
|
|
4454
4532
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4457,9 +4535,9 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4457
4535
|
children: ({ width: e, height: t }) => {
|
|
4458
4536
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4459
4537
|
return /* @__PURE__ */ p("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4460
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4538
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? Zn[t % Zn.length];
|
|
4461
4539
|
return /* @__PURE__ */ p("path", {
|
|
4462
|
-
d:
|
|
4540
|
+
d: N(n, r, o, a, e.a0, e.a1),
|
|
4463
4541
|
fill: s,
|
|
4464
4542
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4465
4543
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4472,10 +4550,10 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4472
4550
|
}
|
|
4473
4551
|
//#endregion
|
|
4474
4552
|
//#region src/charts/sankey/sankey.tsx
|
|
4475
|
-
var
|
|
4476
|
-
function
|
|
4553
|
+
var $n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4554
|
+
function er({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4477
4555
|
o();
|
|
4478
|
-
let u = l ?
|
|
4556
|
+
let u = l ? Ue : He, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ?? $n[n % $n.length];
|
|
4479
4557
|
return /* @__PURE__ */ p(Q, {
|
|
4480
4558
|
title: n,
|
|
4481
4559
|
description: r,
|
|
@@ -4499,7 +4577,7 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4499
4577
|
plain: l,
|
|
4500
4578
|
tooltip: s && f ? ({ width: n, height: r }) => {
|
|
4501
4579
|
if (!s || !f) return;
|
|
4502
|
-
let { nodes: i } =
|
|
4580
|
+
let { nodes: i } = oe(e, t, {
|
|
4503
4581
|
width: n - u.left - u.right,
|
|
4504
4582
|
height: r - u.top - u.bottom
|
|
4505
4583
|
});
|
|
@@ -4515,14 +4593,14 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4515
4593
|
children: ({ width: n, height: r }) => {
|
|
4516
4594
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4517
4595
|
if (i <= 0 || !f) return null;
|
|
4518
|
-
let { nodes: o, links: s } =
|
|
4596
|
+
let { nodes: o, links: s } = oe(e, t, {
|
|
4519
4597
|
width: i,
|
|
4520
4598
|
height: a
|
|
4521
4599
|
});
|
|
4522
4600
|
return /* @__PURE__ */ m("g", {
|
|
4523
4601
|
transform: `translate(${u.left},${u.top})`,
|
|
4524
4602
|
children: [s.map((e, t) => /* @__PURE__ */ p("path", {
|
|
4525
|
-
d:
|
|
4603
|
+
d: X(e),
|
|
4526
4604
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4527
4605
|
fillOpacity: .32,
|
|
4528
4606
|
"data-link": ""
|
|
@@ -4551,23 +4629,23 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4551
4629
|
}
|
|
4552
4630
|
//#endregion
|
|
4553
4631
|
//#region src/charts/calendar/calendar.tsx
|
|
4554
|
-
var
|
|
4555
|
-
function
|
|
4632
|
+
var tr = 864e5, nr = (e) => e instanceof Date ? e : new Date(e), rr = (e) => e.toISOString().slice(0, 10);
|
|
4633
|
+
function ir(e) {
|
|
4556
4634
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4557
4635
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4558
4636
|
}
|
|
4559
|
-
function
|
|
4637
|
+
function ar({ data: e, title: t, description: n, from: r, to: a, width: s, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
|
|
4560
4638
|
o();
|
|
4561
4639
|
let h = e.length > 0, g = i([f?.min ?? 0, f?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4562
|
-
for (let t of e) v.set(
|
|
4563
|
-
let y = e.map((e) =>
|
|
4640
|
+
for (let t of e) v.set(rr(nr(t.day)), t.value);
|
|
4641
|
+
let y = e.map((e) => nr(e.day)), b = ir(r ? nr(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = a ? nr(a) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = h ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / tr / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4564
4642
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4565
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4643
|
+
let n = new Date(b.getTime() + (e * 7 + t) * tr);
|
|
4566
4644
|
n > x || T.push({
|
|
4567
4645
|
col: e,
|
|
4568
4646
|
row: t,
|
|
4569
4647
|
date: n,
|
|
4570
|
-
value: v.get(
|
|
4648
|
+
value: v.get(rr(n)) ?? 0
|
|
4571
4649
|
});
|
|
4572
4650
|
}
|
|
4573
4651
|
let E = /* @__PURE__ */ p(Q, {
|
|
@@ -4578,7 +4656,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4578
4656
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4579
4657
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4580
4658
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Day" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4581
|
-
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children:
|
|
4659
|
+
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: rr(nr(e.day)) }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
4582
4660
|
] }),
|
|
4583
4661
|
className: u,
|
|
4584
4662
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4588,10 +4666,10 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4588
4666
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4589
4667
|
return {
|
|
4590
4668
|
points: T.map((e, n) => ({
|
|
4591
|
-
id: `${
|
|
4669
|
+
id: `${rr(e.date)}-${n}`,
|
|
4592
4670
|
cx: e.col * (t + 2) + t / 2,
|
|
4593
4671
|
cy: e.row * (t + 2) + t / 2,
|
|
4594
|
-
label:
|
|
4672
|
+
label: rr(e.date),
|
|
4595
4673
|
value: e.value
|
|
4596
4674
|
})),
|
|
4597
4675
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4600,7 +4678,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4600
4678
|
children: ({ width: e }) => {
|
|
4601
4679
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4602
4680
|
return /* @__PURE__ */ p("g", { children: T.map((e, n) => {
|
|
4603
|
-
let r = f ?
|
|
4681
|
+
let r = f ? qt(e.value, f).color : void 0, i = f ? Jt(e.value, f, g.value, _.value) : !0;
|
|
4604
4682
|
return /* @__PURE__ */ p("rect", {
|
|
4605
4683
|
x: e.col * (t + 2),
|
|
4606
4684
|
y: e.row * (t + 2),
|
|
@@ -4609,7 +4687,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4609
4687
|
rx: 1.5,
|
|
4610
4688
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4611
4689
|
fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4612
|
-
"data-day":
|
|
4690
|
+
"data-day": rr(e.date)
|
|
4613
4691
|
}, n);
|
|
4614
4692
|
}) });
|
|
4615
4693
|
}
|
|
@@ -4620,7 +4698,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4620
4698
|
flexDirection: "column",
|
|
4621
4699
|
gap: "0.5rem"
|
|
4622
4700
|
},
|
|
4623
|
-
children: [E, /* @__PURE__ */ p(
|
|
4701
|
+
children: [E, /* @__PURE__ */ p(Yt, {
|
|
4624
4702
|
options: f,
|
|
4625
4703
|
range: g,
|
|
4626
4704
|
hidden: _,
|
|
@@ -4630,23 +4708,23 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4630
4708
|
}
|
|
4631
4709
|
//#endregion
|
|
4632
4710
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4633
|
-
function
|
|
4711
|
+
function or({ data: e, title: t, description: n, width: r, height: s, yTicks: l = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: g, tooltip: v, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
|
|
4634
4712
|
o();
|
|
4635
|
-
let
|
|
4636
|
-
T && !
|
|
4637
|
-
T &&
|
|
4713
|
+
let O = b ? Ue : He, ee = s ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = i([0, Math.max(0, k - 1)]), te = c(null);
|
|
4714
|
+
T && !te.current && (te.current = ft(T)), a(() => () => {
|
|
4715
|
+
T && pt(T);
|
|
4638
4716
|
}), a(() => {
|
|
4639
|
-
let e =
|
|
4717
|
+
let e = te.current;
|
|
4640
4718
|
if (!e) return;
|
|
4641
4719
|
let t = e.window.value, n = j.peek();
|
|
4642
4720
|
t && (t[0] !== n[0] || t[1] !== n[1]) && (j.value = t);
|
|
4643
4721
|
}), a(() => {
|
|
4644
|
-
let e =
|
|
4722
|
+
let e = te.current;
|
|
4645
4723
|
if (!e) return;
|
|
4646
4724
|
let t = j.value, n = e.window.peek();
|
|
4647
4725
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4648
4726
|
});
|
|
4649
|
-
let
|
|
4727
|
+
let M = A ? e.slice(j.value[0], j.value[1] + 1) : e, N = M.length > 0, P = N ? Math.min(...M.map((e) => e.low)) : 0, F = N ? Math.max(...M.map((e) => e.high)) : 1, ne = N ? Math.max(1, ...M.map((e) => e.volume ?? 0)) : 1, re = M.map((e) => e.t);
|
|
4650
4728
|
return /* @__PURE__ */ m("div", {
|
|
4651
4729
|
style: {
|
|
4652
4730
|
display: "flex",
|
|
@@ -4658,7 +4736,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4658
4736
|
title: t,
|
|
4659
4737
|
description: n,
|
|
4660
4738
|
width: r,
|
|
4661
|
-
height:
|
|
4739
|
+
height: ee,
|
|
4662
4740
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4663
4741
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4664
4742
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -4668,7 +4746,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4668
4746
|
/* @__PURE__ */ p("th", { children: "Low" }),
|
|
4669
4747
|
/* @__PURE__ */ p("th", { children: "Close" })
|
|
4670
4748
|
] }) }),
|
|
4671
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
4749
|
+
/* @__PURE__ */ p("tbody", { children: M.map((e, t) => /* @__PURE__ */ m("tr", { children: [
|
|
4672
4750
|
/* @__PURE__ */ p("td", { children: e.t }),
|
|
4673
4751
|
/* @__PURE__ */ p("td", { children: e.open }),
|
|
4674
4752
|
/* @__PURE__ */ p("td", { children: e.high }),
|
|
@@ -4677,18 +4755,18 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4677
4755
|
] }, t)) })
|
|
4678
4756
|
] }),
|
|
4679
4757
|
className: y,
|
|
4680
|
-
"data-state":
|
|
4758
|
+
"data-state": N ? void 0 : "empty",
|
|
4681
4759
|
plain: b,
|
|
4682
|
-
tooltip: v !== !1 &&
|
|
4683
|
-
if (v === !1 || !
|
|
4684
|
-
let n = e -
|
|
4760
|
+
tooltip: v !== !1 && N ? ({ width: e, height: t }) => {
|
|
4761
|
+
if (v === !1 || !N) return;
|
|
4762
|
+
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4685
4763
|
if (n <= 0) return;
|
|
4686
|
-
let i = _(
|
|
4764
|
+
let i = _(re, [0, n], .3), a = r - (g ? Math.min(r * .2, 60) : 0), o = h([P, F], [a, 0]);
|
|
4687
4765
|
if (E === "axis") return {
|
|
4688
|
-
points:
|
|
4766
|
+
points: M.map((e, t) => ({
|
|
4689
4767
|
id: `c-${t}`,
|
|
4690
|
-
cx:
|
|
4691
|
-
cy:
|
|
4768
|
+
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4769
|
+
cy: O.top + o.map(e.high),
|
|
4692
4770
|
label: e.t,
|
|
4693
4771
|
value: e.close,
|
|
4694
4772
|
segments: [
|
|
@@ -4712,21 +4790,21 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4712
4790
|
})),
|
|
4713
4791
|
mode: "axis",
|
|
4714
4792
|
format: (e) => {
|
|
4715
|
-
let t =
|
|
4793
|
+
let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4716
4794
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4717
4795
|
}
|
|
4718
4796
|
};
|
|
4719
|
-
let s = h([
|
|
4797
|
+
let s = h([P, F], [r, 0]);
|
|
4720
4798
|
return {
|
|
4721
|
-
points:
|
|
4799
|
+
points: M.map((e, t) => ({
|
|
4722
4800
|
id: `c-${t}`,
|
|
4723
|
-
cx:
|
|
4724
|
-
cy:
|
|
4801
|
+
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4802
|
+
cy: O.top + s.map(e.high),
|
|
4725
4803
|
label: e.t,
|
|
4726
4804
|
value: e.close
|
|
4727
4805
|
})),
|
|
4728
4806
|
format: (e) => {
|
|
4729
|
-
let t =
|
|
4807
|
+
let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4730
4808
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4731
4809
|
}
|
|
4732
4810
|
};
|
|
@@ -4739,19 +4817,19 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4739
4817
|
j.value = [0, Math.max(0, k - 1)];
|
|
4740
4818
|
} : void 0,
|
|
4741
4819
|
children: ({ width: e, height: t }) => {
|
|
4742
|
-
let n = e -
|
|
4743
|
-
if (n <= 0 || !
|
|
4744
|
-
let i = _(
|
|
4820
|
+
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4821
|
+
if (n <= 0 || !N) return null;
|
|
4822
|
+
let i = _(re, [0, n], .3), a = h([P, F], [r, 0]), o = g ? Math.min(r * .2, 60) : 0, s = r - o, c = h([P, F], [s, 0]), v = i.bandwidth;
|
|
4745
4823
|
return /* @__PURE__ */ m("g", {
|
|
4746
|
-
transform: `translate(${
|
|
4824
|
+
transform: `translate(${O.left},${O.top})`,
|
|
4747
4825
|
children: [
|
|
4748
|
-
!b && /* @__PURE__ */ p(
|
|
4826
|
+
!b && /* @__PURE__ */ p(vt, {
|
|
4749
4827
|
scale: a,
|
|
4750
4828
|
orientation: "y",
|
|
4751
4829
|
length: n,
|
|
4752
4830
|
tickCount: l
|
|
4753
4831
|
}),
|
|
4754
|
-
|
|
4832
|
+
M.map((e, t) => {
|
|
4755
4833
|
let n = (i.map(e.t) ?? 0) + v / 2, r = e.close >= e.open, a = r ? u : d, l = c.map(e.open), f = c.map(e.close), h = Math.min(l, f), _ = Math.max(1, Math.abs(f - l));
|
|
4756
4834
|
return /* @__PURE__ */ m("g", {
|
|
4757
4835
|
"data-candle": r ? "up" : "down",
|
|
@@ -4775,9 +4853,9 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4775
4853
|
}),
|
|
4776
4854
|
g && e.volume !== void 0 && /* @__PURE__ */ p("rect", {
|
|
4777
4855
|
x: n - v / 2,
|
|
4778
|
-
y: s + (o - e.volume /
|
|
4856
|
+
y: s + (o - e.volume / ne * o),
|
|
4779
4857
|
width: v,
|
|
4780
|
-
height: e.volume /
|
|
4858
|
+
height: e.volume / ne * o,
|
|
4781
4859
|
fill: a,
|
|
4782
4860
|
fillOpacity: .4,
|
|
4783
4861
|
"data-volume": ""
|
|
@@ -4785,7 +4863,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4785
4863
|
]
|
|
4786
4864
|
}, t);
|
|
4787
4865
|
}),
|
|
4788
|
-
!b &&
|
|
4866
|
+
!b && Ct(x, {
|
|
4789
4867
|
xScale: i,
|
|
4790
4868
|
yScale: c,
|
|
4791
4869
|
innerW: n,
|
|
@@ -4795,7 +4873,8 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4795
4873
|
scale: i,
|
|
4796
4874
|
orientation: "x",
|
|
4797
4875
|
length: n,
|
|
4798
|
-
transform: `translate(0,${r})
|
|
4876
|
+
transform: `translate(0,${r})`,
|
|
4877
|
+
...D ? { format: D } : {}
|
|
4799
4878
|
}), /* @__PURE__ */ p($, {
|
|
4800
4879
|
scale: a,
|
|
4801
4880
|
orientation: "y",
|
|
@@ -4806,12 +4885,12 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4806
4885
|
});
|
|
4807
4886
|
}
|
|
4808
4887
|
}),
|
|
4809
|
-
S && !C && k > 1 && /* @__PURE__ */ p(
|
|
4888
|
+
S && !C && k > 1 && /* @__PURE__ */ p(zt, {
|
|
4810
4889
|
count: k,
|
|
4811
4890
|
window: j,
|
|
4812
4891
|
label: "Time range"
|
|
4813
4892
|
}),
|
|
4814
|
-
C && k > 1 && /* @__PURE__ */ p(
|
|
4893
|
+
C && k > 1 && /* @__PURE__ */ p(Bt, {
|
|
4815
4894
|
count: k,
|
|
4816
4895
|
window: j,
|
|
4817
4896
|
label: "Time range"
|
|
@@ -4821,10 +4900,10 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4821
4900
|
}
|
|
4822
4901
|
//#endregion
|
|
4823
4902
|
//#region src/charts/polar/polar.tsx
|
|
4824
|
-
var
|
|
4825
|
-
function
|
|
4903
|
+
var sr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4904
|
+
function cr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: s = 4, max: c, tooltip: l, className: u, plain: d }) {
|
|
4826
4905
|
o();
|
|
4827
|
-
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4906
|
+
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y = xe(_), b = /* @__PURE__ */ m("table", { children: [
|
|
4828
4907
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4829
4908
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4830
4909
|
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: e.label }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
@@ -4834,7 +4913,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4834
4913
|
cx: n,
|
|
4835
4914
|
cy: r,
|
|
4836
4915
|
outerR: i,
|
|
4837
|
-
rScale:
|
|
4916
|
+
rScale: Se([0, v], [0, i])
|
|
4838
4917
|
};
|
|
4839
4918
|
};
|
|
4840
4919
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -4851,7 +4930,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4851
4930
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4852
4931
|
return {
|
|
4853
4932
|
points: e.map((e, t) => {
|
|
4854
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4933
|
+
let n = y.center(e.label) ?? 0, [o, s] = be(r, i, a.map(e.value), n);
|
|
4855
4934
|
return {
|
|
4856
4935
|
id: `p-${t}`,
|
|
4857
4936
|
cx: o,
|
|
@@ -4867,7 +4946,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4867
4946
|
if (!g) return null;
|
|
4868
4947
|
let { cx: i, cy: a, outerR: o, rScale: c } = x(t, n), l = Array.from({ length: s }, (e, t) => o * (t + 1) / s), u = e.map((e) => {
|
|
4869
4948
|
let t = y.center(e.label) ?? 0;
|
|
4870
|
-
return
|
|
4949
|
+
return be(i, a, c.map(e.value), t);
|
|
4871
4950
|
});
|
|
4872
4951
|
return /* @__PURE__ */ m("g", { children: [
|
|
4873
4952
|
!d && l.map((e, t) => /* @__PURE__ */ p("circle", {
|
|
@@ -4882,13 +4961,13 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4882
4961
|
r === "bar" ? e.map((e, t) => {
|
|
4883
4962
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4884
4963
|
return /* @__PURE__ */ p("path", {
|
|
4885
|
-
d:
|
|
4886
|
-
fill: e.color ??
|
|
4964
|
+
d: N(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4965
|
+
fill: e.color ?? sr[t % sr.length],
|
|
4887
4966
|
fillOpacity: .85,
|
|
4888
4967
|
"data-wedge": ""
|
|
4889
4968
|
}, t);
|
|
4890
4969
|
}) : (() => {
|
|
4891
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4970
|
+
let t = [...u, u[0]], n = e[0]?.color ?? sr[0];
|
|
4892
4971
|
return /* @__PURE__ */ m(f, { children: [r === "area" && /* @__PURE__ */ p("path", {
|
|
4893
4972
|
d: `${E(t, "linear")}Z`,
|
|
4894
4973
|
fill: n,
|
|
@@ -4904,7 +4983,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4904
4983
|
})] });
|
|
4905
4984
|
})(),
|
|
4906
4985
|
!d && e.map((e, t) => {
|
|
4907
|
-
let n = y.center(e.label) ?? 0, [r, s] =
|
|
4986
|
+
let n = y.center(e.label) ?? 0, [r, s] = be(i, a, o + 12, n);
|
|
4908
4987
|
return /* @__PURE__ */ p("text", {
|
|
4909
4988
|
x: r,
|
|
4910
4989
|
y: s,
|
|
@@ -4922,10 +5001,10 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4922
5001
|
}
|
|
4923
5002
|
//#endregion
|
|
4924
5003
|
//#region src/charts/gauge/gauge.tsx
|
|
4925
|
-
var
|
|
4926
|
-
function
|
|
5004
|
+
var lr = Math.PI / 180;
|
|
5005
|
+
function ur({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: s = 5, title: c, description: l, width: u, height: d, className: f, plain: h }) {
|
|
4927
5006
|
o();
|
|
4928
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
5007
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * lr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
4929
5008
|
return /* @__PURE__ */ p(Q, {
|
|
4930
5009
|
title: c,
|
|
4931
5010
|
description: l,
|
|
@@ -4945,7 +5024,7 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4945
5024
|
}], w = t, T = Array.from({ length: s + 1 }, (e, n) => t + _ * n / s);
|
|
4946
5025
|
return /* @__PURE__ */ m("g", { children: [
|
|
4947
5026
|
/* @__PURE__ */ p("path", {
|
|
4948
|
-
d:
|
|
5027
|
+
d: N(c, l, u, f, x, x + b),
|
|
4949
5028
|
fill: "var(--cascivo-chart-grid)",
|
|
4950
5029
|
fillOpacity: .25,
|
|
4951
5030
|
"data-track": ""
|
|
@@ -4953,13 +5032,13 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4953
5032
|
C.map((e, t) => {
|
|
4954
5033
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
4955
5034
|
return w = e.upTo, /* @__PURE__ */ p("path", {
|
|
4956
|
-
d:
|
|
5035
|
+
d: N(c, l, u, f, r, i),
|
|
4957
5036
|
fill: e.color,
|
|
4958
5037
|
"data-zone": ""
|
|
4959
5038
|
}, t);
|
|
4960
5039
|
}),
|
|
4961
5040
|
!h && T.map((e, t) => {
|
|
4962
|
-
let n = S(e), [r, i] =
|
|
5041
|
+
let n = S(e), [r, i] = be(c, l, f - 2, n), [a, o] = be(c, l, f - 8, n), [s, u] = be(c, l, f - 18, n);
|
|
4963
5042
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("line", {
|
|
4964
5043
|
x1: r,
|
|
4965
5044
|
y1: i,
|
|
@@ -4979,7 +5058,7 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4979
5058
|
})] }, t);
|
|
4980
5059
|
}),
|
|
4981
5060
|
(() => {
|
|
4982
|
-
let [e, t] =
|
|
5061
|
+
let [e, t] = be(c, l, g, S(v));
|
|
4983
5062
|
return /* @__PURE__ */ p("line", {
|
|
4984
5063
|
x1: c,
|
|
4985
5064
|
y1: l,
|
|
@@ -5013,4 +5092,4 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5013
5092
|
});
|
|
5014
5093
|
}
|
|
5015
5094
|
//#endregion
|
|
5016
|
-
export {
|
|
5095
|
+
export { We as AXIS_CHAR_PX, un as AreaChart, $ as Axis, mn as BarChart, On as Boxplot, zt as Brush, Mn as BubbleChart, Wn as Bullet, ar as Calendar, or as Candlestick, Qe as CanvasLayer, Mt as ChartDefs, Q as ChartFrame, Fn as ComboChart, He as DEFAULT_MARGINS, Dt as DataLabel, Bt as DataZoom, Jn as Funnel, ur as Gauge, Pt as Glyph, vt as GridLines, In as Heatmap, En as Histogram, Tn as Kpi, Zt as Legend, on as LineChart, Sn as Meter, Ue as PLAIN_MARGINS, _n as PieChart, cr as Polar, Hn as Radar, Kn as RadialBar, er as Sankey, yn as ScatterChart, bn as Sparkline, Xn as Stream, Qn as Sunburst, Rt as Text, at as Toolbox, Rn as Treemap, Yt as VisualMap, mt as _syncGroupCount, De as aggregate, xe as angleBand, wt as annotationSummary, N as arcPath, M as areaPath, qe as autoLabelStride, _ as bandScale, Oe as bin, R as binValues, Be as bindStream, z as boxStats, L as cellPath, Le as decimate, ge as divergingRamp, lt as download, Ne as encode, Pe as encodeCategory, B as extent, jt as fillFor, Ce as filter, ft as getSyncGroup, Nt as glyphPath, kt as gradientId, rt as isZoomed, Ge as leftMarginForLabels, E as linePath, h as linearScale, X as linkPath, y as logScale, Fe as lttb, qt as mapVisual, Y as maxDepth, Ie as minmax, ne as nearestIndex, g as niceTicks, nt as panWindow, J as partition, At as patternId, Kt as pieceIndex, be as polarPoint, w as quantize, Se as radiusScale, ye as rampLightness, _e as rampOf, ve as rampStops, je as regression, pt as releaseSyncGroup, St as renderAnnotation, Ct as renderAnnotations, $e as resolveColor, Et as resolveLabels, Ke as rightMarginForLabels, oe as sankeyLayout, he as sequentialRamp, st as serializeSvg, Te as sort, T as splitDefined, v as sqrtScale, W as squarify, P as stackSeries, K as streamExtent, G as streamLayout, q as sumValue, ct as svgToPngBlob, C as timeScale, F as toStackedSeries, Ve as useChartSize, ze as useStreamSeries, Jt as visualVisible, ie as voronoiCells, re as voronoiFind, Lt as wrapText, tt as zoomWindow };
|