@cascivo/charts 0.4.1 → 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/README.md +21 -1
- package/dist/charts.css +1 -1
- package/dist/index.d.ts +42 -2
- package/dist/index.js +687 -664
- package/package.json +4 -4
- package/readme.body.md +20 -0
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++) {
|
|
@@ -361,21 +361,21 @@ function te(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 V(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 V(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 =
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
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 = {
|
|
929
|
+
frame: "_frame_1xxqo_2",
|
|
930
|
+
"cascivo-chart-in": "_cascivo-chart-in_1xxqo_1",
|
|
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
|
-
te.current.textContent = t ? (
|
|
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,17 +1275,17 @@ 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
1291
|
ref: te,
|
|
@@ -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:
|
|
2354
|
+
transition: ee,
|
|
2355
|
+
onBeforeDraw: R,
|
|
2342
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,41 +2438,41 @@ 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
2470
|
} : R ? {
|
|
2457
2471
|
method: R.method ?? "lttb",
|
|
2458
2472
|
threshold: R.threshold ?? 1e3
|
|
2459
|
-
} : null, H = e.reduce((e, t) => Math.max(e, t.data.length), 0), U = (
|
|
2460
|
-
|
|
2461
|
-
|
|
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
2477
|
let e = G.current;
|
|
2464
2478
|
if (!e) return;
|
|
@@ -2473,12 +2487,18 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2473
2487
|
let K = U ? e.map((e) => ({
|
|
2474
2488
|
...e,
|
|
2475
2489
|
data: e.data.slice(W.value[0], W.value[1] + 1)
|
|
2476
|
-
})) : e,
|
|
2477
|
-
|
|
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) => {
|
|
2493
|
+
let n = t(e);
|
|
2494
|
+
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
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,
|
|
2478
2500
|
right: 60
|
|
2479
|
-
} :
|
|
2480
|
-
Yt("AreaChart", () => [...ie, ...ae]);
|
|
2481
|
-
let oe = Z.length > 0, se = oe ? Math.min(...Z) : 0, ce = oe ? Math.max(...Z) : 1, le = u ? 0 : Math.min(0, ...ie), ue = Math.max(...u ? (K[0]?.data ?? []).map((e, t) => K.reduce((e, n) => e + X(n)(n.data[t]), 0)) : ie), de = q ? Math.min(0, ...ae) : le, fe = q ? Math.max(...ae) : ue;
|
|
2501
|
+
} : be;
|
|
2482
2502
|
return /* @__PURE__ */ p("div", {
|
|
2483
2503
|
style: {
|
|
2484
2504
|
display: "flex",
|
|
@@ -2490,136 +2510,136 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2490
2510
|
title: r,
|
|
2491
2511
|
description: l,
|
|
2492
2512
|
width: v,
|
|
2493
|
-
height:
|
|
2513
|
+
height: ie,
|
|
2494
2514
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2495
2515
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2496
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))] }) }),
|
|
2497
|
-
/* @__PURE__ */ f("tbody", { children: (K[0]?.data ?? []).map((e,
|
|
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)) })
|
|
2498
2518
|
] }),
|
|
2499
|
-
className:
|
|
2500
|
-
"data-state":
|
|
2501
|
-
plain:
|
|
2502
|
-
tooltip:
|
|
2503
|
-
if (
|
|
2504
|
-
let
|
|
2505
|
-
if (
|
|
2506
|
-
let e = K.reduce((e, t) => Math.max(e, t.data.length), 0),
|
|
2507
|
-
for (let
|
|
2508
|
-
let e = [],
|
|
2509
|
-
K.forEach((
|
|
2510
|
-
if (z.value.has(
|
|
2511
|
-
let
|
|
2512
|
-
if (
|
|
2513
|
-
let
|
|
2514
|
-
Number.isFinite(
|
|
2515
|
-
label:
|
|
2516
|
-
value:
|
|
2517
|
-
color:
|
|
2519
|
+
className: E,
|
|
2520
|
+
"data-state": ce ? void 0 : "empty",
|
|
2521
|
+
plain: D,
|
|
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;
|
|
2525
|
+
if (L === "axis") {
|
|
2526
|
+
let e = K.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2527
|
+
for (let n = 0; n < e; n++) {
|
|
2528
|
+
let e = [], r = Infinity, a = "", o = X.left;
|
|
2529
|
+
K.forEach((t, c) => {
|
|
2530
|
+
if (z.value.has(t.id)) return;
|
|
2531
|
+
let l = t.data[n];
|
|
2532
|
+
if (l === void 0) return;
|
|
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({
|
|
2535
|
+
label: t.label,
|
|
2536
|
+
value: u,
|
|
2537
|
+
color: t.color ?? rn[c % rn.length]
|
|
2518
2538
|
}));
|
|
2519
|
-
}), e.length !== 0 &&
|
|
2520
|
-
id: `x-${
|
|
2521
|
-
cx:
|
|
2522
|
-
cy:
|
|
2523
|
-
label:
|
|
2524
|
-
value:
|
|
2539
|
+
}), e.length !== 0 && t.push({
|
|
2540
|
+
id: `x-${n}`,
|
|
2541
|
+
cx: o,
|
|
2542
|
+
cy: X.top + (r === Infinity ? 0 : r),
|
|
2543
|
+
label: a,
|
|
2544
|
+
value: a,
|
|
2525
2545
|
segments: e
|
|
2526
2546
|
});
|
|
2527
2547
|
}
|
|
2528
2548
|
return {
|
|
2529
|
-
points:
|
|
2549
|
+
points: t,
|
|
2530
2550
|
mode: "axis",
|
|
2531
2551
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2532
2552
|
};
|
|
2533
2553
|
}
|
|
2534
|
-
return { points: K.flatMap((e) => z.value.has(e.id) ? [] : e.data.map((
|
|
2535
|
-
id: `${e.id}-${
|
|
2536
|
-
cx:
|
|
2537
|
-
cy:
|
|
2538
|
-
label:
|
|
2539
|
-
value:
|
|
2554
|
+
return { points: K.flatMap((e) => z.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2555
|
+
id: `${e.id}-${n}`,
|
|
2556
|
+
cx: X.left + pe(i, t),
|
|
2557
|
+
cy: X.top + s(e).map(J(e)(t)),
|
|
2558
|
+
label: me(t),
|
|
2559
|
+
value: J(e)(t),
|
|
2540
2560
|
seriesId: e.id
|
|
2541
2561
|
}))) };
|
|
2542
2562
|
} : void 0,
|
|
2543
|
-
onSelect:
|
|
2544
|
-
zoom:
|
|
2563
|
+
onSelect: A,
|
|
2564
|
+
zoom: P && H > 1 ? {
|
|
2545
2565
|
window: W,
|
|
2546
2566
|
count: H
|
|
2547
2567
|
} : void 0,
|
|
2548
|
-
toolbox:
|
|
2568
|
+
toolbox: te,
|
|
2549
2569
|
onRestore: U ? () => {
|
|
2550
2570
|
W.value = [0, Math.max(0, H - 1)];
|
|
2551
2571
|
} : void 0,
|
|
2552
|
-
children: ({ width: e, height:
|
|
2553
|
-
let
|
|
2554
|
-
return u && (
|
|
2555
|
-
prefix:
|
|
2572
|
+
children: ({ width: e, height: t }) => {
|
|
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,
|
|
2556
2576
|
fill: g,
|
|
2557
2577
|
patternKind: _,
|
|
2558
2578
|
series: K.map((e, t) => ({
|
|
2559
2579
|
id: e.id,
|
|
2560
|
-
color: e.color ??
|
|
2580
|
+
color: e.color ?? rn[t % rn.length]
|
|
2561
2581
|
}))
|
|
2562
2582
|
}), /* @__PURE__ */ p("g", {
|
|
2563
|
-
transform: `translate(${
|
|
2583
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2564
2584
|
children: [
|
|
2565
|
-
!
|
|
2566
|
-
scale:
|
|
2585
|
+
!D && /* @__PURE__ */ f(gt, {
|
|
2586
|
+
scale: a,
|
|
2567
2587
|
orientation: "y",
|
|
2568
|
-
length:
|
|
2588
|
+
length: n,
|
|
2569
2589
|
tickCount: x
|
|
2570
2590
|
}),
|
|
2571
|
-
!
|
|
2572
|
-
xScale:
|
|
2573
|
-
yScale:
|
|
2574
|
-
innerW:
|
|
2575
|
-
innerH:
|
|
2591
|
+
!D && xt(O, {
|
|
2592
|
+
xScale: i,
|
|
2593
|
+
yScale: a,
|
|
2594
|
+
innerW: n,
|
|
2595
|
+
innerH: r
|
|
2576
2596
|
}),
|
|
2577
|
-
K.map((e,
|
|
2597
|
+
K.map((e, t) => {
|
|
2578
2598
|
if (z.value.has(e.id)) return null;
|
|
2579
|
-
let
|
|
2580
|
-
if (u &&
|
|
2581
|
-
let
|
|
2582
|
-
|
|
2583
|
-
let
|
|
2584
|
-
|
|
2585
|
-
let
|
|
2599
|
+
let n = e.color ?? rn[t % rn.length], r, c;
|
|
2600
|
+
if (u && s[t]) {
|
|
2601
|
+
let o = s[t];
|
|
2602
|
+
r = e.data.map((e, t) => [pe(i, e), a.map(o[t][1])]);
|
|
2603
|
+
let l = e.data.map((e, t) => [pe(i, e), a.map(o[t][0])]);
|
|
2604
|
+
c = a.map(0);
|
|
2605
|
+
let u = T(r, h), d = l[l.length - 1], m = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${d[0]},${d[1]}${_}L${m[0]},${m[1]}Z`;
|
|
2586
2606
|
return /* @__PURE__ */ p("g", {
|
|
2587
2607
|
"data-series": e.id,
|
|
2588
2608
|
children: [
|
|
2589
2609
|
/* @__PURE__ */ f("path", {
|
|
2590
|
-
d:
|
|
2591
|
-
fill:
|
|
2592
|
-
style: g === "solid" ?
|
|
2610
|
+
d: v,
|
|
2611
|
+
fill: kt(ne, e.id, g, n),
|
|
2612
|
+
style: g === "solid" ? nn : void 0,
|
|
2593
2613
|
stroke: "none"
|
|
2594
2614
|
}),
|
|
2595
2615
|
/* @__PURE__ */ f("path", {
|
|
2596
|
-
d: T(
|
|
2616
|
+
d: T(r, h),
|
|
2597
2617
|
fill: "none",
|
|
2598
|
-
stroke:
|
|
2618
|
+
stroke: n,
|
|
2599
2619
|
strokeWidth: 2
|
|
2600
2620
|
}),
|
|
2601
|
-
B &&
|
|
2621
|
+
B && r.map((t, n) => /* @__PURE__ */ f(Tt, {
|
|
2602
2622
|
x: t[0],
|
|
2603
2623
|
y: t[1] - 8,
|
|
2604
|
-
text: B.format(
|
|
2624
|
+
text: B.format(J(e)(e.data[n]))
|
|
2605
2625
|
}, n))
|
|
2606
2626
|
]
|
|
2607
2627
|
}, e.id);
|
|
2608
2628
|
} else {
|
|
2609
|
-
let
|
|
2610
|
-
if (
|
|
2611
|
-
let t =
|
|
2629
|
+
let t = e.axis === "right" ? o : a;
|
|
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]]);
|
|
2612
2632
|
return /* @__PURE__ */ p("g", {
|
|
2613
2633
|
"data-series": e.id,
|
|
2614
2634
|
children: [/* @__PURE__ */ f("path", {
|
|
2615
|
-
d: N(t,
|
|
2616
|
-
fill:
|
|
2617
|
-
style: g === "solid" ?
|
|
2635
|
+
d: N(t, c, h),
|
|
2636
|
+
fill: kt(ne, e.id, g, n),
|
|
2637
|
+
style: g === "solid" ? nn : void 0,
|
|
2618
2638
|
stroke: "none"
|
|
2619
2639
|
}), /* @__PURE__ */ f("path", {
|
|
2620
2640
|
d: T(t, h),
|
|
2621
2641
|
fill: "none",
|
|
2622
|
-
stroke:
|
|
2642
|
+
stroke: n,
|
|
2623
2643
|
strokeWidth: 2
|
|
2624
2644
|
})]
|
|
2625
2645
|
}, e.id);
|
|
@@ -2628,68 +2648,68 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2628
2648
|
"data-series": e.id,
|
|
2629
2649
|
children: [
|
|
2630
2650
|
/* @__PURE__ */ f("path", {
|
|
2631
|
-
d: N(
|
|
2632
|
-
fill:
|
|
2633
|
-
style: g === "solid" ?
|
|
2651
|
+
d: N(r, c, h),
|
|
2652
|
+
fill: kt(ne, e.id, g, n),
|
|
2653
|
+
style: g === "solid" ? nn : void 0,
|
|
2634
2654
|
stroke: "none"
|
|
2635
2655
|
}),
|
|
2636
2656
|
/* @__PURE__ */ f("path", {
|
|
2637
|
-
d: T(
|
|
2657
|
+
d: T(r, h),
|
|
2638
2658
|
fill: "none",
|
|
2639
|
-
stroke:
|
|
2659
|
+
stroke: n,
|
|
2640
2660
|
strokeWidth: 2
|
|
2641
2661
|
}),
|
|
2642
|
-
B &&
|
|
2662
|
+
B && r.map((t, n) => /* @__PURE__ */ f(Tt, {
|
|
2643
2663
|
x: t[0],
|
|
2644
2664
|
y: t[1] - 8,
|
|
2645
|
-
text: B.format(
|
|
2665
|
+
text: B.format(J(e)(e.data[n]))
|
|
2646
2666
|
}, n))
|
|
2647
2667
|
]
|
|
2648
2668
|
}, e.id);
|
|
2649
2669
|
}
|
|
2650
2670
|
}),
|
|
2651
|
-
!
|
|
2671
|
+
!D && /* @__PURE__ */ p(d, { children: [
|
|
2652
2672
|
/* @__PURE__ */ f($, {
|
|
2653
|
-
scale:
|
|
2673
|
+
scale: i,
|
|
2654
2674
|
orientation: "x",
|
|
2655
|
-
length:
|
|
2675
|
+
length: n,
|
|
2656
2676
|
tickCount: b,
|
|
2657
|
-
transform: `translate(0,${
|
|
2677
|
+
transform: `translate(0,${r})`
|
|
2658
2678
|
}),
|
|
2659
2679
|
/* @__PURE__ */ f($, {
|
|
2660
|
-
scale:
|
|
2680
|
+
scale: a,
|
|
2661
2681
|
orientation: "y",
|
|
2662
|
-
length:
|
|
2682
|
+
length: r,
|
|
2663
2683
|
tickCount: x
|
|
2664
2684
|
}),
|
|
2665
|
-
|
|
2666
|
-
scale:
|
|
2685
|
+
re && /* @__PURE__ */ f($, {
|
|
2686
|
+
scale: o,
|
|
2667
2687
|
orientation: "y",
|
|
2668
|
-
length:
|
|
2688
|
+
length: r,
|
|
2669
2689
|
tickCount: x,
|
|
2670
|
-
transform: `translate(${
|
|
2671
|
-
...
|
|
2690
|
+
transform: `translate(${n},0)`,
|
|
2691
|
+
...ee?.format ? { format: (e) => ee.format(Number(e)) } : {}
|
|
2672
2692
|
})
|
|
2673
2693
|
] })
|
|
2674
2694
|
]
|
|
2675
2695
|
})] });
|
|
2676
2696
|
}
|
|
2677
2697
|
}),
|
|
2678
|
-
|
|
2698
|
+
j && !M && H > 1 && /* @__PURE__ */ f(Lt, {
|
|
2679
2699
|
count: H,
|
|
2680
2700
|
window: W,
|
|
2681
2701
|
label: "Range"
|
|
2682
2702
|
}),
|
|
2683
|
-
|
|
2703
|
+
M && H > 1 && /* @__PURE__ */ f(Rt, {
|
|
2684
2704
|
count: H,
|
|
2685
2705
|
window: W,
|
|
2686
2706
|
label: "Range"
|
|
2687
2707
|
}),
|
|
2688
|
-
|
|
2708
|
+
q && /* @__PURE__ */ f(Yt, {
|
|
2689
2709
|
series: K.map((e, t) => ({
|
|
2690
2710
|
id: e.id,
|
|
2691
2711
|
label: e.label,
|
|
2692
|
-
color: e.color ??
|
|
2712
|
+
color: e.color ?? rn[t % rn.length]
|
|
2693
2713
|
})),
|
|
2694
2714
|
hidden: z
|
|
2695
2715
|
})
|
|
@@ -2698,20 +2718,23 @@ function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2698
2718
|
}
|
|
2699
2719
|
//#endregion
|
|
2700
2720
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2701
|
-
var
|
|
2702
|
-
function
|
|
2721
|
+
var on = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2722
|
+
function sn(e) {
|
|
2703
2723
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2704
2724
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2705
2725
|
}
|
|
2706
|
-
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 }) {
|
|
2707
2727
|
o();
|
|
2708
|
-
let A = s(), j = w ? null :
|
|
2709
|
-
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))));
|
|
2710
2730
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2711
|
-
let r =
|
|
2731
|
+
let r = ne[n] || 1;
|
|
2712
2732
|
return [e / r, t / r];
|
|
2713
2733
|
})) : t;
|
|
2714
|
-
},
|
|
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
|
+
};
|
|
2715
2738
|
return /* @__PURE__ */ p("div", {
|
|
2716
2739
|
style: {
|
|
2717
2740
|
display: "flex",
|
|
@@ -2722,24 +2745,24 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2722
2745
|
title: r,
|
|
2723
2746
|
description: a,
|
|
2724
2747
|
width: u,
|
|
2725
|
-
height:
|
|
2748
|
+
height: N,
|
|
2726
2749
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2727
2750
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2728
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))] }) }),
|
|
2729
|
-
/* @__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)) })
|
|
2730
2753
|
] }),
|
|
2731
2754
|
className: C,
|
|
2732
|
-
"data-state":
|
|
2755
|
+
"data-state": R ? void 0 : "empty",
|
|
2733
2756
|
plain: w,
|
|
2734
|
-
tooltip: x &&
|
|
2735
|
-
if (!x || !
|
|
2736
|
-
let i = n -
|
|
2737
|
-
|
|
2738
|
-
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) => {
|
|
2739
2762
|
let r = d.map((t) => ({
|
|
2740
2763
|
label: t.label,
|
|
2741
|
-
value:
|
|
2742
|
-
color: t.color ??
|
|
2764
|
+
value: I(t)(t.data[n]),
|
|
2765
|
+
color: t.color ?? on[e.indexOf(t) % on.length]
|
|
2743
2766
|
}));
|
|
2744
2767
|
return {
|
|
2745
2768
|
segs: r,
|
|
@@ -2749,22 +2772,22 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2749
2772
|
let r = e.indexOf(n), i = l === "grouped" ? s.bandwidth / d.length : s.bandwidth;
|
|
2750
2773
|
return n.data.map((e, a) => {
|
|
2751
2774
|
let c = s.map(t(e)) ?? 0, m, g;
|
|
2752
|
-
if (
|
|
2775
|
+
if (te && f[r]) {
|
|
2753
2776
|
let e = f[r][a];
|
|
2754
2777
|
m = e[1], g = e[0];
|
|
2755
|
-
} else m =
|
|
2778
|
+
} else m = I(n)(e), g = B;
|
|
2756
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;
|
|
2757
2780
|
return {
|
|
2758
2781
|
id: `${n.id}-${a}`,
|
|
2759
|
-
cx:
|
|
2760
|
-
cy:
|
|
2782
|
+
cx: G.left + (o ? v : y),
|
|
2783
|
+
cy: G.top + (o ? y : v),
|
|
2761
2784
|
label: t(e),
|
|
2762
|
-
value: p ? h[a].total :
|
|
2785
|
+
value: p ? h[a].total : I(n)(e),
|
|
2763
2786
|
seriesId: n.id,
|
|
2764
2787
|
...p && { segments: h[a].segs }
|
|
2765
2788
|
};
|
|
2766
2789
|
});
|
|
2767
|
-
}), v = S ?? (p ?
|
|
2790
|
+
}), v = S ?? (p ? sn : void 0);
|
|
2768
2791
|
return v ? {
|
|
2769
2792
|
points: _,
|
|
2770
2793
|
format: v
|
|
@@ -2772,48 +2795,48 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2772
2795
|
} : void 0,
|
|
2773
2796
|
onSelect: D,
|
|
2774
2797
|
children: ({ width: n, height: r }) => {
|
|
2775
|
-
let i = n -
|
|
2776
|
-
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, {
|
|
2777
2800
|
prefix: A,
|
|
2778
2801
|
fill: O,
|
|
2779
2802
|
patternKind: k,
|
|
2780
2803
|
series: e.map((e, t) => ({
|
|
2781
2804
|
id: e.id,
|
|
2782
|
-
color: e.color ??
|
|
2805
|
+
color: e.color ?? on[t % on.length]
|
|
2783
2806
|
}))
|
|
2784
2807
|
}), /* @__PURE__ */ p("g", {
|
|
2785
|
-
transform: `translate(${
|
|
2808
|
+
transform: `translate(${G.left},${G.top})`,
|
|
2786
2809
|
children: [
|
|
2787
|
-
!w && o && /* @__PURE__ */ f(
|
|
2788
|
-
scale:
|
|
2810
|
+
!w && o && /* @__PURE__ */ f(gt, {
|
|
2811
|
+
scale: h,
|
|
2789
2812
|
orientation: "y",
|
|
2790
2813
|
length: i,
|
|
2791
2814
|
tickCount: v
|
|
2792
2815
|
}),
|
|
2793
|
-
!w && !o && /* @__PURE__ */ f(
|
|
2794
|
-
scale:
|
|
2816
|
+
!w && !o && /* @__PURE__ */ f(gt, {
|
|
2817
|
+
scale: h,
|
|
2795
2818
|
orientation: "x",
|
|
2796
2819
|
length: a,
|
|
2797
2820
|
tickCount: _
|
|
2798
2821
|
}),
|
|
2799
|
-
!w &&
|
|
2800
|
-
xScale: o ?
|
|
2801
|
-
yScale: o ?
|
|
2822
|
+
!w && xt(T, {
|
|
2823
|
+
xScale: o ? u : h,
|
|
2824
|
+
yScale: o ? h : u,
|
|
2802
2825
|
innerW: i,
|
|
2803
2826
|
innerH: a
|
|
2804
2827
|
}),
|
|
2805
|
-
|
|
2806
|
-
let i = n.color ??
|
|
2807
|
-
return n.data.map((e,
|
|
2808
|
-
let
|
|
2809
|
-
if (
|
|
2810
|
-
let e =
|
|
2811
|
-
|
|
2812
|
-
} else
|
|
2813
|
-
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;
|
|
2814
2837
|
if (j) {
|
|
2815
|
-
let t = j.format(
|
|
2816
|
-
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, {
|
|
2817
2840
|
x: r,
|
|
2818
2841
|
y: i ? v + 13 : v - 4,
|
|
2819
2842
|
text: t,
|
|
@@ -2821,7 +2844,7 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2821
2844
|
});
|
|
2822
2845
|
else {
|
|
2823
2846
|
let e = v + y;
|
|
2824
|
-
|
|
2847
|
+
b = /* @__PURE__ */ f(Tt, {
|
|
2825
2848
|
x: i ? e - 4 : e + 4,
|
|
2826
2849
|
y: r + 4,
|
|
2827
2850
|
text: t,
|
|
@@ -2829,63 +2852,63 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2829
2852
|
tone: i ? "muted" : "default"
|
|
2830
2853
|
});
|
|
2831
2854
|
}
|
|
2832
|
-
|
|
2855
|
+
te && y < 14 && (b = null);
|
|
2833
2856
|
}
|
|
2834
2857
|
return /* @__PURE__ */ p("g", { children: [o ? /* @__PURE__ */ f("rect", {
|
|
2835
2858
|
x: _,
|
|
2836
2859
|
y: v,
|
|
2837
|
-
width:
|
|
2860
|
+
width: s,
|
|
2838
2861
|
height: y,
|
|
2839
|
-
fill:
|
|
2862
|
+
fill: kt(A, n.id, O, i),
|
|
2840
2863
|
rx: 2,
|
|
2841
2864
|
"data-series": n.id
|
|
2842
2865
|
}) : /* @__PURE__ */ f("rect", {
|
|
2843
2866
|
x: v,
|
|
2844
2867
|
y: _,
|
|
2845
2868
|
width: y,
|
|
2846
|
-
height:
|
|
2847
|
-
fill:
|
|
2869
|
+
height: s,
|
|
2870
|
+
fill: kt(A, n.id, O, i),
|
|
2848
2871
|
rx: 2,
|
|
2849
2872
|
"data-series": n.id
|
|
2850
|
-
}),
|
|
2873
|
+
}), b] }, `${n.id}-${c}`);
|
|
2851
2874
|
});
|
|
2852
2875
|
}),
|
|
2853
2876
|
!w && o && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f($, {
|
|
2854
|
-
scale:
|
|
2877
|
+
scale: u,
|
|
2855
2878
|
orientation: "x",
|
|
2856
2879
|
length: i,
|
|
2857
2880
|
tickCount: _,
|
|
2858
|
-
labelEvery:
|
|
2881
|
+
labelEvery: s,
|
|
2859
2882
|
transform: `translate(0,${a})`
|
|
2860
2883
|
}), /* @__PURE__ */ f($, {
|
|
2861
|
-
scale:
|
|
2884
|
+
scale: h,
|
|
2862
2885
|
orientation: "y",
|
|
2863
2886
|
length: a,
|
|
2864
2887
|
tickCount: v,
|
|
2865
|
-
...
|
|
2888
|
+
...U && { format: U }
|
|
2866
2889
|
})] }),
|
|
2867
2890
|
!w && !o && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f($, {
|
|
2868
|
-
scale:
|
|
2891
|
+
scale: h,
|
|
2869
2892
|
orientation: "x",
|
|
2870
2893
|
length: i,
|
|
2871
2894
|
tickCount: _,
|
|
2872
|
-
...
|
|
2895
|
+
...U && { format: U },
|
|
2873
2896
|
transform: `translate(0,${a})`
|
|
2874
2897
|
}), /* @__PURE__ */ f($, {
|
|
2875
|
-
scale:
|
|
2898
|
+
scale: u,
|
|
2876
2899
|
orientation: "y",
|
|
2877
2900
|
length: a,
|
|
2878
2901
|
tickCount: v,
|
|
2879
|
-
labelEvery:
|
|
2902
|
+
labelEvery: s
|
|
2880
2903
|
})] })
|
|
2881
2904
|
]
|
|
2882
2905
|
})] });
|
|
2883
2906
|
}
|
|
2884
|
-
}),
|
|
2907
|
+
}), P && /* @__PURE__ */ f(Yt, {
|
|
2885
2908
|
series: e.map((e, t) => ({
|
|
2886
2909
|
id: e.id,
|
|
2887
2910
|
label: e.label,
|
|
2888
|
-
color: e.color ??
|
|
2911
|
+
color: e.color ?? on[t % on.length]
|
|
2889
2912
|
})),
|
|
2890
2913
|
hidden: M
|
|
2891
2914
|
})]
|
|
@@ -2893,13 +2916,13 @@ function an({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2893
2916
|
}
|
|
2894
2917
|
//#endregion
|
|
2895
2918
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2896
|
-
function
|
|
2919
|
+
function ln(e) {
|
|
2897
2920
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2898
2921
|
return `${e.value} (${t}%)`;
|
|
2899
2922
|
}
|
|
2900
|
-
var
|
|
2901
|
-
function
|
|
2902
|
-
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;
|
|
2903
2926
|
o();
|
|
2904
2927
|
let k = i(/* @__PURE__ */ new Set()), A = e.length > 0;
|
|
2905
2928
|
return /* @__PURE__ */ p("div", {
|
|
@@ -2947,17 +2970,17 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2947
2970
|
value: e.value,
|
|
2948
2971
|
seriesId: String(t),
|
|
2949
2972
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
2950
|
-
color: e.color ??
|
|
2973
|
+
color: e.color ?? un[t % un.length]
|
|
2951
2974
|
};
|
|
2952
2975
|
}),
|
|
2953
|
-
format: _ ??
|
|
2976
|
+
format: _ ?? ln
|
|
2954
2977
|
};
|
|
2955
2978
|
} : void 0,
|
|
2956
2979
|
onSelect: S,
|
|
2957
2980
|
children: ({ width: t, height: n }) => {
|
|
2958
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);
|
|
2959
2982
|
return /* @__PURE__ */ p("g", { children: [g.map((e, t) => {
|
|
2960
|
-
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);
|
|
2961
2984
|
v = r;
|
|
2962
2985
|
let d = _ > 0 ? e.value / _ * 100 : 0, m = w && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
2963
2986
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("path", {
|
|
@@ -2966,7 +2989,7 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2966
2989
|
stroke: "var(--cascivo-color-surface)",
|
|
2967
2990
|
strokeWidth: 1,
|
|
2968
2991
|
"data-series": e.id
|
|
2969
|
-
}), m && /* @__PURE__ */ f(
|
|
2992
|
+
}), m && /* @__PURE__ */ f(Tt, {
|
|
2970
2993
|
x: C(i + Math.sin(s) * h),
|
|
2971
2994
|
y: C(a - Math.cos(s) * h + 4),
|
|
2972
2995
|
text: T ? w.format(e.value) : `${Math.round(d)}%`,
|
|
@@ -3012,11 +3035,11 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3012
3035
|
})
|
|
3013
3036
|
}))] });
|
|
3014
3037
|
}
|
|
3015
|
-
}), O && /* @__PURE__ */ f(
|
|
3038
|
+
}), O && /* @__PURE__ */ f(Yt, {
|
|
3016
3039
|
series: e.map((e, t) => ({
|
|
3017
3040
|
id: e.id,
|
|
3018
3041
|
label: e.label,
|
|
3019
|
-
color: e.color ??
|
|
3042
|
+
color: e.color ?? un[t % un.length]
|
|
3020
3043
|
})),
|
|
3021
3044
|
hidden: k
|
|
3022
3045
|
})]
|
|
@@ -3024,23 +3047,23 @@ function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3024
3047
|
}
|
|
3025
3048
|
//#endregion
|
|
3026
3049
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3027
|
-
var
|
|
3028
|
-
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 }) {
|
|
3029
3052
|
o();
|
|
3030
|
-
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 }) => {
|
|
3031
3054
|
let a = n - T.left - T.right, o = i - T.top - T.bottom;
|
|
3032
3055
|
if (a <= 0 || o <= 0) return;
|
|
3033
|
-
let s = m([I, L], [0, a]), c = m([
|
|
3056
|
+
let s = m([I, L], [0, a]), c = m([ee, R], [o, 0]);
|
|
3034
3057
|
e.forEach((e, n) => {
|
|
3035
3058
|
if (!w.value.has(e.id)) {
|
|
3036
|
-
t.fillStyle =
|
|
3059
|
+
t.fillStyle = Ze(t, e.color ?? fn[n % fn.length]), t.globalAlpha = .7;
|
|
3037
3060
|
for (let n of e.data) {
|
|
3038
3061
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3039
3062
|
t.beginPath(), t.arc(T.left + s.map(n.x), T.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3040
3063
|
}
|
|
3041
3064
|
}
|
|
3042
3065
|
}), t.globalAlpha = 1;
|
|
3043
|
-
}, 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;
|
|
3044
3067
|
return /* @__PURE__ */ p("div", {
|
|
3045
3068
|
style: {
|
|
3046
3069
|
display: "flex",
|
|
@@ -3071,7 +3094,7 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3071
3094
|
plain: _,
|
|
3072
3095
|
tooltip: h !== !1 && F ? ({ width: t, height: n }) => {
|
|
3073
3096
|
if (h === !1 || !F) return;
|
|
3074
|
-
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]);
|
|
3075
3098
|
return { points: e.flatMap((e) => w.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3076
3099
|
id: `${e.id}-${n}`,
|
|
3077
3100
|
cx: T.left + a.map(t.x),
|
|
@@ -3090,17 +3113,17 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3090
3113
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3091
3114
|
} : void 0,
|
|
3092
3115
|
children: ({ width: t, height: n }) => {
|
|
3093
|
-
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]);
|
|
3094
3117
|
return /* @__PURE__ */ f("g", { children: /* @__PURE__ */ p("g", {
|
|
3095
3118
|
transform: `translate(${T.left},${T.top})`,
|
|
3096
3119
|
children: [
|
|
3097
|
-
!_ && /* @__PURE__ */ f(
|
|
3120
|
+
!_ && /* @__PURE__ */ f(gt, {
|
|
3098
3121
|
scale: s,
|
|
3099
3122
|
orientation: "y",
|
|
3100
3123
|
length: i,
|
|
3101
3124
|
tickCount: l
|
|
3102
3125
|
}),
|
|
3103
|
-
!_ &&
|
|
3126
|
+
!_ && xt(v, {
|
|
3104
3127
|
xScale: o,
|
|
3105
3128
|
yScale: s,
|
|
3106
3129
|
innerW: i,
|
|
@@ -3108,12 +3131,12 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3108
3131
|
}),
|
|
3109
3132
|
!k && e.map((e, t) => {
|
|
3110
3133
|
if (w.value.has(e.id)) return null;
|
|
3111
|
-
let n = e.color ??
|
|
3134
|
+
let n = e.color ?? fn[t % fn.length];
|
|
3112
3135
|
return /* @__PURE__ */ f("g", {
|
|
3113
3136
|
"data-series": e.id,
|
|
3114
3137
|
children: e.data.map((t, i) => {
|
|
3115
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3116
|
-
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, {
|
|
3117
3140
|
shape: m,
|
|
3118
3141
|
x: o.map(t.x),
|
|
3119
3142
|
y: s.map(t.y),
|
|
@@ -3150,17 +3173,17 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3150
3173
|
}) });
|
|
3151
3174
|
}
|
|
3152
3175
|
}),
|
|
3153
|
-
S && F && /* @__PURE__ */ f(
|
|
3176
|
+
S && F && /* @__PURE__ */ f(qt, {
|
|
3154
3177
|
options: S,
|
|
3155
3178
|
range: A,
|
|
3156
3179
|
hidden: j,
|
|
3157
3180
|
label: t
|
|
3158
3181
|
}),
|
|
3159
|
-
D && /* @__PURE__ */ f(
|
|
3182
|
+
D && /* @__PURE__ */ f(Yt, {
|
|
3160
3183
|
series: e.map((e, t) => ({
|
|
3161
3184
|
id: e.id,
|
|
3162
3185
|
label: e.label,
|
|
3163
|
-
color: e.color ??
|
|
3186
|
+
color: e.color ?? fn[t % fn.length]
|
|
3164
3187
|
})),
|
|
3165
3188
|
hidden: w
|
|
3166
3189
|
})
|
|
@@ -3169,7 +3192,7 @@ function un({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3169
3192
|
}
|
|
3170
3193
|
//#endregion
|
|
3171
3194
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3172
|
-
function
|
|
3195
|
+
function mn({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var(--cascivo-chart-1)", endDot: a = !0 }) {
|
|
3173
3196
|
return /* @__PURE__ */ f(Q, {
|
|
3174
3197
|
title: r,
|
|
3175
3198
|
width: t,
|
|
@@ -3207,13 +3230,13 @@ function dn({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var
|
|
|
3207
3230
|
}
|
|
3208
3231
|
//#endregion
|
|
3209
3232
|
//#region src/charts/meter/meter.tsx
|
|
3210
|
-
function
|
|
3233
|
+
function hn(e, t, n, r) {
|
|
3211
3234
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3212
3235
|
let { warning: i, critical: a } = r;
|
|
3213
3236
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3214
3237
|
}
|
|
3215
|
-
function
|
|
3216
|
-
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);
|
|
3217
3240
|
if (i === "gauge") {
|
|
3218
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) : "";
|
|
3219
3242
|
return /* @__PURE__ */ p("div", {
|
|
@@ -3291,10 +3314,10 @@ function pn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3291
3314
|
}
|
|
3292
3315
|
//#endregion
|
|
3293
3316
|
//#region src/charts/kpi/kpi.tsx
|
|
3294
|
-
function
|
|
3317
|
+
function _n(e) {
|
|
3295
3318
|
return `${e >= 0 ? "+" : ""}${e.toLocaleString()}`;
|
|
3296
3319
|
}
|
|
3297
|
-
function
|
|
3320
|
+
function vn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a, className: o }) {
|
|
3298
3321
|
let s = n != null && n >= 0, c = n != null && n < 0;
|
|
3299
3322
|
return /* @__PURE__ */ p("div", {
|
|
3300
3323
|
className: o,
|
|
@@ -3346,16 +3369,16 @@ function hn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3346
3369
|
fontWeight: 500,
|
|
3347
3370
|
color: s ? "var(--cascivo-color-success-foreground)" : c ? "var(--cascivo-color-destructive-foreground)" : "var(--cascivo-color-foreground-muted)"
|
|
3348
3371
|
},
|
|
3349
|
-
"aria-label": `Trend: ${
|
|
3372
|
+
"aria-label": `Trend: ${_n(n)}${r ? ` ${r}` : ""}`,
|
|
3350
3373
|
children: [
|
|
3351
3374
|
s ? "▲" : c ? "▼" : "–",
|
|
3352
3375
|
" ",
|
|
3353
|
-
|
|
3376
|
+
_n(n),
|
|
3354
3377
|
r && ` ${r}`
|
|
3355
3378
|
]
|
|
3356
3379
|
})]
|
|
3357
3380
|
}),
|
|
3358
|
-
a && a.length > 0 && /* @__PURE__ */ f(
|
|
3381
|
+
a && a.length > 0 && /* @__PURE__ */ f(mn, {
|
|
3359
3382
|
data: a,
|
|
3360
3383
|
label: `${t} trend`,
|
|
3361
3384
|
width: 120,
|
|
@@ -3366,9 +3389,9 @@ function hn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3366
3389
|
}
|
|
3367
3390
|
//#endregion
|
|
3368
3391
|
//#region src/charts/histogram/histogram.tsx
|
|
3369
|
-
function
|
|
3392
|
+
function yn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3370
3393
|
o();
|
|
3371
|
-
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);
|
|
3372
3395
|
return /* @__PURE__ */ f(Q, {
|
|
3373
3396
|
title: n,
|
|
3374
3397
|
description: i,
|
|
@@ -3409,7 +3432,7 @@ function gn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3409
3432
|
return /* @__PURE__ */ p("g", {
|
|
3410
3433
|
transform: `translate(${u.left},${u.top})`,
|
|
3411
3434
|
children: [
|
|
3412
|
-
!l && /* @__PURE__ */ f(
|
|
3435
|
+
!l && /* @__PURE__ */ f(gt, {
|
|
3413
3436
|
scale: i,
|
|
3414
3437
|
orientation: "y",
|
|
3415
3438
|
length: n.width
|
|
@@ -3442,13 +3465,13 @@ function gn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3442
3465
|
}
|
|
3443
3466
|
//#endregion
|
|
3444
3467
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3445
|
-
var
|
|
3446
|
-
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 }) {
|
|
3447
3470
|
o();
|
|
3448
|
-
let c = s ? He :
|
|
3471
|
+
let c = s ? He : Z, l = i ?? (s ? 48 : 320), u = e.map((e) => ({
|
|
3449
3472
|
...e,
|
|
3450
|
-
stats:
|
|
3451
|
-
})), 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];
|
|
3452
3475
|
return /* @__PURE__ */ f(Q, {
|
|
3453
3476
|
title: t,
|
|
3454
3477
|
description: n,
|
|
@@ -3507,7 +3530,7 @@ function vn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3507
3530
|
return /* @__PURE__ */ p("g", {
|
|
3508
3531
|
transform: `translate(${c.left},${c.top})`,
|
|
3509
3532
|
children: [u.map((e, t) => {
|
|
3510
|
-
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);
|
|
3511
3534
|
return /* @__PURE__ */ p("g", { children: [
|
|
3512
3535
|
/* @__PURE__ */ f("line", {
|
|
3513
3536
|
x1: i,
|
|
@@ -3584,10 +3607,10 @@ function vn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3584
3607
|
}
|
|
3585
3608
|
//#endregion
|
|
3586
3609
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3587
|
-
var
|
|
3588
|
-
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 }) {
|
|
3589
3612
|
o();
|
|
3590
|
-
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;
|
|
3591
3614
|
return /* @__PURE__ */ f(Q, {
|
|
3592
3615
|
title: t,
|
|
3593
3616
|
description: n,
|
|
@@ -3638,13 +3661,13 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3638
3661
|
return /* @__PURE__ */ p("g", {
|
|
3639
3662
|
transform: `translate(${g.left},${g.top})`,
|
|
3640
3663
|
children: [
|
|
3641
|
-
!l && /* @__PURE__ */ f(
|
|
3664
|
+
!l && /* @__PURE__ */ f(gt, {
|
|
3642
3665
|
scale: s,
|
|
3643
3666
|
orientation: "y",
|
|
3644
3667
|
length: r.width
|
|
3645
3668
|
}),
|
|
3646
3669
|
e.map((e, t) => {
|
|
3647
|
-
let n =
|
|
3670
|
+
let n = Sn[t % Sn.length] ?? "var(--cascivo-chart-1)";
|
|
3648
3671
|
return /* @__PURE__ */ f("g", {
|
|
3649
3672
|
opacity: h.value !== null && h.value !== e.name ? .2 : 1,
|
|
3650
3673
|
onMouseEnter: () => {
|
|
@@ -3655,7 +3678,7 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3655
3678
|
},
|
|
3656
3679
|
children: e.data.map((t, r) => {
|
|
3657
3680
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3658
|
-
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(
|
|
3681
|
+
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(Mt, {
|
|
3659
3682
|
shape: i,
|
|
3660
3683
|
x: o.map(t.x),
|
|
3661
3684
|
y: s.map(t.y),
|
|
@@ -3693,11 +3716,11 @@ function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3693
3716
|
}
|
|
3694
3717
|
//#endregion
|
|
3695
3718
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3696
|
-
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 }) {
|
|
3697
3720
|
o();
|
|
3698
3721
|
let _ = s ?? (u ? 48 : 320), v = u ? He : {
|
|
3699
|
-
...
|
|
3700
|
-
right: i ? 60 :
|
|
3722
|
+
...Z,
|
|
3723
|
+
right: i ? 60 : Z.right
|
|
3701
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;
|
|
3702
3725
|
return /* @__PURE__ */ f(Q, {
|
|
3703
3726
|
title: n,
|
|
@@ -3748,12 +3771,12 @@ function Cn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3748
3771
|
return /* @__PURE__ */ p("g", {
|
|
3749
3772
|
transform: `translate(${v.left},${v.top})`,
|
|
3750
3773
|
children: [
|
|
3751
|
-
!u && /* @__PURE__ */ f(
|
|
3774
|
+
!u && /* @__PURE__ */ f(gt, {
|
|
3752
3775
|
scale: s,
|
|
3753
3776
|
orientation: "y",
|
|
3754
3777
|
length: a.width
|
|
3755
3778
|
}),
|
|
3756
|
-
!u &&
|
|
3779
|
+
!u && xt(h, {
|
|
3757
3780
|
xScale: o,
|
|
3758
3781
|
yScale: s,
|
|
3759
3782
|
innerW: a.width,
|
|
@@ -3804,14 +3827,14 @@ function Cn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3804
3827
|
}
|
|
3805
3828
|
//#endregion
|
|
3806
3829
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3807
|
-
function
|
|
3830
|
+
function Dn({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u }) {
|
|
3808
3831
|
o();
|
|
3809
3832
|
let m = a ?? (c ? 48 : 320), h = c ? He : {
|
|
3810
3833
|
top: 20,
|
|
3811
3834
|
right: 20,
|
|
3812
3835
|
bottom: 60,
|
|
3813
3836
|
left: 60
|
|
3814
|
-
}, _ = [...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, {
|
|
3815
3838
|
title: t,
|
|
3816
3839
|
description: n,
|
|
3817
3840
|
width: r,
|
|
@@ -3861,7 +3884,7 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3861
3884
|
return /* @__PURE__ */ p("g", {
|
|
3862
3885
|
transform: `translate(${h.left},${h.top})`,
|
|
3863
3886
|
children: [e.map((e, t) => {
|
|
3864
|
-
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;
|
|
3865
3888
|
return /* @__PURE__ */ f("rect", {
|
|
3866
3889
|
x: n,
|
|
3867
3890
|
y: r,
|
|
@@ -3891,7 +3914,7 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3891
3914
|
flexDirection: "column",
|
|
3892
3915
|
gap: "0.5rem"
|
|
3893
3916
|
},
|
|
3894
|
-
children: [T, /* @__PURE__ */ f(
|
|
3917
|
+
children: [T, /* @__PURE__ */ f(qt, {
|
|
3895
3918
|
options: l,
|
|
3896
3919
|
range: C,
|
|
3897
3920
|
hidden: w,
|
|
@@ -3901,8 +3924,8 @@ function wn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3901
3924
|
}
|
|
3902
3925
|
//#endregion
|
|
3903
3926
|
//#region src/charts/treemap/treemap.tsx
|
|
3904
|
-
var
|
|
3905
|
-
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 }) {
|
|
3906
3929
|
o();
|
|
3907
3930
|
let l = s();
|
|
3908
3931
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -3918,7 +3941,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3918
3941
|
className: a,
|
|
3919
3942
|
plain: c,
|
|
3920
3943
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3921
|
-
if (e.length !== 0) return { points:
|
|
3944
|
+
if (e.length !== 0) return { points: K(e.map((e) => ({
|
|
3922
3945
|
id: e.id,
|
|
3923
3946
|
value: e.value
|
|
3924
3947
|
})), t, n).map((t) => {
|
|
@@ -3934,7 +3957,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3934
3957
|
} : void 0,
|
|
3935
3958
|
children: ({ width: t, height: n }) => {
|
|
3936
3959
|
if (e.length === 0) return null;
|
|
3937
|
-
let r =
|
|
3960
|
+
let r = K(e.map((e) => ({
|
|
3938
3961
|
id: e.id,
|
|
3939
3962
|
value: e.value
|
|
3940
3963
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -3947,7 +3970,7 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3947
3970
|
height: Math.max(0, e.h - 4)
|
|
3948
3971
|
})
|
|
3949
3972
|
}, e.id)) }), r.map((e, t) => {
|
|
3950
|
-
let n =
|
|
3973
|
+
let n = On[t % On.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
3951
3974
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("rect", {
|
|
3952
3975
|
x: e.x,
|
|
3953
3976
|
y: e.y,
|
|
@@ -3971,8 +3994,8 @@ function En({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3971
3994
|
}
|
|
3972
3995
|
//#endregion
|
|
3973
3996
|
//#region src/charts/radar/radar.tsx
|
|
3974
|
-
var
|
|
3975
|
-
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) {
|
|
3976
3999
|
let a = e.length;
|
|
3977
4000
|
return e.map((e, o) => {
|
|
3978
4001
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -3982,7 +4005,7 @@ function kn(e, t, n, r, i) {
|
|
|
3982
4005
|
};
|
|
3983
4006
|
});
|
|
3984
4007
|
}
|
|
3985
|
-
function
|
|
4008
|
+
function Nn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3986
4009
|
let u = s ?? (l ? 48 : 320);
|
|
3987
4010
|
o();
|
|
3988
4011
|
let m = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -4014,7 +4037,7 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4014
4037
|
})) };
|
|
4015
4038
|
} : void 0,
|
|
4016
4039
|
children: ({ width: n, height: r }) => {
|
|
4017
|
-
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) => {
|
|
4018
4041
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4019
4042
|
return {
|
|
4020
4043
|
x: C(i + Math.cos(n) * o),
|
|
@@ -4052,7 +4075,7 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4052
4075
|
}, n);
|
|
4053
4076
|
}),
|
|
4054
4077
|
t.map((e, t) => {
|
|
4055
|
-
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)";
|
|
4056
4079
|
return /* @__PURE__ */ f("polygon", {
|
|
4057
4080
|
points: n,
|
|
4058
4081
|
fill: r,
|
|
@@ -4067,12 +4090,12 @@ function An({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4067
4090
|
}
|
|
4068
4091
|
//#endregion
|
|
4069
4092
|
//#region src/charts/bullet/bullet.tsx
|
|
4070
|
-
var
|
|
4093
|
+
var Pn = [
|
|
4071
4094
|
"var(--cascivo-color-neutral-200)",
|
|
4072
4095
|
"var(--cascivo-color-neutral-300)",
|
|
4073
4096
|
"var(--cascivo-color-neutral-400)"
|
|
4074
4097
|
];
|
|
4075
|
-
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 }) {
|
|
4076
4099
|
o();
|
|
4077
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;
|
|
4078
4101
|
return /* @__PURE__ */ p("figure", {
|
|
@@ -4099,7 +4122,7 @@ function Mn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4099
4122
|
y: 0,
|
|
4100
4123
|
width: Math.max(0, r),
|
|
4101
4124
|
height: c,
|
|
4102
|
-
fill:
|
|
4125
|
+
fill: Pn[t % Pn.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4103
4126
|
}, t);
|
|
4104
4127
|
}),
|
|
4105
4128
|
/* @__PURE__ */ f("rect", {
|
|
@@ -4126,8 +4149,8 @@ function Mn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4126
4149
|
}
|
|
4127
4150
|
//#endregion
|
|
4128
4151
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4129
|
-
var
|
|
4130
|
-
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 }) {
|
|
4131
4154
|
o();
|
|
4132
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) => {
|
|
4133
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));
|
|
@@ -4152,7 +4175,7 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4152
4175
|
value: e.value,
|
|
4153
4176
|
seriesId: e.id,
|
|
4154
4177
|
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4155
|
-
color: e.color ??
|
|
4178
|
+
color: e.color ?? In[t % In.length]
|
|
4156
4179
|
};
|
|
4157
4180
|
}) };
|
|
4158
4181
|
}, A = /* @__PURE__ */ p("table", { children: [
|
|
@@ -4179,7 +4202,7 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4179
4202
|
children: ({ width: e, height: t }) => {
|
|
4180
4203
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4181
4204
|
return /* @__PURE__ */ p("g", { children: [s.map((e, t) => {
|
|
4182
|
-
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;
|
|
4183
4206
|
return /* @__PURE__ */ p("g", {
|
|
4184
4207
|
"data-series": e.id,
|
|
4185
4208
|
children: [/* @__PURE__ */ f("path", {
|
|
@@ -4231,11 +4254,11 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4231
4254
|
})
|
|
4232
4255
|
}))] });
|
|
4233
4256
|
}
|
|
4234
|
-
}), S && /* @__PURE__ */ f(
|
|
4257
|
+
}), S && /* @__PURE__ */ f(Yt, {
|
|
4235
4258
|
series: e.map((e, t) => ({
|
|
4236
4259
|
id: e.id,
|
|
4237
4260
|
label: e.label,
|
|
4238
|
-
color: e.color ??
|
|
4261
|
+
color: e.color ?? In[t % In.length]
|
|
4239
4262
|
})),
|
|
4240
4263
|
hidden: y
|
|
4241
4264
|
})]
|
|
@@ -4243,10 +4266,10 @@ function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4243
4266
|
}
|
|
4244
4267
|
//#endregion
|
|
4245
4268
|
//#region src/charts/funnel/funnel.tsx
|
|
4246
|
-
var
|
|
4247
|
-
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 }) {
|
|
4248
4271
|
o();
|
|
4249
|
-
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));
|
|
4250
4273
|
return /* @__PURE__ */ f(Q, {
|
|
4251
4274
|
title: t,
|
|
4252
4275
|
description: n,
|
|
@@ -4280,7 +4303,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4280
4303
|
value: e.value,
|
|
4281
4304
|
seriesId: e.id,
|
|
4282
4305
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4283
|
-
color: e.color ??
|
|
4306
|
+
color: e.color ?? Rn[t % Rn.length]
|
|
4284
4307
|
})),
|
|
4285
4308
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4286
4309
|
};
|
|
@@ -4290,7 +4313,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4290
4313
|
if (r <= 0 || e.length === 0) return null;
|
|
4291
4314
|
let o = i / e.length, s = m([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4292
4315
|
return /* @__PURE__ */ f("g", { children: e.map((t, n) => {
|
|
4293
|
-
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 = [
|
|
4294
4317
|
[d - i, m],
|
|
4295
4318
|
[d + i, m],
|
|
4296
4319
|
[d + s, h],
|
|
@@ -4302,7 +4325,7 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4302
4325
|
points: v,
|
|
4303
4326
|
fill: _,
|
|
4304
4327
|
fillOpacity: .85
|
|
4305
|
-
}), !l && /* @__PURE__ */ f(
|
|
4328
|
+
}), !l && /* @__PURE__ */ f(Tt, {
|
|
4306
4329
|
x: d,
|
|
4307
4330
|
y: m + o / 2,
|
|
4308
4331
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4315,10 +4338,10 @@ function In({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4315
4338
|
}
|
|
4316
4339
|
//#endregion
|
|
4317
4340
|
//#region src/charts/stream/stream.tsx
|
|
4318
|
-
var
|
|
4319
|
-
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: _ }) {
|
|
4320
4343
|
o();
|
|
4321
|
-
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);
|
|
4322
4345
|
return /* @__PURE__ */ p("div", {
|
|
4323
4346
|
style: {
|
|
4324
4347
|
display: "flex",
|
|
@@ -4353,7 +4376,7 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4353
4376
|
label: `${e.label} · ${String(t)}`,
|
|
4354
4377
|
value: e.values[i] ?? 0,
|
|
4355
4378
|
seriesId: e.id,
|
|
4356
|
-
color: e.color ??
|
|
4379
|
+
color: e.color ?? Bn[n % Bn.length]
|
|
4357
4380
|
};
|
|
4358
4381
|
});
|
|
4359
4382
|
}) };
|
|
@@ -4366,7 +4389,7 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4366
4389
|
transform: `translate(${y.left},${y.top})`,
|
|
4367
4390
|
children: [e.map((e, n) => {
|
|
4368
4391
|
if (v.value.has(e.id)) return null;
|
|
4369
|
-
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])]);
|
|
4370
4393
|
return /* @__PURE__ */ f("path", {
|
|
4371
4394
|
d: `${T(a, s)}${T([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4372
4395
|
fill: i,
|
|
@@ -4381,11 +4404,11 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4381
4404
|
})]
|
|
4382
4405
|
});
|
|
4383
4406
|
}
|
|
4384
|
-
}), x && /* @__PURE__ */ f(
|
|
4407
|
+
}), x && /* @__PURE__ */ f(Yt, {
|
|
4385
4408
|
series: e.map((e, t) => ({
|
|
4386
4409
|
id: e.id,
|
|
4387
4410
|
label: e.label,
|
|
4388
|
-
color: e.color ??
|
|
4411
|
+
color: e.color ?? Bn[t % Bn.length]
|
|
4389
4412
|
})),
|
|
4390
4413
|
hidden: v
|
|
4391
4414
|
})]
|
|
@@ -4393,10 +4416,10 @@ function Rn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4393
4416
|
}
|
|
4394
4417
|
//#endregion
|
|
4395
4418
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4396
|
-
var
|
|
4397
|
-
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 }) {
|
|
4398
4421
|
o();
|
|
4399
|
-
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));
|
|
4400
4423
|
return /* @__PURE__ */ f(Q, {
|
|
4401
4424
|
title: t,
|
|
4402
4425
|
description: n,
|
|
@@ -4423,7 +4446,7 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4423
4446
|
label: e.node.label,
|
|
4424
4447
|
value: e.value,
|
|
4425
4448
|
percent: m > 0 ? e.value / m * 100 : 0,
|
|
4426
|
-
color: e.node.color ??
|
|
4449
|
+
color: e.node.color ?? Hn[t % Hn.length]
|
|
4427
4450
|
};
|
|
4428
4451
|
}),
|
|
4429
4452
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4432,7 +4455,7 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4432
4455
|
children: ({ width: e, height: t }) => {
|
|
4433
4456
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4434
4457
|
return /* @__PURE__ */ f("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4435
|
-
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];
|
|
4436
4459
|
return /* @__PURE__ */ f("path", {
|
|
4437
4460
|
d: P(n, r, o, a, e.a0, e.a1),
|
|
4438
4461
|
fill: s,
|
|
@@ -4447,10 +4470,10 @@ function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4447
4470
|
}
|
|
4448
4471
|
//#endregion
|
|
4449
4472
|
//#region src/charts/sankey/sankey.tsx
|
|
4450
|
-
var
|
|
4451
|
-
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 }) {
|
|
4452
4475
|
o();
|
|
4453
|
-
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];
|
|
4454
4477
|
return /* @__PURE__ */ f(Q, {
|
|
4455
4478
|
title: n,
|
|
4456
4479
|
description: r,
|
|
@@ -4474,7 +4497,7 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4474
4497
|
plain: l,
|
|
4475
4498
|
tooltip: s && m ? ({ width: n, height: r }) => {
|
|
4476
4499
|
if (!s || !m) return;
|
|
4477
|
-
let { nodes: i } =
|
|
4500
|
+
let { nodes: i } = oe(e, t, {
|
|
4478
4501
|
width: n - u.left - u.right,
|
|
4479
4502
|
height: r - u.top - u.bottom
|
|
4480
4503
|
});
|
|
@@ -4490,14 +4513,14 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4490
4513
|
children: ({ width: n, height: r }) => {
|
|
4491
4514
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4492
4515
|
if (i <= 0 || !m) return null;
|
|
4493
|
-
let { nodes: o, links: s } =
|
|
4516
|
+
let { nodes: o, links: s } = oe(e, t, {
|
|
4494
4517
|
width: i,
|
|
4495
4518
|
height: a
|
|
4496
4519
|
});
|
|
4497
4520
|
return /* @__PURE__ */ p("g", {
|
|
4498
4521
|
transform: `translate(${u.left},${u.top})`,
|
|
4499
4522
|
children: [s.map((e, t) => /* @__PURE__ */ f("path", {
|
|
4500
|
-
d:
|
|
4523
|
+
d: se(e),
|
|
4501
4524
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4502
4525
|
fillOpacity: .32,
|
|
4503
4526
|
"data-link": ""
|
|
@@ -4526,23 +4549,23 @@ function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4526
4549
|
}
|
|
4527
4550
|
//#endregion
|
|
4528
4551
|
//#region src/charts/calendar/calendar.tsx
|
|
4529
|
-
var
|
|
4530
|
-
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) {
|
|
4531
4554
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4532
4555
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4533
4556
|
}
|
|
4534
|
-
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 }) {
|
|
4535
4558
|
o();
|
|
4536
4559
|
let h = e.length > 0, g = i([m?.min ?? 0, m?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4537
|
-
for (let t of e) v.set(
|
|
4538
|
-
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 = [];
|
|
4539
4562
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4540
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4563
|
+
let n = new Date(b.getTime() + (e * 7 + t) * Kn);
|
|
4541
4564
|
n > x || T.push({
|
|
4542
4565
|
col: e,
|
|
4543
4566
|
row: t,
|
|
4544
4567
|
date: n,
|
|
4545
|
-
value: v.get(
|
|
4568
|
+
value: v.get(Jn(n)) ?? 0
|
|
4546
4569
|
});
|
|
4547
4570
|
}
|
|
4548
4571
|
let E = /* @__PURE__ */ f(Q, {
|
|
@@ -4553,7 +4576,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4553
4576
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
4554
4577
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4555
4578
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Day" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4556
|
-
/* @__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)) })
|
|
4557
4580
|
] }),
|
|
4558
4581
|
className: u,
|
|
4559
4582
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4563,10 +4586,10 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4563
4586
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4564
4587
|
return {
|
|
4565
4588
|
points: T.map((e, n) => ({
|
|
4566
|
-
id: `${
|
|
4589
|
+
id: `${Jn(e.date)}-${n}`,
|
|
4567
4590
|
cx: e.col * (t + 2) + t / 2,
|
|
4568
4591
|
cy: e.row * (t + 2) + t / 2,
|
|
4569
|
-
label:
|
|
4592
|
+
label: Jn(e.date),
|
|
4570
4593
|
value: e.value
|
|
4571
4594
|
})),
|
|
4572
4595
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4575,7 +4598,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4575
4598
|
children: ({ width: e }) => {
|
|
4576
4599
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4577
4600
|
return /* @__PURE__ */ f("g", { children: T.map((e, n) => {
|
|
4578
|
-
let r = m ?
|
|
4601
|
+
let r = m ? Gt(e.value, m).color : void 0, i = m ? Kt(e.value, m, g.value, _.value) : !0;
|
|
4579
4602
|
return /* @__PURE__ */ f("rect", {
|
|
4580
4603
|
x: e.col * (t + 2),
|
|
4581
4604
|
y: e.row * (t + 2),
|
|
@@ -4584,7 +4607,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4584
4607
|
rx: 1.5,
|
|
4585
4608
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4586
4609
|
fillOpacity: m ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4587
|
-
"data-day":
|
|
4610
|
+
"data-day": Jn(e.date)
|
|
4588
4611
|
}, n);
|
|
4589
4612
|
}) });
|
|
4590
4613
|
}
|
|
@@ -4595,7 +4618,7 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4595
4618
|
flexDirection: "column",
|
|
4596
4619
|
gap: "0.5rem"
|
|
4597
4620
|
},
|
|
4598
|
-
children: [E, /* @__PURE__ */ f(
|
|
4621
|
+
children: [E, /* @__PURE__ */ f(qt, {
|
|
4599
4622
|
options: m,
|
|
4600
4623
|
range: g,
|
|
4601
4624
|
hidden: _,
|
|
@@ -4605,11 +4628,11 @@ function qn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4605
4628
|
}
|
|
4606
4629
|
//#endregion
|
|
4607
4630
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4608
|
-
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 }) {
|
|
4609
4632
|
o();
|
|
4610
|
-
let D = b ? He :
|
|
4611
|
-
T && !M.current && (M.current =
|
|
4612
|
-
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);
|
|
4613
4636
|
}), a(() => {
|
|
4614
4637
|
let e = M.current;
|
|
4615
4638
|
if (!e) return;
|
|
@@ -4621,7 +4644,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4621
4644
|
let t = j.value, n = e.window.peek();
|
|
4622
4645
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4623
4646
|
});
|
|
4624
|
-
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);
|
|
4625
4648
|
return /* @__PURE__ */ p("div", {
|
|
4626
4649
|
style: {
|
|
4627
4650
|
display: "flex",
|
|
@@ -4658,7 +4681,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4658
4681
|
if (v === !1 || !P) return;
|
|
4659
4682
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4660
4683
|
if (n <= 0) return;
|
|
4661
|
-
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]);
|
|
4662
4685
|
if (E === "axis") return {
|
|
4663
4686
|
points: N.map((e, t) => ({
|
|
4664
4687
|
id: `c-${t}`,
|
|
@@ -4716,11 +4739,11 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4716
4739
|
children: ({ width: e, height: t }) => {
|
|
4717
4740
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4718
4741
|
if (n <= 0 || !P) return null;
|
|
4719
|
-
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;
|
|
4720
4743
|
return /* @__PURE__ */ p("g", {
|
|
4721
4744
|
transform: `translate(${D.left},${D.top})`,
|
|
4722
4745
|
children: [
|
|
4723
|
-
!b && /* @__PURE__ */ f(
|
|
4746
|
+
!b && /* @__PURE__ */ f(gt, {
|
|
4724
4747
|
scale: a,
|
|
4725
4748
|
orientation: "y",
|
|
4726
4749
|
length: n,
|
|
@@ -4760,7 +4783,7 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4760
4783
|
]
|
|
4761
4784
|
}, t);
|
|
4762
4785
|
}),
|
|
4763
|
-
!b &&
|
|
4786
|
+
!b && xt(x, {
|
|
4764
4787
|
xScale: i,
|
|
4765
4788
|
yScale: c,
|
|
4766
4789
|
innerW: n,
|
|
@@ -4781,12 +4804,12 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4781
4804
|
});
|
|
4782
4805
|
}
|
|
4783
4806
|
}),
|
|
4784
|
-
S && !C && k > 1 && /* @__PURE__ */ f(
|
|
4807
|
+
S && !C && k > 1 && /* @__PURE__ */ f(Lt, {
|
|
4785
4808
|
count: k,
|
|
4786
4809
|
window: j,
|
|
4787
4810
|
label: "Time range"
|
|
4788
4811
|
}),
|
|
4789
|
-
C && k > 1 && /* @__PURE__ */ f(
|
|
4812
|
+
C && k > 1 && /* @__PURE__ */ f(Rt, {
|
|
4790
4813
|
count: k,
|
|
4791
4814
|
window: j,
|
|
4792
4815
|
label: "Time range"
|
|
@@ -4796,10 +4819,10 @@ function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4796
4819
|
}
|
|
4797
4820
|
//#endregion
|
|
4798
4821
|
//#region src/charts/polar/polar.tsx
|
|
4799
|
-
var
|
|
4800
|
-
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 }) {
|
|
4801
4824
|
o();
|
|
4802
|
-
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: [
|
|
4803
4826
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4804
4827
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Category" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4805
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)) })
|
|
@@ -4809,7 +4832,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4809
4832
|
cx: n,
|
|
4810
4833
|
cy: r,
|
|
4811
4834
|
outerR: i,
|
|
4812
|
-
rScale:
|
|
4835
|
+
rScale: Se([0, v], [0, i])
|
|
4813
4836
|
};
|
|
4814
4837
|
};
|
|
4815
4838
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -4826,7 +4849,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4826
4849
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4827
4850
|
return {
|
|
4828
4851
|
points: e.map((e, t) => {
|
|
4829
|
-
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);
|
|
4830
4853
|
return {
|
|
4831
4854
|
id: `p-${t}`,
|
|
4832
4855
|
cx: o,
|
|
@@ -4842,7 +4865,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4842
4865
|
if (!g) return null;
|
|
4843
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) => {
|
|
4844
4867
|
let t = y.center(e.label) ?? 0;
|
|
4845
|
-
return
|
|
4868
|
+
return X(i, a, c.map(e.value), t);
|
|
4846
4869
|
});
|
|
4847
4870
|
return /* @__PURE__ */ p("g", { children: [
|
|
4848
4871
|
!m && l.map((e, t) => /* @__PURE__ */ f("circle", {
|
|
@@ -4858,12 +4881,12 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4858
4881
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4859
4882
|
return /* @__PURE__ */ f("path", {
|
|
4860
4883
|
d: P(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4861
|
-
fill: e.color ??
|
|
4884
|
+
fill: e.color ?? Qn[t % Qn.length],
|
|
4862
4885
|
fillOpacity: .85,
|
|
4863
4886
|
"data-wedge": ""
|
|
4864
4887
|
}, t);
|
|
4865
4888
|
}) : (() => {
|
|
4866
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4889
|
+
let t = [...u, u[0]], n = e[0]?.color ?? Qn[0];
|
|
4867
4890
|
return /* @__PURE__ */ p(d, { children: [r === "area" && /* @__PURE__ */ f("path", {
|
|
4868
4891
|
d: `${T(t, "linear")}Z`,
|
|
4869
4892
|
fill: n,
|
|
@@ -4879,7 +4902,7 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4879
4902
|
})] });
|
|
4880
4903
|
})(),
|
|
4881
4904
|
!m && e.map((e, t) => {
|
|
4882
|
-
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);
|
|
4883
4906
|
return /* @__PURE__ */ f("text", {
|
|
4884
4907
|
x: r,
|
|
4885
4908
|
y: s,
|
|
@@ -4897,10 +4920,10 @@ function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4897
4920
|
}
|
|
4898
4921
|
//#endregion
|
|
4899
4922
|
//#region src/charts/gauge/gauge.tsx
|
|
4900
|
-
var
|
|
4901
|
-
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 }) {
|
|
4902
4925
|
o();
|
|
4903
|
-
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;
|
|
4904
4927
|
return /* @__PURE__ */ f(Q, {
|
|
4905
4928
|
title: c,
|
|
4906
4929
|
description: l,
|
|
@@ -4934,7 +4957,7 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4934
4957
|
}, t);
|
|
4935
4958
|
}),
|
|
4936
4959
|
!h && T.map((e, t) => {
|
|
4937
|
-
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);
|
|
4938
4961
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("line", {
|
|
4939
4962
|
x1: r,
|
|
4940
4963
|
y1: i,
|
|
@@ -4954,7 +4977,7 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4954
4977
|
})] }, t);
|
|
4955
4978
|
}),
|
|
4956
4979
|
(() => {
|
|
4957
|
-
let [e, t] =
|
|
4980
|
+
let [e, t] = X(c, l, g, S(v));
|
|
4958
4981
|
return /* @__PURE__ */ f("line", {
|
|
4959
4982
|
x1: c,
|
|
4960
4983
|
y1: l,
|
|
@@ -4988,4 +5011,4 @@ function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4988
5011
|
});
|
|
4989
5012
|
}
|
|
4990
5013
|
//#endregion
|
|
4991
|
-
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 };
|