@cascivo/charts 0.5.0 → 0.5.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/index.d.ts +14 -1
- package/dist/index.js +661 -641
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -329,7 +329,7 @@ function L(e, t) {
|
|
|
329
329
|
}
|
|
330
330
|
//#endregion
|
|
331
331
|
//#region src/engine/voronoi.ts
|
|
332
|
-
function
|
|
332
|
+
function ee(e, t, n) {
|
|
333
333
|
let r = -1, i = Infinity;
|
|
334
334
|
for (let a = 0; a < e.length; a++) {
|
|
335
335
|
let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
|
|
@@ -337,7 +337,7 @@ function R(e, t, n) {
|
|
|
337
337
|
}
|
|
338
338
|
return r;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function R(e, t, n, r, i) {
|
|
341
341
|
if (e.length === 0) return e;
|
|
342
342
|
let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
|
|
343
343
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -349,7 +349,7 @@ function z(e, t, n, r, i) {
|
|
|
349
349
|
}
|
|
350
350
|
return a;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function te(e, t) {
|
|
353
353
|
let n = [
|
|
354
354
|
[t.x0, t.y0],
|
|
355
355
|
[t.x1, t.y0],
|
|
@@ -361,21 +361,21 @@ function ee(e, t) {
|
|
|
361
361
|
for (let n = 0; n < e.length && i.length > 0; n++) {
|
|
362
362
|
if (n === r) continue;
|
|
363
363
|
let a = e[n];
|
|
364
|
-
i =
|
|
364
|
+
i = R(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
|
|
365
365
|
}
|
|
366
366
|
return i;
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function ne(e) {
|
|
370
370
|
return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
|
|
371
371
|
}
|
|
372
372
|
//#endregion
|
|
373
373
|
//#region src/engine/stats.ts
|
|
374
|
-
function
|
|
374
|
+
function z(e) {
|
|
375
375
|
let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
|
|
376
376
|
return (e[Math.floor(t * .75)] ?? 0) - n;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function B(e, t) {
|
|
379
379
|
if (e.length === 0) return [];
|
|
380
380
|
let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
|
|
381
381
|
if (i === a) return [{
|
|
@@ -386,7 +386,7 @@ function te(e, t) {
|
|
|
386
386
|
let o;
|
|
387
387
|
if (t !== void 0 && t > 0) o = t;
|
|
388
388
|
else {
|
|
389
|
-
let e = 2 *
|
|
389
|
+
let e = 2 * z(n) * r ** (-1 / 3);
|
|
390
390
|
o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
|
|
391
391
|
}
|
|
392
392
|
let s = (a - i) / o, c = Array.from({ length: o }, (e, t) => ({
|
|
@@ -400,7 +400,7 @@ function te(e, t) {
|
|
|
400
400
|
}
|
|
401
401
|
return c;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function V(e) {
|
|
404
404
|
if (e.length === 0) return {
|
|
405
405
|
min: 0,
|
|
406
406
|
q1: 0,
|
|
@@ -422,7 +422,7 @@ function H(e) {
|
|
|
422
422
|
outliers: d
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function H(e) {
|
|
426
426
|
if (e.length === 0) return [0, 1];
|
|
427
427
|
let t = e[0] ?? 0, n = e[0] ?? 0;
|
|
428
428
|
for (let r of e) r < t && (t = r), r > n && (n = r);
|
|
@@ -430,11 +430,11 @@ function U(e) {
|
|
|
430
430
|
}
|
|
431
431
|
//#endregion
|
|
432
432
|
//#region src/engine/treemap.ts
|
|
433
|
-
function
|
|
433
|
+
function U(e, t, n) {
|
|
434
434
|
let r = Math.max(...e), i = Math.min(...e);
|
|
435
435
|
return Math.max(t * t * r / (n * n), n * n / (t * t * i));
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function W(e, t, n, r, i, a, o) {
|
|
438
438
|
let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
|
|
439
439
|
for (let t = 0; t < e.length; t++) {
|
|
440
440
|
let n = e[t] ?? 0, u = a[t] ?? "";
|
|
@@ -459,39 +459,39 @@ function G(e, t, n, r, i, a, o) {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function G(e, t, n, r, i, a) {
|
|
463
463
|
if (e.length === 0 || r <= 0 || i <= 0) return;
|
|
464
464
|
let o = e.reduce((e, t) => e + t.value, 0);
|
|
465
465
|
if (o === 0) return;
|
|
466
466
|
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
467
|
for (; m < c.length;) {
|
|
468
468
|
let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
|
|
469
|
-
if (u.length === 0 ||
|
|
469
|
+
if (u.length === 0 || U(g, f, _) <= U(u, f, p)) u = g, d = [...d, h], p = _, m++;
|
|
470
470
|
else {
|
|
471
471
|
let o = p / s;
|
|
472
472
|
if (r >= i) {
|
|
473
473
|
let s = o * r;
|
|
474
|
-
|
|
474
|
+
W(u, t, n, s, i, d, a), G(e.slice(m), t + s, n, r - s, i, a);
|
|
475
475
|
} else {
|
|
476
476
|
let s = o * i;
|
|
477
|
-
|
|
477
|
+
W(u, t, n, r, s, d, a), G(e.slice(m), t, n + s, r, i - s, a);
|
|
478
478
|
}
|
|
479
479
|
return;
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
if (u.length > 0) {
|
|
483
483
|
let e = p / s;
|
|
484
|
-
r >= i ?
|
|
484
|
+
r >= i ? W(u, t, n, e * r, i, d, a) : W(u, t, n, r, e * i, d, a);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function K(e, t, n) {
|
|
488
488
|
if (e.length === 0 || t <= 0 || n <= 0) return [];
|
|
489
489
|
let r = [...e].sort((e, t) => t.value - e.value), i = [];
|
|
490
|
-
return
|
|
490
|
+
return G(r, 0, 0, t, n, i), i;
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/engine/stream.ts
|
|
494
|
-
function
|
|
494
|
+
function re(e, t = "silhouette") {
|
|
495
495
|
let n = F(e);
|
|
496
496
|
if (t === "zero") return n;
|
|
497
497
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
@@ -500,39 +500,39 @@ function ne(e, t = "silhouette") {
|
|
|
500
500
|
return [e - r, t - r];
|
|
501
501
|
}));
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function ie(e) {
|
|
504
504
|
let t = 0, n = 0;
|
|
505
505
|
for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
|
|
506
506
|
return [t, n];
|
|
507
507
|
}
|
|
508
508
|
//#endregion
|
|
509
509
|
//#region src/engine/hierarchy.ts
|
|
510
|
-
function
|
|
511
|
-
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e +
|
|
510
|
+
function q(e) {
|
|
511
|
+
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + q(t), 0) : e.value ?? 0;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function J(e, t = 2 * Math.PI) {
|
|
514
514
|
let n = [], r = (e, t, i, a) => {
|
|
515
515
|
if (n.push({
|
|
516
516
|
node: e,
|
|
517
517
|
depth: t,
|
|
518
518
|
a0: i,
|
|
519
519
|
a1: a,
|
|
520
|
-
value:
|
|
520
|
+
value: q(e)
|
|
521
521
|
}), !e.children) return;
|
|
522
|
-
let o = a - i, s =
|
|
522
|
+
let o = a - i, s = q(e) || 1, c = i;
|
|
523
523
|
for (let n of e.children) {
|
|
524
|
-
let e = c + o *
|
|
524
|
+
let e = c + o * q(n) / s;
|
|
525
525
|
r(n, t + 1, c, e), c = e;
|
|
526
526
|
}
|
|
527
527
|
};
|
|
528
528
|
return r(e, 0, 0, t), n;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function ae(e) {
|
|
531
531
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
532
532
|
}
|
|
533
533
|
//#endregion
|
|
534
534
|
//#region src/engine/sankey.ts
|
|
535
|
-
function
|
|
535
|
+
function oe(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
|
|
536
536
|
let o = /* @__PURE__ */ new Map();
|
|
537
537
|
for (let t of e) o.set(t.id, {
|
|
538
538
|
...t,
|
|
@@ -586,61 +586,61 @@ function Z(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }
|
|
|
586
586
|
links: v
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function se(e) {
|
|
590
590
|
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
591
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
592
592
|
}
|
|
593
593
|
//#endregion
|
|
594
594
|
//#region src/engine/ramp.ts
|
|
595
|
-
var
|
|
596
|
-
l:
|
|
597
|
-
c:
|
|
598
|
-
h:
|
|
599
|
-
}),
|
|
595
|
+
var ce = (e) => e < 0 ? 0 : e > 1 ? 1 : e, le = (e, t, n) => e + (t - e) * n, ue = (e, t, n) => ({
|
|
596
|
+
l: le(e.l, t.l, n),
|
|
597
|
+
c: le(e.c, t.c, n),
|
|
598
|
+
h: le(e.h, t.h, n)
|
|
599
|
+
}), Y = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, de = {
|
|
600
600
|
l: .95,
|
|
601
601
|
c: .04,
|
|
602
602
|
h: 232
|
|
603
|
-
},
|
|
603
|
+
}, fe = {
|
|
604
604
|
l: .34,
|
|
605
605
|
c: .15,
|
|
606
606
|
h: 274
|
|
607
|
-
},
|
|
607
|
+
}, pe = {
|
|
608
608
|
l: .48,
|
|
609
609
|
c: .14,
|
|
610
610
|
h: 248
|
|
611
|
-
},
|
|
611
|
+
}, me = {
|
|
612
612
|
l: .96,
|
|
613
613
|
c: .02,
|
|
614
614
|
h: 110
|
|
615
|
-
},
|
|
615
|
+
}, he = {
|
|
616
616
|
l: .52,
|
|
617
617
|
c: .15,
|
|
618
618
|
h: 42
|
|
619
619
|
};
|
|
620
|
-
function
|
|
621
|
-
return
|
|
620
|
+
function ge(e) {
|
|
621
|
+
return Y(ue(de, fe, ce(e)));
|
|
622
622
|
}
|
|
623
|
-
function
|
|
624
|
-
let t =
|
|
625
|
-
return
|
|
623
|
+
function _e(e) {
|
|
624
|
+
let t = ce(e);
|
|
625
|
+
return Y(t < .5 ? ue(pe, me, t * 2) : ue(me, he, (t - .5) * 2));
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
return e === "diverging" ?
|
|
627
|
+
function ve(e) {
|
|
628
|
+
return e === "diverging" ? _e : ge;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
631
|
-
let n =
|
|
630
|
+
function ye(e, t = "sequential") {
|
|
631
|
+
let n = ve(t);
|
|
632
632
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function be(e) {
|
|
635
635
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
636
636
|
return t ? Number(t[1]) : NaN;
|
|
637
637
|
}
|
|
638
638
|
//#endregion
|
|
639
639
|
//#region src/engine/polar.ts
|
|
640
|
-
function
|
|
640
|
+
function X(e, t, n, r) {
|
|
641
641
|
return [C(e + n * Math.sin(r)), C(t - n * Math.cos(r))];
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function xe(e, t = [0, 2 * Math.PI]) {
|
|
644
644
|
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
645
|
let n = i.get(e);
|
|
646
646
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -655,25 +655,25 @@ function be(e, t = [0, 2 * Math.PI]) {
|
|
|
655
655
|
step: r
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Se(e, t) {
|
|
659
659
|
return m(e, t);
|
|
660
660
|
}
|
|
661
661
|
//#endregion
|
|
662
662
|
//#region src/engine/transform.ts
|
|
663
|
-
function
|
|
663
|
+
function Ce(e, t) {
|
|
664
664
|
return e.filter((e, n) => t(e, n));
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function we(e, t) {
|
|
667
667
|
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
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function Te(e, t, n = "asc") {
|
|
670
670
|
let r = typeof t == "function" ? t : (e) => e[t], i = n === "desc" ? -1 : 1;
|
|
671
671
|
return e.map((e, t) => ({
|
|
672
672
|
row: e,
|
|
673
673
|
i: t
|
|
674
|
-
})).sort((e, t) =>
|
|
674
|
+
})).sort((e, t) => we(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function Ee(e, t) {
|
|
677
677
|
if (e === "count") return t.length;
|
|
678
678
|
if (t.length === 0) return 0;
|
|
679
679
|
switch (e) {
|
|
@@ -687,7 +687,7 @@ function Te(e, t) {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function De(e, t) {
|
|
691
691
|
let n = typeof t.groupBy == "string" ? [t.groupBy] : t.groupBy, r = /* @__PURE__ */ new Map(), i = [];
|
|
692
692
|
for (let t of e) {
|
|
693
693
|
let e = n.map((e) => String(t[e])).join("\0"), a = r.get(e);
|
|
@@ -696,11 +696,11 @@ function Ee(e, t) {
|
|
|
696
696
|
return i.map((e) => {
|
|
697
697
|
let i = r.get(e), a = {};
|
|
698
698
|
for (let e of n) a[e] = i[0][e];
|
|
699
|
-
for (let [e, n] of Object.entries(t.ops)) a[e] =
|
|
699
|
+
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
700
|
return a;
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function Oe(e, t = {}) {
|
|
704
704
|
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
705
|
x0: r + t * o,
|
|
706
706
|
x1: r + (t + 1) * o,
|
|
@@ -714,7 +714,7 @@ function De(e, t = {}) {
|
|
|
714
714
|
}
|
|
715
715
|
return s;
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function ke(e, t) {
|
|
718
718
|
let n = t.length, r = e.map((e, n) => [...e, t[n]]);
|
|
719
719
|
for (let e = 0; e < n; e++) {
|
|
720
720
|
let t = e;
|
|
@@ -732,12 +732,12 @@ function Oe(e, t) {
|
|
|
732
732
|
return Math.abs(i) < 1e-12 ? 0 : r[t][n] / i;
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Ae(e, t) {
|
|
736
736
|
let n = e.map((e) => e[1]), r = n.reduce((e, t) => e + t, 0) / n.length, i = 0, a = 0;
|
|
737
737
|
for (let [n, o] of e) i += (o - t(n)) ** 2, a += (o - r) ** 2;
|
|
738
738
|
return a === 0 ? 1 : 1 - i / a;
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function je(e, t = {}) {
|
|
741
741
|
let n = t.type ?? "linear", r = [...e].sort((e, t) => e[0] - t[0]), i = r.map((e) => e[0]), a = () => {
|
|
742
742
|
let e = r.length ? r.reduce((e, t) => e + t[1], 0) / r.length : 0;
|
|
743
743
|
return {
|
|
@@ -751,11 +751,11 @@ function Ae(e, t = {}) {
|
|
|
751
751
|
if (n === "exponential") {
|
|
752
752
|
let e = r.filter((e) => e[1] > 0);
|
|
753
753
|
if (e.length < 2) return a();
|
|
754
|
-
let t =
|
|
754
|
+
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
755
|
return {
|
|
756
756
|
predict: s,
|
|
757
757
|
points: i.map((e) => [e, s(e)]),
|
|
758
|
-
r2:
|
|
758
|
+
r2: Ae(r, s),
|
|
759
759
|
coefficients: [n, o]
|
|
760
760
|
};
|
|
761
761
|
}
|
|
@@ -767,18 +767,18 @@ function Ae(e, t = {}) {
|
|
|
767
767
|
for (let t = 0; t < o; t++) s[e][t] += n[e] * n[t];
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
let l =
|
|
770
|
+
let l = ke(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
|
|
771
771
|
return {
|
|
772
772
|
predict: u,
|
|
773
773
|
points: i.map((e) => [e, u(e)]),
|
|
774
|
-
r2:
|
|
774
|
+
r2: Ae(r, u),
|
|
775
775
|
coefficients: l
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
778
|
//#endregion
|
|
779
779
|
//#region src/engine/dataset.ts
|
|
780
|
-
var
|
|
781
|
-
function
|
|
780
|
+
var Me = (e) => typeof e == "number" ? e : Number(e);
|
|
781
|
+
function Ne(e, t) {
|
|
782
782
|
let n = (e) => e.x, r = (e) => e.y;
|
|
783
783
|
if (!t.series) return {
|
|
784
784
|
series: [{
|
|
@@ -786,7 +786,7 @@ function Me(e, t) {
|
|
|
786
786
|
label: t.label ?? t.y,
|
|
787
787
|
data: e.map((e) => ({
|
|
788
788
|
x: e[t.x],
|
|
789
|
-
y:
|
|
789
|
+
y: Me(e[t.y])
|
|
790
790
|
}))
|
|
791
791
|
}],
|
|
792
792
|
x: n,
|
|
@@ -801,7 +801,7 @@ function Me(e, t) {
|
|
|
801
801
|
data: []
|
|
802
802
|
}, i.set(e, r), a.push(e)), r.data.push({
|
|
803
803
|
x: n[t.x],
|
|
804
|
-
y:
|
|
804
|
+
y: Me(n[t.y])
|
|
805
805
|
});
|
|
806
806
|
}
|
|
807
807
|
return {
|
|
@@ -810,15 +810,15 @@ function Me(e, t) {
|
|
|
810
810
|
y: r
|
|
811
811
|
};
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function Pe(e, t) {
|
|
814
814
|
return e.map((e) => ({
|
|
815
815
|
label: String(e[t.category]),
|
|
816
|
-
value:
|
|
816
|
+
value: Me(e[t.value])
|
|
817
817
|
}));
|
|
818
818
|
}
|
|
819
819
|
//#endregion
|
|
820
820
|
//#region src/engine/decimate.ts
|
|
821
|
-
function
|
|
821
|
+
function Fe(e, t) {
|
|
822
822
|
let n = e.length;
|
|
823
823
|
if (t >= n || t < 3) return e.slice();
|
|
824
824
|
let r = [e[0]], i = (n - 2) / (t - 2), a = 0;
|
|
@@ -835,7 +835,7 @@ function Pe(e, t) {
|
|
|
835
835
|
}
|
|
836
836
|
return r.push(e[n - 1]), r;
|
|
837
837
|
}
|
|
838
|
-
function
|
|
838
|
+
function Ie(e, t) {
|
|
839
839
|
let n = e.length;
|
|
840
840
|
if (t >= n || t < 4) return e.slice();
|
|
841
841
|
let r = Math.max(1, Math.floor(t / 2)), i = n / r, a = [e[0]];
|
|
@@ -848,27 +848,27 @@ function Fe(e, t) {
|
|
|
848
848
|
}
|
|
849
849
|
return a.push(e[n - 1]), a;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
return n === "minmax" ?
|
|
851
|
+
function Le(e, t, n = "lttb") {
|
|
852
|
+
return n === "minmax" ? Ie(e, t) : Fe(e, t);
|
|
853
853
|
}
|
|
854
854
|
//#endregion
|
|
855
855
|
//#region src/stream/use-stream-series.ts
|
|
856
|
-
function
|
|
857
|
-
return e.length <= t.to ? e :
|
|
856
|
+
function Re(e, t) {
|
|
857
|
+
return e.length <= t.to ? e : Le(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function ze(e) {
|
|
860
860
|
let { capacity: n, source: i, decimate: o } = e, s = c(t({ capacity: n })).current, l = c(i);
|
|
861
861
|
return l.current = i, a(() => {
|
|
862
862
|
let e = l.current((e) => s.append(e));
|
|
863
863
|
return () => {
|
|
864
864
|
e(), s.dispose();
|
|
865
865
|
};
|
|
866
|
-
}), r(() => o ?
|
|
866
|
+
}), r(() => o ? Re(s.signal.value, o) : s.signal.value);
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function Be(n) {
|
|
869
869
|
let { capacity: r, source: i, decimate: a } = n, o = t({ capacity: r }), s = i((e) => o.append(e));
|
|
870
870
|
return {
|
|
871
|
-
signal: a ? e(() =>
|
|
871
|
+
signal: a ? e(() => Re(o.signal.value, a)) : o.signal,
|
|
872
872
|
stop: () => {
|
|
873
873
|
s(), o.dispose();
|
|
874
874
|
}
|
|
@@ -876,7 +876,7 @@ function ze(n) {
|
|
|
876
876
|
}
|
|
877
877
|
//#endregion
|
|
878
878
|
//#region src/core/use-chart.ts
|
|
879
|
-
function
|
|
879
|
+
function Ve(e = 400, t = 300) {
|
|
880
880
|
let n = c(null), r = i(e), o = i(t);
|
|
881
881
|
return a(() => {
|
|
882
882
|
let e = n.current;
|
|
@@ -904,7 +904,7 @@ function Be(e = 400, t = 300) {
|
|
|
904
904
|
height: o
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
var
|
|
907
|
+
var Z = {
|
|
908
908
|
top: 8,
|
|
909
909
|
right: 8,
|
|
910
910
|
bottom: 24,
|
|
@@ -914,20 +914,31 @@ var Ve = {
|
|
|
914
914
|
right: 2,
|
|
915
915
|
bottom: 2,
|
|
916
916
|
left: 2
|
|
917
|
-
}, Ue =
|
|
917
|
+
}, Ue = 6.5;
|
|
918
|
+
function We(e, t) {
|
|
919
|
+
if (t) return He.left;
|
|
920
|
+
let n = e.reduce((e, t) => Math.max(e, t.length), 0);
|
|
921
|
+
return Math.max(Z.left, Math.ceil(n * Ue + 12));
|
|
922
|
+
}
|
|
923
|
+
function Ge(e, t) {
|
|
924
|
+
if (e.length <= 1 || t <= 0) return;
|
|
925
|
+
let n = t / e.length, r = e.reduce((e, t) => Math.max(e, t.length), 0) * Ue + 6;
|
|
926
|
+
if (!(n >= r)) return Math.ceil(r / n);
|
|
927
|
+
}
|
|
928
|
+
var Ke = {
|
|
918
929
|
frame: "_frame_1xxqo_2",
|
|
919
930
|
"cascivo-chart-in": "_cascivo-chart-in_1xxqo_1",
|
|
920
931
|
fallback: "_fallback_1xxqo_62"
|
|
921
932
|
};
|
|
922
933
|
//#endregion
|
|
923
934
|
//#region src/core/data-point.ts
|
|
924
|
-
function
|
|
935
|
+
function qe(e) {
|
|
925
936
|
return `${e.label}: ${e.value}`;
|
|
926
937
|
}
|
|
927
938
|
//#endregion
|
|
928
939
|
//#region src/core/chart-tooltip.tsx
|
|
929
|
-
function
|
|
930
|
-
let n = t.format ? t.format(e) :
|
|
940
|
+
function Je({ point: e, model: t }) {
|
|
941
|
+
let n = t.format ? t.format(e) : qe(e), r = e.segments?.filter((e) => e.value !== 0);
|
|
931
942
|
return /* @__PURE__ */ f("div", {
|
|
932
943
|
role: "tooltip",
|
|
933
944
|
style: {
|
|
@@ -975,7 +986,7 @@ function Ge({ point: e, model: t }) {
|
|
|
975
986
|
}
|
|
976
987
|
//#endregion
|
|
977
988
|
//#region src/core/nearest.ts
|
|
978
|
-
function
|
|
989
|
+
function Ye(e, t, n, r = "xy") {
|
|
979
990
|
if (e.length === 0) return -1;
|
|
980
991
|
let i = 0, a = Infinity;
|
|
981
992
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -986,7 +997,7 @@ function Ke(e, t, n, r = "xy") {
|
|
|
986
997
|
}
|
|
987
998
|
//#endregion
|
|
988
999
|
//#region src/core/canvas-layer.tsx
|
|
989
|
-
function
|
|
1000
|
+
function Xe({ size: e, paint: t }) {
|
|
990
1001
|
let n = c(null);
|
|
991
1002
|
return a(() => {
|
|
992
1003
|
let { width: r, height: i } = e(), a = n.current;
|
|
@@ -1011,28 +1022,28 @@ function qe({ size: e, paint: t }) {
|
|
|
1011
1022
|
}
|
|
1012
1023
|
});
|
|
1013
1024
|
}
|
|
1014
|
-
function
|
|
1025
|
+
function Ze(e, t) {
|
|
1015
1026
|
let n = /var\((--[^,)]+)/.exec(t);
|
|
1016
1027
|
return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
|
|
1017
1028
|
}
|
|
1018
1029
|
//#endregion
|
|
1019
1030
|
//#region src/core/zoom.ts
|
|
1020
|
-
var
|
|
1021
|
-
function
|
|
1031
|
+
var Qe = 1;
|
|
1032
|
+
function $e(e, t, n, r) {
|
|
1022
1033
|
if (t <= 1) return [0, Math.max(0, t - 1)];
|
|
1023
1034
|
let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
|
|
1024
|
-
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s <
|
|
1035
|
+
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < Qe && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - Qe)), c = Math.min(t - 1, s + Qe)), [s, c];
|
|
1025
1036
|
}
|
|
1026
|
-
function
|
|
1037
|
+
function et(e, t, n) {
|
|
1027
1038
|
let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
|
|
1028
1039
|
return [o, o + a];
|
|
1029
1040
|
}
|
|
1030
|
-
function
|
|
1041
|
+
function tt(e, t) {
|
|
1031
1042
|
return e[0] > 0 || e[1] < t - 1;
|
|
1032
1043
|
}
|
|
1033
1044
|
//#endregion
|
|
1034
1045
|
//#region src/chrome/toolbox.tsx
|
|
1035
|
-
var
|
|
1046
|
+
var nt = {
|
|
1036
1047
|
display: "inline-flex",
|
|
1037
1048
|
alignItems: "center",
|
|
1038
1049
|
justifyContent: "center",
|
|
@@ -1047,7 +1058,7 @@ var $e = {
|
|
|
1047
1058
|
color: "var(--cascivo-color-foreground, inherit)",
|
|
1048
1059
|
cursor: "pointer"
|
|
1049
1060
|
};
|
|
1050
|
-
function
|
|
1061
|
+
function rt({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
|
|
1051
1062
|
let o = e;
|
|
1052
1063
|
return /* @__PURE__ */ p("div", {
|
|
1053
1064
|
role: "group",
|
|
@@ -1059,26 +1070,26 @@ function et({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1059
1070
|
children: [
|
|
1060
1071
|
o.png !== !1 && /* @__PURE__ */ f("button", {
|
|
1061
1072
|
type: "button",
|
|
1062
|
-
style:
|
|
1073
|
+
style: nt,
|
|
1063
1074
|
onClick: t,
|
|
1064
1075
|
children: u(l.charts.exportPng)
|
|
1065
1076
|
}),
|
|
1066
1077
|
o.svg !== !1 && /* @__PURE__ */ f("button", {
|
|
1067
1078
|
type: "button",
|
|
1068
|
-
style:
|
|
1079
|
+
style: nt,
|
|
1069
1080
|
onClick: n,
|
|
1070
1081
|
children: u(l.charts.exportSvg)
|
|
1071
1082
|
}),
|
|
1072
1083
|
o.dataView !== !1 && /* @__PURE__ */ f("button", {
|
|
1073
1084
|
type: "button",
|
|
1074
|
-
style:
|
|
1085
|
+
style: nt,
|
|
1075
1086
|
"aria-pressed": a,
|
|
1076
1087
|
onClick: r,
|
|
1077
1088
|
children: u(l.charts.dataView)
|
|
1078
1089
|
}),
|
|
1079
1090
|
o.restore !== !1 && /* @__PURE__ */ f("button", {
|
|
1080
1091
|
type: "button",
|
|
1081
|
-
style:
|
|
1092
|
+
style: nt,
|
|
1082
1093
|
onClick: i,
|
|
1083
1094
|
children: u(l.charts.restore)
|
|
1084
1095
|
})
|
|
@@ -1087,19 +1098,19 @@ function et({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1087
1098
|
}
|
|
1088
1099
|
//#endregion
|
|
1089
1100
|
//#region src/core/export.ts
|
|
1090
|
-
var
|
|
1101
|
+
var it = [
|
|
1091
1102
|
"fill",
|
|
1092
1103
|
"stroke",
|
|
1093
1104
|
"stop-color",
|
|
1094
1105
|
"color"
|
|
1095
1106
|
];
|
|
1096
|
-
function
|
|
1107
|
+
function at(e) {
|
|
1097
1108
|
let t = e.cloneNode(!0);
|
|
1098
1109
|
if (typeof getComputedStyle == "function") {
|
|
1099
1110
|
let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
|
|
1100
1111
|
for (let e = 0; e < n.length; e++) {
|
|
1101
1112
|
let t = getComputedStyle(n[e]), i = r[e];
|
|
1102
|
-
if (i) for (let e of
|
|
1113
|
+
if (i) for (let e of it) {
|
|
1103
1114
|
let n = t.getPropertyValue(e);
|
|
1104
1115
|
n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
|
|
1105
1116
|
}
|
|
@@ -1107,7 +1118,7 @@ function nt(e) {
|
|
|
1107
1118
|
}
|
|
1108
1119
|
return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
|
|
1109
1120
|
}
|
|
1110
|
-
function
|
|
1121
|
+
function ot(e, t) {
|
|
1111
1122
|
if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
|
|
1112
1123
|
let n = t.dpr ?? 1, r = document.createElement("canvas");
|
|
1113
1124
|
r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
|
|
@@ -1123,14 +1134,14 @@ function rt(e, t) {
|
|
|
1123
1134
|
}), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
1124
1135
|
}) : Promise.resolve(null);
|
|
1125
1136
|
}
|
|
1126
|
-
function
|
|
1137
|
+
function st(e, t) {
|
|
1127
1138
|
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
1128
1139
|
let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1129
1140
|
i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
1130
1141
|
}
|
|
1131
1142
|
//#endregion
|
|
1132
1143
|
//#region src/core/chart-frame.tsx
|
|
1133
|
-
var
|
|
1144
|
+
var ct = {
|
|
1134
1145
|
position: "absolute",
|
|
1135
1146
|
insetInlineStart: "-9999px",
|
|
1136
1147
|
inlineSize: "1px",
|
|
@@ -1141,85 +1152,85 @@ var at = {
|
|
|
1141
1152
|
};
|
|
1142
1153
|
function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, 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: k, onAfterDraw: A }) {
|
|
1143
1154
|
o();
|
|
1144
|
-
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref: P, width: F, height: I } =
|
|
1155
|
+
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref: P, width: F, height: I } = Ve(n ?? 400, r), L = i(null), R = i(!1), te = c(null), ne = c(null), z = c(null), B = c(null);
|
|
1145
1156
|
a(() => {
|
|
1146
|
-
let e =
|
|
1157
|
+
let e = B.current;
|
|
1147
1158
|
if (!e || !T) return;
|
|
1148
1159
|
let t = (t) => {
|
|
1149
1160
|
t.preventDefault();
|
|
1150
1161
|
let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
|
|
1151
|
-
T.window.value =
|
|
1162
|
+
T.window.value = $e(T.window.value, T.count, i, r);
|
|
1152
1163
|
};
|
|
1153
1164
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1154
1165
|
});
|
|
1155
|
-
let
|
|
1166
|
+
let V = () => {
|
|
1156
1167
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1157
|
-
},
|
|
1158
|
-
let t =
|
|
1159
|
-
t &&
|
|
1160
|
-
},
|
|
1161
|
-
let t =
|
|
1162
|
-
t &&
|
|
1163
|
-
width:
|
|
1164
|
-
height:
|
|
1168
|
+
}, H = n ?? F.value, U = r ?? I.value, W = E === !0 ? {} : E || null, G = () => ne.current ? at(ne.current) : null, K = () => {
|
|
1169
|
+
let t = G();
|
|
1170
|
+
t && st(t, `${e || "chart"}.svg`);
|
|
1171
|
+
}, re = () => {
|
|
1172
|
+
let t = G();
|
|
1173
|
+
t && ot(t, {
|
|
1174
|
+
width: H,
|
|
1175
|
+
height: U,
|
|
1165
1176
|
dpr: 2
|
|
1166
1177
|
}).then((t) => {
|
|
1167
|
-
t &&
|
|
1178
|
+
t && st(t, `${e || "chart"}.png`);
|
|
1168
1179
|
});
|
|
1169
|
-
},
|
|
1170
|
-
|
|
1171
|
-
},
|
|
1172
|
-
width:
|
|
1173
|
-
height:
|
|
1180
|
+
}, ie = () => {
|
|
1181
|
+
V(), D?.();
|
|
1182
|
+
}, q = typeof b == "function" ? b({
|
|
1183
|
+
width: H,
|
|
1184
|
+
height: U
|
|
1174
1185
|
}) : b;
|
|
1175
1186
|
a(() => {
|
|
1176
1187
|
let e = L.value;
|
|
1177
|
-
if (!
|
|
1178
|
-
let t = e === null ? void 0 :
|
|
1179
|
-
|
|
1188
|
+
if (!q || !te.current) return;
|
|
1189
|
+
let t = e === null ? void 0 : q.points[e];
|
|
1190
|
+
te.current.textContent = t ? (q.format ?? qe)(t) : "";
|
|
1180
1191
|
});
|
|
1181
|
-
let
|
|
1192
|
+
let J = {
|
|
1182
1193
|
position: "absolute",
|
|
1183
1194
|
inset: 0,
|
|
1184
1195
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1185
1196
|
background: "transparent",
|
|
1186
1197
|
touchAction: T ? "none" : void 0
|
|
1187
|
-
},
|
|
1198
|
+
}, ae = C === "canvas" && w !== void 0, oe = q !== void 0 || T !== void 0, se = {};
|
|
1188
1199
|
if (O && typeof O == "object") {
|
|
1189
|
-
let e =
|
|
1200
|
+
let e = se;
|
|
1190
1201
|
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(", "));
|
|
1191
1202
|
}
|
|
1192
|
-
let
|
|
1193
|
-
...
|
|
1194
|
-
...
|
|
1203
|
+
let ce = oe || ae || W || Object.keys(se).length > 0 ? {
|
|
1204
|
+
...se,
|
|
1205
|
+
...oe || ae || W ? { position: "relative" } : {}
|
|
1195
1206
|
} : void 0;
|
|
1196
1207
|
return /* @__PURE__ */ p("div", {
|
|
1197
1208
|
ref: P,
|
|
1198
|
-
className: [
|
|
1199
|
-
style:
|
|
1209
|
+
className: [Ke.frame, g].filter(Boolean).join(" "),
|
|
1210
|
+
style: ce,
|
|
1200
1211
|
..._ !== void 0 && { "data-state": _ },
|
|
1201
1212
|
...y === !0 && { "data-plain": "" },
|
|
1202
1213
|
...O === !1 && { "data-no-anim": "" },
|
|
1203
1214
|
children: [
|
|
1204
|
-
|
|
1215
|
+
W && /* @__PURE__ */ f("div", {
|
|
1205
1216
|
style: {
|
|
1206
1217
|
position: "absolute",
|
|
1207
1218
|
top: 4,
|
|
1208
1219
|
right: 4,
|
|
1209
1220
|
zIndex: 12
|
|
1210
1221
|
},
|
|
1211
|
-
children: /* @__PURE__ */ f(
|
|
1212
|
-
options:
|
|
1213
|
-
onPng:
|
|
1214
|
-
onSvg:
|
|
1222
|
+
children: /* @__PURE__ */ f(rt, {
|
|
1223
|
+
options: W,
|
|
1224
|
+
onPng: re,
|
|
1225
|
+
onSvg: K,
|
|
1215
1226
|
onToggleData: () => {
|
|
1216
|
-
|
|
1227
|
+
R.value = !R.value;
|
|
1217
1228
|
},
|
|
1218
|
-
onRestore:
|
|
1219
|
-
showData:
|
|
1229
|
+
onRestore: ie,
|
|
1230
|
+
showData: R.value
|
|
1220
1231
|
})
|
|
1221
1232
|
}),
|
|
1222
|
-
|
|
1233
|
+
ae && /* @__PURE__ */ f(Xe, {
|
|
1223
1234
|
size: () => ({
|
|
1224
1235
|
width: n ?? F.value,
|
|
1225
1236
|
height: r ?? I.value
|
|
@@ -1227,33 +1238,33 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1227
1238
|
paint: w
|
|
1228
1239
|
}),
|
|
1229
1240
|
/* @__PURE__ */ p("svg", {
|
|
1230
|
-
ref:
|
|
1241
|
+
ref: ne,
|
|
1231
1242
|
role: "img",
|
|
1232
1243
|
"aria-label": e,
|
|
1233
1244
|
"aria-describedby": t ? M : void 0,
|
|
1234
|
-
width:
|
|
1235
|
-
height:
|
|
1236
|
-
viewBox: `0 0 ${
|
|
1245
|
+
width: H,
|
|
1246
|
+
height: U,
|
|
1247
|
+
viewBox: `0 0 ${H} ${U}`,
|
|
1237
1248
|
children: [
|
|
1238
1249
|
t && /* @__PURE__ */ f("desc", {
|
|
1239
1250
|
id: M,
|
|
1240
1251
|
children: t
|
|
1241
1252
|
}),
|
|
1242
1253
|
k?.({
|
|
1243
|
-
width:
|
|
1244
|
-
height:
|
|
1254
|
+
width: H,
|
|
1255
|
+
height: U
|
|
1245
1256
|
}),
|
|
1246
1257
|
h({
|
|
1247
|
-
width:
|
|
1248
|
-
height:
|
|
1258
|
+
width: H,
|
|
1259
|
+
height: U
|
|
1249
1260
|
}),
|
|
1250
1261
|
A?.({
|
|
1251
|
-
width:
|
|
1252
|
-
height:
|
|
1262
|
+
width: H,
|
|
1263
|
+
height: U
|
|
1253
1264
|
}),
|
|
1254
1265
|
_ === "empty" && /* @__PURE__ */ f("text", {
|
|
1255
|
-
x:
|
|
1256
|
-
y:
|
|
1266
|
+
x: H / 2,
|
|
1267
|
+
y: U / 2,
|
|
1257
1268
|
textAnchor: "middle",
|
|
1258
1269
|
dominantBaseline: "central",
|
|
1259
1270
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1264,20 +1275,20 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1264
1275
|
]
|
|
1265
1276
|
}),
|
|
1266
1277
|
m && /* @__PURE__ */ f("div", {
|
|
1267
|
-
className:
|
|
1268
|
-
style:
|
|
1278
|
+
className: Ke.fallback,
|
|
1279
|
+
style: ct,
|
|
1269
1280
|
children: m
|
|
1270
1281
|
}),
|
|
1271
|
-
|
|
1282
|
+
W && R.value && m && /* @__PURE__ */ f("div", {
|
|
1272
1283
|
"data-data-view": "",
|
|
1273
1284
|
style: { overflowX: "auto" },
|
|
1274
1285
|
children: m
|
|
1275
1286
|
}),
|
|
1276
|
-
|
|
1277
|
-
|
|
1287
|
+
oe && /* @__PURE__ */ p(d, { children: [
|
|
1288
|
+
q !== void 0 && /* @__PURE__ */ p(d, { children: [
|
|
1278
1289
|
/* @__PURE__ */ f("span", {
|
|
1279
1290
|
id: N,
|
|
1280
|
-
ref:
|
|
1291
|
+
ref: te,
|
|
1281
1292
|
"aria-live": "polite",
|
|
1282
1293
|
style: {
|
|
1283
1294
|
position: "absolute",
|
|
@@ -1291,21 +1302,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1291
1302
|
border: 0
|
|
1292
1303
|
}
|
|
1293
1304
|
}),
|
|
1294
|
-
|
|
1305
|
+
q.mode === "axis" && L.value !== null && q.points[L.value] !== void 0 && /* @__PURE__ */ f("div", {
|
|
1295
1306
|
"aria-hidden": "true",
|
|
1296
1307
|
style: {
|
|
1297
1308
|
position: "absolute",
|
|
1298
|
-
left:
|
|
1309
|
+
left: q.points[L.value].cx,
|
|
1299
1310
|
top: 0,
|
|
1300
1311
|
width: 1,
|
|
1301
|
-
height:
|
|
1312
|
+
height: U,
|
|
1302
1313
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1303
1314
|
pointerEvents: "none",
|
|
1304
1315
|
zIndex: 9
|
|
1305
1316
|
}
|
|
1306
1317
|
}),
|
|
1307
|
-
L.value !== null &&
|
|
1308
|
-
let e =
|
|
1318
|
+
L.value !== null && q.points[L.value] !== void 0 && (() => {
|
|
1319
|
+
let e = q.points[L.value];
|
|
1309
1320
|
return /* @__PURE__ */ f("div", {
|
|
1310
1321
|
"aria-hidden": "true",
|
|
1311
1322
|
style: {
|
|
@@ -1322,14 +1333,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1322
1333
|
}
|
|
1323
1334
|
});
|
|
1324
1335
|
})(),
|
|
1325
|
-
L.value !== null &&
|
|
1326
|
-
point:
|
|
1327
|
-
model:
|
|
1336
|
+
L.value !== null && q.points[L.value] !== void 0 && /* @__PURE__ */ f(Je, {
|
|
1337
|
+
point: q.points[L.value],
|
|
1338
|
+
model: q
|
|
1328
1339
|
})
|
|
1329
1340
|
] }),
|
|
1330
|
-
T && !
|
|
1341
|
+
T && !W && tt(T.window.value, T.count) && /* @__PURE__ */ f("button", {
|
|
1331
1342
|
type: "button",
|
|
1332
|
-
onClick:
|
|
1343
|
+
onClick: V,
|
|
1333
1344
|
style: {
|
|
1334
1345
|
position: "absolute",
|
|
1335
1346
|
top: 4,
|
|
@@ -1347,71 +1358,71 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1347
1358
|
children: u(l.charts.resetZoom)
|
|
1348
1359
|
}),
|
|
1349
1360
|
/* @__PURE__ */ f("div", {
|
|
1350
|
-
ref:
|
|
1361
|
+
ref: B,
|
|
1351
1362
|
role: "application",
|
|
1352
1363
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1353
1364
|
tabIndex: 0,
|
|
1354
|
-
style:
|
|
1365
|
+
style: J,
|
|
1355
1366
|
onPointerDown: (e) => {
|
|
1356
|
-
T && (
|
|
1367
|
+
T && (z.current = {
|
|
1357
1368
|
x: e.clientX,
|
|
1358
1369
|
win: [...T.window.value]
|
|
1359
1370
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1360
1371
|
},
|
|
1361
1372
|
onPointerMove: (e) => {
|
|
1362
|
-
if (T &&
|
|
1363
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1364
|
-
T.window.value =
|
|
1373
|
+
if (T && z.current && e.buttons === 1) {
|
|
1374
|
+
let t = e.currentTarget.getBoundingClientRect(), n = z.current.win[1] - z.current.win[0] + 1, r = e.clientX - z.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1375
|
+
T.window.value = et(z.current.win, T.count, i);
|
|
1365
1376
|
return;
|
|
1366
1377
|
}
|
|
1367
|
-
if (!
|
|
1378
|
+
if (!q || !q.points.length) return;
|
|
1368
1379
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1369
|
-
L.value =
|
|
1380
|
+
L.value = q.mode === "axis" ? Ye(q.points, n, r, "x") : S === "voronoi" ? ee(q.points.map((e) => [e.cx, e.cy]), n, r) : Ye(q.points, n, r, "xy");
|
|
1370
1381
|
},
|
|
1371
1382
|
onPointerUp: () => {
|
|
1372
|
-
|
|
1383
|
+
z.current = null;
|
|
1373
1384
|
},
|
|
1374
1385
|
onPointerLeave: () => {
|
|
1375
|
-
|
|
1386
|
+
z.current = null, q && (L.value = null);
|
|
1376
1387
|
},
|
|
1377
1388
|
onKeyDown: (e) => {
|
|
1378
1389
|
if (T) {
|
|
1379
1390
|
if (e.key === "+" || e.key === "=") {
|
|
1380
|
-
e.preventDefault(), T.window.value =
|
|
1391
|
+
e.preventDefault(), T.window.value = $e(T.window.value, T.count, 1 / 1.25, .5);
|
|
1381
1392
|
return;
|
|
1382
1393
|
}
|
|
1383
1394
|
if (e.key === "-" || e.key === "_") {
|
|
1384
|
-
e.preventDefault(), T.window.value =
|
|
1395
|
+
e.preventDefault(), T.window.value = $e(T.window.value, T.count, 1.25, .5);
|
|
1385
1396
|
return;
|
|
1386
1397
|
}
|
|
1387
1398
|
if (e.key === "0") {
|
|
1388
|
-
e.preventDefault(),
|
|
1399
|
+
e.preventDefault(), V();
|
|
1389
1400
|
return;
|
|
1390
1401
|
}
|
|
1391
1402
|
}
|
|
1392
|
-
if (!
|
|
1403
|
+
if (!q || !q.points.length) return;
|
|
1393
1404
|
let t = L.value;
|
|
1394
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), L.value = t === null ? 0 : Math.min(t + 1,
|
|
1395
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), L.value = t === null ?
|
|
1405
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), L.value = t === null ? 0 : Math.min(t + 1, q.points.length - 1);
|
|
1406
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), L.value = t === null ? q.points.length - 1 : Math.max(t - 1, 0);
|
|
1396
1407
|
else if (e.key === "Home") e.preventDefault(), L.value = 0;
|
|
1397
|
-
else if (e.key === "End") e.preventDefault(), L.value =
|
|
1408
|
+
else if (e.key === "End") e.preventDefault(), L.value = q.points.length - 1;
|
|
1398
1409
|
else if (e.key === "Escape") L.value = null;
|
|
1399
1410
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1400
1411
|
e.preventDefault();
|
|
1401
|
-
let t = L.value, n = t === null ? void 0 :
|
|
1412
|
+
let t = L.value, n = t === null ? void 0 : q.points[t];
|
|
1402
1413
|
n && x(n);
|
|
1403
1414
|
}
|
|
1404
1415
|
},
|
|
1405
1416
|
onClick: () => {
|
|
1406
|
-
if (!
|
|
1407
|
-
let e = L.value, t = e === null ? void 0 :
|
|
1417
|
+
if (!q) return;
|
|
1418
|
+
let e = L.value, t = e === null ? void 0 : q.points[e];
|
|
1408
1419
|
x && t && x(t);
|
|
1409
1420
|
},
|
|
1410
1421
|
onFocus: () => {
|
|
1411
|
-
|
|
1422
|
+
q && q.points.length > 0 && L.value === null && (L.value = 0);
|
|
1412
1423
|
},
|
|
1413
1424
|
onBlur: () => {
|
|
1414
|
-
|
|
1425
|
+
q && (L.value = null);
|
|
1415
1426
|
}
|
|
1416
1427
|
})
|
|
1417
1428
|
] })
|
|
@@ -1420,45 +1431,45 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1420
1431
|
}
|
|
1421
1432
|
//#endregion
|
|
1422
1433
|
//#region src/core/sync.ts
|
|
1423
|
-
var
|
|
1424
|
-
function
|
|
1425
|
-
let t =
|
|
1434
|
+
var lt = /* @__PURE__ */ new Map();
|
|
1435
|
+
function ut(e) {
|
|
1436
|
+
let t = lt.get(e);
|
|
1426
1437
|
return t || (t = {
|
|
1427
1438
|
group: {
|
|
1428
1439
|
window: n(null),
|
|
1429
1440
|
hoverX: n(null)
|
|
1430
1441
|
},
|
|
1431
1442
|
refs: 0
|
|
1432
|
-
},
|
|
1443
|
+
}, lt.set(e, t)), t.refs++, t.group;
|
|
1433
1444
|
}
|
|
1434
|
-
function
|
|
1435
|
-
let t =
|
|
1436
|
-
t && (t.refs--, t.refs <= 0 &&
|
|
1445
|
+
function dt(e) {
|
|
1446
|
+
let t = lt.get(e);
|
|
1447
|
+
t && (t.refs--, t.refs <= 0 && lt.delete(e));
|
|
1437
1448
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return
|
|
1449
|
+
function ft() {
|
|
1450
|
+
return lt.size;
|
|
1440
1451
|
}
|
|
1441
1452
|
//#endregion
|
|
1442
1453
|
//#region src/chrome/axis.tsx
|
|
1443
|
-
function
|
|
1454
|
+
function pt(e) {
|
|
1444
1455
|
return "bandwidth" in e;
|
|
1445
1456
|
}
|
|
1446
|
-
function
|
|
1457
|
+
function mt(e) {
|
|
1447
1458
|
return "tickInterval" in e;
|
|
1448
1459
|
}
|
|
1449
|
-
function
|
|
1460
|
+
function ht(e) {
|
|
1450
1461
|
return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
1451
1462
|
}
|
|
1452
|
-
function $({ scale: e, orientation: t, length: n, format: r =
|
|
1463
|
+
function $({ scale: e, orientation: t, length: n, format: r = ht, tickCount: i = 5, labelEvery: a, transform: o }) {
|
|
1453
1464
|
let s;
|
|
1454
|
-
if (
|
|
1465
|
+
if (pt(e)) {
|
|
1455
1466
|
let t = e.domain.length - 1;
|
|
1456
1467
|
s = e.domain.map((t, n) => ({
|
|
1457
1468
|
position: (e.map(t) ?? 0) + e.bandwidth / 2,
|
|
1458
1469
|
label: r(t),
|
|
1459
1470
|
i: n
|
|
1460
1471
|
})).filter(({ i: e }) => a != null && a > 1 ? e % a === 0 || e === t : !0);
|
|
1461
|
-
} else if (
|
|
1472
|
+
} else if (mt(e)) s = e.ticks(i).map((t) => ({
|
|
1462
1473
|
position: e.map(t),
|
|
1463
1474
|
label: r(t)
|
|
1464
1475
|
}));
|
|
@@ -1502,7 +1513,7 @@ function $({ scale: e, orientation: t, length: n, format: r = ft, tickCount: i =
|
|
|
1502
1513
|
}
|
|
1503
1514
|
//#endregion
|
|
1504
1515
|
//#region src/chrome/grid-lines.tsx
|
|
1505
|
-
function
|
|
1516
|
+
function gt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
|
|
1506
1517
|
let a = e.ticks(r), o = t === "x";
|
|
1507
1518
|
return /* @__PURE__ */ f("g", {
|
|
1508
1519
|
transform: i,
|
|
@@ -1523,17 +1534,17 @@ function pt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
|
|
|
1523
1534
|
}
|
|
1524
1535
|
//#endregion
|
|
1525
1536
|
//#region src/chrome/reference.tsx
|
|
1526
|
-
var
|
|
1527
|
-
function
|
|
1537
|
+
var _t = "var(--cascivo-color-foreground-muted)", vt = "var(--cascivo-color-accent)";
|
|
1538
|
+
function yt(e, t) {
|
|
1528
1539
|
let n = e.map(t);
|
|
1529
1540
|
if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
|
|
1530
1541
|
}
|
|
1531
|
-
function
|
|
1542
|
+
function bt(e, t, n) {
|
|
1532
1543
|
let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
|
|
1533
1544
|
if (e.kind === "line") {
|
|
1534
|
-
let t =
|
|
1545
|
+
let t = yt(e.axis === "x" ? r : i, e.value);
|
|
1535
1546
|
if (t == null) return null;
|
|
1536
|
-
let s = e.color ??
|
|
1547
|
+
let s = e.color ?? _t, c = e.dash !== !1, l = e.axis === "x";
|
|
1537
1548
|
return /* @__PURE__ */ p("g", {
|
|
1538
1549
|
"data-annotation": "line",
|
|
1539
1550
|
"aria-hidden": "true",
|
|
@@ -1564,9 +1575,9 @@ function _t(e, t, n) {
|
|
|
1564
1575
|
}, n);
|
|
1565
1576
|
}
|
|
1566
1577
|
if (e.kind === "area") {
|
|
1567
|
-
let t = e.axis === "x" ? r : i, s =
|
|
1578
|
+
let t = e.axis === "x" ? r : i, s = yt(t, e.from), c = yt(t, e.to);
|
|
1568
1579
|
if (s == null || c == null) return null;
|
|
1569
|
-
let l = e.color ??
|
|
1580
|
+
let l = e.color ?? vt, u = e.axis === "x", d = Math.min(s, c), p = Math.abs(c - s);
|
|
1570
1581
|
return /* @__PURE__ */ f("g", {
|
|
1571
1582
|
"data-annotation": "area",
|
|
1572
1583
|
"aria-hidden": "true",
|
|
@@ -1582,9 +1593,9 @@ function _t(e, t, n) {
|
|
|
1582
1593
|
}, n);
|
|
1583
1594
|
}
|
|
1584
1595
|
if (e.kind === "note") {
|
|
1585
|
-
let t =
|
|
1596
|
+
let t = yt(r, e.x), s = yt(i, e.y);
|
|
1586
1597
|
if (t == null || s == null) return null;
|
|
1587
|
-
let c = e.color ??
|
|
1598
|
+
let c = e.color ?? vt, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), m = Math.max(8, Math.min(o - 2, s + u));
|
|
1588
1599
|
return /* @__PURE__ */ p("g", {
|
|
1589
1600
|
"data-annotation": "note",
|
|
1590
1601
|
children: [
|
|
@@ -1620,7 +1631,7 @@ function _t(e, t, n) {
|
|
|
1620
1631
|
if (e.kind === "threshold") {
|
|
1621
1632
|
let t = i.map(e.value);
|
|
1622
1633
|
if (t == null || Number.isNaN(t)) return null;
|
|
1623
|
-
let r = e.color ??
|
|
1634
|
+
let r = e.color ?? vt, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
|
|
1624
1635
|
return /* @__PURE__ */ f("g", {
|
|
1625
1636
|
"data-annotation": "threshold",
|
|
1626
1637
|
"aria-hidden": "true",
|
|
@@ -1635,9 +1646,9 @@ function _t(e, t, n) {
|
|
|
1635
1646
|
})
|
|
1636
1647
|
}, n);
|
|
1637
1648
|
}
|
|
1638
|
-
let s =
|
|
1649
|
+
let s = yt(r, e.x), c = yt(i, e.y);
|
|
1639
1650
|
if (s == null || c == null) return null;
|
|
1640
|
-
let l = e.color ??
|
|
1651
|
+
let l = e.color ?? vt;
|
|
1641
1652
|
return /* @__PURE__ */ p("g", {
|
|
1642
1653
|
"data-annotation": "dot",
|
|
1643
1654
|
"aria-hidden": "true",
|
|
@@ -1659,28 +1670,28 @@ function _t(e, t, n) {
|
|
|
1659
1670
|
})]
|
|
1660
1671
|
}, n);
|
|
1661
1672
|
}
|
|
1662
|
-
function
|
|
1673
|
+
function xt(e, t) {
|
|
1663
1674
|
return !e || e.length === 0 ? null : /* @__PURE__ */ f("g", {
|
|
1664
1675
|
"data-annotations": "",
|
|
1665
|
-
children: e.map((e, n) =>
|
|
1676
|
+
children: e.map((e, n) => bt(e, t, n))
|
|
1666
1677
|
});
|
|
1667
1678
|
}
|
|
1668
|
-
function
|
|
1679
|
+
function St(e) {
|
|
1669
1680
|
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})`;
|
|
1670
1681
|
}
|
|
1671
1682
|
//#endregion
|
|
1672
1683
|
//#region src/chrome/data-label.tsx
|
|
1673
|
-
var
|
|
1674
|
-
function
|
|
1684
|
+
var Ct = (e) => e.toLocaleString();
|
|
1685
|
+
function wt(e) {
|
|
1675
1686
|
return e ? e === !0 ? {
|
|
1676
|
-
format:
|
|
1687
|
+
format: Ct,
|
|
1677
1688
|
position: "auto"
|
|
1678
1689
|
} : {
|
|
1679
|
-
format: e.format ??
|
|
1690
|
+
format: e.format ?? Ct,
|
|
1680
1691
|
position: e.position ?? "auto"
|
|
1681
1692
|
} : null;
|
|
1682
1693
|
}
|
|
1683
|
-
function
|
|
1694
|
+
function Tt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
|
|
1684
1695
|
return /* @__PURE__ */ f("text", {
|
|
1685
1696
|
x: e,
|
|
1686
1697
|
y: t,
|
|
@@ -1696,21 +1707,21 @@ function St({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
|
|
|
1696
1707
|
}
|
|
1697
1708
|
//#endregion
|
|
1698
1709
|
//#region src/chrome/defs.tsx
|
|
1699
|
-
function
|
|
1710
|
+
function Et(e) {
|
|
1700
1711
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1701
1712
|
}
|
|
1702
|
-
function
|
|
1703
|
-
return `${
|
|
1713
|
+
function Dt(e, t) {
|
|
1714
|
+
return `${Et(e)}-grad-${Et(t)}`;
|
|
1704
1715
|
}
|
|
1705
|
-
function
|
|
1706
|
-
return `${
|
|
1716
|
+
function Ot(e, t) {
|
|
1717
|
+
return `${Et(e)}-pat-${Et(t)}`;
|
|
1707
1718
|
}
|
|
1708
|
-
function
|
|
1709
|
-
return n === "gradient" ? `url(#${
|
|
1719
|
+
function kt(e, t, n, r) {
|
|
1720
|
+
return n === "gradient" ? `url(#${Dt(e, t)})` : n === "pattern" ? `url(#${Ot(e, t)})` : r;
|
|
1710
1721
|
}
|
|
1711
|
-
function
|
|
1722
|
+
function At({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
1712
1723
|
return n === "solid" ? null : /* @__PURE__ */ f("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ p("linearGradient", {
|
|
1713
|
-
id:
|
|
1724
|
+
id: Dt(e, t.id),
|
|
1714
1725
|
x1: "0",
|
|
1715
1726
|
y1: "0",
|
|
1716
1727
|
x2: "0",
|
|
@@ -1725,7 +1736,7 @@ function Dt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1725
1736
|
stopOpacity: .1
|
|
1726
1737
|
})]
|
|
1727
1738
|
}, t.id) : /* @__PURE__ */ p("pattern", {
|
|
1728
|
-
id:
|
|
1739
|
+
id: Ot(e, t.id),
|
|
1729
1740
|
patternUnits: "userSpaceOnUse",
|
|
1730
1741
|
width: 6,
|
|
1731
1742
|
height: 6,
|
|
@@ -1771,7 +1782,7 @@ function Dt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1771
1782
|
}
|
|
1772
1783
|
//#endregion
|
|
1773
1784
|
//#region src/chrome/glyph.tsx
|
|
1774
|
-
function
|
|
1785
|
+
function jt(e, t) {
|
|
1775
1786
|
let n = t / 2;
|
|
1776
1787
|
switch (e) {
|
|
1777
1788
|
case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
|
|
@@ -1792,7 +1803,7 @@ function Ot(e, t) {
|
|
|
1792
1803
|
default: return "";
|
|
1793
1804
|
}
|
|
1794
1805
|
}
|
|
1795
|
-
function
|
|
1806
|
+
function Mt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
|
|
1796
1807
|
let c = {
|
|
1797
1808
|
fill: i,
|
|
1798
1809
|
fillOpacity: a,
|
|
@@ -1807,33 +1818,33 @@ function kt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
|
|
|
1807
1818
|
r: r / 2,
|
|
1808
1819
|
...c
|
|
1809
1820
|
}) : /* @__PURE__ */ f("path", {
|
|
1810
|
-
d:
|
|
1821
|
+
d: jt(e, r),
|
|
1811
1822
|
transform: `translate(${t},${n})`,
|
|
1812
1823
|
...c
|
|
1813
1824
|
});
|
|
1814
1825
|
}
|
|
1815
1826
|
//#endregion
|
|
1816
1827
|
//#region src/chrome/text.tsx
|
|
1817
|
-
var
|
|
1818
|
-
function
|
|
1819
|
-
if (
|
|
1820
|
-
|
|
1821
|
-
let n =
|
|
1828
|
+
var Nt;
|
|
1829
|
+
function Pt(e, t) {
|
|
1830
|
+
if (Nt === void 0 && (Nt = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Nt) {
|
|
1831
|
+
Nt.font = `${t}px sans-serif`;
|
|
1832
|
+
let n = Nt.measureText(e).width;
|
|
1822
1833
|
if (n > 0) return n;
|
|
1823
1834
|
}
|
|
1824
1835
|
return e.length * t * .55;
|
|
1825
1836
|
}
|
|
1826
|
-
function
|
|
1837
|
+
function Ft(e, t, n) {
|
|
1827
1838
|
if (!t || t <= 0) return [e];
|
|
1828
1839
|
let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
|
|
1829
1840
|
for (let e of r) {
|
|
1830
1841
|
let r = a ? `${a} ${e}` : e;
|
|
1831
|
-
a &&
|
|
1842
|
+
a && Pt(r, n) > t ? (i.push(a), a = e) : a = r;
|
|
1832
1843
|
}
|
|
1833
1844
|
return a && i.push(a), i.length ? i : [e];
|
|
1834
1845
|
}
|
|
1835
|
-
function
|
|
1836
|
-
let l = r ?
|
|
1846
|
+
function It({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
|
|
1847
|
+
let l = r ? Ft(n, r, i) : [n];
|
|
1837
1848
|
return /* @__PURE__ */ f("text", {
|
|
1838
1849
|
x: e,
|
|
1839
1850
|
y: t,
|
|
@@ -1850,7 +1861,7 @@ function Nt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
|
|
|
1850
1861
|
}
|
|
1851
1862
|
//#endregion
|
|
1852
1863
|
//#region src/chrome/brush.tsx
|
|
1853
|
-
function
|
|
1864
|
+
function Lt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1854
1865
|
o();
|
|
1855
1866
|
let i = Math.max(1, e - 1), a = (e) => e / i * 100, [s, c] = n.value, l = t - 8, u = (t, r) => {
|
|
1856
1867
|
let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
|
|
@@ -1921,7 +1932,7 @@ function Pt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
1921
1932
|
}
|
|
1922
1933
|
//#endregion
|
|
1923
1934
|
//#region src/chrome/data-zoom.tsx
|
|
1924
|
-
function
|
|
1935
|
+
function Rt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1925
1936
|
o();
|
|
1926
1937
|
let a = Math.max(1, e - 1), s = (e) => e / a * 100, [c, l] = n.value, u = t - 8, d = i(0), m = (e, t) => {
|
|
1927
1938
|
let n = t.getBoundingClientRect();
|
|
@@ -2016,27 +2027,27 @@ function Ft({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
2016
2027
|
}
|
|
2017
2028
|
//#endregion
|
|
2018
2029
|
//#region src/chrome/visual-map.tsx
|
|
2019
|
-
var
|
|
2020
|
-
function
|
|
2021
|
-
let n = t.pieces ??
|
|
2022
|
-
return Math.min(n - 1, Math.max(0, Math.floor(
|
|
2023
|
-
}
|
|
2024
|
-
function
|
|
2025
|
-
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i =
|
|
2026
|
-
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ?
|
|
2027
|
-
let [e, n] = t.sizeRange ??
|
|
2028
|
-
a.size =
|
|
2030
|
+
var zt = 5, Bt = [3, 14], Vt = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Ht = (e, t, n) => e + (t - e) * n, Ut = (e, t) => Vt((e - t.min) / (t.max - t.min || 1));
|
|
2031
|
+
function Wt(e, t) {
|
|
2032
|
+
let n = t.pieces ?? zt;
|
|
2033
|
+
return Math.min(n - 1, Math.max(0, Math.floor(Ut(e, t) * n)));
|
|
2034
|
+
}
|
|
2035
|
+
function Gt(e, t) {
|
|
2036
|
+
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Ut(e, t), a = {};
|
|
2037
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? ye(t.pieces ?? zt, r)[Wt(e, t)] : ve(r)(i)), n === "size" || n === "both") {
|
|
2038
|
+
let [e, n] = t.sizeRange ?? Bt;
|
|
2039
|
+
a.size = Ht(e, n, i);
|
|
2029
2040
|
}
|
|
2030
2041
|
return a;
|
|
2031
2042
|
}
|
|
2032
|
-
function
|
|
2033
|
-
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(
|
|
2043
|
+
function Kt(e, t, n, r) {
|
|
2044
|
+
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Wt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
|
|
2034
2045
|
}
|
|
2035
|
-
function
|
|
2046
|
+
function qt({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
|
|
2036
2047
|
o();
|
|
2037
2048
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2038
2049
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2039
|
-
let t = e.pieces ??
|
|
2050
|
+
let t = e.pieces ?? zt, i = ye(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2040
2051
|
if (!n) return;
|
|
2041
2052
|
let t = new Set(n.value);
|
|
2042
2053
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2084,9 +2095,9 @@ function Wt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2084
2095
|
})
|
|
2085
2096
|
});
|
|
2086
2097
|
}
|
|
2087
|
-
let { min: s, max: c } = e, l = c - s || 1, u =
|
|
2098
|
+
let { min: s, max: c } = e, l = c - s || 1, u = ye(8, e.ramp ?? "sequential"), m = (e) => (e - s) / l * 100, h = t?.value[0] ?? s, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2088
2099
|
let n = t.getBoundingClientRect();
|
|
2089
|
-
return n.width === 0 ? s : s +
|
|
2100
|
+
return n.width === 0 ? s : s + Vt((e - n.left) / n.width) * l;
|
|
2090
2101
|
}, y = (e, n) => {
|
|
2091
2102
|
if (!t) return;
|
|
2092
2103
|
let r = Math.max(s, Math.min(c, n)), [i, a] = t.value;
|
|
@@ -2171,23 +2182,23 @@ function Wt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2171
2182
|
]
|
|
2172
2183
|
});
|
|
2173
2184
|
}
|
|
2174
|
-
var
|
|
2185
|
+
var Jt = {
|
|
2175
2186
|
legend: "_legend_zczeh_2",
|
|
2176
2187
|
item: "_item_zczeh_9",
|
|
2177
2188
|
swatch: "_swatch_zczeh_27"
|
|
2178
2189
|
};
|
|
2179
2190
|
//#endregion
|
|
2180
2191
|
//#region src/chrome/legend.tsx
|
|
2181
|
-
function
|
|
2192
|
+
function Yt({ series: e, hidden: t }) {
|
|
2182
2193
|
return o(), /* @__PURE__ */ f("div", {
|
|
2183
|
-
className:
|
|
2194
|
+
className: Jt.legend,
|
|
2184
2195
|
role: "group",
|
|
2185
2196
|
"aria-label": "Chart legend",
|
|
2186
2197
|
children: e.map((e, n) => {
|
|
2187
2198
|
let r = t.value.has(e.id);
|
|
2188
2199
|
return /* @__PURE__ */ p("button", {
|
|
2189
2200
|
type: "button",
|
|
2190
|
-
className:
|
|
2201
|
+
className: Jt.item,
|
|
2191
2202
|
"data-state": r ? "off" : "on",
|
|
2192
2203
|
"aria-pressed": !r,
|
|
2193
2204
|
"aria-label": u(l.charts.legendToggle, { name: e.label }),
|
|
@@ -2196,7 +2207,7 @@ function Kt({ series: e, hidden: t }) {
|
|
|
2196
2207
|
r ? n.delete(e.id) : n.add(e.id), t.value = n;
|
|
2197
2208
|
},
|
|
2198
2209
|
children: [/* @__PURE__ */ f("span", {
|
|
2199
|
-
className:
|
|
2210
|
+
className: Jt.swatch,
|
|
2200
2211
|
style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
|
|
2201
2212
|
"aria-hidden": "true"
|
|
2202
2213
|
}), e.label]
|
|
@@ -2206,53 +2217,56 @@ function Kt({ series: e, hidden: t }) {
|
|
|
2206
2217
|
}
|
|
2207
2218
|
//#endregion
|
|
2208
2219
|
//#region src/core/dev-warn.ts
|
|
2209
|
-
function
|
|
2220
|
+
function Xt() {
|
|
2210
2221
|
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
2211
2222
|
}
|
|
2212
|
-
var
|
|
2213
|
-
function
|
|
2214
|
-
if (
|
|
2223
|
+
var Zt = /* @__PURE__ */ new Set();
|
|
2224
|
+
function Qt(e, t) {
|
|
2225
|
+
if (Xt() || Zt.has(e)) return;
|
|
2215
2226
|
let n = 0;
|
|
2216
2227
|
for (let e of t()) Number.isFinite(e) || n++;
|
|
2217
|
-
n !== 0 && (
|
|
2228
|
+
n !== 0 && (Zt.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.`));
|
|
2218
2229
|
}
|
|
2219
2230
|
//#endregion
|
|
2220
2231
|
//#region src/charts/line-chart/line-chart.tsx
|
|
2221
|
-
var
|
|
2222
|
-
function
|
|
2232
|
+
var $t = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2233
|
+
function en(e) {
|
|
2223
2234
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2224
2235
|
}
|
|
2225
|
-
function
|
|
2236
|
+
function tn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: h, xTicks: g = 5, yTicks: _ = 5, legend: v, tooltip: y, formatTooltip: b, className: x, plain: C, annotations: E, labels: D, connectNulls: O, onSelect: k, brush: A, dataZoom: j, zoom: M, syncId: N, tooltipMode: P, secondAxis: F, decimate: I, toolbox: L, transition: ee, onBeforeDraw: R, onAfterDraw: te }) {
|
|
2226
2237
|
o();
|
|
2227
|
-
let
|
|
2238
|
+
let ne = i(/* @__PURE__ */ new Set()), z = C ? null : wt(D), B = I === !0 ? {
|
|
2228
2239
|
method: "lttb",
|
|
2229
2240
|
threshold: 1e3
|
|
2230
2241
|
} : I ? {
|
|
2231
2242
|
method: I.method ?? "lttb",
|
|
2232
2243
|
threshold: I.threshold ?? 1e3
|
|
2233
|
-
} : null,
|
|
2234
|
-
N && !
|
|
2235
|
-
N &&
|
|
2244
|
+
} : null, V = e.reduce((e, t) => Math.max(e, t.data.length), 0), H = (A || j || M || N !== void 0) && V > 0, U = i([0, Math.max(0, V - 1)]), W = c(null);
|
|
2245
|
+
N && !W.current && (W.current = ut(N)), a(() => () => {
|
|
2246
|
+
N && dt(N);
|
|
2236
2247
|
}), a(() => {
|
|
2237
|
-
let e =
|
|
2248
|
+
let e = W.current;
|
|
2238
2249
|
if (!e) return;
|
|
2239
|
-
let t = e.window.value, n =
|
|
2240
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2250
|
+
let t = e.window.value, n = U.peek();
|
|
2251
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (U.value = t);
|
|
2241
2252
|
}), a(() => {
|
|
2242
|
-
let e =
|
|
2253
|
+
let e = W.current;
|
|
2243
2254
|
if (!e) return;
|
|
2244
|
-
let t =
|
|
2255
|
+
let t = U.value, n = e.window.peek();
|
|
2245
2256
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2246
2257
|
});
|
|
2247
|
-
let
|
|
2258
|
+
let G = H ? e.map((e) => ({
|
|
2248
2259
|
...e,
|
|
2249
|
-
data: e.data.slice(
|
|
2250
|
-
})) : e,
|
|
2251
|
-
|
|
2260
|
+
data: e.data.slice(U.value[0], U.value[1] + 1)
|
|
2261
|
+
})) : e, K = !C && G.some((e) => e.axis === "right"), re = h ?? (C ? 48 : 300), ie = C ? !1 : v ?? G.length > 1, q = (e) => e.y ?? n, J = G.flatMap((e) => e.data.map((e) => t(e))), ae = (e) => e.flatMap((e) => e.data.map((t) => q(e)(t))).filter((e) => Number.isFinite(e)), oe = ae(K ? G.filter((e) => e.axis !== "right") : G), se = K ? ae(G.filter((e) => e.axis === "right")) : [];
|
|
2262
|
+
Qt("LineChart", () => G.flatMap((e) => e.data.map((t) => q(e)(t))));
|
|
2263
|
+
let ce = J.length > 0, le = m(en(oe), [0, 1]).ticks(_).map((e) => e.toLocaleString()), ue = C ? He : {
|
|
2264
|
+
...Z,
|
|
2265
|
+
left: We(le, C)
|
|
2266
|
+
}, Y = K ? {
|
|
2267
|
+
...ue,
|
|
2252
2268
|
right: 60
|
|
2253
|
-
} :
|
|
2254
|
-
Yt("LineChart", () => K.flatMap((e) => e.data.map((t) => X(e)(t))));
|
|
2255
|
-
let se = Z.length > 0, ce = se && Z[0] instanceof Date;
|
|
2269
|
+
} : ue, de = ce && J[0] instanceof Date;
|
|
2256
2270
|
return /* @__PURE__ */ p("div", {
|
|
2257
2271
|
style: {
|
|
2258
2272
|
display: "flex",
|
|
@@ -2264,38 +2278,38 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2264
2278
|
title: r,
|
|
2265
2279
|
description: s,
|
|
2266
2280
|
width: u,
|
|
2267
|
-
height:
|
|
2281
|
+
height: re,
|
|
2268
2282
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2269
2283
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2270
|
-
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }),
|
|
2271
|
-
/* @__PURE__ */ f("tbody", { children: (
|
|
2284
|
+
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }), G.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2285
|
+
/* @__PURE__ */ f("tbody", { children: (G[0]?.data ?? []).map((e, n) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: String(G[0] ? t(G[0].data[n]) : "") }), G.map((e) => /* @__PURE__ */ f("td", { children: e.data[n] == null ? "" : q(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2272
2286
|
] }),
|
|
2273
2287
|
className: x,
|
|
2274
|
-
"data-state":
|
|
2288
|
+
"data-state": ce ? void 0 : "empty",
|
|
2275
2289
|
plain: C,
|
|
2276
|
-
tooltip: y !== !1 &&
|
|
2277
|
-
if (y === !1 || !
|
|
2278
|
-
let r = e -
|
|
2290
|
+
tooltip: y !== !1 && ce ? ({ width: e, height: n }) => {
|
|
2291
|
+
if (y === !1 || !ce) return;
|
|
2292
|
+
let r = e - Y.left - Y.right, i = n - Y.top - Y.bottom, a = Math.min(...de ? J.map((e) => e.getTime()) : J), o = Math.max(...de ? J.map((e) => e.getTime()) : J), s = de ? S([new Date(a), new Date(o)], [0, r]) : m([a, o], [0, r]), c = m(en(oe), [i, 0]), l = K ? m(en(se), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2279
2293
|
if (P === "axis") {
|
|
2280
|
-
let e =
|
|
2294
|
+
let e = G.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2281
2295
|
for (let r = 0; r < e; r++) {
|
|
2282
2296
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
2283
|
-
|
|
2284
|
-
if (
|
|
2297
|
+
G.forEach((n, c) => {
|
|
2298
|
+
if (ne.value.has(n.id)) return;
|
|
2285
2299
|
let l = n.data[r];
|
|
2286
2300
|
if (l === void 0) return;
|
|
2287
|
-
let f =
|
|
2301
|
+
let f = q(n)(l);
|
|
2288
2302
|
if (!Number.isFinite(f)) return;
|
|
2289
2303
|
let p = t(l);
|
|
2290
2304
|
i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
|
|
2291
2305
|
label: n.label,
|
|
2292
2306
|
value: f,
|
|
2293
|
-
color: n.color ??
|
|
2307
|
+
color: n.color ?? $t[c % $t.length]
|
|
2294
2308
|
});
|
|
2295
2309
|
}), a !== 0 && n.push({
|
|
2296
2310
|
id: `x-${r}`,
|
|
2297
|
-
cx:
|
|
2298
|
-
cy:
|
|
2311
|
+
cx: Y.left + i / a,
|
|
2312
|
+
cy: Y.top + (o === Infinity ? 0 : o),
|
|
2299
2313
|
label: s,
|
|
2300
2314
|
value: s,
|
|
2301
2315
|
segments: e
|
|
@@ -2307,67 +2321,67 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2307
2321
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2308
2322
|
};
|
|
2309
2323
|
}
|
|
2310
|
-
let f =
|
|
2311
|
-
let i =
|
|
2324
|
+
let f = G.flatMap((e) => ne.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2325
|
+
let i = q(e)(n);
|
|
2312
2326
|
if (!Number.isFinite(i)) return [];
|
|
2313
2327
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2314
2328
|
return {
|
|
2315
2329
|
id: `${e.id}-${r}`,
|
|
2316
|
-
cx:
|
|
2317
|
-
cy:
|
|
2330
|
+
cx: Y.left + o,
|
|
2331
|
+
cy: Y.top + c,
|
|
2318
2332
|
label: l,
|
|
2319
|
-
value:
|
|
2333
|
+
value: q(e)(n),
|
|
2320
2334
|
seriesId: e.id
|
|
2321
2335
|
};
|
|
2322
2336
|
}));
|
|
2323
2337
|
return b ? {
|
|
2324
2338
|
points: f,
|
|
2325
2339
|
format: (e) => {
|
|
2326
|
-
let t =
|
|
2340
|
+
let t = G.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2327
2341
|
return t && t.data[n] !== void 0 ? b(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2328
2342
|
}
|
|
2329
2343
|
} : { points: f };
|
|
2330
2344
|
} : void 0,
|
|
2331
2345
|
onSelect: k,
|
|
2332
|
-
zoom: M &&
|
|
2333
|
-
window:
|
|
2334
|
-
count:
|
|
2346
|
+
zoom: M && V > 1 ? {
|
|
2347
|
+
window: U,
|
|
2348
|
+
count: V
|
|
2335
2349
|
} : void 0,
|
|
2336
2350
|
toolbox: L,
|
|
2337
|
-
onRestore:
|
|
2338
|
-
|
|
2351
|
+
onRestore: H ? () => {
|
|
2352
|
+
U.value = [0, Math.max(0, V - 1)];
|
|
2339
2353
|
} : void 0,
|
|
2340
|
-
transition:
|
|
2341
|
-
onBeforeDraw:
|
|
2342
|
-
onAfterDraw:
|
|
2354
|
+
transition: ee,
|
|
2355
|
+
onBeforeDraw: R,
|
|
2356
|
+
onAfterDraw: te,
|
|
2343
2357
|
children: ({ width: e, height: n }) => {
|
|
2344
|
-
let r = e -
|
|
2358
|
+
let r = e - Y.left - Y.right, i = n - Y.top - Y.bottom, a = Math.min(...de ? J.map((e) => e.getTime()) : J), o = Math.max(...de ? J.map((e) => e.getTime()) : J), s = de ? S([new Date(a), new Date(o)], [0, r]) : m([a, o], [0, r]), c = m(en(oe), [i, 0]), u = K ? m(en(se), [i, 0]) : c;
|
|
2345
2359
|
return /* @__PURE__ */ f("g", { children: /* @__PURE__ */ p("g", {
|
|
2346
|
-
transform: `translate(${
|
|
2360
|
+
transform: `translate(${Y.left},${Y.top})`,
|
|
2347
2361
|
children: [
|
|
2348
|
-
!C && /* @__PURE__ */ f(
|
|
2362
|
+
!C && /* @__PURE__ */ f(gt, {
|
|
2349
2363
|
scale: c,
|
|
2350
2364
|
orientation: "y",
|
|
2351
2365
|
length: r,
|
|
2352
2366
|
tickCount: _
|
|
2353
2367
|
}),
|
|
2354
|
-
!C &&
|
|
2368
|
+
!C && xt(E, {
|
|
2355
2369
|
xScale: s,
|
|
2356
2370
|
yScale: c,
|
|
2357
2371
|
innerW: r,
|
|
2358
2372
|
innerH: i
|
|
2359
2373
|
}),
|
|
2360
|
-
|
|
2361
|
-
if (
|
|
2362
|
-
let r = e.color ??
|
|
2363
|
-
if (
|
|
2374
|
+
G.map((e, n) => {
|
|
2375
|
+
if (ne.value.has(e.id)) return null;
|
|
2376
|
+
let r = e.color ?? $t[n % $t.length], i = e.axis === "right" ? u : c, a = (e) => s.map(e);
|
|
2377
|
+
if (B && e.data.length > B.threshold) {
|
|
2364
2378
|
let n = [];
|
|
2365
2379
|
for (let r of e.data) {
|
|
2366
|
-
let o =
|
|
2380
|
+
let o = q(e)(r);
|
|
2367
2381
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2368
2382
|
}
|
|
2369
2383
|
return /* @__PURE__ */ f("path", {
|
|
2370
|
-
d: T(
|
|
2384
|
+
d: T(Le(n, B.threshold, B.method).map((e) => [e[0], e[1]]), l),
|
|
2371
2385
|
fill: "none",
|
|
2372
2386
|
stroke: r,
|
|
2373
2387
|
strokeWidth: 2,
|
|
@@ -2377,7 +2391,7 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2377
2391
|
}, e.id);
|
|
2378
2392
|
}
|
|
2379
2393
|
let o = e.data.map((n) => {
|
|
2380
|
-
let r =
|
|
2394
|
+
let r = q(e)(n);
|
|
2381
2395
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2382
2396
|
});
|
|
2383
2397
|
return /* @__PURE__ */ p("g", { children: [w(o, O).map((t, n) => /* @__PURE__ */ f("path", {
|
|
@@ -2388,12 +2402,12 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2388
2402
|
strokeLinecap: "round",
|
|
2389
2403
|
strokeLinejoin: "round",
|
|
2390
2404
|
"data-series": e.id
|
|
2391
|
-
}, n)),
|
|
2405
|
+
}, n)), z && e.data.map((t, n) => {
|
|
2392
2406
|
let r = o[n];
|
|
2393
|
-
return r ? /* @__PURE__ */ f(
|
|
2407
|
+
return r ? /* @__PURE__ */ f(Tt, {
|
|
2394
2408
|
x: r[0],
|
|
2395
2409
|
y: r[1] - 8,
|
|
2396
|
-
text:
|
|
2410
|
+
text: z.format(q(e)(t))
|
|
2397
2411
|
}, n) : null;
|
|
2398
2412
|
})] }, e.id);
|
|
2399
2413
|
}),
|
|
@@ -2411,7 +2425,7 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2411
2425
|
length: i,
|
|
2412
2426
|
tickCount: _
|
|
2413
2427
|
}),
|
|
2414
|
-
|
|
2428
|
+
K && /* @__PURE__ */ f($, {
|
|
2415
2429
|
scale: u,
|
|
2416
2430
|
orientation: "y",
|
|
2417
2431
|
length: i,
|
|
@@ -2424,64 +2438,67 @@ function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2424
2438
|
}) });
|
|
2425
2439
|
}
|
|
2426
2440
|
}),
|
|
2427
|
-
A && !j &&
|
|
2428
|
-
count:
|
|
2429
|
-
window:
|
|
2441
|
+
A && !j && V > 1 && /* @__PURE__ */ f(Lt, {
|
|
2442
|
+
count: V,
|
|
2443
|
+
window: U,
|
|
2430
2444
|
label: "Time range"
|
|
2431
2445
|
}),
|
|
2432
|
-
j &&
|
|
2433
|
-
count:
|
|
2434
|
-
window:
|
|
2446
|
+
j && V > 1 && /* @__PURE__ */ f(Rt, {
|
|
2447
|
+
count: V,
|
|
2448
|
+
window: U,
|
|
2435
2449
|
label: "Time range"
|
|
2436
2450
|
}),
|
|
2437
|
-
|
|
2438
|
-
series:
|
|
2451
|
+
ie && /* @__PURE__ */ f(Yt, {
|
|
2452
|
+
series: G.map((e, t) => ({
|
|
2439
2453
|
id: e.id,
|
|
2440
2454
|
label: e.label,
|
|
2441
|
-
color: e.color ??
|
|
2455
|
+
color: e.color ?? $t[t % $t.length]
|
|
2442
2456
|
})),
|
|
2443
|
-
hidden:
|
|
2457
|
+
hidden: ne
|
|
2444
2458
|
})
|
|
2445
2459
|
]
|
|
2446
2460
|
});
|
|
2447
2461
|
}
|
|
2448
2462
|
//#endregion
|
|
2449
2463
|
//#region src/charts/area-chart/area-chart.tsx
|
|
2450
|
-
var
|
|
2451
|
-
function
|
|
2464
|
+
var nn = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" }, rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2465
|
+
function an({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: h = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: C, tooltip: w, className: E, plain: D, annotations: O, labels: k, onSelect: A, brush: j, dataZoom: M, zoom: P, syncId: I, tooltipMode: L, secondAxis: ee, decimate: R, toolbox: te }) {
|
|
2452
2466
|
o();
|
|
2453
|
-
let
|
|
2467
|
+
let ne = s(), z = i(/* @__PURE__ */ new Set()), B = D ? null : wt(k), V = R === !0 ? {
|
|
2454
2468
|
method: "lttb",
|
|
2455
2469
|
threshold: 1e3
|
|
2456
|
-
} :
|
|
2457
|
-
method:
|
|
2458
|
-
threshold:
|
|
2459
|
-
} : null,
|
|
2460
|
-
I && !
|
|
2461
|
-
I &&
|
|
2470
|
+
} : R ? {
|
|
2471
|
+
method: R.method ?? "lttb",
|
|
2472
|
+
threshold: R.threshold ?? 1e3
|
|
2473
|
+
} : null, H = e.reduce((e, t) => Math.max(e, t.data.length), 0), U = (j || M || P || I !== void 0) && H > 0, W = i([0, Math.max(0, H - 1)]), G = c(null);
|
|
2474
|
+
I && !G.current && (G.current = ut(I)), a(() => () => {
|
|
2475
|
+
I && dt(I);
|
|
2462
2476
|
}), a(() => {
|
|
2463
|
-
let e =
|
|
2477
|
+
let e = G.current;
|
|
2464
2478
|
if (!e) return;
|
|
2465
|
-
let t = e.window.value, n =
|
|
2466
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2479
|
+
let t = e.window.value, n = W.peek();
|
|
2480
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (W.value = t);
|
|
2467
2481
|
}), a(() => {
|
|
2468
|
-
let e =
|
|
2482
|
+
let e = G.current;
|
|
2469
2483
|
if (!e) return;
|
|
2470
|
-
let t =
|
|
2484
|
+
let t = W.value, n = e.window.peek();
|
|
2471
2485
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2472
2486
|
});
|
|
2473
|
-
let
|
|
2487
|
+
let K = U ? e.map((e) => ({
|
|
2474
2488
|
...e,
|
|
2475
|
-
data: e.data.slice(
|
|
2476
|
-
})) : e,
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
} : J, re = y ?? (D ? 48 : 300), X = D ? !1 : C ?? q.length > 1, Z = (e) => e.y ?? n, ie = (q[0]?.data ?? []).map((e) => t(e)), ae = (ne ? q.filter((e) => e.axis !== "right") : q).flatMap((e) => e.data.map((t) => Z(e)(t))), oe = ne ? q.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Z(e)(t))) : [];
|
|
2480
|
-
Yt("AreaChart", () => [...ae, ...oe]);
|
|
2481
|
-
let se = ie.length > 0, ce = se && ie[0] instanceof Date, le = ie.map((e) => e instanceof Date ? e.getTime() : e), ue = se ? Math.min(...le) : 0, de = se ? Math.max(...le) : 1, fe = (e) => ce ? S([new Date(ue), new Date(de)], [0, e]) : m([ue, de], [0, e]), pe = (e, n) => e.map(t(n)), me = (e) => {
|
|
2489
|
+
data: e.data.slice(W.value[0], W.value[1] + 1)
|
|
2490
|
+
})) : e, re = !D && !u && K.some((e) => e.axis === "right"), ie = y ?? (D ? 48 : 300), q = D ? !1 : C ?? K.length > 1, J = (e) => e.y ?? n, ae = (K[0]?.data ?? []).map((e) => t(e)), oe = (re ? K.filter((e) => e.axis !== "right") : K).flatMap((e) => e.data.map((t) => J(e)(t))), se = re ? K.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => J(e)(t))) : [];
|
|
2491
|
+
Qt("AreaChart", () => [...oe, ...se]);
|
|
2492
|
+
let ce = ae.length > 0, le = ce && ae[0] instanceof Date, ue = ae.map((e) => e instanceof Date ? e.getTime() : e), Y = ce ? Math.min(...ue) : 0, de = ce ? Math.max(...ue) : 1, fe = (e) => le ? S([new Date(Y), new Date(de)], [0, e]) : m([Y, de], [0, e]), pe = (e, n) => e.map(t(n)), me = (e) => {
|
|
2482
2493
|
let n = t(e);
|
|
2483
2494
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2484
|
-
}, he = u ? 0 : Math.min(0, ...
|
|
2495
|
+
}, he = u ? 0 : Math.min(0, ...oe), ge = Math.max(...u ? (K[0]?.data ?? []).map((e, t) => K.reduce((e, n) => e + J(n)(n.data[t]), 0)) : oe), _e = re ? Math.min(0, ...se) : he, ve = re ? Math.max(...se) : ge, ye = m([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = D ? He : {
|
|
2496
|
+
...Z,
|
|
2497
|
+
left: We(ye, D)
|
|
2498
|
+
}, X = re ? {
|
|
2499
|
+
...be,
|
|
2500
|
+
right: 60
|
|
2501
|
+
} : be;
|
|
2485
2502
|
return /* @__PURE__ */ p("div", {
|
|
2486
2503
|
style: {
|
|
2487
2504
|
display: "flex",
|
|
@@ -2493,36 +2510,36 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2493
2510
|
title: r,
|
|
2494
2511
|
description: l,
|
|
2495
2512
|
width: v,
|
|
2496
|
-
height:
|
|
2513
|
+
height: ie,
|
|
2497
2514
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2498
2515
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2499
|
-
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }),
|
|
2500
|
-
/* @__PURE__ */ f("tbody", { children: (
|
|
2516
|
+
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }), K.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2517
|
+
/* @__PURE__ */ f("tbody", { children: (K[0]?.data ?? []).map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: K[0] ? me(K[0].data[t]) : "" }), K.map((e) => /* @__PURE__ */ f("td", { children: e.data[t] == null ? "" : J(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2501
2518
|
] }),
|
|
2502
2519
|
className: E,
|
|
2503
|
-
"data-state":
|
|
2520
|
+
"data-state": ce ? void 0 : "empty",
|
|
2504
2521
|
plain: D,
|
|
2505
|
-
tooltip: w !== !1 &&
|
|
2506
|
-
if (w === !1 || !
|
|
2507
|
-
let n = e -
|
|
2522
|
+
tooltip: w !== !1 && ce ? ({ width: e, height: t }) => {
|
|
2523
|
+
if (w === !1 || !ce) return;
|
|
2524
|
+
let n = e - X.left - X.right, r = t - X.top - X.bottom, i = fe(n), a = m([he, ge], [r, 0]), o = re ? m([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2508
2525
|
if (L === "axis") {
|
|
2509
|
-
let e =
|
|
2526
|
+
let e = K.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2510
2527
|
for (let n = 0; n < e; n++) {
|
|
2511
|
-
let e = [], r = Infinity, a = "", o =
|
|
2512
|
-
|
|
2513
|
-
if (
|
|
2528
|
+
let e = [], r = Infinity, a = "", o = X.left;
|
|
2529
|
+
K.forEach((t, c) => {
|
|
2530
|
+
if (z.value.has(t.id)) return;
|
|
2514
2531
|
let l = t.data[n];
|
|
2515
2532
|
if (l === void 0) return;
|
|
2516
|
-
let u =
|
|
2517
|
-
Number.isFinite(u) && (o =
|
|
2533
|
+
let u = J(t)(l);
|
|
2534
|
+
Number.isFinite(u) && (o = X.left + pe(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
|
|
2518
2535
|
label: t.label,
|
|
2519
2536
|
value: u,
|
|
2520
|
-
color: t.color ??
|
|
2537
|
+
color: t.color ?? rn[c % rn.length]
|
|
2521
2538
|
}));
|
|
2522
2539
|
}), e.length !== 0 && t.push({
|
|
2523
2540
|
id: `x-${n}`,
|
|
2524
2541
|
cx: o,
|
|
2525
|
-
cy:
|
|
2542
|
+
cy: X.top + (r === Infinity ? 0 : r),
|
|
2526
2543
|
label: a,
|
|
2527
2544
|
value: a,
|
|
2528
2545
|
segments: e
|
|
@@ -2534,52 +2551,52 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2534
2551
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2535
2552
|
};
|
|
2536
2553
|
}
|
|
2537
|
-
return { points:
|
|
2554
|
+
return { points: K.flatMap((e) => z.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2538
2555
|
id: `${e.id}-${n}`,
|
|
2539
|
-
cx:
|
|
2540
|
-
cy:
|
|
2556
|
+
cx: X.left + pe(i, t),
|
|
2557
|
+
cy: X.top + s(e).map(J(e)(t)),
|
|
2541
2558
|
label: me(t),
|
|
2542
|
-
value:
|
|
2559
|
+
value: J(e)(t),
|
|
2543
2560
|
seriesId: e.id
|
|
2544
2561
|
}))) };
|
|
2545
2562
|
} : void 0,
|
|
2546
2563
|
onSelect: A,
|
|
2547
|
-
zoom: P &&
|
|
2548
|
-
window:
|
|
2549
|
-
count:
|
|
2564
|
+
zoom: P && H > 1 ? {
|
|
2565
|
+
window: W,
|
|
2566
|
+
count: H
|
|
2550
2567
|
} : void 0,
|
|
2551
|
-
toolbox:
|
|
2552
|
-
onRestore:
|
|
2553
|
-
|
|
2568
|
+
toolbox: te,
|
|
2569
|
+
onRestore: U ? () => {
|
|
2570
|
+
W.value = [0, Math.max(0, H - 1)];
|
|
2554
2571
|
} : void 0,
|
|
2555
2572
|
children: ({ width: e, height: t }) => {
|
|
2556
|
-
let n = e -
|
|
2557
|
-
return u && (s = F(
|
|
2558
|
-
prefix:
|
|
2573
|
+
let n = e - X.left - X.right, r = t - X.top - X.bottom, i = fe(n), a = m([he, ge], [r, 0]), o = re ? m([_e, ve], [r, 0]) : a, s = [];
|
|
2574
|
+
return u && (s = F(K.map((e) => e.data.map((t) => J(e)(t))))), /* @__PURE__ */ p("g", { children: [g !== "solid" && /* @__PURE__ */ f(At, {
|
|
2575
|
+
prefix: ne,
|
|
2559
2576
|
fill: g,
|
|
2560
2577
|
patternKind: _,
|
|
2561
|
-
series:
|
|
2578
|
+
series: K.map((e, t) => ({
|
|
2562
2579
|
id: e.id,
|
|
2563
|
-
color: e.color ??
|
|
2580
|
+
color: e.color ?? rn[t % rn.length]
|
|
2564
2581
|
}))
|
|
2565
2582
|
}), /* @__PURE__ */ p("g", {
|
|
2566
|
-
transform: `translate(${
|
|
2583
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2567
2584
|
children: [
|
|
2568
|
-
!D && /* @__PURE__ */ f(
|
|
2585
|
+
!D && /* @__PURE__ */ f(gt, {
|
|
2569
2586
|
scale: a,
|
|
2570
2587
|
orientation: "y",
|
|
2571
2588
|
length: n,
|
|
2572
2589
|
tickCount: x
|
|
2573
2590
|
}),
|
|
2574
|
-
!D &&
|
|
2591
|
+
!D && xt(O, {
|
|
2575
2592
|
xScale: i,
|
|
2576
2593
|
yScale: a,
|
|
2577
2594
|
innerW: n,
|
|
2578
2595
|
innerH: r
|
|
2579
2596
|
}),
|
|
2580
|
-
|
|
2581
|
-
if (
|
|
2582
|
-
let n = e.color ??
|
|
2597
|
+
K.map((e, t) => {
|
|
2598
|
+
if (z.value.has(e.id)) return null;
|
|
2599
|
+
let n = e.color ?? rn[t % rn.length], r, c;
|
|
2583
2600
|
if (u && s[t]) {
|
|
2584
2601
|
let o = s[t];
|
|
2585
2602
|
r = e.data.map((e, t) => [pe(i, e), a.map(o[t][1])]);
|
|
@@ -2591,8 +2608,8 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2591
2608
|
children: [
|
|
2592
2609
|
/* @__PURE__ */ f("path", {
|
|
2593
2610
|
d: v,
|
|
2594
|
-
fill:
|
|
2595
|
-
style: g === "solid" ?
|
|
2611
|
+
fill: kt(ne, e.id, g, n),
|
|
2612
|
+
style: g === "solid" ? nn : void 0,
|
|
2596
2613
|
stroke: "none"
|
|
2597
2614
|
}),
|
|
2598
2615
|
/* @__PURE__ */ f("path", {
|
|
@@ -2601,23 +2618,23 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2601
2618
|
stroke: n,
|
|
2602
2619
|
strokeWidth: 2
|
|
2603
2620
|
}),
|
|
2604
|
-
|
|
2621
|
+
B && r.map((t, n) => /* @__PURE__ */ f(Tt, {
|
|
2605
2622
|
x: t[0],
|
|
2606
2623
|
y: t[1] - 8,
|
|
2607
|
-
text:
|
|
2624
|
+
text: B.format(J(e)(e.data[n]))
|
|
2608
2625
|
}, n))
|
|
2609
2626
|
]
|
|
2610
2627
|
}, e.id);
|
|
2611
2628
|
} else {
|
|
2612
2629
|
let t = e.axis === "right" ? o : a;
|
|
2613
|
-
if (r = e.data.map((n) => [pe(i, n), t.map(
|
|
2614
|
-
let t =
|
|
2630
|
+
if (r = e.data.map((n) => [pe(i, n), t.map(J(e)(n))]), c = t.map(0), V && r.length > V.threshold) {
|
|
2631
|
+
let t = Le(r, V.threshold, V.method).map((e) => [e[0], e[1]]);
|
|
2615
2632
|
return /* @__PURE__ */ p("g", {
|
|
2616
2633
|
"data-series": e.id,
|
|
2617
2634
|
children: [/* @__PURE__ */ f("path", {
|
|
2618
2635
|
d: N(t, c, h),
|
|
2619
|
-
fill:
|
|
2620
|
-
style: g === "solid" ?
|
|
2636
|
+
fill: kt(ne, e.id, g, n),
|
|
2637
|
+
style: g === "solid" ? nn : void 0,
|
|
2621
2638
|
stroke: "none"
|
|
2622
2639
|
}), /* @__PURE__ */ f("path", {
|
|
2623
2640
|
d: T(t, h),
|
|
@@ -2632,8 +2649,8 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2632
2649
|
children: [
|
|
2633
2650
|
/* @__PURE__ */ f("path", {
|
|
2634
2651
|
d: N(r, c, h),
|
|
2635
|
-
fill:
|
|
2636
|
-
style: g === "solid" ?
|
|
2652
|
+
fill: kt(ne, e.id, g, n),
|
|
2653
|
+
style: g === "solid" ? nn : void 0,
|
|
2637
2654
|
stroke: "none"
|
|
2638
2655
|
}),
|
|
2639
2656
|
/* @__PURE__ */ f("path", {
|
|
@@ -2642,10 +2659,10 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2642
2659
|
stroke: n,
|
|
2643
2660
|
strokeWidth: 2
|
|
2644
2661
|
}),
|
|
2645
|
-
|
|
2662
|
+
B && r.map((t, n) => /* @__PURE__ */ f(Tt, {
|
|
2646
2663
|
x: t[0],
|
|
2647
2664
|
y: t[1] - 8,
|
|
2648
|
-
text:
|
|
2665
|
+
text: B.format(J(e)(e.data[n]))
|
|
2649
2666
|
}, n))
|
|
2650
2667
|
]
|
|
2651
2668
|
}, e.id);
|
|
@@ -2665,56 +2682,59 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2665
2682
|
length: r,
|
|
2666
2683
|
tickCount: x
|
|
2667
2684
|
}),
|
|
2668
|
-
|
|
2685
|
+
re && /* @__PURE__ */ f($, {
|
|
2669
2686
|
scale: o,
|
|
2670
2687
|
orientation: "y",
|
|
2671
2688
|
length: r,
|
|
2672
2689
|
tickCount: x,
|
|
2673
2690
|
transform: `translate(${n},0)`,
|
|
2674
|
-
...
|
|
2691
|
+
...ee?.format ? { format: (e) => ee.format(Number(e)) } : {}
|
|
2675
2692
|
})
|
|
2676
2693
|
] })
|
|
2677
2694
|
]
|
|
2678
2695
|
})] });
|
|
2679
2696
|
}
|
|
2680
2697
|
}),
|
|
2681
|
-
j && !M &&
|
|
2682
|
-
count:
|
|
2683
|
-
window:
|
|
2698
|
+
j && !M && H > 1 && /* @__PURE__ */ f(Lt, {
|
|
2699
|
+
count: H,
|
|
2700
|
+
window: W,
|
|
2684
2701
|
label: "Range"
|
|
2685
2702
|
}),
|
|
2686
|
-
M &&
|
|
2687
|
-
count:
|
|
2688
|
-
window:
|
|
2703
|
+
M && H > 1 && /* @__PURE__ */ f(Rt, {
|
|
2704
|
+
count: H,
|
|
2705
|
+
window: W,
|
|
2689
2706
|
label: "Range"
|
|
2690
2707
|
}),
|
|
2691
|
-
|
|
2692
|
-
series:
|
|
2708
|
+
q && /* @__PURE__ */ f(Yt, {
|
|
2709
|
+
series: K.map((e, t) => ({
|
|
2693
2710
|
id: e.id,
|
|
2694
2711
|
label: e.label,
|
|
2695
|
-
color: e.color ??
|
|
2712
|
+
color: e.color ?? rn[t % rn.length]
|
|
2696
2713
|
})),
|
|
2697
|
-
hidden:
|
|
2714
|
+
hidden: z
|
|
2698
2715
|
})
|
|
2699
2716
|
]
|
|
2700
2717
|
});
|
|
2701
2718
|
}
|
|
2702
2719
|
//#endregion
|
|
2703
2720
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2704
|
-
var
|
|
2705
|
-
function
|
|
2721
|
+
var on = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2722
|
+
function sn(e) {
|
|
2706
2723
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2707
2724
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2708
2725
|
}
|
|
2709
|
-
function
|
|
2726
|
+
function cn({ series: e, x: t, y: n, title: r, description: a, orientation: c = "vertical", mode: l = "grouped", width: u, height: h, xTicks: _ = 5, yTicks: v = 5, xLabelEvery: y, legend: b, tooltip: x, tooltipFormat: S, className: C, plain: w, annotations: T, labels: E, onSelect: D, fill: O = "solid", patternKind: k }) {
|
|
2710
2727
|
o();
|
|
2711
|
-
let A = s(), j = w ? null :
|
|
2712
|
-
let t = F(e.map((e) => e.data.map((t) =>
|
|
2728
|
+
let A = s(), j = w ? null : wt(E), M = i(/* @__PURE__ */ new Set()), N = h ?? (w ? 48 : 300), P = w ? !1 : b ?? e.length > 1, I = (e) => e.y ?? n, L = (e[0]?.data ?? []).map((e) => t(e)), ee = e.flatMap((e) => e.data.map((t) => I(e)(t))), R = L.length > 0, te = l === "stacked" || l === "percent", ne = L.map((t, n) => e.reduce((e, t) => e + I(t)(t.data[n]), 0)), z = () => {
|
|
2729
|
+
let t = F(e.map((e) => e.data.map((t) => I(e)(t))));
|
|
2713
2730
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2714
|
-
let r =
|
|
2731
|
+
let r = ne[n] || 1;
|
|
2715
2732
|
return [e / r, t / r];
|
|
2716
2733
|
})) : t;
|
|
2717
|
-
},
|
|
2734
|
+
}, B = te ? 0 : Math.min(0, ...ee), V = R ? Math.max(...ne) : 1, H = l === "percent" ? 1 : l === "stacked" ? V : Math.max(1, ...ee), U = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, W = c === "vertical" ? m([B, H], [0, 1]).ticks(v).map((e) => U ? U(e) : e.toLocaleString()) : L.map((e) => String(e)), G = w ? He : {
|
|
2735
|
+
...Z,
|
|
2736
|
+
left: We(W, w)
|
|
2737
|
+
};
|
|
2718
2738
|
return /* @__PURE__ */ p("div", {
|
|
2719
2739
|
style: {
|
|
2720
2740
|
display: "flex",
|
|
@@ -2725,24 +2745,24 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2725
2745
|
title: r,
|
|
2726
2746
|
description: a,
|
|
2727
2747
|
width: u,
|
|
2728
|
-
height:
|
|
2748
|
+
height: N,
|
|
2729
2749
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2730
2750
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2731
2751
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2732
|
-
/* @__PURE__ */ f("tbody", { children:
|
|
2752
|
+
/* @__PURE__ */ f("tbody", { children: L.map((t, n) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: t }), e.map((e) => /* @__PURE__ */ f("td", { children: e.data[n] == null ? "" : I(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2733
2753
|
] }),
|
|
2734
2754
|
className: C,
|
|
2735
|
-
"data-state":
|
|
2755
|
+
"data-state": R ? void 0 : "empty",
|
|
2736
2756
|
plain: w,
|
|
2737
|
-
tooltip: x &&
|
|
2738
|
-
if (!x || !
|
|
2739
|
-
let i = n -
|
|
2740
|
-
|
|
2741
|
-
let p =
|
|
2757
|
+
tooltip: x && R ? ({ width: n, height: r }) => {
|
|
2758
|
+
if (!x || !R) return;
|
|
2759
|
+
let i = n - G.left - G.right, a = r - G.top - G.bottom, o = c === "vertical", s = g(L, o ? [0, i] : [0, a], .2), u = m([B, H], o ? [a, 0] : [0, i]), d = e.filter((e) => !M.value.has(e.id)), f = [];
|
|
2760
|
+
te && (f = z());
|
|
2761
|
+
let p = te && !S, h = L.map((t, n) => {
|
|
2742
2762
|
let r = d.map((t) => ({
|
|
2743
2763
|
label: t.label,
|
|
2744
|
-
value:
|
|
2745
|
-
color: t.color ??
|
|
2764
|
+
value: I(t)(t.data[n]),
|
|
2765
|
+
color: t.color ?? on[e.indexOf(t) % on.length]
|
|
2746
2766
|
}));
|
|
2747
2767
|
return {
|
|
2748
2768
|
segs: r,
|
|
@@ -2752,22 +2772,22 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2752
2772
|
let r = e.indexOf(n), i = l === "grouped" ? s.bandwidth / d.length : s.bandwidth;
|
|
2753
2773
|
return n.data.map((e, a) => {
|
|
2754
2774
|
let c = s.map(t(e)) ?? 0, m, g;
|
|
2755
|
-
if (
|
|
2775
|
+
if (te && f[r]) {
|
|
2756
2776
|
let e = f[r][a];
|
|
2757
2777
|
m = e[1], g = e[0];
|
|
2758
|
-
} else m =
|
|
2778
|
+
} else m = I(n)(e), g = B;
|
|
2759
2779
|
let _ = d.indexOf(n), v = c + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(m), u.map(g)) + Math.max(u.map(m), u.map(g))) / 2;
|
|
2760
2780
|
return {
|
|
2761
2781
|
id: `${n.id}-${a}`,
|
|
2762
|
-
cx:
|
|
2763
|
-
cy:
|
|
2782
|
+
cx: G.left + (o ? v : y),
|
|
2783
|
+
cy: G.top + (o ? y : v),
|
|
2764
2784
|
label: t(e),
|
|
2765
|
-
value: p ? h[a].total :
|
|
2785
|
+
value: p ? h[a].total : I(n)(e),
|
|
2766
2786
|
seriesId: n.id,
|
|
2767
2787
|
...p && { segments: h[a].segs }
|
|
2768
2788
|
};
|
|
2769
2789
|
});
|
|
2770
|
-
}), v = S ?? (p ?
|
|
2790
|
+
}), v = S ?? (p ? sn : void 0);
|
|
2771
2791
|
return v ? {
|
|
2772
2792
|
points: _,
|
|
2773
2793
|
format: v
|
|
@@ -2775,48 +2795,48 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2775
2795
|
} : void 0,
|
|
2776
2796
|
onSelect: D,
|
|
2777
2797
|
children: ({ width: n, height: r }) => {
|
|
2778
|
-
let i = n -
|
|
2779
|
-
return
|
|
2798
|
+
let i = n - G.left - G.right, a = r - G.top - G.bottom, o = c === "vertical", s = y ?? Ge(L, o ? i : a), u = g(L, o ? [0, i] : [0, a], .2), h = m([B, H], o ? [a, 0] : [0, i]), b = e.filter((e) => !M.value.has(e.id)), x = [];
|
|
2799
|
+
return te && (x = z()), /* @__PURE__ */ p("g", { children: [O !== "solid" && /* @__PURE__ */ f(At, {
|
|
2780
2800
|
prefix: A,
|
|
2781
2801
|
fill: O,
|
|
2782
2802
|
patternKind: k,
|
|
2783
2803
|
series: e.map((e, t) => ({
|
|
2784
2804
|
id: e.id,
|
|
2785
|
-
color: e.color ??
|
|
2805
|
+
color: e.color ?? on[t % on.length]
|
|
2786
2806
|
}))
|
|
2787
2807
|
}), /* @__PURE__ */ p("g", {
|
|
2788
|
-
transform: `translate(${
|
|
2808
|
+
transform: `translate(${G.left},${G.top})`,
|
|
2789
2809
|
children: [
|
|
2790
|
-
!w && o && /* @__PURE__ */ f(
|
|
2791
|
-
scale:
|
|
2810
|
+
!w && o && /* @__PURE__ */ f(gt, {
|
|
2811
|
+
scale: h,
|
|
2792
2812
|
orientation: "y",
|
|
2793
2813
|
length: i,
|
|
2794
2814
|
tickCount: v
|
|
2795
2815
|
}),
|
|
2796
|
-
!w && !o && /* @__PURE__ */ f(
|
|
2797
|
-
scale:
|
|
2816
|
+
!w && !o && /* @__PURE__ */ f(gt, {
|
|
2817
|
+
scale: h,
|
|
2798
2818
|
orientation: "x",
|
|
2799
2819
|
length: a,
|
|
2800
2820
|
tickCount: _
|
|
2801
2821
|
}),
|
|
2802
|
-
!w &&
|
|
2803
|
-
xScale: o ?
|
|
2804
|
-
yScale: o ?
|
|
2822
|
+
!w && xt(T, {
|
|
2823
|
+
xScale: o ? u : h,
|
|
2824
|
+
yScale: o ? h : u,
|
|
2805
2825
|
innerW: i,
|
|
2806
2826
|
innerH: a
|
|
2807
2827
|
}),
|
|
2808
|
-
|
|
2809
|
-
let i = n.color ??
|
|
2810
|
-
return n.data.map((e,
|
|
2811
|
-
let
|
|
2812
|
-
if (
|
|
2813
|
-
let e =
|
|
2814
|
-
|
|
2815
|
-
} else
|
|
2816
|
-
let _ =
|
|
2828
|
+
b.map((n, r) => {
|
|
2829
|
+
let i = n.color ?? on[e.indexOf(n) % on.length], a = e.indexOf(n), s = l === "grouped" ? u.bandwidth / b.length : u.bandwidth;
|
|
2830
|
+
return n.data.map((e, c) => {
|
|
2831
|
+
let d = u.map(t(e)) ?? 0, m, g;
|
|
2832
|
+
if (te && x[a]) {
|
|
2833
|
+
let e = x[a][c];
|
|
2834
|
+
m = e[1], g = e[0];
|
|
2835
|
+
} else m = I(n)(e), g = B;
|
|
2836
|
+
let _ = d + (l === "grouped" ? r * s : 0), v = Math.min(h.map(m), h.map(g)), y = Math.abs(h.map(m) - h.map(g)), b = null;
|
|
2817
2837
|
if (j) {
|
|
2818
|
-
let t = j.format(
|
|
2819
|
-
if (o)
|
|
2838
|
+
let t = j.format(I(n)(e)), r = _ + s / 2, i = te || y < 18 || v < 14;
|
|
2839
|
+
if (o) b = /* @__PURE__ */ f(Tt, {
|
|
2820
2840
|
x: r,
|
|
2821
2841
|
y: i ? v + 13 : v - 4,
|
|
2822
2842
|
text: t,
|
|
@@ -2824,7 +2844,7 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2824
2844
|
});
|
|
2825
2845
|
else {
|
|
2826
2846
|
let e = v + y;
|
|
2827
|
-
|
|
2847
|
+
b = /* @__PURE__ */ f(Tt, {
|
|
2828
2848
|
x: i ? e - 4 : e + 4,
|
|
2829
2849
|
y: r + 4,
|
|
2830
2850
|
text: t,
|
|
@@ -2832,63 +2852,63 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2832
2852
|
tone: i ? "muted" : "default"
|
|
2833
2853
|
});
|
|
2834
2854
|
}
|
|
2835
|
-
|
|
2855
|
+
te && y < 14 && (b = null);
|
|
2836
2856
|
}
|
|
2837
2857
|
return /* @__PURE__ */ p("g", { children: [o ? /* @__PURE__ */ f("rect", {
|
|
2838
2858
|
x: _,
|
|
2839
2859
|
y: v,
|
|
2840
|
-
width:
|
|
2860
|
+
width: s,
|
|
2841
2861
|
height: y,
|
|
2842
|
-
fill:
|
|
2862
|
+
fill: kt(A, n.id, O, i),
|
|
2843
2863
|
rx: 2,
|
|
2844
2864
|
"data-series": n.id
|
|
2845
2865
|
}) : /* @__PURE__ */ f("rect", {
|
|
2846
2866
|
x: v,
|
|
2847
2867
|
y: _,
|
|
2848
2868
|
width: y,
|
|
2849
|
-
height:
|
|
2850
|
-
fill:
|
|
2869
|
+
height: s,
|
|
2870
|
+
fill: kt(A, n.id, O, i),
|
|
2851
2871
|
rx: 2,
|
|
2852
2872
|
"data-series": n.id
|
|
2853
|
-
}),
|
|
2873
|
+
}), b] }, `${n.id}-${c}`);
|
|
2854
2874
|
});
|
|
2855
2875
|
}),
|
|
2856
2876
|
!w && o && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f($, {
|
|
2857
|
-
scale:
|
|
2877
|
+
scale: u,
|
|
2858
2878
|
orientation: "x",
|
|
2859
2879
|
length: i,
|
|
2860
2880
|
tickCount: _,
|
|
2861
|
-
labelEvery:
|
|
2881
|
+
labelEvery: s,
|
|
2862
2882
|
transform: `translate(0,${a})`
|
|
2863
2883
|
}), /* @__PURE__ */ f($, {
|
|
2864
|
-
scale:
|
|
2884
|
+
scale: h,
|
|
2865
2885
|
orientation: "y",
|
|
2866
2886
|
length: a,
|
|
2867
2887
|
tickCount: v,
|
|
2868
|
-
...
|
|
2888
|
+
...U && { format: U }
|
|
2869
2889
|
})] }),
|
|
2870
2890
|
!w && !o && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f($, {
|
|
2871
|
-
scale:
|
|
2891
|
+
scale: h,
|
|
2872
2892
|
orientation: "x",
|
|
2873
2893
|
length: i,
|
|
2874
2894
|
tickCount: _,
|
|
2875
|
-
...
|
|
2895
|
+
...U && { format: U },
|
|
2876
2896
|
transform: `translate(0,${a})`
|
|
2877
2897
|
}), /* @__PURE__ */ f($, {
|
|
2878
|
-
scale:
|
|
2898
|
+
scale: u,
|
|
2879
2899
|
orientation: "y",
|
|
2880
2900
|
length: a,
|
|
2881
2901
|
tickCount: v,
|
|
2882
|
-
labelEvery:
|
|
2902
|
+
labelEvery: s
|
|
2883
2903
|
})] })
|
|
2884
2904
|
]
|
|
2885
2905
|
})] });
|
|
2886
2906
|
}
|
|
2887
|
-
}),
|
|
2907
|
+
}), P && /* @__PURE__ */ f(Yt, {
|
|
2888
2908
|
series: e.map((e, t) => ({
|
|
2889
2909
|
id: e.id,
|
|
2890
2910
|
label: e.label,
|
|
2891
|
-
color: e.color ??
|
|
2911
|
+
color: e.color ?? on[t % on.length]
|
|
2892
2912
|
})),
|
|
2893
2913
|
hidden: M
|
|
2894
2914
|
})]
|
|
@@ -2896,13 +2916,13 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2896
2916
|
}
|
|
2897
2917
|
//#endregion
|
|
2898
2918
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2899
|
-
function
|
|
2919
|
+
function ln(e) {
|
|
2900
2920
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2901
2921
|
return `${e.value} (${t}%)`;
|
|
2902
2922
|
}
|
|
2903
|
-
var
|
|
2904
|
-
function
|
|
2905
|
-
let w = b ? null :
|
|
2923
|
+
var un = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2924
|
+
function dn({ data: e, title: t, description: n, donut: r = !1, width: a, height: s, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: m, centerSlot: h, emptyLabel: g, tooltipFormat: _, legend: v, className: y, plain: b, labels: x, onSelect: S }) {
|
|
2925
|
+
let w = b ? null : wt(x), T = typeof x == "object" && !!x && x.format != null, E = a ?? c, D = s ?? c ?? (b ? 48 : 300), O = b ? !1 : v ?? !0;
|
|
2906
2926
|
o();
|
|
2907
2927
|
let k = i(/* @__PURE__ */ new Set()), A = e.length > 0;
|
|
2908
2928
|
return /* @__PURE__ */ p("div", {
|
|
@@ -2950,17 +2970,17 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2950
2970
|
value: e.value,
|
|
2951
2971
|
seriesId: String(t),
|
|
2952
2972
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
2953
|
-
color: e.color ??
|
|
2973
|
+
color: e.color ?? un[t % un.length]
|
|
2954
2974
|
};
|
|
2955
2975
|
}),
|
|
2956
|
-
format: _ ??
|
|
2976
|
+
format: _ ?? ln
|
|
2957
2977
|
};
|
|
2958
2978
|
} : void 0,
|
|
2959
2979
|
onSelect: S,
|
|
2960
2980
|
children: ({ width: t, height: n }) => {
|
|
2961
2981
|
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 || m != null || h != null);
|
|
2962
2982
|
return /* @__PURE__ */ p("g", { children: [g.map((e, t) => {
|
|
2963
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
2983
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? un[t % un.length], u = P(i, a, o, c, v, r);
|
|
2964
2984
|
v = r;
|
|
2965
2985
|
let d = _ > 0 ? e.value / _ * 100 : 0, m = w && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
2966
2986
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("path", {
|
|
@@ -2969,7 +2989,7 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2969
2989
|
stroke: "var(--cascivo-color-surface)",
|
|
2970
2990
|
strokeWidth: 1,
|
|
2971
2991
|
"data-series": e.id
|
|
2972
|
-
}), m && /* @__PURE__ */ f(
|
|
2992
|
+
}), m && /* @__PURE__ */ f(Tt, {
|
|
2973
2993
|
x: C(i + Math.sin(s) * h),
|
|
2974
2994
|
y: C(a - Math.cos(s) * h + 4),
|
|
2975
2995
|
text: T ? w.format(e.value) : `${Math.round(d)}%`,
|
|
@@ -3015,11 +3035,11 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3015
3035
|
})
|
|
3016
3036
|
}))] });
|
|
3017
3037
|
}
|
|
3018
|
-
}), O && /* @__PURE__ */ f(
|
|
3038
|
+
}), O && /* @__PURE__ */ f(Yt, {
|
|
3019
3039
|
series: e.map((e, t) => ({
|
|
3020
3040
|
id: e.id,
|
|
3021
3041
|
label: e.label,
|
|
3022
|
-
color: e.color ??
|
|
3042
|
+
color: e.color ?? un[t % un.length]
|
|
3023
3043
|
})),
|
|
3024
3044
|
hidden: k
|
|
3025
3045
|
})]
|
|
@@ -3027,23 +3047,23 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3027
3047
|
}
|
|
3028
3048
|
//#endregion
|
|
3029
3049
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3030
|
-
var
|
|
3031
|
-
function
|
|
3050
|
+
var fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3051
|
+
function pn({ series: e, title: t, description: n, r = 4, width: a, height: s, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: h, className: g, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C }) {
|
|
3032
3052
|
o();
|
|
3033
|
-
let w = i(/* @__PURE__ */ new Set()), T = _ ? He :
|
|
3053
|
+
let w = i(/* @__PURE__ */ new Set()), T = _ ? He : Z, E = s ?? (_ ? 48 : 300), D = _ ? !1 : u ?? e.length > 1, O = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && O > 2e3), A = i([S?.min ?? 0, S?.max ?? 1]), j = i(/* @__PURE__ */ new Set()), M = (t, { width: n, height: i }) => {
|
|
3034
3054
|
let a = n - T.left - T.right, o = i - T.top - T.bottom;
|
|
3035
3055
|
if (a <= 0 || o <= 0) return;
|
|
3036
|
-
let s = m([I, L], [0, a]), c = m([
|
|
3056
|
+
let s = m([I, L], [0, a]), c = m([ee, R], [o, 0]);
|
|
3037
3057
|
e.forEach((e, n) => {
|
|
3038
3058
|
if (!w.value.has(e.id)) {
|
|
3039
|
-
t.fillStyle =
|
|
3059
|
+
t.fillStyle = Ze(t, e.color ?? fn[n % fn.length]), t.globalAlpha = .7;
|
|
3040
3060
|
for (let n of e.data) {
|
|
3041
3061
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3042
3062
|
t.beginPath(), t.arc(T.left + s.map(n.x), T.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3043
3063
|
}
|
|
3044
3064
|
}
|
|
3045
3065
|
}), t.globalAlpha = 1;
|
|
3046
|
-
}, N = e.flatMap((e) => e.data.map((e) => e.x)), P = e.flatMap((e) => e.data.map((e) => e.y)), F = N.length > 0, I = F ? Math.min(...N) : 0, L = F ? Math.max(...N) : 1,
|
|
3066
|
+
}, N = e.flatMap((e) => e.data.map((e) => e.x)), P = e.flatMap((e) => e.data.map((e) => e.y)), F = N.length > 0, I = F ? Math.min(...N) : 0, L = F ? Math.max(...N) : 1, ee = F ? Math.min(0, ...P) : 0, R = F ? Math.max(...P) : 1;
|
|
3047
3067
|
return /* @__PURE__ */ p("div", {
|
|
3048
3068
|
style: {
|
|
3049
3069
|
display: "flex",
|
|
@@ -3074,7 +3094,7 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3074
3094
|
plain: _,
|
|
3075
3095
|
tooltip: h !== !1 && F ? ({ width: t, height: n }) => {
|
|
3076
3096
|
if (h === !1 || !F) return;
|
|
3077
|
-
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = m([I, L], [0, r]), o = m([
|
|
3097
|
+
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = m([I, L], [0, r]), o = m([ee, R], [i, 0]);
|
|
3078
3098
|
return { points: e.flatMap((e) => w.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3079
3099
|
id: `${e.id}-${n}`,
|
|
3080
3100
|
cx: T.left + a.map(t.x),
|
|
@@ -3093,17 +3113,17 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3093
3113
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3094
3114
|
} : void 0,
|
|
3095
3115
|
children: ({ width: t, height: n }) => {
|
|
3096
|
-
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = m([I, L], [0, i]), s = m([
|
|
3116
|
+
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = m([I, L], [0, i]), s = m([ee, R], [a, 0]);
|
|
3097
3117
|
return /* @__PURE__ */ f("g", { children: /* @__PURE__ */ p("g", {
|
|
3098
3118
|
transform: `translate(${T.left},${T.top})`,
|
|
3099
3119
|
children: [
|
|
3100
|
-
!_ && /* @__PURE__ */ f(
|
|
3120
|
+
!_ && /* @__PURE__ */ f(gt, {
|
|
3101
3121
|
scale: s,
|
|
3102
3122
|
orientation: "y",
|
|
3103
3123
|
length: i,
|
|
3104
3124
|
tickCount: l
|
|
3105
3125
|
}),
|
|
3106
|
-
!_ &&
|
|
3126
|
+
!_ && xt(v, {
|
|
3107
3127
|
xScale: o,
|
|
3108
3128
|
yScale: s,
|
|
3109
3129
|
innerW: i,
|
|
@@ -3111,12 +3131,12 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3111
3131
|
}),
|
|
3112
3132
|
!k && e.map((e, t) => {
|
|
3113
3133
|
if (w.value.has(e.id)) return null;
|
|
3114
|
-
let n = e.color ??
|
|
3134
|
+
let n = e.color ?? fn[t % fn.length];
|
|
3115
3135
|
return /* @__PURE__ */ f("g", {
|
|
3116
3136
|
"data-series": e.id,
|
|
3117
3137
|
children: e.data.map((t, i) => {
|
|
3118
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3119
|
-
return m && m !== "circle" ? /* @__PURE__ */ f(
|
|
3138
|
+
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? Gt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? Kt(t.y, S, A.value, j.value) : !0, p = d ? .7 : .1, m = typeof b == "function" ? b(t, e.id) : b;
|
|
3139
|
+
return m && m !== "circle" ? /* @__PURE__ */ f(Mt, {
|
|
3120
3140
|
shape: m,
|
|
3121
3141
|
x: o.map(t.x),
|
|
3122
3142
|
y: s.map(t.y),
|
|
@@ -3153,17 +3173,17 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3153
3173
|
}) });
|
|
3154
3174
|
}
|
|
3155
3175
|
}),
|
|
3156
|
-
S && F && /* @__PURE__ */ f(
|
|
3176
|
+
S && F && /* @__PURE__ */ f(qt, {
|
|
3157
3177
|
options: S,
|
|
3158
3178
|
range: A,
|
|
3159
3179
|
hidden: j,
|
|
3160
3180
|
label: t
|
|
3161
3181
|
}),
|
|
3162
|
-
D && /* @__PURE__ */ f(
|
|
3182
|
+
D && /* @__PURE__ */ f(Yt, {
|
|
3163
3183
|
series: e.map((e, t) => ({
|
|
3164
3184
|
id: e.id,
|
|
3165
3185
|
label: e.label,
|
|
3166
|
-
color: e.color ??
|
|
3186
|
+
color: e.color ?? fn[t % fn.length]
|
|
3167
3187
|
})),
|
|
3168
3188
|
hidden: w
|
|
3169
3189
|
})
|
|
@@ -3172,7 +3192,7 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3172
3192
|
}
|
|
3173
3193
|
//#endregion
|
|
3174
3194
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3175
|
-
function
|
|
3195
|
+
function mn({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var(--cascivo-chart-1)", endDot: a = !0 }) {
|
|
3176
3196
|
return /* @__PURE__ */ f(Q, {
|
|
3177
3197
|
title: r,
|
|
3178
3198
|
width: t,
|
|
@@ -3210,13 +3230,13 @@ function dn({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var
|
|
|
3210
3230
|
}
|
|
3211
3231
|
//#endregion
|
|
3212
3232
|
//#region src/charts/meter/meter.tsx
|
|
3213
|
-
function
|
|
3233
|
+
function hn(e, t, n, r) {
|
|
3214
3234
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3215
3235
|
let { warning: i, critical: a } = r;
|
|
3216
3236
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3217
3237
|
}
|
|
3218
|
-
function
|
|
3219
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l =
|
|
3238
|
+
function gn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o = 200, height: s }) {
|
|
3239
|
+
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l = hn(e, t, n, a);
|
|
3220
3240
|
if (i === "gauge") {
|
|
3221
3241
|
let i = s ?? 100, a = o, u = a / 2, d = i * .9, m = Math.min(u, d) - 4, h = m * .65, g = Math.PI, _ = P(u, d, m, h, g, 2 * Math.PI), v = g + c * Math.PI, y = c > 0 ? P(u, d, m, h, g, v) : "";
|
|
3222
3242
|
return /* @__PURE__ */ p("div", {
|
|
@@ -3294,10 +3314,10 @@ function pn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3294
3314
|
}
|
|
3295
3315
|
//#endregion
|
|
3296
3316
|
//#region src/charts/kpi/kpi.tsx
|
|
3297
|
-
function
|
|
3317
|
+
function _n(e) {
|
|
3298
3318
|
return `${e >= 0 ? "+" : ""}${e.toLocaleString()}`;
|
|
3299
3319
|
}
|
|
3300
|
-
function
|
|
3320
|
+
function vn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a, className: o }) {
|
|
3301
3321
|
let s = n != null && n >= 0, c = n != null && n < 0;
|
|
3302
3322
|
return /* @__PURE__ */ p("div", {
|
|
3303
3323
|
className: o,
|
|
@@ -3349,16 +3369,16 @@ function hn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3349
3369
|
fontWeight: 500,
|
|
3350
3370
|
color: s ? "var(--cascivo-color-success-foreground)" : c ? "var(--cascivo-color-destructive-foreground)" : "var(--cascivo-color-foreground-muted)"
|
|
3351
3371
|
},
|
|
3352
|
-
"aria-label": `Trend: ${
|
|
3372
|
+
"aria-label": `Trend: ${_n(n)}${r ? ` ${r}` : ""}`,
|
|
3353
3373
|
children: [
|
|
3354
3374
|
s ? "▲" : c ? "▼" : "–",
|
|
3355
3375
|
" ",
|
|
3356
|
-
|
|
3376
|
+
_n(n),
|
|
3357
3377
|
r && ` ${r}`
|
|
3358
3378
|
]
|
|
3359
3379
|
})]
|
|
3360
3380
|
}),
|
|
3361
|
-
a && a.length > 0 && /* @__PURE__ */ f(
|
|
3381
|
+
a && a.length > 0 && /* @__PURE__ */ f(mn, {
|
|
3362
3382
|
data: a,
|
|
3363
3383
|
label: `${t} trend`,
|
|
3364
3384
|
width: 120,
|
|
@@ -3369,9 +3389,9 @@ function hn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3369
3389
|
}
|
|
3370
3390
|
//#endregion
|
|
3371
3391
|
//#region src/charts/histogram/histogram.tsx
|
|
3372
|
-
function
|
|
3392
|
+
function yn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3373
3393
|
o();
|
|
3374
|
-
let u = l ? He :
|
|
3394
|
+
let u = l ? He : Z, h = s ?? (l ? 48 : 300), g = B(e, t), _ = g.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3375
3395
|
return /* @__PURE__ */ f(Q, {
|
|
3376
3396
|
title: n,
|
|
3377
3397
|
description: i,
|
|
@@ -3412,7 +3432,7 @@ function gn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3412
3432
|
return /* @__PURE__ */ p("g", {
|
|
3413
3433
|
transform: `translate(${u.left},${u.top})`,
|
|
3414
3434
|
children: [
|
|
3415
|
-
!l && /* @__PURE__ */ f(
|
|
3435
|
+
!l && /* @__PURE__ */ f(gt, {
|
|
3416
3436
|
scale: i,
|
|
3417
3437
|
orientation: "y",
|
|
3418
3438
|
length: n.width
|
|
@@ -3445,13 +3465,13 @@ function gn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3445
3465
|
}
|
|
3446
3466
|
//#endregion
|
|
3447
3467
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3448
|
-
var
|
|
3449
|
-
function
|
|
3468
|
+
var bn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3469
|
+
function xn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: s }) {
|
|
3450
3470
|
o();
|
|
3451
|
-
let c = s ? He :
|
|
3471
|
+
let c = s ? He : Z, l = i ?? (s ? 48 : 320), u = e.map((e) => ({
|
|
3452
3472
|
...e,
|
|
3453
|
-
stats:
|
|
3454
|
-
})), h = e.flatMap((e) => e.values), [_, v] = h.length > 0 ?
|
|
3473
|
+
stats: V(e.values)
|
|
3474
|
+
})), h = e.flatMap((e) => e.values), [_, v] = h.length > 0 ? H(h) : [0, 1];
|
|
3455
3475
|
return /* @__PURE__ */ f(Q, {
|
|
3456
3476
|
title: t,
|
|
3457
3477
|
description: n,
|
|
@@ -3510,7 +3530,7 @@ function vn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3510
3530
|
return /* @__PURE__ */ p("g", {
|
|
3511
3531
|
transform: `translate(${c.left},${c.top})`,
|
|
3512
3532
|
children: [u.map((e, t) => {
|
|
3513
|
-
let n =
|
|
3533
|
+
let n = bn[t % bn.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), m = a.map(e.stats.max);
|
|
3514
3534
|
return /* @__PURE__ */ p("g", { children: [
|
|
3515
3535
|
/* @__PURE__ */ f("line", {
|
|
3516
3536
|
x1: i,
|
|
@@ -3587,10 +3607,10 @@ function vn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3587
3607
|
}
|
|
3588
3608
|
//#endregion
|
|
3589
3609
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3590
|
-
var
|
|
3591
|
-
function
|
|
3610
|
+
var Sn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Cn = 3, wn = 24;
|
|
3611
|
+
function Tn({ series: e, title: t, description: n, width: r, height: a, tooltip: s, className: c, plain: l, glyph: u }) {
|
|
3592
3612
|
o();
|
|
3593
|
-
let h = i(null), g = l ? He :
|
|
3613
|
+
let h = i(null), g = l ? He : Z, v = a ?? (l ? 48 : 320), y = e.flatMap((e) => e.data), [b, x] = y.length > 0 ? H(y.map((e) => e.x)) : [0, 1], [S, C] = y.length > 0 ? H(y.map((e) => e.y)) : [0, 1], [w, T] = y.length > 0 ? H(y.map((e) => e.size)) : [0, 1], E = _([w, T], [Cn, wn]), D = y.length > 0;
|
|
3594
3614
|
return /* @__PURE__ */ f(Q, {
|
|
3595
3615
|
title: t,
|
|
3596
3616
|
description: n,
|
|
@@ -3641,13 +3661,13 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3641
3661
|
return /* @__PURE__ */ p("g", {
|
|
3642
3662
|
transform: `translate(${g.left},${g.top})`,
|
|
3643
3663
|
children: [
|
|
3644
|
-
!l && /* @__PURE__ */ f(
|
|
3664
|
+
!l && /* @__PURE__ */ f(gt, {
|
|
3645
3665
|
scale: s,
|
|
3646
3666
|
orientation: "y",
|
|
3647
3667
|
length: r.width
|
|
3648
3668
|
}),
|
|
3649
3669
|
e.map((e, t) => {
|
|
3650
|
-
let n =
|
|
3670
|
+
let n = Sn[t % Sn.length] ?? "var(--cascivo-chart-1)";
|
|
3651
3671
|
return /* @__PURE__ */ f("g", {
|
|
3652
3672
|
opacity: h.value !== null && h.value !== e.name ? .2 : 1,
|
|
3653
3673
|
onMouseEnter: () => {
|
|
@@ -3658,7 +3678,7 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3658
3678
|
},
|
|
3659
3679
|
children: e.data.map((t, r) => {
|
|
3660
3680
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3661
|
-
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(
|
|
3681
|
+
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(Mt, {
|
|
3662
3682
|
shape: i,
|
|
3663
3683
|
x: o.map(t.x),
|
|
3664
3684
|
y: s.map(t.y),
|
|
@@ -3696,11 +3716,11 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3696
3716
|
}
|
|
3697
3717
|
//#endregion
|
|
3698
3718
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3699
|
-
function
|
|
3719
|
+
function En({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, width: a, height: s, tooltip: c, className: l, plain: u, annotations: h }) {
|
|
3700
3720
|
o();
|
|
3701
3721
|
let _ = s ?? (u ? 48 : 320), v = u ? He : {
|
|
3702
|
-
...
|
|
3703
|
-
right: i ? 60 :
|
|
3722
|
+
...Z,
|
|
3723
|
+
right: i ? 60 : Z.right
|
|
3704
3724
|
}, y = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, b = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, x = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, S = e.length > 0;
|
|
3705
3725
|
return /* @__PURE__ */ f(Q, {
|
|
3706
3726
|
title: n,
|
|
@@ -3751,12 +3771,12 @@ function Cn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3751
3771
|
return /* @__PURE__ */ p("g", {
|
|
3752
3772
|
transform: `translate(${v.left},${v.top})`,
|
|
3753
3773
|
children: [
|
|
3754
|
-
!u && /* @__PURE__ */ f(
|
|
3774
|
+
!u && /* @__PURE__ */ f(gt, {
|
|
3755
3775
|
scale: s,
|
|
3756
3776
|
orientation: "y",
|
|
3757
3777
|
length: a.width
|
|
3758
3778
|
}),
|
|
3759
|
-
!u &&
|
|
3779
|
+
!u && xt(h, {
|
|
3760
3780
|
xScale: o,
|
|
3761
3781
|
yScale: s,
|
|
3762
3782
|
innerW: a.width,
|
|
@@ -3807,14 +3827,14 @@ function Cn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3807
3827
|
}
|
|
3808
3828
|
//#endregion
|
|
3809
3829
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3810
|
-
function
|
|
3830
|
+
function Dn({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u }) {
|
|
3811
3831
|
o();
|
|
3812
3832
|
let m = a ?? (c ? 48 : 320), h = c ? He : {
|
|
3813
3833
|
top: 20,
|
|
3814
3834
|
right: 20,
|
|
3815
3835
|
bottom: 60,
|
|
3816
3836
|
left: 60
|
|
3817
|
-
}, _ = [...new Set(e.map((e) => e.x))], v = [...new Set(e.map((e) => e.y))], [y, b] = e.length > 0 ?
|
|
3837
|
+
}, _ = [...new Set(e.map((e) => e.x))], v = [...new Set(e.map((e) => e.y))], [y, b] = e.length > 0 ? H(e.map((e) => e.value)) : [0, 1], x = b - y || 1, S = (e) => Math.max(0, Math.min(1, (e - y) / x)), C = i([l?.min ?? y, l?.max ?? b]), w = i(/* @__PURE__ */ new Set()), T = /* @__PURE__ */ f(Q, {
|
|
3818
3838
|
title: t,
|
|
3819
3839
|
description: n,
|
|
3820
3840
|
width: r,
|
|
@@ -3864,7 +3884,7 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3864
3884
|
return /* @__PURE__ */ p("g", {
|
|
3865
3885
|
transform: `translate(${h.left},${h.top})`,
|
|
3866
3886
|
children: [e.map((e, t) => {
|
|
3867
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ?
|
|
3887
|
+
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ? Gt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-color-neutral-100))`, c = l ? Kt(e.value, l, C.value, w.value) : !0;
|
|
3868
3888
|
return /* @__PURE__ */ f("rect", {
|
|
3869
3889
|
x: n,
|
|
3870
3890
|
y: r,
|
|
@@ -3894,7 +3914,7 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3894
3914
|
flexDirection: "column",
|
|
3895
3915
|
gap: "0.5rem"
|
|
3896
3916
|
},
|
|
3897
|
-
children: [T, /* @__PURE__ */ f(
|
|
3917
|
+
children: [T, /* @__PURE__ */ f(qt, {
|
|
3898
3918
|
options: l,
|
|
3899
3919
|
range: C,
|
|
3900
3920
|
hidden: w,
|
|
@@ -3904,8 +3924,8 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3904
3924
|
}
|
|
3905
3925
|
//#endregion
|
|
3906
3926
|
//#region src/charts/treemap/treemap.tsx
|
|
3907
|
-
var
|
|
3908
|
-
function
|
|
3927
|
+
var On = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3928
|
+
function kn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: c }) {
|
|
3909
3929
|
o();
|
|
3910
3930
|
let l = s();
|
|
3911
3931
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -3921,7 +3941,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3921
3941
|
className: a,
|
|
3922
3942
|
plain: c,
|
|
3923
3943
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3924
|
-
if (e.length !== 0) return { points:
|
|
3944
|
+
if (e.length !== 0) return { points: K(e.map((e) => ({
|
|
3925
3945
|
id: e.id,
|
|
3926
3946
|
value: e.value
|
|
3927
3947
|
})), t, n).map((t) => {
|
|
@@ -3937,7 +3957,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3937
3957
|
} : void 0,
|
|
3938
3958
|
children: ({ width: t, height: n }) => {
|
|
3939
3959
|
if (e.length === 0) return null;
|
|
3940
|
-
let r =
|
|
3960
|
+
let r = K(e.map((e) => ({
|
|
3941
3961
|
id: e.id,
|
|
3942
3962
|
value: e.value
|
|
3943
3963
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -3950,7 +3970,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3950
3970
|
height: Math.max(0, e.h - 4)
|
|
3951
3971
|
})
|
|
3952
3972
|
}, e.id)) }), r.map((e, t) => {
|
|
3953
|
-
let n =
|
|
3973
|
+
let n = On[t % On.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
3954
3974
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("rect", {
|
|
3955
3975
|
x: e.x,
|
|
3956
3976
|
y: e.y,
|
|
@@ -3974,8 +3994,8 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3974
3994
|
}
|
|
3975
3995
|
//#endregion
|
|
3976
3996
|
//#region src/charts/radar/radar.tsx
|
|
3977
|
-
var
|
|
3978
|
-
function
|
|
3997
|
+
var An = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), jn = 4;
|
|
3998
|
+
function Mn(e, t, n, r, i) {
|
|
3979
3999
|
let a = e.length;
|
|
3980
4000
|
return e.map((e, o) => {
|
|
3981
4001
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -3985,7 +4005,7 @@ function kn(e, t, n, r, i) {
|
|
|
3985
4005
|
};
|
|
3986
4006
|
});
|
|
3987
4007
|
}
|
|
3988
|
-
function
|
|
4008
|
+
function Nn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3989
4009
|
let u = s ?? (l ? 48 : 320);
|
|
3990
4010
|
o();
|
|
3991
4011
|
let m = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -4017,7 +4037,7 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4017
4037
|
})) };
|
|
4018
4038
|
} : void 0,
|
|
4019
4039
|
children: ({ width: n, height: r }) => {
|
|
4020
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4040
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: jn }, (e, t) => (t + 1) / jn * o), c = Array.from({ length: h }, (e, t) => {
|
|
4021
4041
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4022
4042
|
return {
|
|
4023
4043
|
x: C(i + Math.cos(n) * o),
|
|
@@ -4055,7 +4075,7 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4055
4075
|
}, n);
|
|
4056
4076
|
}),
|
|
4057
4077
|
t.map((e, t) => {
|
|
4058
|
-
let n =
|
|
4078
|
+
let n = Mn(e.values, m, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = An[t % An.length] ?? "var(--cascivo-chart-1)";
|
|
4059
4079
|
return /* @__PURE__ */ f("polygon", {
|
|
4060
4080
|
points: n,
|
|
4061
4081
|
fill: r,
|
|
@@ -4070,12 +4090,12 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4070
4090
|
}
|
|
4071
4091
|
//#endregion
|
|
4072
4092
|
//#region src/charts/bullet/bullet.tsx
|
|
4073
|
-
var
|
|
4093
|
+
var Pn = [
|
|
4074
4094
|
"var(--cascivo-color-neutral-200)",
|
|
4075
4095
|
"var(--cascivo-color-neutral-300)",
|
|
4076
4096
|
"var(--cascivo-color-neutral-400)"
|
|
4077
4097
|
];
|
|
4078
|
-
function
|
|
4098
|
+
function Fn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: s = 300, height: c = 40, className: l }) {
|
|
4079
4099
|
o();
|
|
4080
4100
|
let u = [...n].sort((e, t) => e - t), h = m([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;
|
|
4081
4101
|
return /* @__PURE__ */ p("figure", {
|
|
@@ -4102,7 +4122,7 @@ function Mn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4102
4122
|
y: 0,
|
|
4103
4123
|
width: Math.max(0, r),
|
|
4104
4124
|
height: c,
|
|
4105
|
-
fill:
|
|
4125
|
+
fill: Pn[t % Pn.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4106
4126
|
}, t);
|
|
4107
4127
|
}),
|
|
4108
4128
|
/* @__PURE__ */ f("rect", {
|
|
@@ -4129,8 +4149,8 @@ function Mn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4129
4149
|
}
|
|
4130
4150
|
//#endregion
|
|
4131
4151
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4132
|
-
var
|
|
4133
|
-
function
|
|
4152
|
+
var In = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4153
|
+
function Ln({ data: e, title: t, description: n, size: r, width: a, height: s, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: m, tooltip: h, legend: g, className: _, plain: v }) {
|
|
4134
4154
|
o();
|
|
4135
4155
|
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, w = 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) => {
|
|
4136
4156
|
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));
|
|
@@ -4155,7 +4175,7 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4155
4175
|
value: e.value,
|
|
4156
4176
|
seriesId: e.id,
|
|
4157
4177
|
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4158
|
-
color: e.color ??
|
|
4178
|
+
color: e.color ?? In[t % In.length]
|
|
4159
4179
|
};
|
|
4160
4180
|
}) };
|
|
4161
4181
|
}, A = /* @__PURE__ */ p("table", { children: [
|
|
@@ -4182,7 +4202,7 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4182
4202
|
children: ({ width: e, height: t }) => {
|
|
4183
4203
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4184
4204
|
return /* @__PURE__ */ p("g", { children: [s.map((e, t) => {
|
|
4185
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4205
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? In[t % In.length], l = Math.max(0, Math.min(1, e.value / T)), u = D + E * l;
|
|
4186
4206
|
return /* @__PURE__ */ p("g", {
|
|
4187
4207
|
"data-series": e.id,
|
|
4188
4208
|
children: [/* @__PURE__ */ f("path", {
|
|
@@ -4234,11 +4254,11 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4234
4254
|
})
|
|
4235
4255
|
}))] });
|
|
4236
4256
|
}
|
|
4237
|
-
}), S && /* @__PURE__ */ f(
|
|
4257
|
+
}), S && /* @__PURE__ */ f(Yt, {
|
|
4238
4258
|
series: e.map((e, t) => ({
|
|
4239
4259
|
id: e.id,
|
|
4240
4260
|
label: e.label,
|
|
4241
|
-
color: e.color ??
|
|
4261
|
+
color: e.color ?? In[t % In.length]
|
|
4242
4262
|
})),
|
|
4243
4263
|
hidden: y
|
|
4244
4264
|
})]
|
|
@@ -4246,10 +4266,10 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4246
4266
|
}
|
|
4247
4267
|
//#endregion
|
|
4248
4268
|
//#region src/charts/funnel/funnel.tsx
|
|
4249
|
-
var
|
|
4250
|
-
function
|
|
4269
|
+
var Rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4270
|
+
function zn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: s, className: c, plain: l }) {
|
|
4251
4271
|
o();
|
|
4252
|
-
let u = l ? He :
|
|
4272
|
+
let u = l ? He : Z, d = i ?? (l ? 48 : 320), h = e.length > 0, g = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4253
4273
|
return /* @__PURE__ */ f(Q, {
|
|
4254
4274
|
title: t,
|
|
4255
4275
|
description: n,
|
|
@@ -4283,7 +4303,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4283
4303
|
value: e.value,
|
|
4284
4304
|
seriesId: e.id,
|
|
4285
4305
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4286
|
-
color: e.color ??
|
|
4306
|
+
color: e.color ?? Rn[t % Rn.length]
|
|
4287
4307
|
})),
|
|
4288
4308
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4289
4309
|
};
|
|
@@ -4293,7 +4313,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4293
4313
|
if (r <= 0 || e.length === 0) return null;
|
|
4294
4314
|
let o = i / e.length, s = m([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4295
4315
|
return /* @__PURE__ */ f("g", { children: e.map((t, n) => {
|
|
4296
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), m = u.top + n * o, h = m + o * (r ? 1 : .9), _ = t.color ??
|
|
4316
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), m = u.top + n * o, h = m + o * (r ? 1 : .9), _ = t.color ?? Rn[n % Rn.length], v = [
|
|
4297
4317
|
[d - i, m],
|
|
4298
4318
|
[d + i, m],
|
|
4299
4319
|
[d + s, h],
|
|
@@ -4305,7 +4325,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4305
4325
|
points: v,
|
|
4306
4326
|
fill: _,
|
|
4307
4327
|
fillOpacity: .85
|
|
4308
|
-
}), !l && /* @__PURE__ */ f(
|
|
4328
|
+
}), !l && /* @__PURE__ */ f(Tt, {
|
|
4309
4329
|
x: d,
|
|
4310
4330
|
y: m + o / 2,
|
|
4311
4331
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4318,10 +4338,10 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4318
4338
|
}
|
|
4319
4339
|
//#endregion
|
|
4320
4340
|
//#region src/charts/stream/stream.tsx
|
|
4321
|
-
var
|
|
4322
|
-
function
|
|
4341
|
+
var Bn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4342
|
+
function Vn({ series: e, categories: t, title: n, description: r, offset: a = "silhouette", curve: s = "basis", width: c, height: l, legend: u, tooltip: d, className: h, plain: _ }) {
|
|
4323
4343
|
o();
|
|
4324
|
-
let v = i(/* @__PURE__ */ new Set()), y = _ ? He :
|
|
4344
|
+
let v = i(/* @__PURE__ */ new Set()), y = _ ? He : Z, b = l ?? (_ ? 48 : 300), x = _ ? !1 : u ?? e.length > 1, S = t.length > 0 && e.length > 0, C = re(e.map((e) => e.values), a), [w, E] = ie(C);
|
|
4325
4345
|
return /* @__PURE__ */ p("div", {
|
|
4326
4346
|
style: {
|
|
4327
4347
|
display: "flex",
|
|
@@ -4356,7 +4376,7 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4356
4376
|
label: `${e.label} · ${String(t)}`,
|
|
4357
4377
|
value: e.values[i] ?? 0,
|
|
4358
4378
|
seriesId: e.id,
|
|
4359
|
-
color: e.color ??
|
|
4379
|
+
color: e.color ?? Bn[n % Bn.length]
|
|
4360
4380
|
};
|
|
4361
4381
|
});
|
|
4362
4382
|
}) };
|
|
@@ -4369,7 +4389,7 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4369
4389
|
transform: `translate(${y.left},${y.top})`,
|
|
4370
4390
|
children: [e.map((e, n) => {
|
|
4371
4391
|
if (v.value.has(e.id)) return null;
|
|
4372
|
-
let r = C[n], i = e.color ??
|
|
4392
|
+
let r = C[n], i = e.color ?? Bn[n % Bn.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])]);
|
|
4373
4393
|
return /* @__PURE__ */ f("path", {
|
|
4374
4394
|
d: `${T(a, s)}${T([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4375
4395
|
fill: i,
|
|
@@ -4384,11 +4404,11 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4384
4404
|
})]
|
|
4385
4405
|
});
|
|
4386
4406
|
}
|
|
4387
|
-
}), x && /* @__PURE__ */ f(
|
|
4407
|
+
}), x && /* @__PURE__ */ f(Yt, {
|
|
4388
4408
|
series: e.map((e, t) => ({
|
|
4389
4409
|
id: e.id,
|
|
4390
4410
|
label: e.label,
|
|
4391
|
-
color: e.color ??
|
|
4411
|
+
color: e.color ?? Bn[t % Bn.length]
|
|
4392
4412
|
})),
|
|
4393
4413
|
hidden: v
|
|
4394
4414
|
})]
|
|
@@ -4396,10 +4416,10 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4396
4416
|
}
|
|
4397
4417
|
//#endregion
|
|
4398
4418
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4399
|
-
var
|
|
4400
|
-
function
|
|
4419
|
+
var Hn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4420
|
+
function Un({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4401
4421
|
o();
|
|
4402
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), m =
|
|
4422
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), m = q(e), h = m > 0, g = J(e), _ = Math.max(1, ae(g));
|
|
4403
4423
|
return /* @__PURE__ */ f(Q, {
|
|
4404
4424
|
title: t,
|
|
4405
4425
|
description: n,
|
|
@@ -4426,7 +4446,7 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4426
4446
|
label: e.node.label,
|
|
4427
4447
|
value: e.value,
|
|
4428
4448
|
percent: m > 0 ? e.value / m * 100 : 0,
|
|
4429
|
-
color: e.node.color ??
|
|
4449
|
+
color: e.node.color ?? Hn[t % Hn.length]
|
|
4430
4450
|
};
|
|
4431
4451
|
}),
|
|
4432
4452
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4435,7 +4455,7 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4435
4455
|
children: ({ width: e, height: t }) => {
|
|
4436
4456
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4437
4457
|
return /* @__PURE__ */ f("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4438
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4458
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? Hn[t % Hn.length];
|
|
4439
4459
|
return /* @__PURE__ */ f("path", {
|
|
4440
4460
|
d: P(n, r, o, a, e.a0, e.a1),
|
|
4441
4461
|
fill: s,
|
|
@@ -4450,10 +4470,10 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4450
4470
|
}
|
|
4451
4471
|
//#endregion
|
|
4452
4472
|
//#region src/charts/sankey/sankey.tsx
|
|
4453
|
-
var
|
|
4454
|
-
function
|
|
4473
|
+
var Wn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4474
|
+
function Gn({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4455
4475
|
o();
|
|
4456
|
-
let u = l ? He :
|
|
4476
|
+
let u = l ? He : Z, d = a ?? (l ? 48 : 320), m = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ?? Wn[n % Wn.length];
|
|
4457
4477
|
return /* @__PURE__ */ f(Q, {
|
|
4458
4478
|
title: n,
|
|
4459
4479
|
description: r,
|
|
@@ -4477,7 +4497,7 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4477
4497
|
plain: l,
|
|
4478
4498
|
tooltip: s && m ? ({ width: n, height: r }) => {
|
|
4479
4499
|
if (!s || !m) return;
|
|
4480
|
-
let { nodes: i } =
|
|
4500
|
+
let { nodes: i } = oe(e, t, {
|
|
4481
4501
|
width: n - u.left - u.right,
|
|
4482
4502
|
height: r - u.top - u.bottom
|
|
4483
4503
|
});
|
|
@@ -4493,14 +4513,14 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4493
4513
|
children: ({ width: n, height: r }) => {
|
|
4494
4514
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4495
4515
|
if (i <= 0 || !m) return null;
|
|
4496
|
-
let { nodes: o, links: s } =
|
|
4516
|
+
let { nodes: o, links: s } = oe(e, t, {
|
|
4497
4517
|
width: i,
|
|
4498
4518
|
height: a
|
|
4499
4519
|
});
|
|
4500
4520
|
return /* @__PURE__ */ p("g", {
|
|
4501
4521
|
transform: `translate(${u.left},${u.top})`,
|
|
4502
4522
|
children: [s.map((e, t) => /* @__PURE__ */ f("path", {
|
|
4503
|
-
d:
|
|
4523
|
+
d: se(e),
|
|
4504
4524
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4505
4525
|
fillOpacity: .32,
|
|
4506
4526
|
"data-link": ""
|
|
@@ -4529,23 +4549,23 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4529
4549
|
}
|
|
4530
4550
|
//#endregion
|
|
4531
4551
|
//#region src/charts/calendar/calendar.tsx
|
|
4532
|
-
var
|
|
4533
|
-
function
|
|
4552
|
+
var Kn = 864e5, qn = (e) => e instanceof Date ? e : new Date(e), Jn = (e) => e.toISOString().slice(0, 10);
|
|
4553
|
+
function Yn(e) {
|
|
4534
4554
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4535
4555
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4536
4556
|
}
|
|
4537
|
-
function
|
|
4557
|
+
function Xn({ data: e, title: t, description: n, from: r, to: a, width: s, height: c, tooltip: l, className: u, plain: d, visualMap: m }) {
|
|
4538
4558
|
o();
|
|
4539
4559
|
let h = e.length > 0, g = i([m?.min ?? 0, m?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4540
|
-
for (let t of e) v.set(
|
|
4541
|
-
let y = e.map((e) =>
|
|
4560
|
+
for (let t of e) v.set(Jn(qn(t.day)), t.value);
|
|
4561
|
+
let y = e.map((e) => qn(e.day)), b = Yn(r ? qn(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = a ? qn(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()) / Kn / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4542
4562
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4543
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4563
|
+
let n = new Date(b.getTime() + (e * 7 + t) * Kn);
|
|
4544
4564
|
n > x || T.push({
|
|
4545
4565
|
col: e,
|
|
4546
4566
|
row: t,
|
|
4547
4567
|
date: n,
|
|
4548
|
-
value: v.get(
|
|
4568
|
+
value: v.get(Jn(n)) ?? 0
|
|
4549
4569
|
});
|
|
4550
4570
|
}
|
|
4551
4571
|
let E = /* @__PURE__ */ f(Q, {
|
|
@@ -4556,7 +4576,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4556
4576
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
4557
4577
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4558
4578
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Day" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4559
|
-
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children:
|
|
4579
|
+
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: Jn(qn(e.day)) }), /* @__PURE__ */ f("td", { children: e.value })] }, t)) })
|
|
4560
4580
|
] }),
|
|
4561
4581
|
className: u,
|
|
4562
4582
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4566,10 +4586,10 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4566
4586
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4567
4587
|
return {
|
|
4568
4588
|
points: T.map((e, n) => ({
|
|
4569
|
-
id: `${
|
|
4589
|
+
id: `${Jn(e.date)}-${n}`,
|
|
4570
4590
|
cx: e.col * (t + 2) + t / 2,
|
|
4571
4591
|
cy: e.row * (t + 2) + t / 2,
|
|
4572
|
-
label:
|
|
4592
|
+
label: Jn(e.date),
|
|
4573
4593
|
value: e.value
|
|
4574
4594
|
})),
|
|
4575
4595
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4578,7 +4598,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4578
4598
|
children: ({ width: e }) => {
|
|
4579
4599
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4580
4600
|
return /* @__PURE__ */ f("g", { children: T.map((e, n) => {
|
|
4581
|
-
let r = m ?
|
|
4601
|
+
let r = m ? Gt(e.value, m).color : void 0, i = m ? Kt(e.value, m, g.value, _.value) : !0;
|
|
4582
4602
|
return /* @__PURE__ */ f("rect", {
|
|
4583
4603
|
x: e.col * (t + 2),
|
|
4584
4604
|
y: e.row * (t + 2),
|
|
@@ -4587,7 +4607,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4587
4607
|
rx: 1.5,
|
|
4588
4608
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4589
4609
|
fillOpacity: m ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4590
|
-
"data-day":
|
|
4610
|
+
"data-day": Jn(e.date)
|
|
4591
4611
|
}, n);
|
|
4592
4612
|
}) });
|
|
4593
4613
|
}
|
|
@@ -4598,7 +4618,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4598
4618
|
flexDirection: "column",
|
|
4599
4619
|
gap: "0.5rem"
|
|
4600
4620
|
},
|
|
4601
|
-
children: [E, /* @__PURE__ */ f(
|
|
4621
|
+
children: [E, /* @__PURE__ */ f(qt, {
|
|
4602
4622
|
options: m,
|
|
4603
4623
|
range: g,
|
|
4604
4624
|
hidden: _,
|
|
@@ -4608,11 +4628,11 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4608
4628
|
}
|
|
4609
4629
|
//#endregion
|
|
4610
4630
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4611
|
-
function
|
|
4631
|
+
function Zn({ data: e, title: t, description: n, width: r, height: s, yTicks: l = 5, upColor: u = "var(--cascivo-chart-2)", downColor: h = "var(--cascivo-chart-4)", volume: _, tooltip: v, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E }) {
|
|
4612
4632
|
o();
|
|
4613
|
-
let D = b ? He :
|
|
4614
|
-
T && !M.current && (M.current =
|
|
4615
|
-
T &&
|
|
4633
|
+
let D = b ? He : Z, O = s ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = i([0, Math.max(0, k - 1)]), M = c(null);
|
|
4634
|
+
T && !M.current && (M.current = ut(T)), a(() => () => {
|
|
4635
|
+
T && dt(T);
|
|
4616
4636
|
}), a(() => {
|
|
4617
4637
|
let e = M.current;
|
|
4618
4638
|
if (!e) return;
|
|
@@ -4624,7 +4644,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4624
4644
|
let t = j.value, n = e.window.peek();
|
|
4625
4645
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4626
4646
|
});
|
|
4627
|
-
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e, P = N.length > 0, F = P ? Math.min(...N.map((e) => e.low)) : 0, I = P ? Math.max(...N.map((e) => e.high)) : 1, L = P ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1,
|
|
4647
|
+
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e, P = N.length > 0, F = P ? Math.min(...N.map((e) => e.low)) : 0, I = P ? Math.max(...N.map((e) => e.high)) : 1, L = P ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1, ee = N.map((e) => e.t);
|
|
4628
4648
|
return /* @__PURE__ */ p("div", {
|
|
4629
4649
|
style: {
|
|
4630
4650
|
display: "flex",
|
|
@@ -4661,7 +4681,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4661
4681
|
if (v === !1 || !P) return;
|
|
4662
4682
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4663
4683
|
if (n <= 0) return;
|
|
4664
|
-
let i = g(
|
|
4684
|
+
let i = g(ee, [0, n], .3), a = r - (_ ? Math.min(r * .2, 60) : 0), o = m([F, I], [a, 0]);
|
|
4665
4685
|
if (E === "axis") return {
|
|
4666
4686
|
points: N.map((e, t) => ({
|
|
4667
4687
|
id: `c-${t}`,
|
|
@@ -4719,11 +4739,11 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4719
4739
|
children: ({ width: e, height: t }) => {
|
|
4720
4740
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4721
4741
|
if (n <= 0 || !P) return null;
|
|
4722
|
-
let i = g(
|
|
4742
|
+
let i = g(ee, [0, n], .3), a = m([F, I], [r, 0]), o = _ ? Math.min(r * .2, 60) : 0, s = r - o, c = m([F, I], [s, 0]), v = i.bandwidth;
|
|
4723
4743
|
return /* @__PURE__ */ p("g", {
|
|
4724
4744
|
transform: `translate(${D.left},${D.top})`,
|
|
4725
4745
|
children: [
|
|
4726
|
-
!b && /* @__PURE__ */ f(
|
|
4746
|
+
!b && /* @__PURE__ */ f(gt, {
|
|
4727
4747
|
scale: a,
|
|
4728
4748
|
orientation: "y",
|
|
4729
4749
|
length: n,
|
|
@@ -4763,7 +4783,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4763
4783
|
]
|
|
4764
4784
|
}, t);
|
|
4765
4785
|
}),
|
|
4766
|
-
!b &&
|
|
4786
|
+
!b && xt(x, {
|
|
4767
4787
|
xScale: i,
|
|
4768
4788
|
yScale: c,
|
|
4769
4789
|
innerW: n,
|
|
@@ -4784,12 +4804,12 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4784
4804
|
});
|
|
4785
4805
|
}
|
|
4786
4806
|
}),
|
|
4787
|
-
S && !C && k > 1 && /* @__PURE__ */ f(
|
|
4807
|
+
S && !C && k > 1 && /* @__PURE__ */ f(Lt, {
|
|
4788
4808
|
count: k,
|
|
4789
4809
|
window: j,
|
|
4790
4810
|
label: "Time range"
|
|
4791
4811
|
}),
|
|
4792
|
-
C && k > 1 && /* @__PURE__ */ f(
|
|
4812
|
+
C && k > 1 && /* @__PURE__ */ f(Rt, {
|
|
4793
4813
|
count: k,
|
|
4794
4814
|
window: j,
|
|
4795
4815
|
label: "Time range"
|
|
@@ -4799,10 +4819,10 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4799
4819
|
}
|
|
4800
4820
|
//#endregion
|
|
4801
4821
|
//#region src/charts/polar/polar.tsx
|
|
4802
|
-
var
|
|
4803
|
-
function
|
|
4822
|
+
var Qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4823
|
+
function $n({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: s = 4, max: c, tooltip: l, className: u, plain: m }) {
|
|
4804
4824
|
o();
|
|
4805
|
-
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 =
|
|
4825
|
+
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__ */ p("table", { children: [
|
|
4806
4826
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4807
4827
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Category" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4808
4828
|
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: e.label }), /* @__PURE__ */ f("td", { children: e.value })] }, t)) })
|
|
@@ -4812,7 +4832,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4812
4832
|
cx: n,
|
|
4813
4833
|
cy: r,
|
|
4814
4834
|
outerR: i,
|
|
4815
|
-
rScale:
|
|
4835
|
+
rScale: Se([0, v], [0, i])
|
|
4816
4836
|
};
|
|
4817
4837
|
};
|
|
4818
4838
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -4829,7 +4849,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4829
4849
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4830
4850
|
return {
|
|
4831
4851
|
points: e.map((e, t) => {
|
|
4832
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4852
|
+
let n = y.center(e.label) ?? 0, [o, s] = X(r, i, a.map(e.value), n);
|
|
4833
4853
|
return {
|
|
4834
4854
|
id: `p-${t}`,
|
|
4835
4855
|
cx: o,
|
|
@@ -4845,7 +4865,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4845
4865
|
if (!g) return null;
|
|
4846
4866
|
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) => {
|
|
4847
4867
|
let t = y.center(e.label) ?? 0;
|
|
4848
|
-
return
|
|
4868
|
+
return X(i, a, c.map(e.value), t);
|
|
4849
4869
|
});
|
|
4850
4870
|
return /* @__PURE__ */ p("g", { children: [
|
|
4851
4871
|
!m && l.map((e, t) => /* @__PURE__ */ f("circle", {
|
|
@@ -4861,12 +4881,12 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4861
4881
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4862
4882
|
return /* @__PURE__ */ f("path", {
|
|
4863
4883
|
d: P(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4864
|
-
fill: e.color ??
|
|
4884
|
+
fill: e.color ?? Qn[t % Qn.length],
|
|
4865
4885
|
fillOpacity: .85,
|
|
4866
4886
|
"data-wedge": ""
|
|
4867
4887
|
}, t);
|
|
4868
4888
|
}) : (() => {
|
|
4869
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4889
|
+
let t = [...u, u[0]], n = e[0]?.color ?? Qn[0];
|
|
4870
4890
|
return /* @__PURE__ */ p(d, { children: [r === "area" && /* @__PURE__ */ f("path", {
|
|
4871
4891
|
d: `${T(t, "linear")}Z`,
|
|
4872
4892
|
fill: n,
|
|
@@ -4882,7 +4902,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4882
4902
|
})] });
|
|
4883
4903
|
})(),
|
|
4884
4904
|
!m && e.map((e, t) => {
|
|
4885
|
-
let n = y.center(e.label) ?? 0, [r, s] =
|
|
4905
|
+
let n = y.center(e.label) ?? 0, [r, s] = X(i, a, o + 12, n);
|
|
4886
4906
|
return /* @__PURE__ */ f("text", {
|
|
4887
4907
|
x: r,
|
|
4888
4908
|
y: s,
|
|
@@ -4900,10 +4920,10 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4900
4920
|
}
|
|
4901
4921
|
//#endregion
|
|
4902
4922
|
//#region src/charts/gauge/gauge.tsx
|
|
4903
|
-
var
|
|
4904
|
-
function
|
|
4923
|
+
var er = Math.PI / 180;
|
|
4924
|
+
function tr({ 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: m, plain: h }) {
|
|
4905
4925
|
o();
|
|
4906
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
4926
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * er, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
4907
4927
|
return /* @__PURE__ */ f(Q, {
|
|
4908
4928
|
title: c,
|
|
4909
4929
|
description: l,
|
|
@@ -4937,7 +4957,7 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4937
4957
|
}, t);
|
|
4938
4958
|
}),
|
|
4939
4959
|
!h && T.map((e, t) => {
|
|
4940
|
-
let n = S(e), [r, i] =
|
|
4960
|
+
let n = S(e), [r, i] = X(c, l, m - 2, n), [a, o] = X(c, l, m - 8, n), [s, u] = X(c, l, m - 18, n);
|
|
4941
4961
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("line", {
|
|
4942
4962
|
x1: r,
|
|
4943
4963
|
y1: i,
|
|
@@ -4957,7 +4977,7 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4957
4977
|
})] }, t);
|
|
4958
4978
|
}),
|
|
4959
4979
|
(() => {
|
|
4960
|
-
let [e, t] =
|
|
4980
|
+
let [e, t] = X(c, l, g, S(v));
|
|
4961
4981
|
return /* @__PURE__ */ f("line", {
|
|
4962
4982
|
x1: c,
|
|
4963
4983
|
y1: l,
|
|
@@ -4991,4 +5011,4 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4991
5011
|
});
|
|
4992
5012
|
}
|
|
4993
5013
|
//#endregion
|
|
4994
|
-
export {
|
|
5014
|
+
export { an as AreaChart, $ as Axis, cn as BarChart, xn as Boxplot, Lt as Brush, Tn as BubbleChart, Fn as Bullet, Xn as Calendar, Zn as Candlestick, Xe as CanvasLayer, At as ChartDefs, Q as ChartFrame, En as ComboChart, Z as DEFAULT_MARGINS, Tt as DataLabel, Rt as DataZoom, zn as Funnel, tr as Gauge, Mt as Glyph, gt as GridLines, Dn as Heatmap, yn as Histogram, vn as Kpi, Yt as Legend, tn as LineChart, gn as Meter, He as PLAIN_MARGINS, dn as PieChart, $n as Polar, Nn as Radar, Ln as RadialBar, Gn as Sankey, pn as ScatterChart, mn as Sparkline, Vn as Stream, Un as Sunburst, It as Text, rt as Toolbox, kn as Treemap, qt as VisualMap, ft as _syncGroupCount, De as aggregate, xe as angleBand, St as annotationSummary, P as arcPath, N as areaPath, Ge as autoLabelStride, g as bandScale, Oe as bin, B as binValues, Be as bindStream, V as boxStats, ne as cellPath, Le as decimate, _e as divergingRamp, st as download, Ne as encode, Pe as encodeCategory, H as extent, kt as fillFor, Ce as filter, ut as getSyncGroup, jt as glyphPath, Dt as gradientId, tt as isZoomed, We as leftMarginForLabels, T as linePath, m as linearScale, se as linkPath, v as logScale, Fe as lttb, Gt as mapVisual, ae as maxDepth, Ie as minmax, L as nearestIndex, h as niceTicks, et as panWindow, J as partition, Ot as patternId, Wt as pieceIndex, X as polarPoint, C as quantize, Se as radiusScale, be as rampLightness, ve as rampOf, ye as rampStops, je as regression, dt as releaseSyncGroup, bt as renderAnnotation, xt as renderAnnotations, Ze as resolveColor, wt as resolveLabels, oe as sankeyLayout, ge as sequentialRamp, at as serializeSvg, Te as sort, w as splitDefined, _ as sqrtScale, K as squarify, F as stackSeries, ie as streamExtent, re as streamLayout, q as sumValue, ot as svgToPngBlob, S as timeScale, I as toStackedSeries, Ve as useChartSize, ze as useStreamSeries, Kt as visualVisible, te as voronoiCells, ee as voronoiFind, Ft as wrapText, $e as zoomWindow };
|