@cascivo/charts 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts.css +1 -1
- package/dist/index.d.ts +622 -37
- package/dist/index.js +762 -708
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -270,23 +270,23 @@ function N(e) {
|
|
|
270
270
|
}
|
|
271
271
|
return o;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function ee(e, t, n = "linear") {
|
|
274
274
|
if (e.length === 0) return "";
|
|
275
275
|
let r = E(e, n), i = e[e.length - 1], a = e[0];
|
|
276
276
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function P(e, t, n, r, i, a) {
|
|
279
279
|
let o = 2 * Math.PI;
|
|
280
280
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
281
281
|
let a = i + Math.PI;
|
|
282
|
-
return
|
|
282
|
+
return P(e, t, n, r, i, a) + P(e, t, n, r, a, i + o - 1e-9);
|
|
283
283
|
}
|
|
284
284
|
let s = (n, r) => [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = w(n), u = w(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
285
285
|
if (r <= 0) return `M${w(e)},${w(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
286
286
|
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
287
287
|
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function F(e) {
|
|
290
290
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
291
291
|
return e.map((e) => e.map((e, t) => {
|
|
292
292
|
let r = n[t];
|
|
@@ -295,7 +295,7 @@ function I(e) {
|
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region src/engine/stacked.ts
|
|
298
|
-
function
|
|
298
|
+
function I(e) {
|
|
299
299
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
300
300
|
for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
|
|
301
301
|
return {
|
|
@@ -317,7 +317,7 @@ function L(e) {
|
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/engine/nearest.ts
|
|
320
|
-
function
|
|
320
|
+
function L(e, t) {
|
|
321
321
|
if (e.length === 0) return -1;
|
|
322
322
|
if (e.length === 1) return 0;
|
|
323
323
|
let n = 0, r = e.length - 1;
|
|
@@ -484,15 +484,15 @@ function G(e, t, n, r, i, a) {
|
|
|
484
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
490
|
return G(r, 0, 0, t, n, i), i;
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/engine/stream.ts
|
|
494
|
-
function
|
|
495
|
-
let n =
|
|
494
|
+
function ie(e, t = "silhouette") {
|
|
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));
|
|
498
498
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -500,39 +500,39 @@ function ae(e, t = "silhouette") {
|
|
|
500
500
|
return [e - r, t - r];
|
|
501
501
|
}));
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function q(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 J(e) {
|
|
511
|
+
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + J(t), 0) : e.value ?? 0;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function Y(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: J(e)
|
|
521
521
|
}), !e.children) return;
|
|
522
|
-
let o = a - i, s =
|
|
522
|
+
let o = a - i, s = J(e) || 1, c = i;
|
|
523
523
|
for (let n of e.children) {
|
|
524
|
-
let e = c + o *
|
|
524
|
+
let e = c + o * J(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 ce(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
|
+
}), de = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, fe = {
|
|
600
600
|
l: .95,
|
|
601
601
|
c: .04,
|
|
602
602
|
h: 232
|
|
603
|
-
},
|
|
603
|
+
}, pe = {
|
|
604
604
|
l: .34,
|
|
605
605
|
c: .15,
|
|
606
606
|
h: 274
|
|
607
|
-
},
|
|
607
|
+
}, X = {
|
|
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 de(ue(fe, pe, ce(e)));
|
|
622
622
|
}
|
|
623
|
-
function
|
|
624
|
-
let t =
|
|
625
|
-
return
|
|
623
|
+
function _e(e) {
|
|
624
|
+
let t = ce(e);
|
|
625
|
+
return de(t < .5 ? ue(X, 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 xe(e, t, n, r) {
|
|
641
641
|
return [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))];
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function Z(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 Ce(e, t = [0, 2 * Math.PI]) {
|
|
|
655
655
|
step: r
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Se(e, t) {
|
|
659
659
|
return h(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 Oe(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 ke(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 Ae(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 je(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 Ne(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 Ne(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 Fe(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 Fe(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 Fe(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 Le(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 Re(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 He(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,41 +904,47 @@ function Ue(e = 400, t = 300) {
|
|
|
904
904
|
height: o
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
var
|
|
907
|
+
var He = {
|
|
908
908
|
top: 8,
|
|
909
909
|
right: 8,
|
|
910
910
|
bottom: 24,
|
|
911
911
|
left: 36
|
|
912
|
-
},
|
|
912
|
+
}, Ue = {
|
|
913
913
|
top: 2,
|
|
914
914
|
right: 2,
|
|
915
915
|
bottom: 2,
|
|
916
916
|
left: 2
|
|
917
917
|
}, We = 6.5;
|
|
918
918
|
function Ge(e, t) {
|
|
919
|
-
if (t) return
|
|
919
|
+
if (t) return Ue.left;
|
|
920
920
|
let n = e.reduce((e, t) => Math.max(e, t.length), 0);
|
|
921
|
-
return Math.max(
|
|
921
|
+
return Math.max(He.left, Math.ceil(n * We + 12));
|
|
922
922
|
}
|
|
923
|
-
function Ke(e
|
|
923
|
+
function Ke(e = {}) {
|
|
924
|
+
let { rightAxisLabels: t = [], bottomAxisLabels: n = [], plain: r } = e;
|
|
925
|
+
if (r) return Ue.right;
|
|
926
|
+
let i = t.reduce((e, t) => Math.max(e, t.length), 0), a = i > 0 ? Math.ceil(i * We + 12) : 0, o = n[n.length - 1] ?? "", s = o ? Math.ceil(o.length * We / 2 + 2) : 0;
|
|
927
|
+
return Math.max(He.right, a, s);
|
|
928
|
+
}
|
|
929
|
+
function qe(e, t) {
|
|
924
930
|
if (e.length <= 1 || t <= 0) return;
|
|
925
931
|
let n = t / e.length, r = e.reduce((e, t) => Math.max(e, t.length), 0) * We + 6;
|
|
926
932
|
if (!(n >= r)) return Math.ceil(r / n);
|
|
927
933
|
}
|
|
928
|
-
var
|
|
929
|
-
frame: "
|
|
930
|
-
"cascivo-chart-in": "_cascivo-chart-
|
|
931
|
-
fallback: "
|
|
934
|
+
var Je = {
|
|
935
|
+
frame: "_frame_1kt6d_2",
|
|
936
|
+
"cascivo-chart-in": "_cascivo-chart-in_1kt6d_1",
|
|
937
|
+
fallback: "_fallback_1kt6d_67"
|
|
932
938
|
};
|
|
933
939
|
//#endregion
|
|
934
940
|
//#region src/core/data-point.ts
|
|
935
|
-
function
|
|
941
|
+
function Ye(e) {
|
|
936
942
|
return `${e.label}: ${e.value}`;
|
|
937
943
|
}
|
|
938
944
|
//#endregion
|
|
939
945
|
//#region src/core/chart-tooltip.tsx
|
|
940
|
-
function
|
|
941
|
-
let n = t.format ? t.format(e) :
|
|
946
|
+
function Xe({ point: e, model: t }) {
|
|
947
|
+
let n = t.format ? t.format(e) : Ye(e), r = e.segments?.filter((e) => e.value !== 0);
|
|
942
948
|
return /* @__PURE__ */ p("div", {
|
|
943
949
|
role: "tooltip",
|
|
944
950
|
style: {
|
|
@@ -986,7 +992,7 @@ function Ye({ point: e, model: t }) {
|
|
|
986
992
|
}
|
|
987
993
|
//#endregion
|
|
988
994
|
//#region src/core/nearest.ts
|
|
989
|
-
function
|
|
995
|
+
function Ze(e, t, n, r = "xy") {
|
|
990
996
|
if (e.length === 0) return -1;
|
|
991
997
|
let i = 0, a = Infinity;
|
|
992
998
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -997,7 +1003,7 @@ function Xe(e, t, n, r = "xy") {
|
|
|
997
1003
|
}
|
|
998
1004
|
//#endregion
|
|
999
1005
|
//#region src/core/canvas-layer.tsx
|
|
1000
|
-
function
|
|
1006
|
+
function Qe({ size: e, paint: t }) {
|
|
1001
1007
|
let n = c(null);
|
|
1002
1008
|
return a(() => {
|
|
1003
1009
|
let { width: r, height: i } = e(), a = n.current;
|
|
@@ -1022,28 +1028,28 @@ function Ze({ size: e, paint: t }) {
|
|
|
1022
1028
|
}
|
|
1023
1029
|
});
|
|
1024
1030
|
}
|
|
1025
|
-
function
|
|
1031
|
+
function $e(e, t) {
|
|
1026
1032
|
let n = /var\((--[^,)]+)/.exec(t);
|
|
1027
1033
|
return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
|
|
1028
1034
|
}
|
|
1029
1035
|
//#endregion
|
|
1030
1036
|
//#region src/core/zoom.ts
|
|
1031
|
-
var
|
|
1032
|
-
function
|
|
1037
|
+
var et = 1;
|
|
1038
|
+
function tt(e, t, n, r) {
|
|
1033
1039
|
if (t <= 1) return [0, Math.max(0, t - 1)];
|
|
1034
1040
|
let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
|
|
1035
|
-
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s <
|
|
1041
|
+
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < et && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - et)), c = Math.min(t - 1, s + et)), [s, c];
|
|
1036
1042
|
}
|
|
1037
|
-
function
|
|
1043
|
+
function nt(e, t, n) {
|
|
1038
1044
|
let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
|
|
1039
1045
|
return [o, o + a];
|
|
1040
1046
|
}
|
|
1041
|
-
function
|
|
1047
|
+
function rt(e, t) {
|
|
1042
1048
|
return e[0] > 0 || e[1] < t - 1;
|
|
1043
1049
|
}
|
|
1044
1050
|
//#endregion
|
|
1045
1051
|
//#region src/chrome/toolbox.tsx
|
|
1046
|
-
var
|
|
1052
|
+
var it = {
|
|
1047
1053
|
display: "inline-flex",
|
|
1048
1054
|
alignItems: "center",
|
|
1049
1055
|
justifyContent: "center",
|
|
@@ -1058,7 +1064,7 @@ var rt = {
|
|
|
1058
1064
|
color: "var(--cascivo-color-foreground, inherit)",
|
|
1059
1065
|
cursor: "pointer"
|
|
1060
1066
|
};
|
|
1061
|
-
function
|
|
1067
|
+
function at({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
|
|
1062
1068
|
let o = e;
|
|
1063
1069
|
return /* @__PURE__ */ m("div", {
|
|
1064
1070
|
role: "group",
|
|
@@ -1070,26 +1076,26 @@ function it({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1070
1076
|
children: [
|
|
1071
1077
|
o.png !== !1 && /* @__PURE__ */ p("button", {
|
|
1072
1078
|
type: "button",
|
|
1073
|
-
style:
|
|
1079
|
+
style: it,
|
|
1074
1080
|
onClick: t,
|
|
1075
1081
|
children: d(l.charts.exportPng)
|
|
1076
1082
|
}),
|
|
1077
1083
|
o.svg !== !1 && /* @__PURE__ */ p("button", {
|
|
1078
1084
|
type: "button",
|
|
1079
|
-
style:
|
|
1085
|
+
style: it,
|
|
1080
1086
|
onClick: n,
|
|
1081
1087
|
children: d(l.charts.exportSvg)
|
|
1082
1088
|
}),
|
|
1083
1089
|
o.dataView !== !1 && /* @__PURE__ */ p("button", {
|
|
1084
1090
|
type: "button",
|
|
1085
|
-
style:
|
|
1091
|
+
style: it,
|
|
1086
1092
|
"aria-pressed": a,
|
|
1087
1093
|
onClick: r,
|
|
1088
1094
|
children: d(l.charts.dataView)
|
|
1089
1095
|
}),
|
|
1090
1096
|
o.restore !== !1 && /* @__PURE__ */ p("button", {
|
|
1091
1097
|
type: "button",
|
|
1092
|
-
style:
|
|
1098
|
+
style: it,
|
|
1093
1099
|
onClick: i,
|
|
1094
1100
|
children: d(l.charts.restore)
|
|
1095
1101
|
})
|
|
@@ -1098,19 +1104,19 @@ function it({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1098
1104
|
}
|
|
1099
1105
|
//#endregion
|
|
1100
1106
|
//#region src/core/export.ts
|
|
1101
|
-
var
|
|
1107
|
+
var ot = [
|
|
1102
1108
|
"fill",
|
|
1103
1109
|
"stroke",
|
|
1104
1110
|
"stop-color",
|
|
1105
1111
|
"color"
|
|
1106
1112
|
];
|
|
1107
|
-
function
|
|
1113
|
+
function st(e) {
|
|
1108
1114
|
let t = e.cloneNode(!0);
|
|
1109
1115
|
if (typeof getComputedStyle == "function") {
|
|
1110
1116
|
let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
|
|
1111
1117
|
for (let e = 0; e < n.length; e++) {
|
|
1112
1118
|
let t = getComputedStyle(n[e]), i = r[e];
|
|
1113
|
-
if (i) for (let e of
|
|
1119
|
+
if (i) for (let e of ot) {
|
|
1114
1120
|
let n = t.getPropertyValue(e);
|
|
1115
1121
|
n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
|
|
1116
1122
|
}
|
|
@@ -1118,7 +1124,7 @@ function ot(e) {
|
|
|
1118
1124
|
}
|
|
1119
1125
|
return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
|
|
1120
1126
|
}
|
|
1121
|
-
function
|
|
1127
|
+
function ct(e, t) {
|
|
1122
1128
|
if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
|
|
1123
1129
|
let n = t.dpr ?? 1, r = document.createElement("canvas");
|
|
1124
1130
|
r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
|
|
@@ -1134,14 +1140,14 @@ function st(e, t) {
|
|
|
1134
1140
|
}), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
1135
1141
|
}) : Promise.resolve(null);
|
|
1136
1142
|
}
|
|
1137
|
-
function
|
|
1143
|
+
function lt(e, t) {
|
|
1138
1144
|
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
1139
1145
|
let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1140
1146
|
i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
1141
1147
|
}
|
|
1142
1148
|
//#endregion
|
|
1143
1149
|
//#region src/core/chart-frame.tsx
|
|
1144
|
-
var
|
|
1150
|
+
var ut = {
|
|
1145
1151
|
position: "absolute",
|
|
1146
1152
|
insetInlineStart: "-9999px",
|
|
1147
1153
|
inlineSize: "1px",
|
|
@@ -1152,62 +1158,62 @@ var lt = {
|
|
|
1152
1158
|
};
|
|
1153
1159
|
function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: k, onAfterDraw: A }) {
|
|
1154
1160
|
o();
|
|
1155
|
-
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref:
|
|
1161
|
+
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref: ee, width: P, height: F } = Ve(n ?? 400, r), I = i(null), L = i(!1), ne = c(null), re = c(null), R = c(null), z = c(null);
|
|
1156
1162
|
a(() => {
|
|
1157
1163
|
let e = z.current;
|
|
1158
1164
|
if (!e || !T) return;
|
|
1159
1165
|
let t = (t) => {
|
|
1160
1166
|
t.preventDefault();
|
|
1161
1167
|
let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
|
|
1162
|
-
T.window.value =
|
|
1168
|
+
T.window.value = tt(T.window.value, T.count, i, r);
|
|
1163
1169
|
};
|
|
1164
1170
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1165
1171
|
});
|
|
1166
1172
|
let B = () => {
|
|
1167
1173
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1168
|
-
}, V = n ??
|
|
1174
|
+
}, V = n ?? P.value, H = r ?? F.value, U = E === !0 ? {} : E || null, W = () => re.current ? st(re.current) : null, G = () => {
|
|
1169
1175
|
let t = W();
|
|
1170
|
-
t &&
|
|
1171
|
-
},
|
|
1176
|
+
t && lt(t, `${e || "chart"}.svg`);
|
|
1177
|
+
}, K = () => {
|
|
1172
1178
|
let t = W();
|
|
1173
|
-
t &&
|
|
1179
|
+
t && ct(t, {
|
|
1174
1180
|
width: V,
|
|
1175
1181
|
height: H,
|
|
1176
1182
|
dpr: 2
|
|
1177
1183
|
}).then((t) => {
|
|
1178
|
-
t &&
|
|
1184
|
+
t && lt(t, `${e || "chart"}.png`);
|
|
1179
1185
|
});
|
|
1180
|
-
},
|
|
1186
|
+
}, ie = () => {
|
|
1181
1187
|
B(), D?.();
|
|
1182
|
-
},
|
|
1188
|
+
}, q = typeof b == "function" ? b({
|
|
1183
1189
|
width: V,
|
|
1184
1190
|
height: H
|
|
1185
1191
|
}) : b;
|
|
1186
1192
|
a(() => {
|
|
1187
|
-
let e =
|
|
1188
|
-
if (!
|
|
1189
|
-
let t = e === null ? void 0 :
|
|
1190
|
-
ne.current.textContent = t ? (
|
|
1193
|
+
let e = I.value;
|
|
1194
|
+
if (!q || !ne.current) return;
|
|
1195
|
+
let t = e === null ? void 0 : q.points[e];
|
|
1196
|
+
ne.current.textContent = t ? (q.format ?? Ye)(t) : "";
|
|
1191
1197
|
});
|
|
1192
|
-
let
|
|
1198
|
+
let J = {
|
|
1193
1199
|
position: "absolute",
|
|
1194
1200
|
inset: 0,
|
|
1195
1201
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1196
1202
|
background: "transparent",
|
|
1197
1203
|
touchAction: T ? "none" : void 0
|
|
1198
|
-
},
|
|
1204
|
+
}, Y = C === "canvas" && w !== void 0, ae = q !== void 0 || T !== void 0, oe = {};
|
|
1199
1205
|
if (O && typeof O == "object") {
|
|
1200
|
-
let e =
|
|
1206
|
+
let e = oe;
|
|
1201
1207
|
O.duration !== void 0 && (e["--cascivo-chart-anim-dur"] = `${O.duration}ms`), O.easing && (e["--cascivo-chart-anim-ease"] = O.easing), O.properties && (e["--cascivo-chart-anim-props"] = O.properties.join(", "));
|
|
1202
1208
|
}
|
|
1203
|
-
let
|
|
1204
|
-
...
|
|
1205
|
-
...
|
|
1209
|
+
let se = ae || Y || U || Object.keys(oe).length > 0 ? {
|
|
1210
|
+
...oe,
|
|
1211
|
+
...ae || Y || U ? { position: "relative" } : {}
|
|
1206
1212
|
} : void 0;
|
|
1207
1213
|
return /* @__PURE__ */ m("div", {
|
|
1208
|
-
ref:
|
|
1209
|
-
className: [
|
|
1210
|
-
style:
|
|
1214
|
+
ref: ee,
|
|
1215
|
+
className: [Je.frame, g].filter(Boolean).join(" "),
|
|
1216
|
+
style: se,
|
|
1211
1217
|
..._ !== void 0 && { "data-state": _ },
|
|
1212
1218
|
...y === !0 && { "data-plain": "" },
|
|
1213
1219
|
...O === !1 && { "data-no-anim": "" },
|
|
@@ -1219,21 +1225,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1219
1225
|
right: 4,
|
|
1220
1226
|
zIndex: 12
|
|
1221
1227
|
},
|
|
1222
|
-
children: /* @__PURE__ */ p(
|
|
1228
|
+
children: /* @__PURE__ */ p(at, {
|
|
1223
1229
|
options: U,
|
|
1224
|
-
onPng:
|
|
1230
|
+
onPng: K,
|
|
1225
1231
|
onSvg: G,
|
|
1226
1232
|
onToggleData: () => {
|
|
1227
|
-
|
|
1233
|
+
L.value = !L.value;
|
|
1228
1234
|
},
|
|
1229
|
-
onRestore:
|
|
1230
|
-
showData:
|
|
1235
|
+
onRestore: ie,
|
|
1236
|
+
showData: L.value
|
|
1231
1237
|
})
|
|
1232
1238
|
}),
|
|
1233
|
-
|
|
1239
|
+
Y && /* @__PURE__ */ p(Qe, {
|
|
1234
1240
|
size: () => ({
|
|
1235
|
-
width: n ??
|
|
1236
|
-
height: r ??
|
|
1241
|
+
width: n ?? P.value,
|
|
1242
|
+
height: r ?? F.value
|
|
1237
1243
|
}),
|
|
1238
1244
|
paint: w
|
|
1239
1245
|
}),
|
|
@@ -1275,17 +1281,17 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1275
1281
|
]
|
|
1276
1282
|
}),
|
|
1277
1283
|
u && /* @__PURE__ */ p("div", {
|
|
1278
|
-
className:
|
|
1279
|
-
style:
|
|
1284
|
+
className: Je.fallback,
|
|
1285
|
+
style: ut,
|
|
1280
1286
|
children: u
|
|
1281
1287
|
}),
|
|
1282
|
-
U &&
|
|
1288
|
+
U && L.value && u && /* @__PURE__ */ p("div", {
|
|
1283
1289
|
"data-data-view": "",
|
|
1284
1290
|
style: { overflowX: "auto" },
|
|
1285
1291
|
children: u
|
|
1286
1292
|
}),
|
|
1287
|
-
|
|
1288
|
-
|
|
1293
|
+
ae && /* @__PURE__ */ m(f, { children: [
|
|
1294
|
+
q !== void 0 && /* @__PURE__ */ m(f, { children: [
|
|
1289
1295
|
/* @__PURE__ */ p("span", {
|
|
1290
1296
|
id: N,
|
|
1291
1297
|
ref: ne,
|
|
@@ -1302,11 +1308,11 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1302
1308
|
border: 0
|
|
1303
1309
|
}
|
|
1304
1310
|
}),
|
|
1305
|
-
|
|
1311
|
+
q.mode === "axis" && I.value !== null && q.points[I.value] !== void 0 && /* @__PURE__ */ p("div", {
|
|
1306
1312
|
"aria-hidden": "true",
|
|
1307
1313
|
style: {
|
|
1308
1314
|
position: "absolute",
|
|
1309
|
-
left:
|
|
1315
|
+
left: q.points[I.value].cx,
|
|
1310
1316
|
top: 0,
|
|
1311
1317
|
width: 1,
|
|
1312
1318
|
height: H,
|
|
@@ -1315,8 +1321,8 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1315
1321
|
zIndex: 9
|
|
1316
1322
|
}
|
|
1317
1323
|
}),
|
|
1318
|
-
|
|
1319
|
-
let e =
|
|
1324
|
+
I.value !== null && q.points[I.value] !== void 0 && (() => {
|
|
1325
|
+
let e = q.points[I.value];
|
|
1320
1326
|
return /* @__PURE__ */ p("div", {
|
|
1321
1327
|
"aria-hidden": "true",
|
|
1322
1328
|
style: {
|
|
@@ -1333,12 +1339,12 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1333
1339
|
}
|
|
1334
1340
|
});
|
|
1335
1341
|
})(),
|
|
1336
|
-
|
|
1337
|
-
point:
|
|
1338
|
-
model:
|
|
1342
|
+
I.value !== null && q.points[I.value] !== void 0 && /* @__PURE__ */ p(Xe, {
|
|
1343
|
+
point: q.points[I.value],
|
|
1344
|
+
model: q
|
|
1339
1345
|
})
|
|
1340
1346
|
] }),
|
|
1341
|
-
T && !U &&
|
|
1347
|
+
T && !U && rt(T.window.value, T.count) && /* @__PURE__ */ p("button", {
|
|
1342
1348
|
type: "button",
|
|
1343
1349
|
onClick: B,
|
|
1344
1350
|
style: {
|
|
@@ -1362,7 +1368,7 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1362
1368
|
role: "application",
|
|
1363
1369
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1364
1370
|
tabIndex: 0,
|
|
1365
|
-
style:
|
|
1371
|
+
style: J,
|
|
1366
1372
|
onPointerDown: (e) => {
|
|
1367
1373
|
T && (R.current = {
|
|
1368
1374
|
x: e.clientX,
|
|
@@ -1372,27 +1378,27 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1372
1378
|
onPointerMove: (e) => {
|
|
1373
1379
|
if (T && R.current && e.buttons === 1) {
|
|
1374
1380
|
let t = e.currentTarget.getBoundingClientRect(), n = R.current.win[1] - R.current.win[0] + 1, r = e.clientX - R.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1375
|
-
T.window.value =
|
|
1381
|
+
T.window.value = nt(R.current.win, T.count, i);
|
|
1376
1382
|
return;
|
|
1377
1383
|
}
|
|
1378
|
-
if (!
|
|
1384
|
+
if (!q || !q.points.length) return;
|
|
1379
1385
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1380
|
-
|
|
1386
|
+
I.value = q.mode === "axis" ? Ze(q.points, n, r, "x") : S === "voronoi" ? te(q.points.map((e) => [e.cx, e.cy]), n, r) : Ze(q.points, n, r, "xy");
|
|
1381
1387
|
},
|
|
1382
1388
|
onPointerUp: () => {
|
|
1383
1389
|
R.current = null;
|
|
1384
1390
|
},
|
|
1385
1391
|
onPointerLeave: () => {
|
|
1386
|
-
R.current = null,
|
|
1392
|
+
R.current = null, q && (I.value = null);
|
|
1387
1393
|
},
|
|
1388
1394
|
onKeyDown: (e) => {
|
|
1389
1395
|
if (T) {
|
|
1390
1396
|
if (e.key === "+" || e.key === "=") {
|
|
1391
|
-
e.preventDefault(), T.window.value =
|
|
1397
|
+
e.preventDefault(), T.window.value = tt(T.window.value, T.count, 1 / 1.25, .5);
|
|
1392
1398
|
return;
|
|
1393
1399
|
}
|
|
1394
1400
|
if (e.key === "-" || e.key === "_") {
|
|
1395
|
-
e.preventDefault(), T.window.value =
|
|
1401
|
+
e.preventDefault(), T.window.value = tt(T.window.value, T.count, 1.25, .5);
|
|
1396
1402
|
return;
|
|
1397
1403
|
}
|
|
1398
1404
|
if (e.key === "0") {
|
|
@@ -1400,29 +1406,29 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1400
1406
|
return;
|
|
1401
1407
|
}
|
|
1402
1408
|
}
|
|
1403
|
-
if (!
|
|
1404
|
-
let t =
|
|
1405
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(),
|
|
1406
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(),
|
|
1407
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
1408
|
-
else if (e.key === "End") e.preventDefault(),
|
|
1409
|
-
else if (e.key === "Escape")
|
|
1409
|
+
if (!q || !q.points.length) return;
|
|
1410
|
+
let t = I.value;
|
|
1411
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), I.value = t === null ? 0 : Math.min(t + 1, q.points.length - 1);
|
|
1412
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), I.value = t === null ? q.points.length - 1 : Math.max(t - 1, 0);
|
|
1413
|
+
else if (e.key === "Home") e.preventDefault(), I.value = 0;
|
|
1414
|
+
else if (e.key === "End") e.preventDefault(), I.value = q.points.length - 1;
|
|
1415
|
+
else if (e.key === "Escape") I.value = null;
|
|
1410
1416
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1411
1417
|
e.preventDefault();
|
|
1412
|
-
let t =
|
|
1418
|
+
let t = I.value, n = t === null ? void 0 : q.points[t];
|
|
1413
1419
|
n && x(n);
|
|
1414
1420
|
}
|
|
1415
1421
|
},
|
|
1416
1422
|
onClick: () => {
|
|
1417
|
-
if (!
|
|
1418
|
-
let e =
|
|
1423
|
+
if (!q) return;
|
|
1424
|
+
let e = I.value, t = e === null ? void 0 : q.points[e];
|
|
1419
1425
|
x && t && x(t);
|
|
1420
1426
|
},
|
|
1421
1427
|
onFocus: () => {
|
|
1422
|
-
|
|
1428
|
+
q && q.points.length > 0 && I.value === null && (I.value = 0);
|
|
1423
1429
|
},
|
|
1424
1430
|
onBlur: () => {
|
|
1425
|
-
|
|
1431
|
+
q && (I.value = null);
|
|
1426
1432
|
}
|
|
1427
1433
|
})
|
|
1428
1434
|
] })
|
|
@@ -1431,45 +1437,49 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1431
1437
|
}
|
|
1432
1438
|
//#endregion
|
|
1433
1439
|
//#region src/core/sync.ts
|
|
1434
|
-
var
|
|
1435
|
-
function
|
|
1436
|
-
let t =
|
|
1440
|
+
var dt = /* @__PURE__ */ new Map();
|
|
1441
|
+
function ft(e) {
|
|
1442
|
+
let t = dt.get(e);
|
|
1437
1443
|
return t || (t = {
|
|
1438
1444
|
group: {
|
|
1439
1445
|
window: n(null),
|
|
1440
1446
|
hoverX: n(null)
|
|
1441
1447
|
},
|
|
1442
1448
|
refs: 0
|
|
1443
|
-
},
|
|
1449
|
+
}, dt.set(e, t)), t.refs++, t.group;
|
|
1444
1450
|
}
|
|
1445
|
-
function
|
|
1446
|
-
let t =
|
|
1447
|
-
t && (t.refs--, t.refs <= 0 &&
|
|
1451
|
+
function pt(e) {
|
|
1452
|
+
let t = dt.get(e);
|
|
1453
|
+
t && (t.refs--, t.refs <= 0 && dt.delete(e));
|
|
1448
1454
|
}
|
|
1449
|
-
function
|
|
1450
|
-
return
|
|
1455
|
+
function mt() {
|
|
1456
|
+
return dt.size;
|
|
1451
1457
|
}
|
|
1452
1458
|
//#endregion
|
|
1453
1459
|
//#region src/chrome/axis.tsx
|
|
1454
|
-
function
|
|
1460
|
+
function ht(e) {
|
|
1455
1461
|
return "bandwidth" in e;
|
|
1456
1462
|
}
|
|
1457
|
-
function
|
|
1463
|
+
function gt(e) {
|
|
1458
1464
|
return "tickInterval" in e;
|
|
1459
1465
|
}
|
|
1460
|
-
function
|
|
1466
|
+
function _t(e) {
|
|
1461
1467
|
return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
1462
1468
|
}
|
|
1463
|
-
function $({ scale: e, orientation: t, length: n, format: r =
|
|
1469
|
+
function $({ scale: e, orientation: t, length: n, format: r = _t, tickCount: i = 5, labelEvery: a, transform: o }) {
|
|
1464
1470
|
let s;
|
|
1465
|
-
if (
|
|
1466
|
-
let t = e.domain.length - 1;
|
|
1471
|
+
if (ht(e)) {
|
|
1472
|
+
let t = e.domain.length - 1, n = a != null && a > 1, i = n ? Math.floor(t / a) * a : -1, o = !1;
|
|
1473
|
+
if (n && i !== t && i >= 0) {
|
|
1474
|
+
let n = (t) => (e.map(e.domain[t]) ?? 0) + e.bandwidth / 2, a = e.domain.reduce((e, t) => Math.max(e, r(t).length), 0) * We;
|
|
1475
|
+
o = n(t) - n(i) < a;
|
|
1476
|
+
}
|
|
1467
1477
|
s = e.domain.map((t, n) => ({
|
|
1468
1478
|
position: (e.map(t) ?? 0) + e.bandwidth / 2,
|
|
1469
1479
|
label: r(t),
|
|
1470
1480
|
i: n
|
|
1471
|
-
})).filter(({ i: e }) =>
|
|
1472
|
-
} else if (
|
|
1481
|
+
})).filter(({ i: e }) => !n || e === t ? !0 : o && e === i ? !1 : e % a === 0);
|
|
1482
|
+
} else if (gt(e)) s = e.ticks(i).map((t) => ({
|
|
1473
1483
|
position: e.map(t),
|
|
1474
1484
|
label: r(t)
|
|
1475
1485
|
}));
|
|
@@ -1480,7 +1490,7 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1480
1490
|
label: r(e)
|
|
1481
1491
|
}));
|
|
1482
1492
|
}
|
|
1483
|
-
let c = t === "x";
|
|
1493
|
+
let c = t === "x", l = t === "y-right", u = c ? 0 : l ? 4 : -4, d = c ? 0 : l ? 8 : -8, f = c ? "middle" : l ? "start" : "end";
|
|
1484
1494
|
return /* @__PURE__ */ m("g", {
|
|
1485
1495
|
transform: o,
|
|
1486
1496
|
"aria-hidden": "true",
|
|
@@ -1496,14 +1506,14 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1496
1506
|
children: [/* @__PURE__ */ p("line", {
|
|
1497
1507
|
x1: 0,
|
|
1498
1508
|
y1: 0,
|
|
1499
|
-
x2:
|
|
1509
|
+
x2: u,
|
|
1500
1510
|
y2: c ? 4 : 0,
|
|
1501
1511
|
stroke: "var(--cascivo-chart-axis)",
|
|
1502
1512
|
strokeWidth: 1
|
|
1503
1513
|
}), /* @__PURE__ */ p("text", {
|
|
1504
|
-
x:
|
|
1514
|
+
x: d,
|
|
1505
1515
|
y: c ? 16 : 4,
|
|
1506
|
-
textAnchor:
|
|
1516
|
+
textAnchor: f,
|
|
1507
1517
|
fill: "var(--cascivo-chart-axis)",
|
|
1508
1518
|
fontSize: 11,
|
|
1509
1519
|
children: t
|
|
@@ -1513,7 +1523,7 @@ function $({ scale: e, orientation: t, length: n, format: r = gt, tickCount: i =
|
|
|
1513
1523
|
}
|
|
1514
1524
|
//#endregion
|
|
1515
1525
|
//#region src/chrome/grid-lines.tsx
|
|
1516
|
-
function
|
|
1526
|
+
function vt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
|
|
1517
1527
|
let a = e.ticks(r), o = t === "x";
|
|
1518
1528
|
return /* @__PURE__ */ p("g", {
|
|
1519
1529
|
transform: i,
|
|
@@ -1534,17 +1544,17 @@ function _t({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
|
|
|
1534
1544
|
}
|
|
1535
1545
|
//#endregion
|
|
1536
1546
|
//#region src/chrome/reference.tsx
|
|
1537
|
-
var
|
|
1538
|
-
function
|
|
1547
|
+
var yt = "var(--cascivo-color-foreground-muted)", bt = "var(--cascivo-color-accent)";
|
|
1548
|
+
function xt(e, t) {
|
|
1539
1549
|
let n = e.map(t);
|
|
1540
1550
|
if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
|
|
1541
1551
|
}
|
|
1542
|
-
function
|
|
1552
|
+
function St(e, t, n) {
|
|
1543
1553
|
let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
|
|
1544
1554
|
if (e.kind === "line") {
|
|
1545
|
-
let t =
|
|
1555
|
+
let t = xt(e.axis === "x" ? r : i, e.value);
|
|
1546
1556
|
if (t == null) return null;
|
|
1547
|
-
let s = e.color ??
|
|
1557
|
+
let s = e.color ?? yt, c = e.dash !== !1, l = e.axis === "x";
|
|
1548
1558
|
return /* @__PURE__ */ m("g", {
|
|
1549
1559
|
"data-annotation": "line",
|
|
1550
1560
|
"aria-hidden": "true",
|
|
@@ -1575,9 +1585,9 @@ function xt(e, t, n) {
|
|
|
1575
1585
|
}, n);
|
|
1576
1586
|
}
|
|
1577
1587
|
if (e.kind === "area") {
|
|
1578
|
-
let t = e.axis === "x" ? r : i, s =
|
|
1588
|
+
let t = e.axis === "x" ? r : i, s = xt(t, e.from), c = xt(t, e.to);
|
|
1579
1589
|
if (s == null || c == null) return null;
|
|
1580
|
-
let l = e.color ??
|
|
1590
|
+
let l = e.color ?? bt, u = e.axis === "x", d = Math.min(s, c), f = Math.abs(c - s);
|
|
1581
1591
|
return /* @__PURE__ */ p("g", {
|
|
1582
1592
|
"data-annotation": "area",
|
|
1583
1593
|
"aria-hidden": "true",
|
|
@@ -1593,9 +1603,9 @@ function xt(e, t, n) {
|
|
|
1593
1603
|
}, n);
|
|
1594
1604
|
}
|
|
1595
1605
|
if (e.kind === "note") {
|
|
1596
|
-
let t =
|
|
1606
|
+
let t = xt(r, e.x), s = xt(i, e.y);
|
|
1597
1607
|
if (t == null || s == null) return null;
|
|
1598
|
-
let c = e.color ??
|
|
1608
|
+
let c = e.color ?? bt, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), f = Math.max(8, Math.min(o - 2, s + u));
|
|
1599
1609
|
return /* @__PURE__ */ m("g", {
|
|
1600
1610
|
"data-annotation": "note",
|
|
1601
1611
|
children: [
|
|
@@ -1631,7 +1641,7 @@ function xt(e, t, n) {
|
|
|
1631
1641
|
if (e.kind === "threshold") {
|
|
1632
1642
|
let t = i.map(e.value);
|
|
1633
1643
|
if (t == null || Number.isNaN(t)) return null;
|
|
1634
|
-
let r = e.color ??
|
|
1644
|
+
let r = e.color ?? bt, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
|
|
1635
1645
|
return /* @__PURE__ */ p("g", {
|
|
1636
1646
|
"data-annotation": "threshold",
|
|
1637
1647
|
"aria-hidden": "true",
|
|
@@ -1646,9 +1656,9 @@ function xt(e, t, n) {
|
|
|
1646
1656
|
})
|
|
1647
1657
|
}, n);
|
|
1648
1658
|
}
|
|
1649
|
-
let s =
|
|
1659
|
+
let s = xt(r, e.x), c = xt(i, e.y);
|
|
1650
1660
|
if (s == null || c == null) return null;
|
|
1651
|
-
let l = e.color ??
|
|
1661
|
+
let l = e.color ?? bt;
|
|
1652
1662
|
return /* @__PURE__ */ m("g", {
|
|
1653
1663
|
"data-annotation": "dot",
|
|
1654
1664
|
"aria-hidden": "true",
|
|
@@ -1670,28 +1680,28 @@ function xt(e, t, n) {
|
|
|
1670
1680
|
})]
|
|
1671
1681
|
}, n);
|
|
1672
1682
|
}
|
|
1673
|
-
function
|
|
1683
|
+
function Ct(e, t) {
|
|
1674
1684
|
return !e || e.length === 0 ? null : /* @__PURE__ */ p("g", {
|
|
1675
1685
|
"data-annotations": "",
|
|
1676
|
-
children: e.map((e, n) =>
|
|
1686
|
+
children: e.map((e, n) => St(e, t, n))
|
|
1677
1687
|
});
|
|
1678
1688
|
}
|
|
1679
|
-
function
|
|
1689
|
+
function wt(e) {
|
|
1680
1690
|
return e.kind === "line" ? e.label ?? `${e.axis}=${String(e.value)}` : e.kind === "area" ? e.label ?? `${e.axis} ${String(e.from)}–${String(e.to)}` : e.kind === "threshold" ? e.label ?? `${e.side} ${e.value}` : e.kind === "note" ? e.label : e.label ?? `(${String(e.x)}, ${e.y})`;
|
|
1681
1691
|
}
|
|
1682
1692
|
//#endregion
|
|
1683
1693
|
//#region src/chrome/data-label.tsx
|
|
1684
|
-
var
|
|
1685
|
-
function
|
|
1694
|
+
var Tt = (e) => e.toLocaleString();
|
|
1695
|
+
function Et(e) {
|
|
1686
1696
|
return e ? e === !0 ? {
|
|
1687
|
-
format:
|
|
1697
|
+
format: Tt,
|
|
1688
1698
|
position: "auto"
|
|
1689
1699
|
} : {
|
|
1690
|
-
format: e.format ??
|
|
1700
|
+
format: e.format ?? Tt,
|
|
1691
1701
|
position: e.position ?? "auto"
|
|
1692
1702
|
} : null;
|
|
1693
1703
|
}
|
|
1694
|
-
function
|
|
1704
|
+
function Dt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
|
|
1695
1705
|
return /* @__PURE__ */ p("text", {
|
|
1696
1706
|
x: e,
|
|
1697
1707
|
y: t,
|
|
@@ -1707,21 +1717,21 @@ function Et({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
|
|
|
1707
1717
|
}
|
|
1708
1718
|
//#endregion
|
|
1709
1719
|
//#region src/chrome/defs.tsx
|
|
1710
|
-
function
|
|
1720
|
+
function Ot(e) {
|
|
1711
1721
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1712
1722
|
}
|
|
1713
|
-
function Ot(e, t) {
|
|
1714
|
-
return `${Dt(e)}-grad-${Dt(t)}`;
|
|
1715
|
-
}
|
|
1716
1723
|
function kt(e, t) {
|
|
1717
|
-
return `${
|
|
1724
|
+
return `${Ot(e)}-grad-${Ot(t)}`;
|
|
1718
1725
|
}
|
|
1719
|
-
function At(e, t
|
|
1720
|
-
return
|
|
1726
|
+
function At(e, t) {
|
|
1727
|
+
return `${Ot(e)}-pat-${Ot(t)}`;
|
|
1721
1728
|
}
|
|
1722
|
-
function jt(
|
|
1729
|
+
function jt(e, t, n, r) {
|
|
1730
|
+
return n === "gradient" ? `url(#${kt(e, t)})` : n === "pattern" ? `url(#${At(e, t)})` : r;
|
|
1731
|
+
}
|
|
1732
|
+
function Mt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
1723
1733
|
return n === "solid" ? null : /* @__PURE__ */ p("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ m("linearGradient", {
|
|
1724
|
-
id:
|
|
1734
|
+
id: kt(e, t.id),
|
|
1725
1735
|
x1: "0",
|
|
1726
1736
|
y1: "0",
|
|
1727
1737
|
x2: "0",
|
|
@@ -1736,7 +1746,7 @@ function jt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1736
1746
|
stopOpacity: .1
|
|
1737
1747
|
})]
|
|
1738
1748
|
}, t.id) : /* @__PURE__ */ m("pattern", {
|
|
1739
|
-
id:
|
|
1749
|
+
id: At(e, t.id),
|
|
1740
1750
|
patternUnits: "userSpaceOnUse",
|
|
1741
1751
|
width: 6,
|
|
1742
1752
|
height: 6,
|
|
@@ -1782,7 +1792,7 @@ function jt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1782
1792
|
}
|
|
1783
1793
|
//#endregion
|
|
1784
1794
|
//#region src/chrome/glyph.tsx
|
|
1785
|
-
function
|
|
1795
|
+
function Nt(e, t) {
|
|
1786
1796
|
let n = t / 2;
|
|
1787
1797
|
switch (e) {
|
|
1788
1798
|
case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
|
|
@@ -1803,7 +1813,7 @@ function Mt(e, t) {
|
|
|
1803
1813
|
default: return "";
|
|
1804
1814
|
}
|
|
1805
1815
|
}
|
|
1806
|
-
function
|
|
1816
|
+
function Pt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
|
|
1807
1817
|
let c = {
|
|
1808
1818
|
fill: i,
|
|
1809
1819
|
fillOpacity: a,
|
|
@@ -1818,33 +1828,33 @@ function Nt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
|
|
|
1818
1828
|
r: r / 2,
|
|
1819
1829
|
...c
|
|
1820
1830
|
}) : /* @__PURE__ */ p("path", {
|
|
1821
|
-
d:
|
|
1831
|
+
d: Nt(e, r),
|
|
1822
1832
|
transform: `translate(${t},${n})`,
|
|
1823
1833
|
...c
|
|
1824
1834
|
});
|
|
1825
1835
|
}
|
|
1826
1836
|
//#endregion
|
|
1827
1837
|
//#region src/chrome/text.tsx
|
|
1828
|
-
var
|
|
1829
|
-
function
|
|
1830
|
-
if (
|
|
1831
|
-
|
|
1832
|
-
let n =
|
|
1838
|
+
var Ft;
|
|
1839
|
+
function It(e, t) {
|
|
1840
|
+
if (Ft === void 0 && (Ft = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Ft) {
|
|
1841
|
+
Ft.font = `${t}px sans-serif`;
|
|
1842
|
+
let n = Ft.measureText(e).width;
|
|
1833
1843
|
if (n > 0) return n;
|
|
1834
1844
|
}
|
|
1835
1845
|
return e.length * t * .55;
|
|
1836
1846
|
}
|
|
1837
|
-
function
|
|
1847
|
+
function Lt(e, t, n) {
|
|
1838
1848
|
if (!t || t <= 0) return [e];
|
|
1839
1849
|
let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
|
|
1840
1850
|
for (let e of r) {
|
|
1841
1851
|
let r = a ? `${a} ${e}` : e;
|
|
1842
|
-
a &&
|
|
1852
|
+
a && It(r, n) > t ? (i.push(a), a = e) : a = r;
|
|
1843
1853
|
}
|
|
1844
1854
|
return a && i.push(a), i.length ? i : [e];
|
|
1845
1855
|
}
|
|
1846
|
-
function
|
|
1847
|
-
let l = r ?
|
|
1856
|
+
function Rt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
|
|
1857
|
+
let l = r ? Lt(n, r, i) : [n];
|
|
1848
1858
|
return /* @__PURE__ */ p("text", {
|
|
1849
1859
|
x: e,
|
|
1850
1860
|
y: t,
|
|
@@ -1861,7 +1871,7 @@ function Lt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
|
|
|
1861
1871
|
}
|
|
1862
1872
|
//#endregion
|
|
1863
1873
|
//#region src/chrome/brush.tsx
|
|
1864
|
-
function
|
|
1874
|
+
function zt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1865
1875
|
o();
|
|
1866
1876
|
let i = Math.max(1, e - 1), a = (e) => e / i * 100, [s, c] = n.value, l = t - 8, u = (t, r) => {
|
|
1867
1877
|
let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
|
|
@@ -1932,7 +1942,7 @@ function Rt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
1932
1942
|
}
|
|
1933
1943
|
//#endregion
|
|
1934
1944
|
//#region src/chrome/data-zoom.tsx
|
|
1935
|
-
function
|
|
1945
|
+
function Bt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1936
1946
|
o();
|
|
1937
1947
|
let a = Math.max(1, e - 1), s = (e) => e / a * 100, [c, l] = n.value, u = t - 8, d = i(0), f = (e, t) => {
|
|
1938
1948
|
let n = t.getBoundingClientRect();
|
|
@@ -2027,27 +2037,27 @@ function zt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
2027
2037
|
}
|
|
2028
2038
|
//#endregion
|
|
2029
2039
|
//#region src/chrome/visual-map.tsx
|
|
2030
|
-
var
|
|
2031
|
-
function Gt(e, t) {
|
|
2032
|
-
let n = t.pieces ?? Bt;
|
|
2033
|
-
return Math.min(n - 1, Math.max(0, Math.floor(Wt(e, t) * n)));
|
|
2034
|
-
}
|
|
2040
|
+
var Vt = 5, Ht = [3, 14], Ut = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Wt = (e, t, n) => e + (t - e) * n, Gt = (e, t) => Ut((e - t.min) / (t.max - t.min || 1));
|
|
2035
2041
|
function Kt(e, t) {
|
|
2036
|
-
let n = t.
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2042
|
+
let n = t.pieces ?? Vt;
|
|
2043
|
+
return Math.min(n - 1, Math.max(0, Math.floor(Gt(e, t) * n)));
|
|
2044
|
+
}
|
|
2045
|
+
function qt(e, t) {
|
|
2046
|
+
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Gt(e, t), a = {};
|
|
2047
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? ye(t.pieces ?? Vt, r)[Kt(e, t)] : ve(r)(i)), n === "size" || n === "both") {
|
|
2048
|
+
let [e, n] = t.sizeRange ?? Ht;
|
|
2049
|
+
a.size = Wt(e, n, i);
|
|
2040
2050
|
}
|
|
2041
2051
|
return a;
|
|
2042
2052
|
}
|
|
2043
|
-
function
|
|
2044
|
-
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(
|
|
2053
|
+
function Jt(e, t, n, r) {
|
|
2054
|
+
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Kt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
|
|
2045
2055
|
}
|
|
2046
|
-
function
|
|
2056
|
+
function Yt({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
|
|
2047
2057
|
o();
|
|
2048
2058
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2049
2059
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2050
|
-
let t = e.pieces ??
|
|
2060
|
+
let t = e.pieces ?? Vt, i = ye(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2051
2061
|
if (!n) return;
|
|
2052
2062
|
let t = new Set(n.value);
|
|
2053
2063
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2095,9 +2105,9 @@ function Jt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2095
2105
|
})
|
|
2096
2106
|
});
|
|
2097
2107
|
}
|
|
2098
|
-
let { min: s, max: c } = e, l = c - s || 1, u =
|
|
2108
|
+
let { min: s, max: c } = e, l = c - s || 1, u = ye(8, e.ramp ?? "sequential"), d = (e) => (e - s) / l * 100, h = t?.value[0] ?? s, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2099
2109
|
let n = t.getBoundingClientRect();
|
|
2100
|
-
return n.width === 0 ? s : s +
|
|
2110
|
+
return n.width === 0 ? s : s + Ut((e - n.left) / n.width) * l;
|
|
2101
2111
|
}, y = (e, n) => {
|
|
2102
2112
|
if (!t) return;
|
|
2103
2113
|
let r = Math.max(s, Math.min(c, n)), [i, a] = t.value;
|
|
@@ -2182,23 +2192,23 @@ function Jt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2182
2192
|
]
|
|
2183
2193
|
});
|
|
2184
2194
|
}
|
|
2185
|
-
var
|
|
2195
|
+
var Xt = {
|
|
2186
2196
|
legend: "_legend_zczeh_2",
|
|
2187
2197
|
item: "_item_zczeh_9",
|
|
2188
2198
|
swatch: "_swatch_zczeh_27"
|
|
2189
2199
|
};
|
|
2190
2200
|
//#endregion
|
|
2191
2201
|
//#region src/chrome/legend.tsx
|
|
2192
|
-
function
|
|
2202
|
+
function Zt({ series: e, hidden: t }) {
|
|
2193
2203
|
return o(), /* @__PURE__ */ p("div", {
|
|
2194
|
-
className:
|
|
2204
|
+
className: Xt.legend,
|
|
2195
2205
|
role: "group",
|
|
2196
2206
|
"aria-label": "Chart legend",
|
|
2197
2207
|
children: e.map((e, n) => {
|
|
2198
2208
|
let r = t.value.has(e.id);
|
|
2199
2209
|
return /* @__PURE__ */ m("button", {
|
|
2200
2210
|
type: "button",
|
|
2201
|
-
className:
|
|
2211
|
+
className: Xt.item,
|
|
2202
2212
|
"data-state": r ? "off" : "on",
|
|
2203
2213
|
"aria-pressed": !r,
|
|
2204
2214
|
"aria-label": d(l.charts.legendToggle, { name: e.label }),
|
|
@@ -2207,7 +2217,7 @@ function Xt({ series: e, hidden: t }) {
|
|
|
2207
2217
|
r ? n.delete(e.id) : n.add(e.id), t.value = n;
|
|
2208
2218
|
},
|
|
2209
2219
|
children: [/* @__PURE__ */ p("span", {
|
|
2210
|
-
className:
|
|
2220
|
+
className: Xt.swatch,
|
|
2211
2221
|
style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
|
|
2212
2222
|
"aria-hidden": "true"
|
|
2213
2223
|
}), e.label]
|
|
@@ -2217,33 +2227,43 @@ function Xt({ series: e, hidden: t }) {
|
|
|
2217
2227
|
}
|
|
2218
2228
|
//#endregion
|
|
2219
2229
|
//#region src/core/dev-warn.ts
|
|
2220
|
-
function
|
|
2230
|
+
function Qt() {
|
|
2221
2231
|
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
2222
2232
|
}
|
|
2223
|
-
var
|
|
2224
|
-
function
|
|
2225
|
-
if (
|
|
2233
|
+
var $t = /* @__PURE__ */ new Set();
|
|
2234
|
+
function en(e, t) {
|
|
2235
|
+
if (Qt() || $t.has(e)) return;
|
|
2226
2236
|
let n = 0;
|
|
2227
2237
|
for (let e of t()) Number.isFinite(e) || n++;
|
|
2228
|
-
n !== 0 && (
|
|
2238
|
+
n !== 0 && ($t.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
|
|
2239
|
+
}
|
|
2240
|
+
function tn(e, t) {
|
|
2241
|
+
Qt() || $t.has(e) || ($t.add(e), console.warn(`[cascivo charts] ${t}`));
|
|
2242
|
+
}
|
|
2243
|
+
function nn(e, t) {
|
|
2244
|
+
if (Qt()) return;
|
|
2245
|
+
let n = t.filter((e) => Number.isFinite(e.max) && e.max > 0);
|
|
2246
|
+
if (n.length < 2) return;
|
|
2247
|
+
let r = [...n].sort((e, t) => t.max - e.max), i = r[0], a = r[r.length - 1];
|
|
2248
|
+
i.max / a.max < 20 || tn(`${e}:scale-mismatch`, `${e}: "${a.label}" (max ${a.max.toLocaleString()}) is more than 20× smaller than "${i.label}" (max ${i.max.toLocaleString()}) on the same axis, so it renders as a flat line at the baseline while the legend still names both. Put the smaller series on its own scale with \`axis: 'right'\` + \`secondAxis\`, or split it into a second chart.`);
|
|
2229
2249
|
}
|
|
2230
2250
|
//#endregion
|
|
2231
2251
|
//#region src/charts/line-chart/line-chart.tsx
|
|
2232
|
-
var
|
|
2233
|
-
function
|
|
2252
|
+
var rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2253
|
+
function an(e) {
|
|
2234
2254
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2235
2255
|
}
|
|
2236
|
-
function
|
|
2256
|
+
function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: d, xTicks: g = 5, yTicks: _ = 5, legend: v, tooltip: y, formatTooltip: b, className: x, plain: S, annotations: w, labels: D, connectNulls: O, onSelect: k, brush: A, dataZoom: j, zoom: M, syncId: N, tooltipMode: ee, secondAxis: P, decimate: F, toolbox: I, transition: L, onBeforeDraw: te, onAfterDraw: ne }) {
|
|
2237
2257
|
o();
|
|
2238
|
-
let re = i(/* @__PURE__ */ new Set()), R = S ? null :
|
|
2258
|
+
let re = i(/* @__PURE__ */ new Set()), R = S ? null : Et(D), z = F === !0 ? {
|
|
2239
2259
|
method: "lttb",
|
|
2240
2260
|
threshold: 1e3
|
|
2241
|
-
} :
|
|
2242
|
-
method:
|
|
2243
|
-
threshold:
|
|
2261
|
+
} : F ? {
|
|
2262
|
+
method: F.method ?? "lttb",
|
|
2263
|
+
threshold: F.threshold ?? 1e3
|
|
2244
2264
|
} : null, B = e.reduce((e, t) => Math.max(e, t.data.length), 0), V = (A || j || M || N !== void 0) && B > 0, H = i([0, Math.max(0, B - 1)]), U = c(null);
|
|
2245
|
-
N && !U.current && (U.current =
|
|
2246
|
-
N &&
|
|
2265
|
+
N && !U.current && (U.current = ft(N)), a(() => () => {
|
|
2266
|
+
N && pt(N);
|
|
2247
2267
|
}), a(() => {
|
|
2248
2268
|
let e = U.current;
|
|
2249
2269
|
if (!e) return;
|
|
@@ -2258,15 +2278,17 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2258
2278
|
let W = V ? e.map((e) => ({
|
|
2259
2279
|
...e,
|
|
2260
2280
|
data: e.data.slice(H.value[0], H.value[1] + 1)
|
|
2261
|
-
})) : e, G = !S && W.some((e) => e.axis === "right"),
|
|
2262
|
-
|
|
2263
|
-
let
|
|
2264
|
-
...
|
|
2265
|
-
left: Ge(
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2281
|
+
})) : e, G = !S && W.some((e) => e.axis === "right"), K = d ?? (S ? 48 : 300), ie = S ? !1 : v ?? W.length > 1, q = (e) => e.y ?? n, J = W.flatMap((e) => e.data.map((e) => t(e))), Y = (e) => e.flatMap((e) => e.data.map((t) => q(e)(t))).filter((e) => Number.isFinite(e)), ae = Y(G ? W.filter((e) => e.axis !== "right") : W), oe = G ? Y(W.filter((e) => e.axis === "right")) : [];
|
|
2282
|
+
en("LineChart", () => W.flatMap((e) => e.data.map((t) => q(e)(t))));
|
|
2283
|
+
let se = J.length > 0, ce = h(an(ae), [0, 1]).ticks(_).map((e) => e.toLocaleString()), le = se && J[0] instanceof Date, ue = G ? h(an(oe), [0, 1]).ticks(_).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], de = J.filter((e) => typeof e == "number"), fe = J.filter((e) => e instanceof Date), pe = se ? le ? C([new Date(Math.min(...fe.map((e) => e.getTime()))), new Date(Math.max(...fe.map((e) => e.getTime())))], [0, 1]).ticks(g).map((e) => e.toLocaleDateString()) : h([Math.min(...de), Math.max(...de)], [0, 1]).ticks(g).map((e) => e.toLocaleString()) : [], X = S ? Ue : {
|
|
2284
|
+
...He,
|
|
2285
|
+
left: Ge(ce, S),
|
|
2286
|
+
right: Ke({
|
|
2287
|
+
rightAxisLabels: ue,
|
|
2288
|
+
bottomAxisLabels: pe,
|
|
2289
|
+
plain: S
|
|
2290
|
+
})
|
|
2291
|
+
};
|
|
2270
2292
|
return /* @__PURE__ */ m("div", {
|
|
2271
2293
|
style: {
|
|
2272
2294
|
display: "flex",
|
|
@@ -2278,19 +2300,19 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2278
2300
|
title: r,
|
|
2279
2301
|
description: s,
|
|
2280
2302
|
width: u,
|
|
2281
|
-
height:
|
|
2303
|
+
height: K,
|
|
2282
2304
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2283
2305
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2284
2306
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), W.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2285
|
-
/* @__PURE__ */ p("tbody", { children: (W[0]?.data ?? []).map((e, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(W[0] ? t(W[0].data[n]) : "") }), W.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" :
|
|
2307
|
+
/* @__PURE__ */ p("tbody", { children: (W[0]?.data ?? []).map((e, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(W[0] ? t(W[0].data[n]) : "") }), W.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : q(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2286
2308
|
] }),
|
|
2287
2309
|
className: x,
|
|
2288
|
-
"data-state":
|
|
2310
|
+
"data-state": se ? void 0 : "empty",
|
|
2289
2311
|
plain: S,
|
|
2290
|
-
tooltip: y !== !1 &&
|
|
2291
|
-
if (y === !1 || !
|
|
2292
|
-
let r = e -
|
|
2293
|
-
if (
|
|
2312
|
+
tooltip: y !== !1 && se ? ({ width: e, height: n }) => {
|
|
2313
|
+
if (y === !1 || !se) return;
|
|
2314
|
+
let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(ae), [i, 0]), l = G ? h(an(oe), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2315
|
+
if (ee === "axis") {
|
|
2294
2316
|
let e = W.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2295
2317
|
for (let r = 0; r < e; r++) {
|
|
2296
2318
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
@@ -2298,18 +2320,18 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2298
2320
|
if (re.value.has(n.id)) return;
|
|
2299
2321
|
let l = n.data[r];
|
|
2300
2322
|
if (l === void 0) return;
|
|
2301
|
-
let f =
|
|
2323
|
+
let f = q(n)(l);
|
|
2302
2324
|
if (!Number.isFinite(f)) return;
|
|
2303
2325
|
let p = t(l);
|
|
2304
2326
|
i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
|
|
2305
2327
|
label: n.label,
|
|
2306
2328
|
value: f,
|
|
2307
|
-
color: n.color ??
|
|
2329
|
+
color: n.color ?? rn[c % rn.length]
|
|
2308
2330
|
});
|
|
2309
2331
|
}), a !== 0 && n.push({
|
|
2310
2332
|
id: `x-${r}`,
|
|
2311
|
-
cx:
|
|
2312
|
-
cy:
|
|
2333
|
+
cx: X.left + i / a,
|
|
2334
|
+
cy: X.top + (o === Infinity ? 0 : o),
|
|
2313
2335
|
label: s,
|
|
2314
2336
|
value: s,
|
|
2315
2337
|
segments: e
|
|
@@ -2322,15 +2344,15 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2322
2344
|
};
|
|
2323
2345
|
}
|
|
2324
2346
|
let f = W.flatMap((e) => re.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2325
|
-
let i =
|
|
2347
|
+
let i = q(e)(n);
|
|
2326
2348
|
if (!Number.isFinite(i)) return [];
|
|
2327
2349
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2328
2350
|
return {
|
|
2329
2351
|
id: `${e.id}-${r}`,
|
|
2330
|
-
cx:
|
|
2331
|
-
cy:
|
|
2352
|
+
cx: X.left + o,
|
|
2353
|
+
cy: X.top + c,
|
|
2332
2354
|
label: l,
|
|
2333
|
-
value:
|
|
2355
|
+
value: q(e)(n),
|
|
2334
2356
|
seriesId: e.id
|
|
2335
2357
|
};
|
|
2336
2358
|
}));
|
|
@@ -2347,25 +2369,25 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2347
2369
|
window: H,
|
|
2348
2370
|
count: B
|
|
2349
2371
|
} : void 0,
|
|
2350
|
-
toolbox:
|
|
2372
|
+
toolbox: I,
|
|
2351
2373
|
onRestore: V ? () => {
|
|
2352
2374
|
H.value = [0, Math.max(0, B - 1)];
|
|
2353
2375
|
} : void 0,
|
|
2354
|
-
transition:
|
|
2376
|
+
transition: L,
|
|
2355
2377
|
onBeforeDraw: te,
|
|
2356
2378
|
onAfterDraw: ne,
|
|
2357
2379
|
children: ({ width: e, height: n }) => {
|
|
2358
|
-
let r = e -
|
|
2380
|
+
let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(ae), [i, 0]), u = G ? h(an(oe), [i, 0]) : c;
|
|
2359
2381
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
2360
|
-
transform: `translate(${
|
|
2382
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2361
2383
|
children: [
|
|
2362
|
-
!S && /* @__PURE__ */ p(
|
|
2384
|
+
!S && /* @__PURE__ */ p(vt, {
|
|
2363
2385
|
scale: c,
|
|
2364
2386
|
orientation: "y",
|
|
2365
2387
|
length: r,
|
|
2366
2388
|
tickCount: _
|
|
2367
2389
|
}),
|
|
2368
|
-
!S &&
|
|
2390
|
+
!S && Ct(w, {
|
|
2369
2391
|
xScale: s,
|
|
2370
2392
|
yScale: c,
|
|
2371
2393
|
innerW: r,
|
|
@@ -2373,15 +2395,15 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2373
2395
|
}),
|
|
2374
2396
|
W.map((e, n) => {
|
|
2375
2397
|
if (re.value.has(e.id)) return null;
|
|
2376
|
-
let r = e.color ??
|
|
2398
|
+
let r = e.color ?? rn[n % rn.length], i = e.axis === "right" ? u : c, a = (e) => s.map(e);
|
|
2377
2399
|
if (z && e.data.length > z.threshold) {
|
|
2378
2400
|
let n = [];
|
|
2379
2401
|
for (let r of e.data) {
|
|
2380
|
-
let o =
|
|
2402
|
+
let o = q(e)(r);
|
|
2381
2403
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2382
2404
|
}
|
|
2383
2405
|
return /* @__PURE__ */ p("path", {
|
|
2384
|
-
d: E(
|
|
2406
|
+
d: E(Le(n, z.threshold, z.method).map((e) => [e[0], e[1]]), l),
|
|
2385
2407
|
fill: "none",
|
|
2386
2408
|
stroke: r,
|
|
2387
2409
|
strokeWidth: 2,
|
|
@@ -2391,7 +2413,7 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2391
2413
|
}, e.id);
|
|
2392
2414
|
}
|
|
2393
2415
|
let o = e.data.map((n) => {
|
|
2394
|
-
let r =
|
|
2416
|
+
let r = q(e)(n);
|
|
2395
2417
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2396
2418
|
});
|
|
2397
2419
|
return /* @__PURE__ */ m("g", { children: [T(o, O).map((t, n) => /* @__PURE__ */ p("path", {
|
|
@@ -2404,10 +2426,10 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2404
2426
|
"data-series": e.id
|
|
2405
2427
|
}, n)), R && e.data.map((t, n) => {
|
|
2406
2428
|
let r = o[n];
|
|
2407
|
-
return r ? /* @__PURE__ */ p(
|
|
2429
|
+
return r ? /* @__PURE__ */ p(Dt, {
|
|
2408
2430
|
x: r[0],
|
|
2409
2431
|
y: r[1] - 8,
|
|
2410
|
-
text: R.format(
|
|
2432
|
+
text: R.format(q(e)(t))
|
|
2411
2433
|
}, n) : null;
|
|
2412
2434
|
})] }, e.id);
|
|
2413
2435
|
}),
|
|
@@ -2427,32 +2449,32 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2427
2449
|
}),
|
|
2428
2450
|
G && /* @__PURE__ */ p($, {
|
|
2429
2451
|
scale: u,
|
|
2430
|
-
orientation: "y",
|
|
2452
|
+
orientation: "y-right",
|
|
2431
2453
|
length: i,
|
|
2432
2454
|
tickCount: _,
|
|
2433
2455
|
transform: `translate(${r},0)`,
|
|
2434
|
-
...
|
|
2456
|
+
...P?.format ? { format: (e) => P.format(Number(e)) } : {}
|
|
2435
2457
|
})
|
|
2436
2458
|
] })
|
|
2437
2459
|
]
|
|
2438
2460
|
}) });
|
|
2439
2461
|
}
|
|
2440
2462
|
}),
|
|
2441
|
-
A && !j && B > 1 && /* @__PURE__ */ p(
|
|
2463
|
+
A && !j && B > 1 && /* @__PURE__ */ p(zt, {
|
|
2442
2464
|
count: B,
|
|
2443
2465
|
window: H,
|
|
2444
2466
|
label: "Time range"
|
|
2445
2467
|
}),
|
|
2446
|
-
j && B > 1 && /* @__PURE__ */ p(
|
|
2468
|
+
j && B > 1 && /* @__PURE__ */ p(Bt, {
|
|
2447
2469
|
count: B,
|
|
2448
2470
|
window: H,
|
|
2449
2471
|
label: "Time range"
|
|
2450
2472
|
}),
|
|
2451
|
-
|
|
2473
|
+
ie && /* @__PURE__ */ p(Zt, {
|
|
2452
2474
|
series: W.map((e, t) => ({
|
|
2453
2475
|
id: e.id,
|
|
2454
2476
|
label: e.label,
|
|
2455
|
-
color: e.color ??
|
|
2477
|
+
color: e.color ?? rn[t % rn.length]
|
|
2456
2478
|
})),
|
|
2457
2479
|
hidden: re
|
|
2458
2480
|
})
|
|
@@ -2461,18 +2483,22 @@ function nn({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2461
2483
|
}
|
|
2462
2484
|
//#endregion
|
|
2463
2485
|
//#region src/charts/area-chart/area-chart.tsx
|
|
2464
|
-
var
|
|
2465
|
-
function
|
|
2486
|
+
var sn = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" };
|
|
2487
|
+
function cn(e, t) {
|
|
2488
|
+
return t || e <= 1 ? sn : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
|
|
2489
|
+
}
|
|
2490
|
+
var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2491
|
+
function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: d = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: w, className: T, plain: D, annotations: O, labels: k, onSelect: A, brush: j, dataZoom: M, zoom: N, syncId: P, tooltipMode: I, secondAxis: L, decimate: te, toolbox: ne }) {
|
|
2466
2492
|
o();
|
|
2467
|
-
let re = s(), R = i(/* @__PURE__ */ new Set()), z = D ? null :
|
|
2493
|
+
let re = s(), R = i(/* @__PURE__ */ new Set()), z = D ? null : Et(k), B = te === !0 ? {
|
|
2468
2494
|
method: "lttb",
|
|
2469
2495
|
threshold: 1e3
|
|
2470
2496
|
} : te ? {
|
|
2471
2497
|
method: te.method ?? "lttb",
|
|
2472
2498
|
threshold: te.threshold ?? 1e3
|
|
2473
|
-
} : null, V = e.reduce((e, t) => Math.max(e, t.data.length), 0), H = (j || M || N ||
|
|
2474
|
-
|
|
2475
|
-
|
|
2499
|
+
} : null, V = e.reduce((e, t) => Math.max(e, t.data.length), 0), H = (j || M || N || P !== void 0) && V > 0, U = i([0, Math.max(0, V - 1)]), W = c(null);
|
|
2500
|
+
P && !W.current && (W.current = ft(P)), a(() => () => {
|
|
2501
|
+
P && pt(P);
|
|
2476
2502
|
}), a(() => {
|
|
2477
2503
|
let e = W.current;
|
|
2478
2504
|
if (!e) return;
|
|
@@ -2487,18 +2513,23 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2487
2513
|
let G = H ? e.map((e) => ({
|
|
2488
2514
|
...e,
|
|
2489
2515
|
data: e.data.slice(U.value[0], U.value[1] + 1)
|
|
2490
|
-
})) : e,
|
|
2491
|
-
|
|
2492
|
-
|
|
2516
|
+
})) : e, K = !D && !u && G.some((e) => e.axis === "right"), ie = y ?? (D ? 48 : 300), q = D ? !1 : S ?? G.length > 1, J = cn(G.length, u), Y = (e) => e.y ?? n, ae = (G[0]?.data ?? []).map((e) => t(e)), oe = (K ? G.filter((e) => e.axis !== "right") : G).flatMap((e) => e.data.map((t) => Y(e)(t))), se = K ? G.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Y(e)(t))) : [];
|
|
2517
|
+
!K && !u && G.length > 1 && nn("AreaChart", G.map((e) => ({
|
|
2518
|
+
label: e.label,
|
|
2519
|
+
max: Math.max(0, ...e.data.map((t) => Y(e)(t)).filter((e) => Number.isFinite(e)))
|
|
2520
|
+
}))), en("AreaChart", () => [...oe, ...se]);
|
|
2521
|
+
let ce = ae.length > 0, le = ce && ae[0] instanceof Date, ue = ae.map((e) => e instanceof Date ? e.getTime() : e), de = ce ? Math.min(...ue) : 0, fe = ce ? Math.max(...ue) : 1, pe = (e) => le ? C([new Date(de), new Date(fe)], [0, e]) : h([de, fe], [0, e]), X = (e, n) => e.map(t(n)), me = (e) => {
|
|
2493
2522
|
let n = t(e);
|
|
2494
2523
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2495
|
-
},
|
|
2496
|
-
...
|
|
2497
|
-
left: Ge(
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2524
|
+
}, he = u ? 0 : Math.min(0, ...oe), ge = Math.max(...u ? (G[0]?.data ?? []).map((e, t) => G.reduce((e, n) => e + Y(n)(n.data[t]), 0)) : oe), _e = K ? Math.min(0, ...se) : he, ve = K ? Math.max(...se) : ge, ye = h([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = K ? h([_e, ve], [0, 1]).ticks(x).map((e) => L?.format ? L.format(e) : e.toLocaleString()) : [], xe = le ? C([new Date(de), new Date(fe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : h([de, fe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Z = D ? Ue : {
|
|
2525
|
+
...He,
|
|
2526
|
+
left: Ge(ye, D),
|
|
2527
|
+
right: Ke({
|
|
2528
|
+
rightAxisLabels: be,
|
|
2529
|
+
bottomAxisLabels: xe,
|
|
2530
|
+
plain: D
|
|
2531
|
+
})
|
|
2532
|
+
};
|
|
2502
2533
|
return /* @__PURE__ */ m("div", {
|
|
2503
2534
|
style: {
|
|
2504
2535
|
display: "flex",
|
|
@@ -2510,36 +2541,36 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2510
2541
|
title: r,
|
|
2511
2542
|
description: l,
|
|
2512
2543
|
width: v,
|
|
2513
|
-
height:
|
|
2544
|
+
height: ie,
|
|
2514
2545
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2515
2546
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2516
2547
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), G.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2517
|
-
/* @__PURE__ */ p("tbody", { children: (G[0]?.data ?? []).map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: G[0] ?
|
|
2548
|
+
/* @__PURE__ */ p("tbody", { children: (G[0]?.data ?? []).map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: G[0] ? me(G[0].data[t]) : "" }), G.map((e) => /* @__PURE__ */ p("td", { children: e.data[t] == null ? "" : Y(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2518
2549
|
] }),
|
|
2519
2550
|
className: T,
|
|
2520
|
-
"data-state":
|
|
2551
|
+
"data-state": ce ? void 0 : "empty",
|
|
2521
2552
|
plain: D,
|
|
2522
|
-
tooltip: w !== !1 &&
|
|
2523
|
-
if (w === !1 || !
|
|
2524
|
-
let n = e -
|
|
2525
|
-
if (
|
|
2553
|
+
tooltip: w !== !1 && ce ? ({ width: e, height: t }) => {
|
|
2554
|
+
if (w === !1 || !ce) return;
|
|
2555
|
+
let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = K ? h([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2556
|
+
if (I === "axis") {
|
|
2526
2557
|
let e = G.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2527
2558
|
for (let n = 0; n < e; n++) {
|
|
2528
|
-
let e = [], r = Infinity, a = "", o =
|
|
2559
|
+
let e = [], r = Infinity, a = "", o = Z.left;
|
|
2529
2560
|
G.forEach((t, c) => {
|
|
2530
2561
|
if (R.value.has(t.id)) return;
|
|
2531
2562
|
let l = t.data[n];
|
|
2532
2563
|
if (l === void 0) return;
|
|
2533
|
-
let u =
|
|
2534
|
-
Number.isFinite(u) && (o =
|
|
2564
|
+
let u = Y(t)(l);
|
|
2565
|
+
Number.isFinite(u) && (o = Z.left + X(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
|
|
2535
2566
|
label: t.label,
|
|
2536
2567
|
value: u,
|
|
2537
|
-
color: t.color ??
|
|
2568
|
+
color: t.color ?? ln[c % ln.length]
|
|
2538
2569
|
}));
|
|
2539
2570
|
}), e.length !== 0 && t.push({
|
|
2540
2571
|
id: `x-${n}`,
|
|
2541
2572
|
cx: o,
|
|
2542
|
-
cy:
|
|
2573
|
+
cy: Z.top + (r === Infinity ? 0 : r),
|
|
2543
2574
|
label: a,
|
|
2544
2575
|
value: a,
|
|
2545
2576
|
segments: e
|
|
@@ -2553,10 +2584,10 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2553
2584
|
}
|
|
2554
2585
|
return { points: G.flatMap((e) => R.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2555
2586
|
id: `${e.id}-${n}`,
|
|
2556
|
-
cx:
|
|
2557
|
-
cy:
|
|
2558
|
-
label:
|
|
2559
|
-
value:
|
|
2587
|
+
cx: Z.left + X(i, t),
|
|
2588
|
+
cy: Z.top + s(e).map(Y(e)(t)),
|
|
2589
|
+
label: me(t),
|
|
2590
|
+
value: Y(e)(t),
|
|
2560
2591
|
seriesId: e.id
|
|
2561
2592
|
}))) };
|
|
2562
2593
|
} : void 0,
|
|
@@ -2570,25 +2601,25 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2570
2601
|
U.value = [0, Math.max(0, V - 1)];
|
|
2571
2602
|
} : void 0,
|
|
2572
2603
|
children: ({ width: e, height: t }) => {
|
|
2573
|
-
let n = e -
|
|
2574
|
-
return u && (s =
|
|
2604
|
+
let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = K ? h([_e, ve], [r, 0]) : a, s = [];
|
|
2605
|
+
return u && (s = F(G.map((e) => e.data.map((t) => Y(e)(t))))), /* @__PURE__ */ m("g", { children: [g !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2575
2606
|
prefix: re,
|
|
2576
2607
|
fill: g,
|
|
2577
2608
|
patternKind: _,
|
|
2578
2609
|
series: G.map((e, t) => ({
|
|
2579
2610
|
id: e.id,
|
|
2580
|
-
color: e.color ??
|
|
2611
|
+
color: e.color ?? ln[t % ln.length]
|
|
2581
2612
|
}))
|
|
2582
2613
|
}), /* @__PURE__ */ m("g", {
|
|
2583
|
-
transform: `translate(${
|
|
2614
|
+
transform: `translate(${Z.left},${Z.top})`,
|
|
2584
2615
|
children: [
|
|
2585
|
-
!D && /* @__PURE__ */ p(
|
|
2616
|
+
!D && /* @__PURE__ */ p(vt, {
|
|
2586
2617
|
scale: a,
|
|
2587
2618
|
orientation: "y",
|
|
2588
2619
|
length: n,
|
|
2589
2620
|
tickCount: x
|
|
2590
2621
|
}),
|
|
2591
|
-
!D &&
|
|
2622
|
+
!D && Ct(O, {
|
|
2592
2623
|
xScale: i,
|
|
2593
2624
|
yScale: a,
|
|
2594
2625
|
innerW: n,
|
|
@@ -2596,11 +2627,11 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2596
2627
|
}),
|
|
2597
2628
|
G.map((e, t) => {
|
|
2598
2629
|
if (R.value.has(e.id)) return null;
|
|
2599
|
-
let n = e.color ??
|
|
2630
|
+
let n = e.color ?? ln[t % ln.length], r, c;
|
|
2600
2631
|
if (u && s[t]) {
|
|
2601
2632
|
let o = s[t];
|
|
2602
|
-
r = e.data.map((e, t) => [
|
|
2603
|
-
let l = e.data.map((e, t) => [
|
|
2633
|
+
r = e.data.map((e, t) => [X(i, e), a.map(o[t][1])]);
|
|
2634
|
+
let l = e.data.map((e, t) => [X(i, e), a.map(o[t][0])]);
|
|
2604
2635
|
c = a.map(0);
|
|
2605
2636
|
let u = E(r, d), f = l[l.length - 1], h = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${f[0]},${f[1]}${_}L${h[0]},${h[1]}Z`;
|
|
2606
2637
|
return /* @__PURE__ */ m("g", {
|
|
@@ -2608,8 +2639,8 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2608
2639
|
children: [
|
|
2609
2640
|
/* @__PURE__ */ p("path", {
|
|
2610
2641
|
d: v,
|
|
2611
|
-
fill:
|
|
2612
|
-
style: g === "solid" ?
|
|
2642
|
+
fill: jt(re, e.id, g, n),
|
|
2643
|
+
style: g === "solid" ? J : void 0,
|
|
2613
2644
|
stroke: "none"
|
|
2614
2645
|
}),
|
|
2615
2646
|
/* @__PURE__ */ p("path", {
|
|
@@ -2618,23 +2649,23 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2618
2649
|
stroke: n,
|
|
2619
2650
|
strokeWidth: 2
|
|
2620
2651
|
}),
|
|
2621
|
-
z && r.map((t, n) => /* @__PURE__ */ p(
|
|
2652
|
+
z && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2622
2653
|
x: t[0],
|
|
2623
2654
|
y: t[1] - 8,
|
|
2624
|
-
text: z.format(
|
|
2655
|
+
text: z.format(Y(e)(e.data[n]))
|
|
2625
2656
|
}, n))
|
|
2626
2657
|
]
|
|
2627
2658
|
}, e.id);
|
|
2628
2659
|
} else {
|
|
2629
2660
|
let t = e.axis === "right" ? o : a;
|
|
2630
|
-
if (r = e.data.map((n) => [
|
|
2631
|
-
let t =
|
|
2661
|
+
if (r = e.data.map((n) => [X(i, n), t.map(Y(e)(n))]), c = t.map(0), B && r.length > B.threshold) {
|
|
2662
|
+
let t = Le(r, B.threshold, B.method).map((e) => [e[0], e[1]]);
|
|
2632
2663
|
return /* @__PURE__ */ m("g", {
|
|
2633
2664
|
"data-series": e.id,
|
|
2634
2665
|
children: [/* @__PURE__ */ p("path", {
|
|
2635
|
-
d:
|
|
2636
|
-
fill:
|
|
2637
|
-
style: g === "solid" ?
|
|
2666
|
+
d: ee(t, c, d),
|
|
2667
|
+
fill: jt(re, e.id, g, n),
|
|
2668
|
+
style: g === "solid" ? J : void 0,
|
|
2638
2669
|
stroke: "none"
|
|
2639
2670
|
}), /* @__PURE__ */ p("path", {
|
|
2640
2671
|
d: E(t, d),
|
|
@@ -2648,9 +2679,9 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2648
2679
|
"data-series": e.id,
|
|
2649
2680
|
children: [
|
|
2650
2681
|
/* @__PURE__ */ p("path", {
|
|
2651
|
-
d:
|
|
2652
|
-
fill:
|
|
2653
|
-
style: g === "solid" ?
|
|
2682
|
+
d: ee(r, c, d),
|
|
2683
|
+
fill: jt(re, e.id, g, n),
|
|
2684
|
+
style: g === "solid" ? J : void 0,
|
|
2654
2685
|
stroke: "none"
|
|
2655
2686
|
}),
|
|
2656
2687
|
/* @__PURE__ */ p("path", {
|
|
@@ -2659,10 +2690,10 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2659
2690
|
stroke: n,
|
|
2660
2691
|
strokeWidth: 2
|
|
2661
2692
|
}),
|
|
2662
|
-
z && r.map((t, n) => /* @__PURE__ */ p(
|
|
2693
|
+
z && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2663
2694
|
x: t[0],
|
|
2664
2695
|
y: t[1] - 8,
|
|
2665
|
-
text: z.format(
|
|
2696
|
+
text: z.format(Y(e)(e.data[n]))
|
|
2666
2697
|
}, n))
|
|
2667
2698
|
]
|
|
2668
2699
|
}, e.id);
|
|
@@ -2682,34 +2713,34 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2682
2713
|
length: r,
|
|
2683
2714
|
tickCount: x
|
|
2684
2715
|
}),
|
|
2685
|
-
|
|
2716
|
+
K && /* @__PURE__ */ p($, {
|
|
2686
2717
|
scale: o,
|
|
2687
|
-
orientation: "y",
|
|
2718
|
+
orientation: "y-right",
|
|
2688
2719
|
length: r,
|
|
2689
2720
|
tickCount: x,
|
|
2690
2721
|
transform: `translate(${n},0)`,
|
|
2691
|
-
...
|
|
2722
|
+
...L?.format ? { format: (e) => L.format(Number(e)) } : {}
|
|
2692
2723
|
})
|
|
2693
2724
|
] })
|
|
2694
2725
|
]
|
|
2695
2726
|
})] });
|
|
2696
2727
|
}
|
|
2697
2728
|
}),
|
|
2698
|
-
j && !M && V > 1 && /* @__PURE__ */ p(
|
|
2729
|
+
j && !M && V > 1 && /* @__PURE__ */ p(zt, {
|
|
2699
2730
|
count: V,
|
|
2700
2731
|
window: U,
|
|
2701
2732
|
label: "Range"
|
|
2702
2733
|
}),
|
|
2703
|
-
M && V > 1 && /* @__PURE__ */ p(
|
|
2734
|
+
M && V > 1 && /* @__PURE__ */ p(Bt, {
|
|
2704
2735
|
count: V,
|
|
2705
2736
|
window: U,
|
|
2706
2737
|
label: "Range"
|
|
2707
2738
|
}),
|
|
2708
|
-
|
|
2739
|
+
q && /* @__PURE__ */ p(Zt, {
|
|
2709
2740
|
series: G.map((e, t) => ({
|
|
2710
2741
|
id: e.id,
|
|
2711
2742
|
label: e.label,
|
|
2712
|
-
color: e.color ??
|
|
2743
|
+
color: e.color ?? ln[t % ln.length]
|
|
2713
2744
|
})),
|
|
2714
2745
|
hidden: R
|
|
2715
2746
|
})
|
|
@@ -2718,22 +2749,26 @@ function on({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2718
2749
|
}
|
|
2719
2750
|
//#endregion
|
|
2720
2751
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2721
|
-
var
|
|
2722
|
-
function
|
|
2752
|
+
var dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2753
|
+
function fn(e) {
|
|
2723
2754
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2724
2755
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2725
2756
|
}
|
|
2726
|
-
function
|
|
2757
|
+
function pn({ series: e, x: t, y: n, title: r, description: a, orientation: c = "vertical", mode: l = "grouped", width: u, height: d, xTicks: g = 5, yTicks: v = 5, xLabelEvery: y, legend: b, tooltip: x, tooltipFormat: S, className: C, plain: w, annotations: T, labels: E, onSelect: D, fill: O = "solid", patternKind: k }) {
|
|
2727
2758
|
o();
|
|
2728
|
-
let A = s(), j = w ? null :
|
|
2729
|
-
let t =
|
|
2759
|
+
let A = s(), j = w ? null : Et(E), M = i(/* @__PURE__ */ new Set()), N = d ?? (w ? 48 : 300), ee = w ? !1 : b ?? e.length > 1, P = (e) => e.y ?? n, I = (e[0]?.data ?? []).map((e) => t(e)), L = e.flatMap((e) => e.data.map((t) => P(e)(t))), te = I.length > 0, ne = l === "stacked" || l === "percent", re = I.map((t, n) => e.reduce((e, t) => e + P(t)(t.data[n]), 0)), R = () => {
|
|
2760
|
+
let t = F(e.map((e) => e.data.map((t) => P(e)(t))));
|
|
2730
2761
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2731
2762
|
let r = re[n] || 1;
|
|
2732
2763
|
return [e / r, t / r];
|
|
2733
2764
|
})) : t;
|
|
2734
|
-
}, z = ne ? 0 : Math.min(0, ...
|
|
2735
|
-
...
|
|
2736
|
-
left: Ge(
|
|
2765
|
+
}, z = ne ? 0 : Math.min(0, ...L), B = te ? Math.max(...re) : 1, V = l === "percent" ? 1 : l === "stacked" ? B : Math.max(1, ...L), H = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, U = c === "vertical", W = U ? h([z, V], [0, 1]).ticks(v).map((e) => H ? H(e) : e.toLocaleString()) : I.map((e) => String(e)), G = U ? I.map((e) => String(e)) : h([z, V], [0, 1]).ticks(g).map((e) => H ? H(e) : e.toLocaleString()), K = w ? Ue : {
|
|
2766
|
+
...He,
|
|
2767
|
+
left: Ge(W, w),
|
|
2768
|
+
right: Ke({
|
|
2769
|
+
bottomAxisLabels: G,
|
|
2770
|
+
plain: w
|
|
2771
|
+
})
|
|
2737
2772
|
};
|
|
2738
2773
|
return /* @__PURE__ */ m("div", {
|
|
2739
2774
|
style: {
|
|
@@ -2749,20 +2784,20 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2749
2784
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2750
2785
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2751
2786
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2752
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
2787
|
+
/* @__PURE__ */ p("tbody", { children: I.map((t, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: t }), e.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : P(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2753
2788
|
] }),
|
|
2754
2789
|
className: C,
|
|
2755
2790
|
"data-state": te ? void 0 : "empty",
|
|
2756
2791
|
plain: w,
|
|
2757
2792
|
tooltip: x && te ? ({ width: n, height: r }) => {
|
|
2758
2793
|
if (!x || !te) return;
|
|
2759
|
-
let i = n -
|
|
2794
|
+
let i = n - K.left - K.right, a = r - K.top - K.bottom, o = c === "vertical", s = _(I, o ? [0, i] : [0, a], .2), u = h([z, V], o ? [a, 0] : [0, i]), d = e.filter((e) => !M.value.has(e.id)), f = [];
|
|
2760
2795
|
ne && (f = R());
|
|
2761
|
-
let p = ne && !S, m =
|
|
2796
|
+
let p = ne && !S, m = I.map((t, n) => {
|
|
2762
2797
|
let r = d.map((t) => ({
|
|
2763
2798
|
label: t.label,
|
|
2764
|
-
value:
|
|
2765
|
-
color: t.color ??
|
|
2799
|
+
value: P(t)(t.data[n]),
|
|
2800
|
+
color: t.color ?? dn[e.indexOf(t) % dn.length]
|
|
2766
2801
|
}));
|
|
2767
2802
|
return {
|
|
2768
2803
|
segs: r,
|
|
@@ -2775,19 +2810,19 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2775
2810
|
if (ne && f[r]) {
|
|
2776
2811
|
let e = f[r][a];
|
|
2777
2812
|
h = e[1], g = e[0];
|
|
2778
|
-
} else h =
|
|
2813
|
+
} else h = P(n)(e), g = z;
|
|
2779
2814
|
let _ = d.indexOf(n), v = c + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
|
|
2780
2815
|
return {
|
|
2781
2816
|
id: `${n.id}-${a}`,
|
|
2782
|
-
cx:
|
|
2783
|
-
cy:
|
|
2817
|
+
cx: K.left + (o ? v : y),
|
|
2818
|
+
cy: K.top + (o ? y : v),
|
|
2784
2819
|
label: t(e),
|
|
2785
|
-
value: p ? m[a].total :
|
|
2820
|
+
value: p ? m[a].total : P(n)(e),
|
|
2786
2821
|
seriesId: n.id,
|
|
2787
2822
|
...p && { segments: m[a].segs }
|
|
2788
2823
|
};
|
|
2789
2824
|
});
|
|
2790
|
-
}), v = S ?? (p ?
|
|
2825
|
+
}), v = S ?? (p ? fn : void 0);
|
|
2791
2826
|
return v ? {
|
|
2792
2827
|
points: g,
|
|
2793
2828
|
format: v
|
|
@@ -2795,48 +2830,48 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2795
2830
|
} : void 0,
|
|
2796
2831
|
onSelect: D,
|
|
2797
2832
|
children: ({ width: n, height: r }) => {
|
|
2798
|
-
let i = n -
|
|
2799
|
-
return ne && (x = R()), /* @__PURE__ */ m("g", { children: [O !== "solid" && /* @__PURE__ */ p(
|
|
2833
|
+
let i = n - K.left - K.right, a = r - K.top - K.bottom, o = c === "vertical", s = y ?? qe(I, o ? i : a), u = _(I, o ? [0, i] : [0, a], .2), d = h([z, V], o ? [a, 0] : [0, i]), b = e.filter((e) => !M.value.has(e.id)), x = [];
|
|
2834
|
+
return ne && (x = R()), /* @__PURE__ */ m("g", { children: [O !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2800
2835
|
prefix: A,
|
|
2801
2836
|
fill: O,
|
|
2802
2837
|
patternKind: k,
|
|
2803
2838
|
series: e.map((e, t) => ({
|
|
2804
2839
|
id: e.id,
|
|
2805
|
-
color: e.color ??
|
|
2840
|
+
color: e.color ?? dn[t % dn.length]
|
|
2806
2841
|
}))
|
|
2807
2842
|
}), /* @__PURE__ */ m("g", {
|
|
2808
|
-
transform: `translate(${
|
|
2843
|
+
transform: `translate(${K.left},${K.top})`,
|
|
2809
2844
|
children: [
|
|
2810
|
-
!w && o && /* @__PURE__ */ p(
|
|
2845
|
+
!w && o && /* @__PURE__ */ p(vt, {
|
|
2811
2846
|
scale: d,
|
|
2812
2847
|
orientation: "y",
|
|
2813
2848
|
length: i,
|
|
2814
2849
|
tickCount: v
|
|
2815
2850
|
}),
|
|
2816
|
-
!w && !o && /* @__PURE__ */ p(
|
|
2851
|
+
!w && !o && /* @__PURE__ */ p(vt, {
|
|
2817
2852
|
scale: d,
|
|
2818
2853
|
orientation: "x",
|
|
2819
2854
|
length: a,
|
|
2820
2855
|
tickCount: g
|
|
2821
2856
|
}),
|
|
2822
|
-
!w &&
|
|
2857
|
+
!w && Ct(T, {
|
|
2823
2858
|
xScale: o ? u : d,
|
|
2824
2859
|
yScale: o ? d : u,
|
|
2825
2860
|
innerW: i,
|
|
2826
2861
|
innerH: a
|
|
2827
2862
|
}),
|
|
2828
2863
|
b.map((n, r) => {
|
|
2829
|
-
let i = n.color ??
|
|
2864
|
+
let i = n.color ?? dn[e.indexOf(n) % dn.length], a = e.indexOf(n), s = l === "grouped" ? u.bandwidth / b.length : u.bandwidth;
|
|
2830
2865
|
return n.data.map((e, c) => {
|
|
2831
2866
|
let f = u.map(t(e)) ?? 0, h, g;
|
|
2832
2867
|
if (ne && x[a]) {
|
|
2833
2868
|
let e = x[a][c];
|
|
2834
2869
|
h = e[1], g = e[0];
|
|
2835
|
-
} else h =
|
|
2870
|
+
} else h = P(n)(e), g = z;
|
|
2836
2871
|
let _ = f + (l === "grouped" ? r * s : 0), v = Math.min(d.map(h), d.map(g)), y = Math.abs(d.map(h) - d.map(g)), b = null;
|
|
2837
2872
|
if (j) {
|
|
2838
|
-
let t = j.format(
|
|
2839
|
-
if (o) b = /* @__PURE__ */ p(
|
|
2873
|
+
let t = j.format(P(n)(e)), r = _ + s / 2, i = ne || y < 18 || v < 14;
|
|
2874
|
+
if (o) b = /* @__PURE__ */ p(Dt, {
|
|
2840
2875
|
x: r,
|
|
2841
2876
|
y: i ? v + 13 : v - 4,
|
|
2842
2877
|
text: t,
|
|
@@ -2844,7 +2879,7 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2844
2879
|
});
|
|
2845
2880
|
else {
|
|
2846
2881
|
let e = v + y;
|
|
2847
|
-
b = /* @__PURE__ */ p(
|
|
2882
|
+
b = /* @__PURE__ */ p(Dt, {
|
|
2848
2883
|
x: i ? e - 4 : e + 4,
|
|
2849
2884
|
y: r + 4,
|
|
2850
2885
|
text: t,
|
|
@@ -2859,7 +2894,7 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2859
2894
|
y: v,
|
|
2860
2895
|
width: s,
|
|
2861
2896
|
height: y,
|
|
2862
|
-
fill:
|
|
2897
|
+
fill: jt(A, n.id, O, i),
|
|
2863
2898
|
rx: 2,
|
|
2864
2899
|
"data-series": n.id
|
|
2865
2900
|
}) : /* @__PURE__ */ p("rect", {
|
|
@@ -2867,7 +2902,7 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2867
2902
|
y: _,
|
|
2868
2903
|
width: y,
|
|
2869
2904
|
height: s,
|
|
2870
|
-
fill:
|
|
2905
|
+
fill: jt(A, n.id, O, i),
|
|
2871
2906
|
rx: 2,
|
|
2872
2907
|
"data-series": n.id
|
|
2873
2908
|
}), b] }, `${n.id}-${c}`);
|
|
@@ -2904,11 +2939,11 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2904
2939
|
]
|
|
2905
2940
|
})] });
|
|
2906
2941
|
}
|
|
2907
|
-
}),
|
|
2942
|
+
}), ee && /* @__PURE__ */ p(Zt, {
|
|
2908
2943
|
series: e.map((e, t) => ({
|
|
2909
2944
|
id: e.id,
|
|
2910
2945
|
label: e.label,
|
|
2911
|
-
color: e.color ??
|
|
2946
|
+
color: e.color ?? dn[t % dn.length]
|
|
2912
2947
|
})),
|
|
2913
2948
|
hidden: M
|
|
2914
2949
|
})]
|
|
@@ -2916,15 +2951,15 @@ function ln({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2916
2951
|
}
|
|
2917
2952
|
//#endregion
|
|
2918
2953
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2919
|
-
function
|
|
2954
|
+
function mn(e) {
|
|
2920
2955
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2921
2956
|
return `${e.value} (${t}%)`;
|
|
2922
2957
|
}
|
|
2923
|
-
var
|
|
2924
|
-
function
|
|
2925
|
-
let
|
|
2958
|
+
var hn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2959
|
+
function gn({ data: e, title: t, description: n, donut: r = !1, width: a, height: s, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: h, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
|
|
2960
|
+
let T = x ? null : Et(S), E = typeof S == "object" && !!S && S.format != null, D = a ?? c, O = s ?? c ?? (x ? 48 : 300), k = x ? !1 : y ?? !0;
|
|
2926
2961
|
o();
|
|
2927
|
-
let
|
|
2962
|
+
let A = i(/* @__PURE__ */ new Set()), j = e.length > 0;
|
|
2928
2963
|
return /* @__PURE__ */ m("div", {
|
|
2929
2964
|
style: {
|
|
2930
2965
|
display: "flex",
|
|
@@ -2934,8 +2969,8 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2934
2969
|
children: [/* @__PURE__ */ p(Q, {
|
|
2935
2970
|
title: t,
|
|
2936
2971
|
description: n,
|
|
2937
|
-
width:
|
|
2938
|
-
height:
|
|
2972
|
+
width: D,
|
|
2973
|
+
height: O,
|
|
2939
2974
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2940
2975
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
2941
2976
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -2952,13 +2987,13 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2952
2987
|
] }, t.id);
|
|
2953
2988
|
}) })
|
|
2954
2989
|
] }),
|
|
2955
|
-
className:
|
|
2956
|
-
"data-state":
|
|
2990
|
+
className: b,
|
|
2991
|
+
"data-state": j ? void 0 : "empty",
|
|
2957
2992
|
emptyLabel: g,
|
|
2958
|
-
plain:
|
|
2959
|
-
tooltip:
|
|
2960
|
-
if (!
|
|
2961
|
-
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !
|
|
2993
|
+
plain: x,
|
|
2994
|
+
tooltip: _ !== !1 && j ? ({ width: t, height: n }) => {
|
|
2995
|
+
if (!j) return;
|
|
2996
|
+
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !A.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
|
|
2962
2997
|
return {
|
|
2963
2998
|
points: o.map((e, t) => {
|
|
2964
2999
|
let n = s > 0 ? e.value / s * 2 * Math.PI : 0, o = c + n, l = (c + o) / 2;
|
|
@@ -2970,29 +3005,29 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2970
3005
|
value: e.value,
|
|
2971
3006
|
seriesId: String(t),
|
|
2972
3007
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
2973
|
-
color: e.color ??
|
|
3008
|
+
color: e.color ?? hn[t % hn.length]
|
|
2974
3009
|
};
|
|
2975
3010
|
}),
|
|
2976
|
-
format:
|
|
3011
|
+
format: v ?? mn
|
|
2977
3012
|
};
|
|
2978
3013
|
} : void 0,
|
|
2979
|
-
onSelect:
|
|
3014
|
+
onSelect: C,
|
|
2980
3015
|
children: ({ width: t, height: n }) => {
|
|
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) => !
|
|
3016
|
+
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) => !A.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || h != null);
|
|
2982
3017
|
return /* @__PURE__ */ m("g", { children: [g.map((e, t) => {
|
|
2983
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
3018
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? hn[t % hn.length], u = P(i, a, o, c, v, r);
|
|
2984
3019
|
v = r;
|
|
2985
|
-
let d = _ > 0 ? e.value / _ * 100 : 0, f =
|
|
3020
|
+
let d = _ > 0 ? e.value / _ * 100 : 0, f = T && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
2986
3021
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("path", {
|
|
2987
3022
|
d: u,
|
|
2988
3023
|
fill: l,
|
|
2989
3024
|
stroke: "var(--cascivo-color-surface)",
|
|
2990
3025
|
strokeWidth: 1,
|
|
2991
3026
|
"data-series": e.id
|
|
2992
|
-
}), f && /* @__PURE__ */ p(
|
|
3027
|
+
}), f && /* @__PURE__ */ p(Dt, {
|
|
2993
3028
|
x: w(i + Math.sin(s) * h),
|
|
2994
3029
|
y: w(a - Math.cos(s) * h + 4),
|
|
2995
|
-
text:
|
|
3030
|
+
text: E ? T.format(e.value) : `${Math.round(d)}%`,
|
|
2996
3031
|
tone: "muted"
|
|
2997
3032
|
})] }, e.id);
|
|
2998
3033
|
}), y && (h == null ? /* @__PURE__ */ m("g", {
|
|
@@ -3035,35 +3070,35 @@ function fn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3035
3070
|
})
|
|
3036
3071
|
}))] });
|
|
3037
3072
|
}
|
|
3038
|
-
}),
|
|
3073
|
+
}), k && /* @__PURE__ */ p(Zt, {
|
|
3039
3074
|
series: e.map((e, t) => ({
|
|
3040
3075
|
id: e.id,
|
|
3041
3076
|
label: e.label,
|
|
3042
|
-
color: e.color ??
|
|
3077
|
+
color: e.color ?? hn[t % hn.length]
|
|
3043
3078
|
})),
|
|
3044
|
-
hidden:
|
|
3079
|
+
hidden: A
|
|
3045
3080
|
})]
|
|
3046
3081
|
});
|
|
3047
3082
|
}
|
|
3048
3083
|
//#endregion
|
|
3049
3084
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3050
|
-
var
|
|
3051
|
-
function
|
|
3085
|
+
var _n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3086
|
+
function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: g, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C }) {
|
|
3052
3087
|
o();
|
|
3053
|
-
let w = i(/* @__PURE__ */ new Set()), T = _ ?
|
|
3088
|
+
let w = i(/* @__PURE__ */ new Set()), T = _ ? Ue : He, 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 }) => {
|
|
3054
3089
|
let a = n - T.left - T.right, o = i - T.top - T.bottom;
|
|
3055
3090
|
if (a <= 0 || o <= 0) return;
|
|
3056
|
-
let s = h([
|
|
3091
|
+
let s = h([F, I], [0, a]), c = h([L, te], [o, 0]);
|
|
3057
3092
|
e.forEach((e, n) => {
|
|
3058
3093
|
if (!w.value.has(e.id)) {
|
|
3059
|
-
t.fillStyle =
|
|
3094
|
+
t.fillStyle = $e(t, e.color ?? _n[n % _n.length]), t.globalAlpha = .7;
|
|
3060
3095
|
for (let n of e.data) {
|
|
3061
3096
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3062
3097
|
t.beginPath(), t.arc(T.left + s.map(n.x), T.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3063
3098
|
}
|
|
3064
3099
|
}
|
|
3065
3100
|
}), t.globalAlpha = 1;
|
|
3066
|
-
}, N = e.flatMap((e) => e.data.map((e) => e.x)),
|
|
3101
|
+
}, N = e.flatMap((e) => e.data.map((e) => e.x)), ee = e.flatMap((e) => e.data.map((e) => e.y)), P = N.length > 0, F = P ? Math.min(...N) : 0, I = P ? Math.max(...N) : 1, L = P ? Math.min(0, ...ee) : 0, te = P ? Math.max(...ee) : 1;
|
|
3067
3102
|
return /* @__PURE__ */ m("div", {
|
|
3068
3103
|
style: {
|
|
3069
3104
|
display: "flex",
|
|
@@ -3090,11 +3125,11 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3090
3125
|
] }, `${e.id}-${n}`))) })
|
|
3091
3126
|
] }),
|
|
3092
3127
|
className: g,
|
|
3093
|
-
"data-state":
|
|
3128
|
+
"data-state": P ? void 0 : "empty",
|
|
3094
3129
|
plain: _,
|
|
3095
|
-
tooltip: d !== !1 &&
|
|
3096
|
-
if (d === !1 || !
|
|
3097
|
-
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = h([
|
|
3130
|
+
tooltip: d !== !1 && P ? ({ width: t, height: n }) => {
|
|
3131
|
+
if (d === !1 || !P) return;
|
|
3132
|
+
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = h([F, I], [0, r]), o = h([L, te], [i, 0]);
|
|
3098
3133
|
return { points: e.flatMap((e) => w.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3099
3134
|
id: `${e.id}-${n}`,
|
|
3100
3135
|
cx: T.left + a.map(t.x),
|
|
@@ -3113,17 +3148,17 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3113
3148
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3114
3149
|
} : void 0,
|
|
3115
3150
|
children: ({ width: t, height: n }) => {
|
|
3116
|
-
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = h([
|
|
3151
|
+
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = h([F, I], [0, i]), s = h([L, te], [a, 0]);
|
|
3117
3152
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
3118
3153
|
transform: `translate(${T.left},${T.top})`,
|
|
3119
3154
|
children: [
|
|
3120
|
-
!_ && /* @__PURE__ */ p(
|
|
3155
|
+
!_ && /* @__PURE__ */ p(vt, {
|
|
3121
3156
|
scale: s,
|
|
3122
3157
|
orientation: "y",
|
|
3123
3158
|
length: i,
|
|
3124
3159
|
tickCount: l
|
|
3125
3160
|
}),
|
|
3126
|
-
!_ &&
|
|
3161
|
+
!_ && Ct(v, {
|
|
3127
3162
|
xScale: o,
|
|
3128
3163
|
yScale: s,
|
|
3129
3164
|
innerW: i,
|
|
@@ -3131,12 +3166,12 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3131
3166
|
}),
|
|
3132
3167
|
!k && e.map((e, t) => {
|
|
3133
3168
|
if (w.value.has(e.id)) return null;
|
|
3134
|
-
let n = e.color ??
|
|
3169
|
+
let n = e.color ?? _n[t % _n.length];
|
|
3135
3170
|
return /* @__PURE__ */ p("g", {
|
|
3136
3171
|
"data-series": e.id,
|
|
3137
3172
|
children: e.data.map((t, i) => {
|
|
3138
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3139
|
-
return m && m !== "circle" ? /* @__PURE__ */ p(
|
|
3173
|
+
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? qt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? Jt(t.y, S, A.value, j.value) : !0, f = d ? .7 : .1, m = typeof b == "function" ? b(t, e.id) : b;
|
|
3174
|
+
return m && m !== "circle" ? /* @__PURE__ */ p(Pt, {
|
|
3140
3175
|
shape: m,
|
|
3141
3176
|
x: o.map(t.x),
|
|
3142
3177
|
y: s.map(t.y),
|
|
@@ -3173,17 +3208,17 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3173
3208
|
}) });
|
|
3174
3209
|
}
|
|
3175
3210
|
}),
|
|
3176
|
-
S &&
|
|
3211
|
+
S && P && /* @__PURE__ */ p(Yt, {
|
|
3177
3212
|
options: S,
|
|
3178
3213
|
range: A,
|
|
3179
3214
|
hidden: j,
|
|
3180
3215
|
label: t
|
|
3181
3216
|
}),
|
|
3182
|
-
D && /* @__PURE__ */ p(
|
|
3217
|
+
D && /* @__PURE__ */ p(Zt, {
|
|
3183
3218
|
series: e.map((e, t) => ({
|
|
3184
3219
|
id: e.id,
|
|
3185
3220
|
label: e.label,
|
|
3186
|
-
color: e.color ??
|
|
3221
|
+
color: e.color ?? _n[t % _n.length]
|
|
3187
3222
|
})),
|
|
3188
3223
|
hidden: w
|
|
3189
3224
|
})
|
|
@@ -3192,7 +3227,7 @@ function mn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3192
3227
|
}
|
|
3193
3228
|
//#endregion
|
|
3194
3229
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3195
|
-
function
|
|
3230
|
+
function yn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
|
|
3196
3231
|
return /* @__PURE__ */ p(Q, {
|
|
3197
3232
|
title: r ?? i,
|
|
3198
3233
|
width: t,
|
|
@@ -3230,15 +3265,15 @@ function hn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3230
3265
|
}
|
|
3231
3266
|
//#endregion
|
|
3232
3267
|
//#region src/charts/meter/meter.tsx
|
|
3233
|
-
function
|
|
3268
|
+
function bn(e, t, n, r) {
|
|
3234
3269
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3235
3270
|
let { warning: i, critical: a } = r;
|
|
3236
3271
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3237
3272
|
}
|
|
3238
|
-
function
|
|
3239
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l =
|
|
3273
|
+
function xn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o = 200, height: s }) {
|
|
3274
|
+
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l = bn(e, t, n, a);
|
|
3240
3275
|
if (i === "gauge") {
|
|
3241
|
-
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ =
|
|
3276
|
+
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ = P(u, d, f, h, g, 2 * Math.PI), v = g + c * Math.PI, y = c > 0 ? P(u, d, f, h, g, v) : "";
|
|
3242
3277
|
return /* @__PURE__ */ m("div", {
|
|
3243
3278
|
"aria-label": r,
|
|
3244
3279
|
role: "meter",
|
|
@@ -3312,38 +3347,30 @@ function _n({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3312
3347
|
})]
|
|
3313
3348
|
});
|
|
3314
3349
|
}
|
|
3350
|
+
var Sn = {
|
|
3351
|
+
kpi: "_kpi_1k88k_7",
|
|
3352
|
+
head: "_head_1k88k_19",
|
|
3353
|
+
label: "_label_1k88k_27",
|
|
3354
|
+
valueRow: "_valueRow_1k88k_34",
|
|
3355
|
+
value: "_value_1k88k_34",
|
|
3356
|
+
delta: "_delta_1k88k_49"
|
|
3357
|
+
};
|
|
3315
3358
|
//#endregion
|
|
3316
3359
|
//#region src/charts/kpi/kpi.tsx
|
|
3317
|
-
function
|
|
3360
|
+
function Cn(e, t) {
|
|
3318
3361
|
if (typeof t == "function") return t(e);
|
|
3319
3362
|
let n = e >= 0 ? "+" : "", r = e.toLocaleString(u());
|
|
3320
3363
|
return t === "percent" ? `${n}${r}%` : `${n}${r}`;
|
|
3321
3364
|
}
|
|
3322
|
-
function
|
|
3365
|
+
function wn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabel: i, icon: a, sparkline: o, className: s }) {
|
|
3323
3366
|
let c = n != null && n >= 0, l = n != null && n < 0;
|
|
3324
3367
|
return /* @__PURE__ */ m("div", {
|
|
3325
|
-
className: s,
|
|
3326
|
-
style: {
|
|
3327
|
-
display: "flex",
|
|
3328
|
-
flexDirection: "column",
|
|
3329
|
-
gap: "var(--cascivo-space-2)",
|
|
3330
|
-
padding: "var(--cascivo-space-4)",
|
|
3331
|
-
borderRadius: "var(--cascivo-radius-surface)",
|
|
3332
|
-
border: "1px solid var(--cascivo-color-border)",
|
|
3333
|
-
background: "var(--cascivo-color-surface)"
|
|
3334
|
-
},
|
|
3368
|
+
className: [Sn.kpi, s].filter(Boolean).join(" "),
|
|
3335
3369
|
children: [
|
|
3336
3370
|
/* @__PURE__ */ m("div", {
|
|
3337
|
-
|
|
3338
|
-
display: "flex",
|
|
3339
|
-
alignItems: "center",
|
|
3340
|
-
justifyContent: "space-between"
|
|
3341
|
-
},
|
|
3371
|
+
className: Sn.head,
|
|
3342
3372
|
children: [/* @__PURE__ */ p("span", {
|
|
3343
|
-
|
|
3344
|
-
fontSize: "var(--cascivo-text-sm)",
|
|
3345
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3346
|
-
},
|
|
3373
|
+
className: Sn.label,
|
|
3347
3374
|
children: t
|
|
3348
3375
|
}), a && /* @__PURE__ */ p("span", {
|
|
3349
3376
|
"aria-hidden": "true",
|
|
@@ -3351,39 +3378,26 @@ function yn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3351
3378
|
})]
|
|
3352
3379
|
}),
|
|
3353
3380
|
/* @__PURE__ */ m("div", {
|
|
3354
|
-
|
|
3355
|
-
display: "flex",
|
|
3356
|
-
alignItems: "flex-end",
|
|
3357
|
-
gap: "var(--cascivo-space-2)"
|
|
3358
|
-
},
|
|
3381
|
+
className: Sn.valueRow,
|
|
3359
3382
|
children: [/* @__PURE__ */ p("span", {
|
|
3360
|
-
|
|
3361
|
-
fontSize: "var(--cascivo-text-2xl)",
|
|
3362
|
-
fontWeight: 700,
|
|
3363
|
-
lineHeight: 1,
|
|
3364
|
-
color: "var(--cascivo-color-foreground)"
|
|
3365
|
-
},
|
|
3383
|
+
className: Sn.value,
|
|
3366
3384
|
children: typeof e == "number" ? e.toLocaleString(u()) : e
|
|
3367
3385
|
}), n != null && /* @__PURE__ */ m("span", {
|
|
3368
3386
|
role: "img",
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
color: c ? "var(--cascivo-color-success-foreground)" : l ? "var(--cascivo-color-destructive-foreground)" : "var(--cascivo-color-foreground-muted)"
|
|
3373
|
-
},
|
|
3374
|
-
"aria-label": `Trend: ${vn(n, r)}${i ? ` ${i}` : ""}`,
|
|
3387
|
+
className: Sn.delta,
|
|
3388
|
+
"data-trend": c ? "up" : l ? "down" : "flat",
|
|
3389
|
+
"aria-label": `Trend: ${Cn(n, r)}${i ? ` ${i}` : ""}`,
|
|
3375
3390
|
children: [
|
|
3376
3391
|
c ? "▲" : l ? "▼" : "–",
|
|
3377
3392
|
" ",
|
|
3378
|
-
|
|
3393
|
+
Cn(n, r),
|
|
3379
3394
|
i && ` ${i}`
|
|
3380
3395
|
]
|
|
3381
3396
|
})]
|
|
3382
3397
|
}),
|
|
3383
|
-
o && o.length > 0 && /* @__PURE__ */ p(
|
|
3398
|
+
o && o.length > 0 && /* @__PURE__ */ p(yn, {
|
|
3384
3399
|
data: o,
|
|
3385
3400
|
label: `${t} trend`,
|
|
3386
|
-
width: 120,
|
|
3387
3401
|
height: 32
|
|
3388
3402
|
})
|
|
3389
3403
|
]
|
|
@@ -3391,9 +3405,9 @@ function yn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3391
3405
|
}
|
|
3392
3406
|
//#endregion
|
|
3393
3407
|
//#region src/charts/histogram/histogram.tsx
|
|
3394
|
-
function
|
|
3408
|
+
function Tn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3395
3409
|
o();
|
|
3396
|
-
let u = l ?
|
|
3410
|
+
let u = l ? Ue : He, d = s ?? (l ? 48 : 300), g = B(e, t), _ = g.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3397
3411
|
return /* @__PURE__ */ p(Q, {
|
|
3398
3412
|
title: n,
|
|
3399
3413
|
description: i,
|
|
@@ -3434,7 +3448,7 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3434
3448
|
return /* @__PURE__ */ m("g", {
|
|
3435
3449
|
transform: `translate(${u.left},${u.top})`,
|
|
3436
3450
|
children: [
|
|
3437
|
-
!l && /* @__PURE__ */ p(
|
|
3451
|
+
!l && /* @__PURE__ */ p(vt, {
|
|
3438
3452
|
scale: i,
|
|
3439
3453
|
orientation: "y",
|
|
3440
3454
|
length: n.width
|
|
@@ -3467,10 +3481,10 @@ function bn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3467
3481
|
}
|
|
3468
3482
|
//#endregion
|
|
3469
3483
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3470
|
-
var
|
|
3471
|
-
function
|
|
3484
|
+
var En = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3485
|
+
function Dn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: s }) {
|
|
3472
3486
|
o();
|
|
3473
|
-
let c = s ?
|
|
3487
|
+
let c = s ? Ue : He, l = i ?? (s ? 48 : 320), u = e.map((e) => ({
|
|
3474
3488
|
...e,
|
|
3475
3489
|
stats: V(e.values)
|
|
3476
3490
|
})), d = e.flatMap((e) => e.values), [g, v] = d.length > 0 ? H(d) : [0, 1];
|
|
@@ -3532,7 +3546,7 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3532
3546
|
return /* @__PURE__ */ m("g", {
|
|
3533
3547
|
transform: `translate(${c.left},${c.top})`,
|
|
3534
3548
|
children: [u.map((e, t) => {
|
|
3535
|
-
let n =
|
|
3549
|
+
let n = En[t % En.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
|
|
3536
3550
|
return /* @__PURE__ */ m("g", { children: [
|
|
3537
3551
|
/* @__PURE__ */ p("line", {
|
|
3538
3552
|
x1: i,
|
|
@@ -3609,10 +3623,10 @@ function Sn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3609
3623
|
}
|
|
3610
3624
|
//#endregion
|
|
3611
3625
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3612
|
-
var
|
|
3613
|
-
function
|
|
3626
|
+
var On = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), kn = 3, An = 24;
|
|
3627
|
+
function jn({ series: e, title: t, description: n, width: r, height: a, tooltip: s, className: c, plain: l, glyph: u }) {
|
|
3614
3628
|
o();
|
|
3615
|
-
let d = i(null), g = l ?
|
|
3629
|
+
let d = i(null), g = l ? Ue : He, _ = 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 = v([w, T], [kn, An]), D = y.length > 0;
|
|
3616
3630
|
return /* @__PURE__ */ p(Q, {
|
|
3617
3631
|
title: t,
|
|
3618
3632
|
description: n,
|
|
@@ -3663,13 +3677,13 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3663
3677
|
return /* @__PURE__ */ m("g", {
|
|
3664
3678
|
transform: `translate(${g.left},${g.top})`,
|
|
3665
3679
|
children: [
|
|
3666
|
-
!l && /* @__PURE__ */ p(
|
|
3680
|
+
!l && /* @__PURE__ */ p(vt, {
|
|
3667
3681
|
scale: s,
|
|
3668
3682
|
orientation: "y",
|
|
3669
3683
|
length: r.width
|
|
3670
3684
|
}),
|
|
3671
3685
|
e.map((e, t) => {
|
|
3672
|
-
let n =
|
|
3686
|
+
let n = On[t % On.length] ?? "var(--cascivo-chart-1)";
|
|
3673
3687
|
return /* @__PURE__ */ p("g", {
|
|
3674
3688
|
opacity: d.value !== null && d.value !== e.name ? .2 : 1,
|
|
3675
3689
|
onMouseEnter: () => {
|
|
@@ -3680,7 +3694,7 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3680
3694
|
},
|
|
3681
3695
|
children: e.data.map((t, r) => {
|
|
3682
3696
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3683
|
-
return i && i !== "circle" ? /* @__PURE__ */ p("g", { children: /* @__PURE__ */ p(
|
|
3697
|
+
return i && i !== "circle" ? /* @__PURE__ */ p("g", { children: /* @__PURE__ */ p(Pt, {
|
|
3684
3698
|
shape: i,
|
|
3685
3699
|
x: o.map(t.x),
|
|
3686
3700
|
y: s.map(t.y),
|
|
@@ -3718,120 +3732,160 @@ function En({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3718
3732
|
}
|
|
3719
3733
|
//#endregion
|
|
3720
3734
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3721
|
-
|
|
3735
|
+
var Mn = "var(--cascivo-chart-1)", Nn = "var(--cascivo-chart-2)";
|
|
3736
|
+
function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, barsLabel: s = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: g, tooltip: v, className: y, plain: b, annotations: x }) {
|
|
3722
3737
|
o();
|
|
3723
|
-
let
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3738
|
+
let S = i(/* @__PURE__ */ new Set()), C = g ?? (b ? 48 : 320), w = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, T = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, D = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, O = e.length > 0, k = b ? !1 : l ?? (e.length > 0 && t.length > 0);
|
|
3739
|
+
t.length > 0 && e.length > 0 && t.length !== e.length && tn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !a && t.length > 0 && e.length > 0 && nn("ComboChart", [{
|
|
3740
|
+
label: s,
|
|
3741
|
+
max: w
|
|
3742
|
+
}, {
|
|
3743
|
+
label: c,
|
|
3744
|
+
max: D
|
|
3745
|
+
}]);
|
|
3746
|
+
let A = h([0, w], [0, 1]).ticks(5).map((e) => e.toLocaleString()), j = a ? h([T, D || T + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], M = e.map((e) => e.label), N = b ? Ue : {
|
|
3747
|
+
...He,
|
|
3748
|
+
left: Ge(A, b),
|
|
3749
|
+
right: Ke({
|
|
3750
|
+
rightAxisLabels: j,
|
|
3751
|
+
plain: b
|
|
3752
|
+
})
|
|
3753
|
+
};
|
|
3754
|
+
return /* @__PURE__ */ m("div", {
|
|
3755
|
+
style: {
|
|
3756
|
+
display: "flex",
|
|
3757
|
+
flexDirection: "column",
|
|
3758
|
+
gap: "var(--cascivo-space-2)"
|
|
3759
|
+
},
|
|
3760
|
+
className: y,
|
|
3761
|
+
children: [/* @__PURE__ */ p(Q, {
|
|
3762
|
+
title: n,
|
|
3763
|
+
description: r,
|
|
3764
|
+
width: d,
|
|
3765
|
+
height: C,
|
|
3766
|
+
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3767
|
+
/* @__PURE__ */ p("caption", { children: n }),
|
|
3768
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
3769
|
+
/* @__PURE__ */ p("th", { children: "Label" }),
|
|
3770
|
+
/* @__PURE__ */ p("th", { children: s }),
|
|
3771
|
+
t.length > 0 && /* @__PURE__ */ p("th", { children: c })
|
|
3772
|
+
] }) }),
|
|
3773
|
+
/* @__PURE__ */ p("tbody", { children: e.map((e, n) => /* @__PURE__ */ m("tr", { children: [
|
|
3774
|
+
/* @__PURE__ */ p("td", { children: e.label }),
|
|
3775
|
+
/* @__PURE__ */ p("td", { children: e.value }),
|
|
3776
|
+
t.length > 0 && /* @__PURE__ */ p("td", { children: t[n]?.y ?? "" })
|
|
3777
|
+
] }, e.label)) })
|
|
3778
|
+
] }),
|
|
3779
|
+
plain: b,
|
|
3780
|
+
tooltip: v !== !1 && O ? ({ width: n, height: r }) => {
|
|
3781
|
+
if (v === !1 || !O) return;
|
|
3782
|
+
let i = {
|
|
3783
|
+
width: n - N.left - N.right,
|
|
3784
|
+
height: r - N.top - N.bottom
|
|
3762
3785
|
};
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
opacity: .75
|
|
3796
|
-
}, e.label);
|
|
3797
|
-
}),
|
|
3798
|
-
g && /* @__PURE__ */ p("path", {
|
|
3799
|
-
d: g,
|
|
3800
|
-
fill: "none",
|
|
3801
|
-
stroke: "var(--cascivo-chart-2)",
|
|
3802
|
-
strokeWidth: 2.5,
|
|
3803
|
-
strokeLinejoin: "round",
|
|
3804
|
-
strokeLinecap: "round"
|
|
3805
|
-
}),
|
|
3806
|
-
!u && /* @__PURE__ */ m(f, { children: [
|
|
3807
|
-
/* @__PURE__ */ p($, {
|
|
3808
|
-
scale: o,
|
|
3809
|
-
orientation: "x",
|
|
3810
|
-
length: a.width,
|
|
3811
|
-
transform: `translate(0,${a.height})`
|
|
3812
|
-
}),
|
|
3813
|
-
/* @__PURE__ */ p($, {
|
|
3786
|
+
if (i.width <= 0) return;
|
|
3787
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, w], [i.height, 0]), c = a ? h([T, D || T + 1], [i.height, 0]) : s, l = e.map((e, t) => ({
|
|
3788
|
+
id: `bar-${t}`,
|
|
3789
|
+
cx: N.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
|
|
3790
|
+
cy: N.top + s.map(e.value),
|
|
3791
|
+
label: e.label,
|
|
3792
|
+
value: e.value,
|
|
3793
|
+
seriesId: "bars"
|
|
3794
|
+
})), u = t.map((n, r) => {
|
|
3795
|
+
let a = e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1);
|
|
3796
|
+
return {
|
|
3797
|
+
id: `line-${r}`,
|
|
3798
|
+
cx: N.left + a,
|
|
3799
|
+
cy: N.top + c.map(n.y),
|
|
3800
|
+
label: e[r]?.label ?? String(n.x),
|
|
3801
|
+
value: n.y,
|
|
3802
|
+
seriesId: "line"
|
|
3803
|
+
};
|
|
3804
|
+
});
|
|
3805
|
+
return { points: [...l, ...u] };
|
|
3806
|
+
} : void 0,
|
|
3807
|
+
children: ({ width: n, height: r }) => {
|
|
3808
|
+
let i = {
|
|
3809
|
+
width: n - N.left - N.right,
|
|
3810
|
+
height: r - N.top - N.bottom
|
|
3811
|
+
};
|
|
3812
|
+
if (i.width <= 0 || e.length === 0) return null;
|
|
3813
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, w], [i.height, 0]), c = a ? h([T, D || T + 1], [i.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? E(l, "monotone") : "", g = u ?? qe(M, i.width), v = S.value.has("bars"), y = S.value.has("line");
|
|
3814
|
+
return /* @__PURE__ */ m("g", {
|
|
3815
|
+
transform: `translate(${N.left},${N.top})`,
|
|
3816
|
+
children: [
|
|
3817
|
+
!b && /* @__PURE__ */ p(vt, {
|
|
3814
3818
|
scale: s,
|
|
3815
3819
|
orientation: "y",
|
|
3816
|
-
length:
|
|
3820
|
+
length: i.width
|
|
3817
3821
|
}),
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
})
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3822
|
+
!b && Ct(x, {
|
|
3823
|
+
xScale: o,
|
|
3824
|
+
yScale: s,
|
|
3825
|
+
innerW: i.width,
|
|
3826
|
+
innerH: i.height
|
|
3827
|
+
}),
|
|
3828
|
+
!v && e.map((e) => {
|
|
3829
|
+
let t = o.map(e.label) ?? 0, n = s.map(e.value);
|
|
3830
|
+
return /* @__PURE__ */ p("rect", {
|
|
3831
|
+
x: t,
|
|
3832
|
+
y: n,
|
|
3833
|
+
width: o.bandwidth,
|
|
3834
|
+
height: Math.max(0, i.height - n),
|
|
3835
|
+
fill: Mn,
|
|
3836
|
+
opacity: .75
|
|
3837
|
+
}, e.label);
|
|
3838
|
+
}),
|
|
3839
|
+
d && !y && /* @__PURE__ */ p("path", {
|
|
3840
|
+
d,
|
|
3841
|
+
fill: "none",
|
|
3842
|
+
stroke: Nn,
|
|
3843
|
+
strokeWidth: 2.5,
|
|
3844
|
+
strokeLinejoin: "round",
|
|
3845
|
+
strokeLinecap: "round"
|
|
3846
|
+
}),
|
|
3847
|
+
!b && /* @__PURE__ */ m(f, { children: [
|
|
3848
|
+
/* @__PURE__ */ p($, {
|
|
3849
|
+
scale: o,
|
|
3850
|
+
orientation: "x",
|
|
3851
|
+
length: i.width,
|
|
3852
|
+
labelEvery: g,
|
|
3853
|
+
transform: `translate(0,${i.height})`
|
|
3854
|
+
}),
|
|
3855
|
+
/* @__PURE__ */ p($, {
|
|
3856
|
+
scale: s,
|
|
3857
|
+
orientation: "y",
|
|
3858
|
+
length: i.height
|
|
3859
|
+
}),
|
|
3860
|
+
a && /* @__PURE__ */ p($, {
|
|
3861
|
+
scale: c,
|
|
3862
|
+
orientation: "y-right",
|
|
3863
|
+
length: i.height,
|
|
3864
|
+
transform: `translate(${i.width},0)`
|
|
3865
|
+
})
|
|
3866
|
+
] })
|
|
3867
|
+
]
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
}), k && /* @__PURE__ */ p(Zt, {
|
|
3871
|
+
series: [{
|
|
3872
|
+
id: "bars",
|
|
3873
|
+
label: s,
|
|
3874
|
+
color: Mn
|
|
3875
|
+
}, ...t.length > 0 ? [{
|
|
3876
|
+
id: "line",
|
|
3877
|
+
label: c,
|
|
3878
|
+
color: Nn
|
|
3879
|
+
}] : []],
|
|
3880
|
+
hidden: S
|
|
3881
|
+
})]
|
|
3828
3882
|
});
|
|
3829
3883
|
}
|
|
3830
3884
|
//#endregion
|
|
3831
3885
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3832
|
-
function
|
|
3886
|
+
function Fn({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u }) {
|
|
3833
3887
|
o();
|
|
3834
|
-
let d = a ?? (c ? 48 : 320), h = c ?
|
|
3888
|
+
let d = a ?? (c ? 48 : 320), h = c ? Ue : {
|
|
3835
3889
|
top: 20,
|
|
3836
3890
|
right: 20,
|
|
3837
3891
|
bottom: 60,
|
|
@@ -3886,7 +3940,7 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3886
3940
|
return /* @__PURE__ */ m("g", {
|
|
3887
3941
|
transform: `translate(${h.left},${h.top})`,
|
|
3888
3942
|
children: [e.map((e, t) => {
|
|
3889
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ?
|
|
3943
|
+
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ? qt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-color-neutral-100))`, c = l ? Jt(e.value, l, C.value, w.value) : !0;
|
|
3890
3944
|
return /* @__PURE__ */ p("rect", {
|
|
3891
3945
|
x: n,
|
|
3892
3946
|
y: r,
|
|
@@ -3916,7 +3970,7 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3916
3970
|
flexDirection: "column",
|
|
3917
3971
|
gap: "0.5rem"
|
|
3918
3972
|
},
|
|
3919
|
-
children: [T, /* @__PURE__ */ p(
|
|
3973
|
+
children: [T, /* @__PURE__ */ p(Yt, {
|
|
3920
3974
|
options: l,
|
|
3921
3975
|
range: C,
|
|
3922
3976
|
hidden: w,
|
|
@@ -3926,8 +3980,8 @@ function On({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3926
3980
|
}
|
|
3927
3981
|
//#endregion
|
|
3928
3982
|
//#region src/charts/treemap/treemap.tsx
|
|
3929
|
-
var
|
|
3930
|
-
function
|
|
3983
|
+
var In = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3984
|
+
function Ln({ data: e, title: t, description: n, width: r, height: i, className: a, plain: c }) {
|
|
3931
3985
|
o();
|
|
3932
3986
|
let l = s();
|
|
3933
3987
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -3943,7 +3997,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3943
3997
|
className: a,
|
|
3944
3998
|
plain: c,
|
|
3945
3999
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3946
|
-
if (e.length !== 0) return { points:
|
|
4000
|
+
if (e.length !== 0) return { points: K(e.map((e) => ({
|
|
3947
4001
|
id: e.id,
|
|
3948
4002
|
value: e.value
|
|
3949
4003
|
})), t, n).map((t) => {
|
|
@@ -3959,7 +4013,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3959
4013
|
} : void 0,
|
|
3960
4014
|
children: ({ width: t, height: n }) => {
|
|
3961
4015
|
if (e.length === 0) return null;
|
|
3962
|
-
let r =
|
|
4016
|
+
let r = K(e.map((e) => ({
|
|
3963
4017
|
id: e.id,
|
|
3964
4018
|
value: e.value
|
|
3965
4019
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -3972,7 +4026,7 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3972
4026
|
height: Math.max(0, e.h - 4)
|
|
3973
4027
|
})
|
|
3974
4028
|
}, e.id)) }), r.map((e, t) => {
|
|
3975
|
-
let n =
|
|
4029
|
+
let n = In[t % In.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
3976
4030
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("rect", {
|
|
3977
4031
|
x: e.x,
|
|
3978
4032
|
y: e.y,
|
|
@@ -3996,8 +4050,8 @@ function An({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3996
4050
|
}
|
|
3997
4051
|
//#endregion
|
|
3998
4052
|
//#region src/charts/radar/radar.tsx
|
|
3999
|
-
var
|
|
4000
|
-
function
|
|
4053
|
+
var Rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), zn = 4;
|
|
4054
|
+
function Bn(e, t, n, r, i) {
|
|
4001
4055
|
let a = e.length;
|
|
4002
4056
|
return e.map((e, o) => {
|
|
4003
4057
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -4007,7 +4061,7 @@ function Nn(e, t, n, r, i) {
|
|
|
4007
4061
|
};
|
|
4008
4062
|
});
|
|
4009
4063
|
}
|
|
4010
|
-
function
|
|
4064
|
+
function Vn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
4011
4065
|
let u = s ?? (l ? 48 : 320);
|
|
4012
4066
|
o();
|
|
4013
4067
|
let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -4039,7 +4093,7 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4039
4093
|
})) };
|
|
4040
4094
|
} : void 0,
|
|
4041
4095
|
children: ({ width: n, height: r }) => {
|
|
4042
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4096
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: zn }, (e, t) => (t + 1) / zn * o), c = Array.from({ length: h }, (e, t) => {
|
|
4043
4097
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4044
4098
|
return {
|
|
4045
4099
|
x: w(i + Math.cos(n) * o),
|
|
@@ -4077,7 +4131,7 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4077
4131
|
}, n);
|
|
4078
4132
|
}),
|
|
4079
4133
|
t.map((e, t) => {
|
|
4080
|
-
let n =
|
|
4134
|
+
let n = Bn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Rn[t % Rn.length] ?? "var(--cascivo-chart-1)";
|
|
4081
4135
|
return /* @__PURE__ */ p("polygon", {
|
|
4082
4136
|
points: n,
|
|
4083
4137
|
fill: r,
|
|
@@ -4092,12 +4146,12 @@ function Pn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4092
4146
|
}
|
|
4093
4147
|
//#endregion
|
|
4094
4148
|
//#region src/charts/bullet/bullet.tsx
|
|
4095
|
-
var
|
|
4149
|
+
var Hn = [
|
|
4096
4150
|
"var(--cascivo-color-neutral-200)",
|
|
4097
4151
|
"var(--cascivo-color-neutral-300)",
|
|
4098
4152
|
"var(--cascivo-color-neutral-400)"
|
|
4099
4153
|
];
|
|
4100
|
-
function
|
|
4154
|
+
function Un({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: s = 300, height: c = 40, className: l }) {
|
|
4101
4155
|
o();
|
|
4102
4156
|
let u = [...n].sort((e, t) => e - t), d = h([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, s]), g = c * .35, _ = (c - g) / 2, v = c * .7, y = (c - v) / 2;
|
|
4103
4157
|
return /* @__PURE__ */ m("figure", {
|
|
@@ -4124,7 +4178,7 @@ function In({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4124
4178
|
y: 0,
|
|
4125
4179
|
width: Math.max(0, r),
|
|
4126
4180
|
height: c,
|
|
4127
|
-
fill:
|
|
4181
|
+
fill: Hn[t % Hn.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4128
4182
|
}, t);
|
|
4129
4183
|
}),
|
|
4130
4184
|
/* @__PURE__ */ p("rect", {
|
|
@@ -4151,8 +4205,8 @@ function In({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4151
4205
|
}
|
|
4152
4206
|
//#endregion
|
|
4153
4207
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4154
|
-
var
|
|
4155
|
-
function
|
|
4208
|
+
var Wn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4209
|
+
function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: h, legend: g, className: _, plain: v }) {
|
|
4156
4210
|
o();
|
|
4157
4211
|
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, T = c ?? Math.max(1, ...e.map((e) => e.value)), E = Math.min(360, Math.max(0, l)) * Math.PI / 180, D = -E / 2, O = (t, n) => {
|
|
4158
4212
|
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));
|
|
@@ -4177,7 +4231,7 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4177
4231
|
value: e.value,
|
|
4178
4232
|
seriesId: e.id,
|
|
4179
4233
|
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4180
|
-
color: e.color ??
|
|
4234
|
+
color: e.color ?? Wn[t % Wn.length]
|
|
4181
4235
|
};
|
|
4182
4236
|
}) };
|
|
4183
4237
|
}, A = /* @__PURE__ */ m("table", { children: [
|
|
@@ -4204,15 +4258,15 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4204
4258
|
children: ({ width: e, height: t }) => {
|
|
4205
4259
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4206
4260
|
return /* @__PURE__ */ m("g", { children: [s.map((e, t) => {
|
|
4207
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4261
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Wn[t % Wn.length], l = Math.max(0, Math.min(1, e.value / T)), u = D + E * l;
|
|
4208
4262
|
return /* @__PURE__ */ m("g", {
|
|
4209
4263
|
"data-series": e.id,
|
|
4210
4264
|
children: [/* @__PURE__ */ p("path", {
|
|
4211
|
-
d:
|
|
4265
|
+
d: P(n, r, a, s, D, D + E),
|
|
4212
4266
|
fill: "var(--cascivo-chart-grid)",
|
|
4213
4267
|
fillOpacity: .35
|
|
4214
4268
|
}), l > 0 && /* @__PURE__ */ p("path", {
|
|
4215
|
-
d:
|
|
4269
|
+
d: P(n, r, a, s, D, u),
|
|
4216
4270
|
fill: c
|
|
4217
4271
|
})]
|
|
4218
4272
|
}, e.id);
|
|
@@ -4256,11 +4310,11 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4256
4310
|
})
|
|
4257
4311
|
}))] });
|
|
4258
4312
|
}
|
|
4259
|
-
}), S && /* @__PURE__ */ p(
|
|
4313
|
+
}), S && /* @__PURE__ */ p(Zt, {
|
|
4260
4314
|
series: e.map((e, t) => ({
|
|
4261
4315
|
id: e.id,
|
|
4262
4316
|
label: e.label,
|
|
4263
|
-
color: e.color ??
|
|
4317
|
+
color: e.color ?? Wn[t % Wn.length]
|
|
4264
4318
|
})),
|
|
4265
4319
|
hidden: y
|
|
4266
4320
|
})]
|
|
@@ -4268,10 +4322,10 @@ function Rn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4268
4322
|
}
|
|
4269
4323
|
//#endregion
|
|
4270
4324
|
//#region src/charts/funnel/funnel.tsx
|
|
4271
|
-
var
|
|
4272
|
-
function
|
|
4325
|
+
var Kn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4326
|
+
function qn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: s, className: c, plain: l }) {
|
|
4273
4327
|
o();
|
|
4274
|
-
let u = l ?
|
|
4328
|
+
let u = l ? Ue : He, d = i ?? (l ? 48 : 320), f = e.length > 0, g = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4275
4329
|
return /* @__PURE__ */ p(Q, {
|
|
4276
4330
|
title: t,
|
|
4277
4331
|
description: n,
|
|
@@ -4305,7 +4359,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4305
4359
|
value: e.value,
|
|
4306
4360
|
seriesId: e.id,
|
|
4307
4361
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4308
|
-
color: e.color ??
|
|
4362
|
+
color: e.color ?? Kn[t % Kn.length]
|
|
4309
4363
|
})),
|
|
4310
4364
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4311
4365
|
};
|
|
@@ -4315,7 +4369,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4315
4369
|
if (r <= 0 || e.length === 0) return null;
|
|
4316
4370
|
let o = i / e.length, s = h([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4317
4371
|
return /* @__PURE__ */ p("g", { children: e.map((t, n) => {
|
|
4318
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ??
|
|
4372
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ?? Kn[n % Kn.length], v = [
|
|
4319
4373
|
[d - i, f],
|
|
4320
4374
|
[d + i, f],
|
|
4321
4375
|
[d + s, h],
|
|
@@ -4327,7 +4381,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4327
4381
|
points: v,
|
|
4328
4382
|
fill: _,
|
|
4329
4383
|
fillOpacity: .85
|
|
4330
|
-
}), !l && /* @__PURE__ */ p(
|
|
4384
|
+
}), !l && /* @__PURE__ */ p(Dt, {
|
|
4331
4385
|
x: d,
|
|
4332
4386
|
y: f + o / 2,
|
|
4333
4387
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4340,10 +4394,10 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4340
4394
|
}
|
|
4341
4395
|
//#endregion
|
|
4342
4396
|
//#region src/charts/stream/stream.tsx
|
|
4343
|
-
var
|
|
4344
|
-
function
|
|
4397
|
+
var Jn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4398
|
+
function Yn({ series: e, categories: t, title: n, description: r, offset: a = "silhouette", curve: s = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: g }) {
|
|
4345
4399
|
o();
|
|
4346
|
-
let v = i(/* @__PURE__ */ new Set()), y = g ?
|
|
4400
|
+
let v = i(/* @__PURE__ */ new Set()), y = g ? Ue : He, b = l ?? (g ? 48 : 300), x = g ? !1 : u ?? e.length > 1, S = t.length > 0 && e.length > 0, C = ie(e.map((e) => e.values), a), [w, T] = q(C);
|
|
4347
4401
|
return /* @__PURE__ */ m("div", {
|
|
4348
4402
|
style: {
|
|
4349
4403
|
display: "flex",
|
|
@@ -4378,7 +4432,7 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4378
4432
|
label: `${e.label} · ${String(t)}`,
|
|
4379
4433
|
value: e.values[i] ?? 0,
|
|
4380
4434
|
seriesId: e.id,
|
|
4381
|
-
color: e.color ??
|
|
4435
|
+
color: e.color ?? Jn[n % Jn.length]
|
|
4382
4436
|
};
|
|
4383
4437
|
});
|
|
4384
4438
|
}) };
|
|
@@ -4391,7 +4445,7 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4391
4445
|
transform: `translate(${y.left},${y.top})`,
|
|
4392
4446
|
children: [e.map((e, n) => {
|
|
4393
4447
|
if (v.value.has(e.id)) return null;
|
|
4394
|
-
let r = C[n], i = e.color ??
|
|
4448
|
+
let r = C[n], i = e.color ?? Jn[n % Jn.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), o = t.map((e, t) => [l(t), c.map(r[t][0])]);
|
|
4395
4449
|
return /* @__PURE__ */ p("path", {
|
|
4396
4450
|
d: `${E(a, s)}${E([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4397
4451
|
fill: i,
|
|
@@ -4406,11 +4460,11 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4406
4460
|
})]
|
|
4407
4461
|
});
|
|
4408
4462
|
}
|
|
4409
|
-
}), x && /* @__PURE__ */ p(
|
|
4463
|
+
}), x && /* @__PURE__ */ p(Zt, {
|
|
4410
4464
|
series: e.map((e, t) => ({
|
|
4411
4465
|
id: e.id,
|
|
4412
4466
|
label: e.label,
|
|
4413
|
-
color: e.color ??
|
|
4467
|
+
color: e.color ?? Jn[t % Jn.length]
|
|
4414
4468
|
})),
|
|
4415
4469
|
hidden: v
|
|
4416
4470
|
})]
|
|
@@ -4418,10 +4472,10 @@ function Hn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4418
4472
|
}
|
|
4419
4473
|
//#endregion
|
|
4420
4474
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4421
|
-
var
|
|
4422
|
-
function
|
|
4475
|
+
var Xn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4476
|
+
function Zn({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4423
4477
|
o();
|
|
4424
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f =
|
|
4478
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = J(e), h = f > 0, g = Y(e), _ = Math.max(1, ae(g));
|
|
4425
4479
|
return /* @__PURE__ */ p(Q, {
|
|
4426
4480
|
title: t,
|
|
4427
4481
|
description: n,
|
|
@@ -4448,7 +4502,7 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4448
4502
|
label: e.node.label,
|
|
4449
4503
|
value: e.value,
|
|
4450
4504
|
percent: f > 0 ? e.value / f * 100 : 0,
|
|
4451
|
-
color: e.node.color ??
|
|
4505
|
+
color: e.node.color ?? Xn[t % Xn.length]
|
|
4452
4506
|
};
|
|
4453
4507
|
}),
|
|
4454
4508
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4457,9 +4511,9 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4457
4511
|
children: ({ width: e, height: t }) => {
|
|
4458
4512
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4459
4513
|
return /* @__PURE__ */ p("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4460
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4514
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? Xn[t % Xn.length];
|
|
4461
4515
|
return /* @__PURE__ */ p("path", {
|
|
4462
|
-
d:
|
|
4516
|
+
d: P(n, r, o, a, e.a0, e.a1),
|
|
4463
4517
|
fill: s,
|
|
4464
4518
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4465
4519
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4472,10 +4526,10 @@ function Wn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4472
4526
|
}
|
|
4473
4527
|
//#endregion
|
|
4474
4528
|
//#region src/charts/sankey/sankey.tsx
|
|
4475
|
-
var
|
|
4476
|
-
function
|
|
4529
|
+
var Qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4530
|
+
function $n({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4477
4531
|
o();
|
|
4478
|
-
let u = l ?
|
|
4532
|
+
let u = l ? Ue : He, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ?? Qn[n % Qn.length];
|
|
4479
4533
|
return /* @__PURE__ */ p(Q, {
|
|
4480
4534
|
title: n,
|
|
4481
4535
|
description: r,
|
|
@@ -4499,7 +4553,7 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4499
4553
|
plain: l,
|
|
4500
4554
|
tooltip: s && f ? ({ width: n, height: r }) => {
|
|
4501
4555
|
if (!s || !f) return;
|
|
4502
|
-
let { nodes: i } =
|
|
4556
|
+
let { nodes: i } = oe(e, t, {
|
|
4503
4557
|
width: n - u.left - u.right,
|
|
4504
4558
|
height: r - u.top - u.bottom
|
|
4505
4559
|
});
|
|
@@ -4515,14 +4569,14 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4515
4569
|
children: ({ width: n, height: r }) => {
|
|
4516
4570
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4517
4571
|
if (i <= 0 || !f) return null;
|
|
4518
|
-
let { nodes: o, links: s } =
|
|
4572
|
+
let { nodes: o, links: s } = oe(e, t, {
|
|
4519
4573
|
width: i,
|
|
4520
4574
|
height: a
|
|
4521
4575
|
});
|
|
4522
4576
|
return /* @__PURE__ */ m("g", {
|
|
4523
4577
|
transform: `translate(${u.left},${u.top})`,
|
|
4524
4578
|
children: [s.map((e, t) => /* @__PURE__ */ p("path", {
|
|
4525
|
-
d:
|
|
4579
|
+
d: se(e),
|
|
4526
4580
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4527
4581
|
fillOpacity: .32,
|
|
4528
4582
|
"data-link": ""
|
|
@@ -4551,23 +4605,23 @@ function Kn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4551
4605
|
}
|
|
4552
4606
|
//#endregion
|
|
4553
4607
|
//#region src/charts/calendar/calendar.tsx
|
|
4554
|
-
var
|
|
4555
|
-
function
|
|
4608
|
+
var er = 864e5, tr = (e) => e instanceof Date ? e : new Date(e), nr = (e) => e.toISOString().slice(0, 10);
|
|
4609
|
+
function rr(e) {
|
|
4556
4610
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4557
4611
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4558
4612
|
}
|
|
4559
|
-
function
|
|
4613
|
+
function ir({ data: e, title: t, description: n, from: r, to: a, width: s, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
|
|
4560
4614
|
o();
|
|
4561
4615
|
let h = e.length > 0, g = i([f?.min ?? 0, f?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4562
|
-
for (let t of e) v.set(
|
|
4563
|
-
let y = e.map((e) =>
|
|
4616
|
+
for (let t of e) v.set(nr(tr(t.day)), t.value);
|
|
4617
|
+
let y = e.map((e) => tr(e.day)), b = rr(r ? tr(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = a ? tr(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()) / er / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4564
4618
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4565
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4619
|
+
let n = new Date(b.getTime() + (e * 7 + t) * er);
|
|
4566
4620
|
n > x || T.push({
|
|
4567
4621
|
col: e,
|
|
4568
4622
|
row: t,
|
|
4569
4623
|
date: n,
|
|
4570
|
-
value: v.get(
|
|
4624
|
+
value: v.get(nr(n)) ?? 0
|
|
4571
4625
|
});
|
|
4572
4626
|
}
|
|
4573
4627
|
let E = /* @__PURE__ */ p(Q, {
|
|
@@ -4578,7 +4632,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4578
4632
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4579
4633
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4580
4634
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Day" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4581
|
-
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children:
|
|
4635
|
+
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: nr(tr(e.day)) }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
4582
4636
|
] }),
|
|
4583
4637
|
className: u,
|
|
4584
4638
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4588,10 +4642,10 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4588
4642
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4589
4643
|
return {
|
|
4590
4644
|
points: T.map((e, n) => ({
|
|
4591
|
-
id: `${
|
|
4645
|
+
id: `${nr(e.date)}-${n}`,
|
|
4592
4646
|
cx: e.col * (t + 2) + t / 2,
|
|
4593
4647
|
cy: e.row * (t + 2) + t / 2,
|
|
4594
|
-
label:
|
|
4648
|
+
label: nr(e.date),
|
|
4595
4649
|
value: e.value
|
|
4596
4650
|
})),
|
|
4597
4651
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4600,7 +4654,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4600
4654
|
children: ({ width: e }) => {
|
|
4601
4655
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4602
4656
|
return /* @__PURE__ */ p("g", { children: T.map((e, n) => {
|
|
4603
|
-
let r = f ?
|
|
4657
|
+
let r = f ? qt(e.value, f).color : void 0, i = f ? Jt(e.value, f, g.value, _.value) : !0;
|
|
4604
4658
|
return /* @__PURE__ */ p("rect", {
|
|
4605
4659
|
x: e.col * (t + 2),
|
|
4606
4660
|
y: e.row * (t + 2),
|
|
@@ -4609,7 +4663,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4609
4663
|
rx: 1.5,
|
|
4610
4664
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4611
4665
|
fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4612
|
-
"data-day":
|
|
4666
|
+
"data-day": nr(e.date)
|
|
4613
4667
|
}, n);
|
|
4614
4668
|
}) });
|
|
4615
4669
|
}
|
|
@@ -4620,7 +4674,7 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4620
4674
|
flexDirection: "column",
|
|
4621
4675
|
gap: "0.5rem"
|
|
4622
4676
|
},
|
|
4623
|
-
children: [E, /* @__PURE__ */ p(
|
|
4677
|
+
children: [E, /* @__PURE__ */ p(Yt, {
|
|
4624
4678
|
options: f,
|
|
4625
4679
|
range: g,
|
|
4626
4680
|
hidden: _,
|
|
@@ -4630,11 +4684,11 @@ function Zn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4630
4684
|
}
|
|
4631
4685
|
//#endregion
|
|
4632
4686
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4633
|
-
function
|
|
4687
|
+
function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: g, tooltip: v, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E }) {
|
|
4634
4688
|
o();
|
|
4635
|
-
let D = b ?
|
|
4636
|
-
T && !M.current && (M.current =
|
|
4637
|
-
T &&
|
|
4689
|
+
let D = b ? Ue : He, 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);
|
|
4690
|
+
T && !M.current && (M.current = ft(T)), a(() => () => {
|
|
4691
|
+
T && pt(T);
|
|
4638
4692
|
}), a(() => {
|
|
4639
4693
|
let e = M.current;
|
|
4640
4694
|
if (!e) return;
|
|
@@ -4646,7 +4700,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4646
4700
|
let t = j.value, n = e.window.peek();
|
|
4647
4701
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4648
4702
|
});
|
|
4649
|
-
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e,
|
|
4703
|
+
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e, ee = N.length > 0, P = ee ? Math.min(...N.map((e) => e.low)) : 0, F = ee ? Math.max(...N.map((e) => e.high)) : 1, I = ee ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1, L = N.map((e) => e.t);
|
|
4650
4704
|
return /* @__PURE__ */ m("div", {
|
|
4651
4705
|
style: {
|
|
4652
4706
|
display: "flex",
|
|
@@ -4677,13 +4731,13 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4677
4731
|
] }, t)) })
|
|
4678
4732
|
] }),
|
|
4679
4733
|
className: y,
|
|
4680
|
-
"data-state":
|
|
4734
|
+
"data-state": ee ? void 0 : "empty",
|
|
4681
4735
|
plain: b,
|
|
4682
|
-
tooltip: v !== !1 &&
|
|
4683
|
-
if (v === !1 || !
|
|
4736
|
+
tooltip: v !== !1 && ee ? ({ width: e, height: t }) => {
|
|
4737
|
+
if (v === !1 || !ee) return;
|
|
4684
4738
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4685
4739
|
if (n <= 0) return;
|
|
4686
|
-
let i = _(
|
|
4740
|
+
let i = _(L, [0, n], .3), a = r - (g ? Math.min(r * .2, 60) : 0), o = h([P, F], [a, 0]);
|
|
4687
4741
|
if (E === "axis") return {
|
|
4688
4742
|
points: N.map((e, t) => ({
|
|
4689
4743
|
id: `c-${t}`,
|
|
@@ -4716,7 +4770,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4716
4770
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4717
4771
|
}
|
|
4718
4772
|
};
|
|
4719
|
-
let s = h([
|
|
4773
|
+
let s = h([P, F], [r, 0]);
|
|
4720
4774
|
return {
|
|
4721
4775
|
points: N.map((e, t) => ({
|
|
4722
4776
|
id: `c-${t}`,
|
|
@@ -4740,12 +4794,12 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4740
4794
|
} : void 0,
|
|
4741
4795
|
children: ({ width: e, height: t }) => {
|
|
4742
4796
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4743
|
-
if (n <= 0 || !
|
|
4744
|
-
let i = _(
|
|
4797
|
+
if (n <= 0 || !ee) return null;
|
|
4798
|
+
let i = _(L, [0, n], .3), a = h([P, F], [r, 0]), o = g ? Math.min(r * .2, 60) : 0, s = r - o, c = h([P, F], [s, 0]), v = i.bandwidth;
|
|
4745
4799
|
return /* @__PURE__ */ m("g", {
|
|
4746
4800
|
transform: `translate(${D.left},${D.top})`,
|
|
4747
4801
|
children: [
|
|
4748
|
-
!b && /* @__PURE__ */ p(
|
|
4802
|
+
!b && /* @__PURE__ */ p(vt, {
|
|
4749
4803
|
scale: a,
|
|
4750
4804
|
orientation: "y",
|
|
4751
4805
|
length: n,
|
|
@@ -4775,9 +4829,9 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4775
4829
|
}),
|
|
4776
4830
|
g && e.volume !== void 0 && /* @__PURE__ */ p("rect", {
|
|
4777
4831
|
x: n - v / 2,
|
|
4778
|
-
y: s + (o - e.volume /
|
|
4832
|
+
y: s + (o - e.volume / I * o),
|
|
4779
4833
|
width: v,
|
|
4780
|
-
height: e.volume /
|
|
4834
|
+
height: e.volume / I * o,
|
|
4781
4835
|
fill: a,
|
|
4782
4836
|
fillOpacity: .4,
|
|
4783
4837
|
"data-volume": ""
|
|
@@ -4785,7 +4839,7 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4785
4839
|
]
|
|
4786
4840
|
}, t);
|
|
4787
4841
|
}),
|
|
4788
|
-
!b &&
|
|
4842
|
+
!b && Ct(x, {
|
|
4789
4843
|
xScale: i,
|
|
4790
4844
|
yScale: c,
|
|
4791
4845
|
innerW: n,
|
|
@@ -4806,12 +4860,12 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4806
4860
|
});
|
|
4807
4861
|
}
|
|
4808
4862
|
}),
|
|
4809
|
-
S && !C && k > 1 && /* @__PURE__ */ p(
|
|
4863
|
+
S && !C && k > 1 && /* @__PURE__ */ p(zt, {
|
|
4810
4864
|
count: k,
|
|
4811
4865
|
window: j,
|
|
4812
4866
|
label: "Time range"
|
|
4813
4867
|
}),
|
|
4814
|
-
C && k > 1 && /* @__PURE__ */ p(
|
|
4868
|
+
C && k > 1 && /* @__PURE__ */ p(Bt, {
|
|
4815
4869
|
count: k,
|
|
4816
4870
|
window: j,
|
|
4817
4871
|
label: "Time range"
|
|
@@ -4821,10 +4875,10 @@ function Qn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4821
4875
|
}
|
|
4822
4876
|
//#endregion
|
|
4823
4877
|
//#region src/charts/polar/polar.tsx
|
|
4824
|
-
var
|
|
4825
|
-
function
|
|
4878
|
+
var or = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4879
|
+
function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: s = 4, max: c, tooltip: l, className: u, plain: d }) {
|
|
4826
4880
|
o();
|
|
4827
|
-
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4881
|
+
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 = Z(_), b = /* @__PURE__ */ m("table", { children: [
|
|
4828
4882
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4829
4883
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4830
4884
|
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: e.label }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
@@ -4834,7 +4888,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4834
4888
|
cx: n,
|
|
4835
4889
|
cy: r,
|
|
4836
4890
|
outerR: i,
|
|
4837
|
-
rScale:
|
|
4891
|
+
rScale: Se([0, v], [0, i])
|
|
4838
4892
|
};
|
|
4839
4893
|
};
|
|
4840
4894
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -4851,7 +4905,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4851
4905
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4852
4906
|
return {
|
|
4853
4907
|
points: e.map((e, t) => {
|
|
4854
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4908
|
+
let n = y.center(e.label) ?? 0, [o, s] = xe(r, i, a.map(e.value), n);
|
|
4855
4909
|
return {
|
|
4856
4910
|
id: `p-${t}`,
|
|
4857
4911
|
cx: o,
|
|
@@ -4867,7 +4921,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4867
4921
|
if (!g) return null;
|
|
4868
4922
|
let { cx: i, cy: a, outerR: o, rScale: c } = x(t, n), l = Array.from({ length: s }, (e, t) => o * (t + 1) / s), u = e.map((e) => {
|
|
4869
4923
|
let t = y.center(e.label) ?? 0;
|
|
4870
|
-
return
|
|
4924
|
+
return xe(i, a, c.map(e.value), t);
|
|
4871
4925
|
});
|
|
4872
4926
|
return /* @__PURE__ */ m("g", { children: [
|
|
4873
4927
|
!d && l.map((e, t) => /* @__PURE__ */ p("circle", {
|
|
@@ -4882,13 +4936,13 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4882
4936
|
r === "bar" ? e.map((e, t) => {
|
|
4883
4937
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4884
4938
|
return /* @__PURE__ */ p("path", {
|
|
4885
|
-
d:
|
|
4886
|
-
fill: e.color ??
|
|
4939
|
+
d: P(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4940
|
+
fill: e.color ?? or[t % or.length],
|
|
4887
4941
|
fillOpacity: .85,
|
|
4888
4942
|
"data-wedge": ""
|
|
4889
4943
|
}, t);
|
|
4890
4944
|
}) : (() => {
|
|
4891
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4945
|
+
let t = [...u, u[0]], n = e[0]?.color ?? or[0];
|
|
4892
4946
|
return /* @__PURE__ */ m(f, { children: [r === "area" && /* @__PURE__ */ p("path", {
|
|
4893
4947
|
d: `${E(t, "linear")}Z`,
|
|
4894
4948
|
fill: n,
|
|
@@ -4904,7 +4958,7 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4904
4958
|
})] });
|
|
4905
4959
|
})(),
|
|
4906
4960
|
!d && e.map((e, t) => {
|
|
4907
|
-
let n = y.center(e.label) ?? 0, [r, s] =
|
|
4961
|
+
let n = y.center(e.label) ?? 0, [r, s] = xe(i, a, o + 12, n);
|
|
4908
4962
|
return /* @__PURE__ */ p("text", {
|
|
4909
4963
|
x: r,
|
|
4910
4964
|
y: s,
|
|
@@ -4922,10 +4976,10 @@ function er({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4922
4976
|
}
|
|
4923
4977
|
//#endregion
|
|
4924
4978
|
//#region src/charts/gauge/gauge.tsx
|
|
4925
|
-
var
|
|
4926
|
-
function
|
|
4979
|
+
var cr = Math.PI / 180;
|
|
4980
|
+
function lr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: s = 5, title: c, description: l, width: u, height: d, className: f, plain: h }) {
|
|
4927
4981
|
o();
|
|
4928
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
4982
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * cr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
4929
4983
|
return /* @__PURE__ */ p(Q, {
|
|
4930
4984
|
title: c,
|
|
4931
4985
|
description: l,
|
|
@@ -4945,7 +4999,7 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4945
4999
|
}], w = t, T = Array.from({ length: s + 1 }, (e, n) => t + _ * n / s);
|
|
4946
5000
|
return /* @__PURE__ */ m("g", { children: [
|
|
4947
5001
|
/* @__PURE__ */ p("path", {
|
|
4948
|
-
d:
|
|
5002
|
+
d: P(c, l, u, f, x, x + b),
|
|
4949
5003
|
fill: "var(--cascivo-chart-grid)",
|
|
4950
5004
|
fillOpacity: .25,
|
|
4951
5005
|
"data-track": ""
|
|
@@ -4953,13 +5007,13 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4953
5007
|
C.map((e, t) => {
|
|
4954
5008
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
4955
5009
|
return w = e.upTo, /* @__PURE__ */ p("path", {
|
|
4956
|
-
d:
|
|
5010
|
+
d: P(c, l, u, f, r, i),
|
|
4957
5011
|
fill: e.color,
|
|
4958
5012
|
"data-zone": ""
|
|
4959
5013
|
}, t);
|
|
4960
5014
|
}),
|
|
4961
5015
|
!h && T.map((e, t) => {
|
|
4962
|
-
let n = S(e), [r, i] =
|
|
5016
|
+
let n = S(e), [r, i] = xe(c, l, f - 2, n), [a, o] = xe(c, l, f - 8, n), [s, u] = xe(c, l, f - 18, n);
|
|
4963
5017
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("line", {
|
|
4964
5018
|
x1: r,
|
|
4965
5019
|
y1: i,
|
|
@@ -4979,7 +5033,7 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4979
5033
|
})] }, t);
|
|
4980
5034
|
}),
|
|
4981
5035
|
(() => {
|
|
4982
|
-
let [e, t] =
|
|
5036
|
+
let [e, t] = xe(c, l, g, S(v));
|
|
4983
5037
|
return /* @__PURE__ */ p("line", {
|
|
4984
5038
|
x1: c,
|
|
4985
5039
|
y1: l,
|
|
@@ -5013,4 +5067,4 @@ function nr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5013
5067
|
});
|
|
5014
5068
|
}
|
|
5015
5069
|
//#endregion
|
|
5016
|
-
export {
|
|
5070
|
+
export { We as AXIS_CHAR_PX, un as AreaChart, $ as Axis, pn as BarChart, Dn as Boxplot, zt as Brush, jn as BubbleChart, Un as Bullet, ir as Calendar, ar as Candlestick, Qe as CanvasLayer, Mt as ChartDefs, Q as ChartFrame, Pn as ComboChart, He as DEFAULT_MARGINS, Dt as DataLabel, Bt as DataZoom, qn as Funnel, lr as Gauge, Pt as Glyph, vt as GridLines, Fn as Heatmap, Tn as Histogram, wn as Kpi, Zt as Legend, on as LineChart, xn as Meter, Ue as PLAIN_MARGINS, gn as PieChart, sr as Polar, Vn as Radar, Gn as RadialBar, $n as Sankey, vn as ScatterChart, yn as Sparkline, Yn as Stream, Zn as Sunburst, Rt as Text, at as Toolbox, Ln as Treemap, Yt as VisualMap, mt as _syncGroupCount, De as aggregate, Z as angleBand, wt as annotationSummary, P as arcPath, ee as areaPath, qe as autoLabelStride, _ as bandScale, Oe as bin, B as binValues, Be as bindStream, V as boxStats, R as cellPath, Le as decimate, _e as divergingRamp, lt as download, Ne as encode, Pe as encodeCategory, H as extent, jt as fillFor, Ce as filter, ft as getSyncGroup, Nt as glyphPath, kt as gradientId, rt as isZoomed, Ge as leftMarginForLabels, E as linePath, h as linearScale, se as linkPath, y as logScale, Fe as lttb, qt as mapVisual, ae as maxDepth, Ie as minmax, L as nearestIndex, g as niceTicks, nt as panWindow, Y as partition, At as patternId, Kt as pieceIndex, xe as polarPoint, w as quantize, Se as radiusScale, be as rampLightness, ve as rampOf, ye as rampStops, je as regression, pt as releaseSyncGroup, St as renderAnnotation, Ct as renderAnnotations, $e as resolveColor, Et as resolveLabels, Ke as rightMarginForLabels, oe as sankeyLayout, ge as sequentialRamp, st as serializeSvg, Te as sort, T as splitDefined, v as sqrtScale, K as squarify, F as stackSeries, q as streamExtent, ie as streamLayout, J as sumValue, ct as svgToPngBlob, C as timeScale, I as toStackedSeries, Ve as useChartSize, ze as useStreamSeries, Jt as visualVisible, re as voronoiCells, te as voronoiFind, Lt as wrapText, tt as zoomWindow };
|