@cascivo/charts 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts.css +1 -1
- package/dist/index.d.ts +20 -13
- package/dist/index.js +508 -505
- package/dist/node/index.js +508 -505
- package/package.json +3 -3
package/dist/node/index.js
CHANGED
|
@@ -277,23 +277,23 @@ function M(e) {
|
|
|
277
277
|
}
|
|
278
278
|
return o;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function ne(e, t, n = "linear") {
|
|
281
281
|
if (e.length === 0) return "";
|
|
282
282
|
let r = D(e, n), i = e[e.length - 1], a = e[0];
|
|
283
283
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function N(e, t, n, r, i, a) {
|
|
286
286
|
let o = 2 * Math.PI;
|
|
287
287
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
288
288
|
let a = i + Math.PI;
|
|
289
|
-
return
|
|
289
|
+
return N(e, t, n, r, i, a) + N(e, t, n, r, a, i + o - 1e-9);
|
|
290
290
|
}
|
|
291
291
|
let s = (n, r) => [T(e + n * Math.sin(r)), T(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = T(n), u = T(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
292
292
|
if (r <= 0) return `M${T(e)},${T(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
293
293
|
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
294
294
|
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function P(e) {
|
|
297
297
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
298
298
|
return e.map((e) => e.map((e, t) => {
|
|
299
299
|
let r = n[t];
|
|
@@ -302,7 +302,7 @@ function F(e) {
|
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
304
|
//#region src/engine/stacked.ts
|
|
305
|
-
function
|
|
305
|
+
function F(e) {
|
|
306
306
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
307
307
|
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));
|
|
308
308
|
return {
|
|
@@ -324,7 +324,7 @@ function I(e) {
|
|
|
324
324
|
}
|
|
325
325
|
//#endregion
|
|
326
326
|
//#region src/engine/nearest.ts
|
|
327
|
-
function
|
|
327
|
+
function re(e, t) {
|
|
328
328
|
if (e.length === 0) return -1;
|
|
329
329
|
if (e.length === 1) return 0;
|
|
330
330
|
let n = 0, r = e.length - 1;
|
|
@@ -336,7 +336,7 @@ function ne(e, t) {
|
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region src/engine/voronoi.ts
|
|
339
|
-
function
|
|
339
|
+
function ie(e, t, n) {
|
|
340
340
|
let r = -1, i = Infinity;
|
|
341
341
|
for (let a = 0; a < e.length; a++) {
|
|
342
342
|
let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
|
|
@@ -344,7 +344,7 @@ function re(e, t, n) {
|
|
|
344
344
|
}
|
|
345
345
|
return r;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function ae(e, t, n, r, i) {
|
|
348
348
|
if (e.length === 0) return e;
|
|
349
349
|
let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
|
|
350
350
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -356,7 +356,7 @@ function ie(e, t, n, r, i) {
|
|
|
356
356
|
}
|
|
357
357
|
return a;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function I(e, t) {
|
|
360
360
|
let n = [
|
|
361
361
|
[t.x0, t.y0],
|
|
362
362
|
[t.x1, t.y0],
|
|
@@ -368,21 +368,21 @@ function L(e, t) {
|
|
|
368
368
|
for (let n = 0; n < e.length && i.length > 0; n++) {
|
|
369
369
|
if (n === r) continue;
|
|
370
370
|
let a = e[n];
|
|
371
|
-
i =
|
|
371
|
+
i = ae(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
|
|
372
372
|
}
|
|
373
373
|
return i;
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function oe(e) {
|
|
377
377
|
return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
|
|
378
378
|
}
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/engine/stats.ts
|
|
381
|
-
function
|
|
381
|
+
function L(e) {
|
|
382
382
|
let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
|
|
383
383
|
return (e[Math.floor(t * .75)] ?? 0) - n;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function R(e, t) {
|
|
386
386
|
if (e.length === 0) return [];
|
|
387
387
|
let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
|
|
388
388
|
if (i === a) return [{
|
|
@@ -393,7 +393,7 @@ function z(e, t) {
|
|
|
393
393
|
let o;
|
|
394
394
|
if (t !== void 0 && t > 0) o = t;
|
|
395
395
|
else {
|
|
396
|
-
let e = 2 *
|
|
396
|
+
let e = 2 * L(n) * r ** (-1 / 3);
|
|
397
397
|
o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
|
|
398
398
|
}
|
|
399
399
|
let s = (a - i) / o;
|
|
@@ -413,7 +413,7 @@ function z(e, t) {
|
|
|
413
413
|
}
|
|
414
414
|
return c;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function z(e) {
|
|
417
417
|
if (e.length === 0) return {
|
|
418
418
|
min: 0,
|
|
419
419
|
q1: 0,
|
|
@@ -435,7 +435,7 @@ function B(e) {
|
|
|
435
435
|
outliers: d
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function B(e) {
|
|
439
439
|
if (e.length === 0) return [0, 1];
|
|
440
440
|
let t = e[0] ?? 0, n = e[0] ?? 0;
|
|
441
441
|
for (let r of e) r < t && (t = r), r > n && (n = r);
|
|
@@ -443,11 +443,11 @@ function V(e) {
|
|
|
443
443
|
}
|
|
444
444
|
//#endregion
|
|
445
445
|
//#region src/engine/treemap.ts
|
|
446
|
-
function
|
|
446
|
+
function V(e, t, n) {
|
|
447
447
|
let r = Math.max(...e), i = Math.min(...e);
|
|
448
448
|
return Math.max(t * t * r / (n * n), n * n / (t * t * i));
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function H(e, t, n, r, i, a, o) {
|
|
451
451
|
let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
|
|
452
452
|
for (let t = 0; t < e.length; t++) {
|
|
453
453
|
let n = e[t] ?? 0, u = a[t] ?? "";
|
|
@@ -472,40 +472,40 @@ function U(e, t, n, r, i, a, o) {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function U(e, t, n, r, i, a) {
|
|
476
476
|
if (e.length === 0 || r <= 0 || i <= 0) return;
|
|
477
477
|
let o = e.reduce((e, t) => e + t.value, 0);
|
|
478
478
|
if (o === 0) return;
|
|
479
479
|
let s = r * i, c = e.map((e) => e.value / o * s), l = e.map((e) => e.id), u = [], d = [], f = Math.min(r, i), p = 0, m = 0;
|
|
480
480
|
for (; m < c.length;) {
|
|
481
481
|
let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
|
|
482
|
-
if (u.length === 0 ||
|
|
482
|
+
if (u.length === 0 || V(g, f, _) <= V(u, f, p)) u = g, d = [...d, h], p = _, m++;
|
|
483
483
|
else {
|
|
484
484
|
let o = p / s;
|
|
485
485
|
if (r >= i) {
|
|
486
486
|
let s = o * r;
|
|
487
|
-
|
|
487
|
+
H(u, t, n, s, i, d, a), U(e.slice(m), t + s, n, r - s, i, a);
|
|
488
488
|
} else {
|
|
489
489
|
let s = o * i;
|
|
490
|
-
|
|
490
|
+
H(u, t, n, r, s, d, a), U(e.slice(m), t, n + s, r, i - s, a);
|
|
491
491
|
}
|
|
492
492
|
return;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
if (u.length > 0) {
|
|
496
496
|
let e = p / s;
|
|
497
|
-
r >= i ?
|
|
497
|
+
r >= i ? H(u, t, n, e * r, i, d, a) : H(u, t, n, r, e * i, d, a);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function W(e, t, n) {
|
|
501
501
|
if (e.length === 0 || t <= 0 || n <= 0) return [];
|
|
502
502
|
let r = [...e].sort((e, t) => t.value - e.value), i = [];
|
|
503
|
-
return
|
|
503
|
+
return U(r, 0, 0, t, n, i), i;
|
|
504
504
|
}
|
|
505
505
|
//#endregion
|
|
506
506
|
//#region src/engine/stream.ts
|
|
507
|
-
function
|
|
508
|
-
let n =
|
|
507
|
+
function G(e, t = "silhouette") {
|
|
508
|
+
let n = P(e);
|
|
509
509
|
if (t === "zero") return n;
|
|
510
510
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
511
511
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -513,39 +513,39 @@ function K(e, t = "silhouette") {
|
|
|
513
513
|
return [e - r, t - r];
|
|
514
514
|
}));
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function K(e) {
|
|
517
517
|
let t = 0, n = 0;
|
|
518
518
|
for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
|
|
519
519
|
return [t, n];
|
|
520
520
|
}
|
|
521
521
|
//#endregion
|
|
522
522
|
//#region src/engine/hierarchy.ts
|
|
523
|
-
function
|
|
524
|
-
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e +
|
|
523
|
+
function q(e) {
|
|
524
|
+
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + q(t), 0) : e.value ?? 0;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function J(e, t = 2 * Math.PI) {
|
|
527
527
|
let n = [], r = (e, t, i, a) => {
|
|
528
528
|
if (n.push({
|
|
529
529
|
node: e,
|
|
530
530
|
depth: t,
|
|
531
531
|
a0: i,
|
|
532
532
|
a1: a,
|
|
533
|
-
value:
|
|
533
|
+
value: q(e)
|
|
534
534
|
}), !e.children) return;
|
|
535
|
-
let o = a - i, s =
|
|
535
|
+
let o = a - i, s = q(e) || 1, c = i;
|
|
536
536
|
for (let n of e.children) {
|
|
537
|
-
let e = c + o *
|
|
537
|
+
let e = c + o * q(n) / s;
|
|
538
538
|
r(n, t + 1, c, e), c = e;
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
return r(e, 0, 0, t), n;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function se(e) {
|
|
544
544
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
545
545
|
}
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region src/engine/sankey.ts
|
|
548
|
-
function
|
|
548
|
+
function Y(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
|
|
549
549
|
let o = /* @__PURE__ */ new Map();
|
|
550
550
|
for (let t of e) o.set(t.id, {
|
|
551
551
|
...t,
|
|
@@ -599,61 +599,61 @@ function X(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }
|
|
|
599
599
|
links: v
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function ce(e) {
|
|
603
603
|
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;
|
|
604
604
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
607
607
|
//#region src/engine/ramp.ts
|
|
608
|
-
var
|
|
609
|
-
l:
|
|
610
|
-
c:
|
|
611
|
-
h:
|
|
612
|
-
}),
|
|
608
|
+
var le = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ue = (e, t, n) => e + (t - e) * n, de = (e, t, n) => ({
|
|
609
|
+
l: ue(e.l, t.l, n),
|
|
610
|
+
c: ue(e.c, t.c, n),
|
|
611
|
+
h: ue(e.h, t.h, n)
|
|
612
|
+
}), fe = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, pe = {
|
|
613
613
|
l: .95,
|
|
614
614
|
c: .04,
|
|
615
615
|
h: 232
|
|
616
|
-
},
|
|
616
|
+
}, me = {
|
|
617
617
|
l: .34,
|
|
618
618
|
c: .15,
|
|
619
619
|
h: 274
|
|
620
|
-
},
|
|
620
|
+
}, X = {
|
|
621
621
|
l: .48,
|
|
622
622
|
c: .14,
|
|
623
623
|
h: 248
|
|
624
|
-
},
|
|
624
|
+
}, he = {
|
|
625
625
|
l: .96,
|
|
626
626
|
c: .02,
|
|
627
627
|
h: 110
|
|
628
|
-
},
|
|
628
|
+
}, ge = {
|
|
629
629
|
l: .52,
|
|
630
630
|
c: .15,
|
|
631
631
|
h: 42
|
|
632
632
|
};
|
|
633
|
-
function ge(e) {
|
|
634
|
-
return de(ue(fe, pe, ce(e)));
|
|
635
|
-
}
|
|
636
633
|
function _e(e) {
|
|
637
|
-
|
|
638
|
-
return de(t < .5 ? ue(Z, me, t * 2) : ue(me, he, (t - .5) * 2));
|
|
634
|
+
return fe(de(pe, me, le(e)));
|
|
639
635
|
}
|
|
640
636
|
function ve(e) {
|
|
641
|
-
|
|
637
|
+
let t = le(e);
|
|
638
|
+
return fe(t < .5 ? de(X, he, t * 2) : de(he, ge, (t - .5) * 2));
|
|
642
639
|
}
|
|
643
|
-
function ye(e
|
|
644
|
-
|
|
640
|
+
function ye(e) {
|
|
641
|
+
return e === "diverging" ? ve : _e;
|
|
642
|
+
}
|
|
643
|
+
function be(e, t = "sequential") {
|
|
644
|
+
let n = ye(t);
|
|
645
645
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function xe(e) {
|
|
648
648
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
649
649
|
return t ? Number(t[1]) : NaN;
|
|
650
650
|
}
|
|
651
651
|
//#endregion
|
|
652
652
|
//#region src/engine/polar.ts
|
|
653
|
-
function
|
|
653
|
+
function Se(e, t, n, r) {
|
|
654
654
|
return [T(e + n * Math.sin(r)), T(t - n * Math.cos(r))];
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function Z(e, t = [0, 2 * Math.PI]) {
|
|
657
657
|
let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
|
|
658
658
|
let n = i.get(e);
|
|
659
659
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -946,9 +946,9 @@ function Ye(e, t, n = "horizontal") {
|
|
|
946
946
|
if (!(r >= i)) return Math.ceil(i / r);
|
|
947
947
|
}
|
|
948
948
|
var Xe = {
|
|
949
|
-
frame: "
|
|
950
|
-
"cascivo-chart-in": "_cascivo-chart-
|
|
951
|
-
fallback: "
|
|
949
|
+
frame: "_frame_1gm0a_2",
|
|
950
|
+
"cascivo-chart-in": "_cascivo-chart-in_1gm0a_1",
|
|
951
|
+
fallback: "_fallback_1gm0a_78"
|
|
952
952
|
};
|
|
953
953
|
//#endregion
|
|
954
954
|
//#region src/core/data-point.ts
|
|
@@ -1170,11 +1170,11 @@ var ft = {
|
|
|
1170
1170
|
clipPath: "inset(50%)",
|
|
1171
1171
|
whiteSpace: "nowrap"
|
|
1172
1172
|
};
|
|
1173
|
-
function Q({ title: e, description: t, width: n, height: r
|
|
1173
|
+
function Q({ title: e, description: t, width: n, height: r, fallback: i, children: d, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: ee, onAfterDraw: k }) {
|
|
1174
1174
|
s();
|
|
1175
|
-
let A = c(), j = `${A}-desc`, te = `${A}-live`, { ref: M, width:
|
|
1175
|
+
let A = c(), j = `${A}-desc`, te = `${A}-live`, { ref: M, width: ne, height: N } = He(n ?? 400, 300), P = a(null), F = a(!1), re = l(null), ae = l(null), I = l(null), oe = l(null);
|
|
1176
1176
|
o(() => {
|
|
1177
|
-
let e =
|
|
1177
|
+
let e = oe.current;
|
|
1178
1178
|
if (!e || !T) return;
|
|
1179
1179
|
let t = (t) => {
|
|
1180
1180
|
t.preventDefault();
|
|
@@ -1183,56 +1183,56 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1183
1183
|
};
|
|
1184
1184
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1185
1185
|
});
|
|
1186
|
-
let
|
|
1186
|
+
let L = () => {
|
|
1187
1187
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1188
|
-
},
|
|
1189
|
-
let t =
|
|
1188
|
+
}, R = n ?? ne.value, z = r ?? N.value, B = E === !0 ? {} : E || null, V = () => ae.current ? lt(ae.current) : null, H = () => {
|
|
1189
|
+
let t = V();
|
|
1190
1190
|
t && dt(t, `${e || "chart"}.svg`);
|
|
1191
|
-
},
|
|
1192
|
-
let t =
|
|
1191
|
+
}, U = () => {
|
|
1192
|
+
let t = V();
|
|
1193
1193
|
t && ut(t, {
|
|
1194
|
-
width:
|
|
1195
|
-
height:
|
|
1194
|
+
width: R,
|
|
1195
|
+
height: z,
|
|
1196
1196
|
dpr: 2
|
|
1197
1197
|
}).then((t) => {
|
|
1198
1198
|
t && dt(t, `${e || "chart"}.png`);
|
|
1199
1199
|
});
|
|
1200
|
-
},
|
|
1201
|
-
|
|
1202
|
-
},
|
|
1203
|
-
width:
|
|
1204
|
-
height:
|
|
1200
|
+
}, W = () => {
|
|
1201
|
+
L(), D?.();
|
|
1202
|
+
}, G = typeof b == "function" ? b({
|
|
1203
|
+
width: R,
|
|
1204
|
+
height: z
|
|
1205
1205
|
}) : b;
|
|
1206
1206
|
o(() => {
|
|
1207
|
-
let e =
|
|
1208
|
-
if (!
|
|
1209
|
-
let t = e === null ? void 0 :
|
|
1210
|
-
|
|
1207
|
+
let e = P.value;
|
|
1208
|
+
if (!G || !re.current) return;
|
|
1209
|
+
let t = e === null ? void 0 : G.points[e];
|
|
1210
|
+
re.current.textContent = t ? (G.format ?? Ze)(t) : "";
|
|
1211
1211
|
});
|
|
1212
|
-
let
|
|
1212
|
+
let K = {
|
|
1213
1213
|
position: "absolute",
|
|
1214
1214
|
inset: 0,
|
|
1215
1215
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1216
1216
|
background: "transparent",
|
|
1217
1217
|
touchAction: T ? "none" : void 0
|
|
1218
|
-
},
|
|
1218
|
+
}, q = C === "canvas" && w !== void 0, J = G !== void 0 || T !== void 0, se = {};
|
|
1219
1219
|
if (O && typeof O == "object") {
|
|
1220
|
-
let e =
|
|
1220
|
+
let e = se;
|
|
1221
1221
|
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(", "));
|
|
1222
1222
|
}
|
|
1223
|
-
let
|
|
1224
|
-
...
|
|
1225
|
-
...
|
|
1223
|
+
let Y = J || q || B || Object.keys(se).length > 0 ? {
|
|
1224
|
+
...se,
|
|
1225
|
+
...J || q || B ? { position: "relative" } : {}
|
|
1226
1226
|
} : void 0;
|
|
1227
1227
|
return /* @__PURE__ */ h("div", {
|
|
1228
1228
|
ref: M,
|
|
1229
1229
|
className: [Xe.frame, g].filter(Boolean).join(" "),
|
|
1230
|
-
style:
|
|
1230
|
+
style: Y,
|
|
1231
1231
|
..._ !== void 0 && { "data-state": _ },
|
|
1232
1232
|
...y === !0 && { "data-plain": "" },
|
|
1233
1233
|
...O === !1 && { "data-no-anim": "" },
|
|
1234
1234
|
children: [
|
|
1235
|
-
|
|
1235
|
+
B && /* @__PURE__ */ m("div", {
|
|
1236
1236
|
style: {
|
|
1237
1237
|
position: "absolute",
|
|
1238
1238
|
top: 4,
|
|
@@ -1240,51 +1240,51 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1240
1240
|
zIndex: 12
|
|
1241
1241
|
},
|
|
1242
1242
|
children: /* @__PURE__ */ m(st, {
|
|
1243
|
-
options:
|
|
1244
|
-
onPng:
|
|
1245
|
-
onSvg:
|
|
1243
|
+
options: B,
|
|
1244
|
+
onPng: U,
|
|
1245
|
+
onSvg: H,
|
|
1246
1246
|
onToggleData: () => {
|
|
1247
|
-
|
|
1247
|
+
F.value = !F.value;
|
|
1248
1248
|
},
|
|
1249
|
-
onRestore:
|
|
1250
|
-
showData:
|
|
1249
|
+
onRestore: W,
|
|
1250
|
+
showData: F.value
|
|
1251
1251
|
})
|
|
1252
1252
|
}),
|
|
1253
|
-
|
|
1253
|
+
q && /* @__PURE__ */ m(et, {
|
|
1254
1254
|
size: () => ({
|
|
1255
|
-
width: n ??
|
|
1256
|
-
height: r ??
|
|
1255
|
+
width: n ?? ne.value,
|
|
1256
|
+
height: r ?? N.value
|
|
1257
1257
|
}),
|
|
1258
1258
|
paint: w
|
|
1259
1259
|
}),
|
|
1260
1260
|
/* @__PURE__ */ h("svg", {
|
|
1261
|
-
ref:
|
|
1261
|
+
ref: ae,
|
|
1262
1262
|
role: "img",
|
|
1263
1263
|
"aria-label": e,
|
|
1264
1264
|
"aria-describedby": t ? j : void 0,
|
|
1265
|
-
width:
|
|
1266
|
-
height:
|
|
1267
|
-
viewBox: `0 0 ${
|
|
1265
|
+
width: R,
|
|
1266
|
+
height: z,
|
|
1267
|
+
viewBox: `0 0 ${R} ${z}`,
|
|
1268
1268
|
children: [
|
|
1269
1269
|
t && /* @__PURE__ */ m("desc", {
|
|
1270
1270
|
id: j,
|
|
1271
1271
|
children: t
|
|
1272
1272
|
}),
|
|
1273
1273
|
ee?.({
|
|
1274
|
-
width:
|
|
1275
|
-
height:
|
|
1274
|
+
width: R,
|
|
1275
|
+
height: z
|
|
1276
1276
|
}),
|
|
1277
1277
|
d({
|
|
1278
|
-
width:
|
|
1279
|
-
height:
|
|
1278
|
+
width: R,
|
|
1279
|
+
height: z
|
|
1280
1280
|
}),
|
|
1281
1281
|
k?.({
|
|
1282
|
-
width:
|
|
1283
|
-
height:
|
|
1282
|
+
width: R,
|
|
1283
|
+
height: z
|
|
1284
1284
|
}),
|
|
1285
1285
|
_ === "empty" && /* @__PURE__ */ m("text", {
|
|
1286
|
-
x:
|
|
1287
|
-
y:
|
|
1286
|
+
x: R / 2,
|
|
1287
|
+
y: z / 2,
|
|
1288
1288
|
textAnchor: "middle",
|
|
1289
1289
|
dominantBaseline: "central",
|
|
1290
1290
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1299,16 +1299,16 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1299
1299
|
style: ft,
|
|
1300
1300
|
children: i
|
|
1301
1301
|
}),
|
|
1302
|
-
|
|
1302
|
+
B && F.value && i && /* @__PURE__ */ m("div", {
|
|
1303
1303
|
"data-data-view": "",
|
|
1304
1304
|
style: { overflowX: "auto" },
|
|
1305
1305
|
children: i
|
|
1306
1306
|
}),
|
|
1307
|
-
|
|
1308
|
-
|
|
1307
|
+
J && /* @__PURE__ */ h(p, { children: [
|
|
1308
|
+
G !== void 0 && /* @__PURE__ */ h(p, { children: [
|
|
1309
1309
|
/* @__PURE__ */ m("span", {
|
|
1310
1310
|
id: te,
|
|
1311
|
-
ref:
|
|
1311
|
+
ref: re,
|
|
1312
1312
|
"aria-live": "polite",
|
|
1313
1313
|
style: {
|
|
1314
1314
|
position: "absolute",
|
|
@@ -1322,21 +1322,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1322
1322
|
border: 0
|
|
1323
1323
|
}
|
|
1324
1324
|
}),
|
|
1325
|
-
|
|
1325
|
+
G.mode === "axis" && P.value !== null && G.points[P.value] !== void 0 && /* @__PURE__ */ m("div", {
|
|
1326
1326
|
"aria-hidden": "true",
|
|
1327
1327
|
style: {
|
|
1328
1328
|
position: "absolute",
|
|
1329
|
-
left:
|
|
1329
|
+
left: G.points[P.value].cx,
|
|
1330
1330
|
top: 0,
|
|
1331
1331
|
width: 1,
|
|
1332
|
-
height:
|
|
1332
|
+
height: z,
|
|
1333
1333
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1334
1334
|
pointerEvents: "none",
|
|
1335
1335
|
zIndex: 9
|
|
1336
1336
|
}
|
|
1337
1337
|
}),
|
|
1338
|
-
|
|
1339
|
-
let e =
|
|
1338
|
+
P.value !== null && G.points[P.value] !== void 0 && (() => {
|
|
1339
|
+
let e = G.points[P.value];
|
|
1340
1340
|
return /* @__PURE__ */ m("div", {
|
|
1341
1341
|
"aria-hidden": "true",
|
|
1342
1342
|
style: {
|
|
@@ -1353,14 +1353,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1353
1353
|
}
|
|
1354
1354
|
});
|
|
1355
1355
|
})(),
|
|
1356
|
-
|
|
1357
|
-
point:
|
|
1358
|
-
model:
|
|
1356
|
+
P.value !== null && G.points[P.value] !== void 0 && /* @__PURE__ */ m(Qe, {
|
|
1357
|
+
point: G.points[P.value],
|
|
1358
|
+
model: G
|
|
1359
1359
|
})
|
|
1360
1360
|
] }),
|
|
1361
|
-
T && !
|
|
1361
|
+
T && !B && at(T.window.value, T.count) && /* @__PURE__ */ m("button", {
|
|
1362
1362
|
type: "button",
|
|
1363
|
-
onClick:
|
|
1363
|
+
onClick: L,
|
|
1364
1364
|
style: {
|
|
1365
1365
|
position: "absolute",
|
|
1366
1366
|
top: 4,
|
|
@@ -1378,32 +1378,32 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1378
1378
|
children: f(u.charts.resetZoom)
|
|
1379
1379
|
}),
|
|
1380
1380
|
/* @__PURE__ */ m("div", {
|
|
1381
|
-
ref:
|
|
1381
|
+
ref: oe,
|
|
1382
1382
|
role: "application",
|
|
1383
1383
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1384
1384
|
tabIndex: 0,
|
|
1385
|
-
style:
|
|
1385
|
+
style: K,
|
|
1386
1386
|
onPointerDown: (e) => {
|
|
1387
|
-
T && (
|
|
1387
|
+
T && (I.current = {
|
|
1388
1388
|
x: e.clientX,
|
|
1389
1389
|
win: [...T.window.value]
|
|
1390
1390
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1391
1391
|
},
|
|
1392
1392
|
onPointerMove: (e) => {
|
|
1393
|
-
if (T &&
|
|
1394
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1395
|
-
T.window.value = it(
|
|
1393
|
+
if (T && I.current && e.buttons === 1) {
|
|
1394
|
+
let t = e.currentTarget.getBoundingClientRect(), n = I.current.win[1] - I.current.win[0] + 1, r = e.clientX - I.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1395
|
+
T.window.value = it(I.current.win, T.count, i);
|
|
1396
1396
|
return;
|
|
1397
1397
|
}
|
|
1398
|
-
if (!
|
|
1398
|
+
if (!G || !G.points.length) return;
|
|
1399
1399
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1400
|
-
|
|
1400
|
+
P.value = G.mode === "axis" ? $e(G.points, n, r, "x") : S === "voronoi" ? ie(G.points.map((e) => [e.cx, e.cy]), n, r) : $e(G.points, n, r, "xy");
|
|
1401
1401
|
},
|
|
1402
1402
|
onPointerUp: () => {
|
|
1403
|
-
|
|
1403
|
+
I.current = null;
|
|
1404
1404
|
},
|
|
1405
1405
|
onPointerLeave: () => {
|
|
1406
|
-
|
|
1406
|
+
I.current = null, G && (P.value = null);
|
|
1407
1407
|
},
|
|
1408
1408
|
onKeyDown: (e) => {
|
|
1409
1409
|
if (T) {
|
|
@@ -1416,33 +1416,33 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1416
1416
|
return;
|
|
1417
1417
|
}
|
|
1418
1418
|
if (e.key === "0") {
|
|
1419
|
-
e.preventDefault(),
|
|
1419
|
+
e.preventDefault(), L();
|
|
1420
1420
|
return;
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
|
-
if (!
|
|
1424
|
-
let t =
|
|
1425
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(),
|
|
1426
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(),
|
|
1427
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
1428
|
-
else if (e.key === "End") e.preventDefault(),
|
|
1429
|
-
else if (e.key === "Escape")
|
|
1423
|
+
if (!G || !G.points.length) return;
|
|
1424
|
+
let t = P.value;
|
|
1425
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), P.value = t === null ? 0 : Math.min(t + 1, G.points.length - 1);
|
|
1426
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), P.value = t === null ? G.points.length - 1 : Math.max(t - 1, 0);
|
|
1427
|
+
else if (e.key === "Home") e.preventDefault(), P.value = 0;
|
|
1428
|
+
else if (e.key === "End") e.preventDefault(), P.value = G.points.length - 1;
|
|
1429
|
+
else if (e.key === "Escape") P.value = null;
|
|
1430
1430
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1431
1431
|
e.preventDefault();
|
|
1432
|
-
let t =
|
|
1432
|
+
let t = P.value, n = t === null ? void 0 : G.points[t];
|
|
1433
1433
|
n && x(n);
|
|
1434
1434
|
}
|
|
1435
1435
|
},
|
|
1436
1436
|
onClick: () => {
|
|
1437
|
-
if (!
|
|
1438
|
-
let e =
|
|
1437
|
+
if (!G) return;
|
|
1438
|
+
let e = P.value, t = e === null ? void 0 : G.points[e];
|
|
1439
1439
|
x && t && x(t);
|
|
1440
1440
|
},
|
|
1441
1441
|
onFocus: () => {
|
|
1442
|
-
|
|
1442
|
+
G && G.points.length > 0 && P.value === null && (P.value = 0);
|
|
1443
1443
|
},
|
|
1444
1444
|
onBlur: () => {
|
|
1445
|
-
|
|
1445
|
+
G && (P.value = null);
|
|
1446
1446
|
}
|
|
1447
1447
|
})
|
|
1448
1448
|
] })
|
|
@@ -2069,7 +2069,7 @@ function Jt(e, t) {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
function Yt(e, t) {
|
|
2071
2071
|
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = qt(e, t), a = {};
|
|
2072
|
-
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ?
|
|
2072
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? be(t.pieces ?? Ut, r)[Jt(e, t)] : ye(r)(i)), n === "size" || n === "both") {
|
|
2073
2073
|
let [e, n] = t.sizeRange ?? Wt;
|
|
2074
2074
|
a.size = Kt(e, n, i);
|
|
2075
2075
|
}
|
|
@@ -2082,7 +2082,7 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2082
2082
|
s();
|
|
2083
2083
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2084
2084
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2085
|
-
let t = e.pieces ?? Ut, i =
|
|
2085
|
+
let t = e.pieces ?? Ut, i = be(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2086
2086
|
if (!n) return;
|
|
2087
2087
|
let t = new Set(n.value);
|
|
2088
2088
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2130,7 +2130,7 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2130
2130
|
})
|
|
2131
2131
|
});
|
|
2132
2132
|
}
|
|
2133
|
-
let { min: o, max: c } = e, l = c - o || 1, u =
|
|
2133
|
+
let { min: o, max: c } = e, l = c - o || 1, u = be(8, e.ramp ?? "sequential"), d = (e) => (e - o) / l * 100, f = t?.value[0] ?? o, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2134
2134
|
let n = t.getBoundingClientRect();
|
|
2135
2135
|
return n.width === 0 ? o : o + Gt((e - n.left) / n.width) * l;
|
|
2136
2136
|
}, y = (e, n) => {
|
|
@@ -2278,40 +2278,40 @@ var on = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
|
2278
2278
|
function sn(e) {
|
|
2279
2279
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2280
2280
|
}
|
|
2281
|
-
function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monotone", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: C, annotations: T, labels: O, connectNulls: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode:
|
|
2281
|
+
function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monotone", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: C, annotations: T, labels: O, connectNulls: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: ne, secondAxis: N, decimate: P, toolbox: F, transition: re, onBeforeDraw: ie, onAfterDraw: ae }) {
|
|
2282
2282
|
s();
|
|
2283
|
-
let
|
|
2283
|
+
let I = a(/* @__PURE__ */ new Set()), oe = C ? null : Ot(O), L = P === !0 ? {
|
|
2284
2284
|
method: "lttb",
|
|
2285
2285
|
threshold: 1e3
|
|
2286
|
-
} :
|
|
2287
|
-
method:
|
|
2288
|
-
threshold:
|
|
2289
|
-
} : null,
|
|
2290
|
-
M && !
|
|
2286
|
+
} : P ? {
|
|
2287
|
+
method: P.method ?? "lttb",
|
|
2288
|
+
threshold: P.threshold ?? 1e3
|
|
2289
|
+
} : null, R = e.reduce((e, t) => Math.max(e, t.data.length), 0), z = (A || j || te || M !== void 0) && R > 0, B = a([0, Math.max(0, R - 1)]), V = l(null);
|
|
2290
|
+
M && !V.current && (V.current = mt(M)), o(() => () => {
|
|
2291
2291
|
M && ht(M);
|
|
2292
2292
|
}), o(() => {
|
|
2293
|
-
let e =
|
|
2293
|
+
let e = V.current;
|
|
2294
2294
|
if (!e) return;
|
|
2295
|
-
let t = e.window.value, n =
|
|
2296
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2295
|
+
let t = e.window.value, n = B.peek();
|
|
2296
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (B.value = t);
|
|
2297
2297
|
}), o(() => {
|
|
2298
|
-
let e =
|
|
2298
|
+
let e = V.current;
|
|
2299
2299
|
if (!e) return;
|
|
2300
|
-
let t =
|
|
2300
|
+
let t = B.value, n = e.window.peek();
|
|
2301
2301
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2302
2302
|
});
|
|
2303
|
-
let
|
|
2303
|
+
let H = z ? e.map((e) => ({
|
|
2304
2304
|
...e,
|
|
2305
|
-
data: e.data.slice(
|
|
2306
|
-
})) : e,
|
|
2307
|
-
nn("LineChart", () =>
|
|
2308
|
-
let
|
|
2305
|
+
data: e.data.slice(B.value[0], B.value[1] + 1)
|
|
2306
|
+
})) : e, U = !C && H.some((e) => e.axis === "right"), W = d ?? (C ? 48 : 300), G = C ? !1 : y ?? H.length > 1, K = (e) => e.y ?? n, q = H.flatMap((e) => e.data.map((e) => t(e))), J = (e) => e.flatMap((e) => e.data.map((t) => K(e)(t))).filter((e) => Number.isFinite(e)), se = J(U ? H.filter((e) => e.axis !== "right") : H), Y = U ? J(H.filter((e) => e.axis === "right")) : [];
|
|
2307
|
+
nn("LineChart", () => H.flatMap((e) => e.data.map((t) => K(e)(t))));
|
|
2308
|
+
let ce = q.length > 0, le = g(sn(se), [0, 1]).ticks(_).map((e) => e.toLocaleString()), ue = ce && q[0] instanceof Date, de = U ? g(sn(Y), [0, 1]).ticks(_).map((e) => N?.format ? N.format(e) : e.toLocaleString()) : [], fe = q.filter((e) => typeof e == "number"), pe = q.filter((e) => e instanceof Date), me = ce ? ue ? w([new Date(Math.min(...pe.map((e) => e.getTime()))), new Date(Math.max(...pe.map((e) => e.getTime())))], [0, 1]).ticks(f).map((e) => e.toLocaleDateString()) : g([Math.min(...fe), Math.max(...fe)], [0, 1]).ticks(f).map((e) => e.toLocaleString()) : [], X = C ? We : {
|
|
2309
2309
|
...Ue,
|
|
2310
|
-
left: Ke(
|
|
2310
|
+
left: Ke(le, C),
|
|
2311
2311
|
right: qe({
|
|
2312
|
-
rightAxisLabels:
|
|
2313
|
-
bottomAxisLabels:
|
|
2314
|
-
rightAxisTitle:
|
|
2312
|
+
rightAxisLabels: de,
|
|
2313
|
+
bottomAxisLabels: me,
|
|
2314
|
+
rightAxisTitle: N?.label !== void 0 && N.label !== "",
|
|
2315
2315
|
plain: C
|
|
2316
2316
|
})
|
|
2317
2317
|
};
|
|
@@ -2326,27 +2326,27 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2326
2326
|
title: r,
|
|
2327
2327
|
description: i,
|
|
2328
2328
|
width: u,
|
|
2329
|
-
height:
|
|
2329
|
+
height: W,
|
|
2330
2330
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2331
2331
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2332
|
-
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }),
|
|
2333
|
-
/* @__PURE__ */ m("tbody", { children: (
|
|
2332
|
+
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), H.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2333
|
+
/* @__PURE__ */ m("tbody", { children: (H[0]?.data ?? []).map((e, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: String(H[0] ? t(H[0].data[n]) : "") }), H.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : K(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2334
2334
|
] }),
|
|
2335
2335
|
className: S,
|
|
2336
|
-
"data-state":
|
|
2336
|
+
"data-state": ce ? void 0 : "empty",
|
|
2337
2337
|
plain: C,
|
|
2338
|
-
tooltip: b !== !1 &&
|
|
2339
|
-
if (b === !1 || !
|
|
2340
|
-
let r = e -
|
|
2341
|
-
if (
|
|
2342
|
-
let e =
|
|
2338
|
+
tooltip: b !== !1 && ce ? ({ width: e, height: n }) => {
|
|
2339
|
+
if (b === !1 || !ce) return;
|
|
2340
|
+
let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...ue ? q.map((e) => e.getTime()) : q), o = Math.max(...ue ? q.map((e) => e.getTime()) : q), s = ue ? w([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), c = g(sn(se), [i, 0]), l = U ? g(sn(Y), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2341
|
+
if (ne === "axis") {
|
|
2342
|
+
let e = H.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2343
2343
|
for (let r = 0; r < e; r++) {
|
|
2344
2344
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
2345
|
-
|
|
2346
|
-
if (
|
|
2345
|
+
H.forEach((n, c) => {
|
|
2346
|
+
if (I.value.has(n.id)) return;
|
|
2347
2347
|
let l = n.data[r];
|
|
2348
2348
|
if (l === void 0) return;
|
|
2349
|
-
let f =
|
|
2349
|
+
let f = K(n)(l);
|
|
2350
2350
|
if (!Number.isFinite(f)) return;
|
|
2351
2351
|
let p = t(l);
|
|
2352
2352
|
i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
|
|
@@ -2356,8 +2356,8 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2356
2356
|
});
|
|
2357
2357
|
}), a !== 0 && n.push({
|
|
2358
2358
|
id: `x-${r}`,
|
|
2359
|
-
cx:
|
|
2360
|
-
cy:
|
|
2359
|
+
cx: X.left + i / a,
|
|
2360
|
+
cy: X.top + (o === Infinity ? 0 : o),
|
|
2361
2361
|
label: s,
|
|
2362
2362
|
value: s,
|
|
2363
2363
|
segments: e
|
|
@@ -2369,43 +2369,43 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2369
2369
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2370
2370
|
};
|
|
2371
2371
|
}
|
|
2372
|
-
let f =
|
|
2373
|
-
let i =
|
|
2372
|
+
let f = H.flatMap((e) => I.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2373
|
+
let i = K(e)(n);
|
|
2374
2374
|
if (!Number.isFinite(i)) return [];
|
|
2375
2375
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2376
2376
|
return {
|
|
2377
2377
|
id: `${e.id}-${r}`,
|
|
2378
|
-
cx:
|
|
2379
|
-
cy:
|
|
2378
|
+
cx: X.left + o,
|
|
2379
|
+
cy: X.top + c,
|
|
2380
2380
|
label: l,
|
|
2381
|
-
value:
|
|
2381
|
+
value: K(e)(n),
|
|
2382
2382
|
seriesId: e.id
|
|
2383
2383
|
};
|
|
2384
2384
|
}));
|
|
2385
2385
|
return x ? {
|
|
2386
2386
|
points: f,
|
|
2387
2387
|
format: (e) => {
|
|
2388
|
-
let t =
|
|
2388
|
+
let t = H.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2389
2389
|
return t && t.data[n] !== void 0 ? x(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2390
2390
|
}
|
|
2391
2391
|
} : { points: f };
|
|
2392
2392
|
} : void 0,
|
|
2393
2393
|
onSelect: k,
|
|
2394
|
-
zoom: te &&
|
|
2395
|
-
window:
|
|
2396
|
-
count:
|
|
2394
|
+
zoom: te && R > 1 ? {
|
|
2395
|
+
window: B,
|
|
2396
|
+
count: R
|
|
2397
2397
|
} : void 0,
|
|
2398
|
-
toolbox:
|
|
2399
|
-
onRestore:
|
|
2400
|
-
|
|
2398
|
+
toolbox: F,
|
|
2399
|
+
onRestore: z ? () => {
|
|
2400
|
+
B.value = [0, Math.max(0, R - 1)];
|
|
2401
2401
|
} : void 0,
|
|
2402
|
-
transition:
|
|
2403
|
-
onBeforeDraw:
|
|
2404
|
-
onAfterDraw:
|
|
2402
|
+
transition: re,
|
|
2403
|
+
onBeforeDraw: ie,
|
|
2404
|
+
onAfterDraw: ae,
|
|
2405
2405
|
children: ({ width: e, height: n }) => {
|
|
2406
|
-
let r = e -
|
|
2406
|
+
let r = e - X.left - X.right, i = n - X.top - X.bottom, a = Math.min(...ue ? q.map((e) => e.getTime()) : q), o = Math.max(...ue ? q.map((e) => e.getTime()) : q), s = ue ? w([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), l = g(sn(se), [i, 0]), u = U ? g(sn(Y), [i, 0]) : l;
|
|
2407
2407
|
return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
|
|
2408
|
-
transform: `translate(${
|
|
2408
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2409
2409
|
children: [
|
|
2410
2410
|
!C && /* @__PURE__ */ m(bt, {
|
|
2411
2411
|
scale: l,
|
|
@@ -2419,17 +2419,17 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2419
2419
|
innerW: r,
|
|
2420
2420
|
innerH: i
|
|
2421
2421
|
}),
|
|
2422
|
-
|
|
2423
|
-
if (
|
|
2422
|
+
H.map((e, n) => {
|
|
2423
|
+
if (I.value.has(e.id)) return null;
|
|
2424
2424
|
let r = e.color ?? on[n % on.length], i = e.axis === "right" ? u : l, a = (e) => s.map(e);
|
|
2425
|
-
if (
|
|
2425
|
+
if (L && e.data.length > L.threshold) {
|
|
2426
2426
|
let n = [];
|
|
2427
2427
|
for (let r of e.data) {
|
|
2428
|
-
let o =
|
|
2428
|
+
let o = K(e)(r);
|
|
2429
2429
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2430
2430
|
}
|
|
2431
2431
|
return /* @__PURE__ */ m("path", {
|
|
2432
|
-
d: D(Re(n,
|
|
2432
|
+
d: D(Re(n, L.threshold, L.method).map((e) => [e[0], e[1]]), c),
|
|
2433
2433
|
fill: "none",
|
|
2434
2434
|
stroke: r,
|
|
2435
2435
|
strokeWidth: 2,
|
|
@@ -2439,7 +2439,7 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2439
2439
|
}, e.id);
|
|
2440
2440
|
}
|
|
2441
2441
|
let o = e.data.map((n) => {
|
|
2442
|
-
let r =
|
|
2442
|
+
let r = K(e)(n);
|
|
2443
2443
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2444
2444
|
});
|
|
2445
2445
|
return /* @__PURE__ */ h("g", { children: [E(o, ee).map((t, n) => /* @__PURE__ */ m("path", {
|
|
@@ -2450,12 +2450,12 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2450
2450
|
strokeLinecap: "round",
|
|
2451
2451
|
strokeLinejoin: "round",
|
|
2452
2452
|
"data-series": e.id
|
|
2453
|
-
}, n)),
|
|
2453
|
+
}, n)), oe && e.data.map((t, n) => {
|
|
2454
2454
|
let r = o[n];
|
|
2455
2455
|
return r ? /* @__PURE__ */ m(kt, {
|
|
2456
2456
|
x: r[0],
|
|
2457
2457
|
y: r[1] - 8,
|
|
2458
|
-
text:
|
|
2458
|
+
text: oe.format(K(e)(t))
|
|
2459
2459
|
}, n) : null;
|
|
2460
2460
|
})] }, e.id);
|
|
2461
2461
|
}),
|
|
@@ -2474,16 +2474,16 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2474
2474
|
length: i,
|
|
2475
2475
|
tickCount: _
|
|
2476
2476
|
}),
|
|
2477
|
-
|
|
2477
|
+
U && /* @__PURE__ */ m($, {
|
|
2478
2478
|
scale: u,
|
|
2479
2479
|
orientation: "y-right",
|
|
2480
2480
|
length: i,
|
|
2481
2481
|
tickCount: _,
|
|
2482
2482
|
transform: `translate(${r},0)`,
|
|
2483
|
-
...
|
|
2484
|
-
...
|
|
2485
|
-
title:
|
|
2486
|
-
titleOffset: 8 + Math.ceil(
|
|
2483
|
+
...N?.format ? { format: (e) => N.format(Number(e)) } : {},
|
|
2484
|
+
...N?.label !== void 0 && N.label !== "" ? {
|
|
2485
|
+
title: N.label,
|
|
2486
|
+
titleOffset: 8 + Math.ceil(de.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
|
|
2487
2487
|
} : {}
|
|
2488
2488
|
})
|
|
2489
2489
|
] })
|
|
@@ -2491,23 +2491,23 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2491
2491
|
}) });
|
|
2492
2492
|
}
|
|
2493
2493
|
}),
|
|
2494
|
-
A && !j &&
|
|
2495
|
-
count:
|
|
2496
|
-
window:
|
|
2494
|
+
A && !j && R > 1 && /* @__PURE__ */ m(Vt, {
|
|
2495
|
+
count: R,
|
|
2496
|
+
window: B,
|
|
2497
2497
|
label: "Time range"
|
|
2498
2498
|
}),
|
|
2499
|
-
j &&
|
|
2500
|
-
count:
|
|
2501
|
-
window:
|
|
2499
|
+
j && R > 1 && /* @__PURE__ */ m(Ht, {
|
|
2500
|
+
count: R,
|
|
2501
|
+
window: B,
|
|
2502
2502
|
label: "Time range"
|
|
2503
2503
|
}),
|
|
2504
|
-
|
|
2505
|
-
series:
|
|
2504
|
+
G && /* @__PURE__ */ m($t, {
|
|
2505
|
+
series: H.map((e, t) => ({
|
|
2506
2506
|
id: e.id,
|
|
2507
2507
|
label: e.label,
|
|
2508
2508
|
color: e.color ?? on[t % on.length]
|
|
2509
2509
|
})),
|
|
2510
|
-
hidden:
|
|
2510
|
+
hidden: I
|
|
2511
2511
|
})
|
|
2512
2512
|
]
|
|
2513
2513
|
});
|
|
@@ -2519,46 +2519,46 @@ function un(e, t) {
|
|
|
2519
2519
|
return t || e <= 1 ? ln : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
|
|
2520
2520
|
}
|
|
2521
2521
|
var dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2522
|
-
function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1, curve: d = "monotone", fill: f = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: T, plain: E, annotations: O, labels: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode:
|
|
2522
|
+
function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1, curve: d = "monotone", fill: f = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: T, plain: E, annotations: O, labels: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: N, secondAxis: F, decimate: re, toolbox: ie, format: ae }) {
|
|
2523
2523
|
s();
|
|
2524
|
-
let
|
|
2524
|
+
let I = c(), oe = a(/* @__PURE__ */ new Set()), L = E ? null : Ot(ee), R = re === !0 ? {
|
|
2525
2525
|
method: "lttb",
|
|
2526
2526
|
threshold: 1e3
|
|
2527
|
-
} :
|
|
2528
|
-
method:
|
|
2529
|
-
threshold:
|
|
2530
|
-
} : null,
|
|
2531
|
-
M && !
|
|
2527
|
+
} : re ? {
|
|
2528
|
+
method: re.method ?? "lttb",
|
|
2529
|
+
threshold: re.threshold ?? 1e3
|
|
2530
|
+
} : null, z = e.reduce((e, t) => Math.max(e, t.data.length), 0), B = (A || j || te || M !== void 0) && z > 0, V = a([0, Math.max(0, z - 1)]), H = l(null);
|
|
2531
|
+
M && !H.current && (H.current = mt(M)), o(() => () => {
|
|
2532
2532
|
M && ht(M);
|
|
2533
2533
|
}), o(() => {
|
|
2534
|
-
let e =
|
|
2534
|
+
let e = H.current;
|
|
2535
2535
|
if (!e) return;
|
|
2536
|
-
let t = e.window.value, n =
|
|
2537
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2536
|
+
let t = e.window.value, n = V.peek();
|
|
2537
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (V.value = t);
|
|
2538
2538
|
}), o(() => {
|
|
2539
|
-
let e =
|
|
2539
|
+
let e = H.current;
|
|
2540
2540
|
if (!e) return;
|
|
2541
|
-
let t =
|
|
2541
|
+
let t = V.value, n = e.window.peek();
|
|
2542
2542
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2543
2543
|
});
|
|
2544
|
-
let
|
|
2544
|
+
let U = B ? e.map((e) => ({
|
|
2545
2545
|
...e,
|
|
2546
|
-
data: e.data.slice(
|
|
2547
|
-
})) : e,
|
|
2548
|
-
!
|
|
2546
|
+
data: e.data.slice(V.value[0], V.value[1] + 1)
|
|
2547
|
+
})) : e, W = !E && !u && U.some((e) => e.axis === "right"), G = y ?? (E ? 48 : 300), K = E ? !1 : S ?? U.length > 1, q = un(U.length, u), J = (e) => e.y ?? n, se = (U[0]?.data ?? []).map((e) => t(e)), Y = (W ? U.filter((e) => e.axis !== "right") : U).flatMap((e) => e.data.map((t) => J(e)(t))), ce = W ? U.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => J(e)(t))) : [];
|
|
2548
|
+
!W && !u && U.length > 1 && an("AreaChart", U.map((e) => ({
|
|
2549
2549
|
label: e.label,
|
|
2550
|
-
max: Math.max(0, ...e.data.map((t) =>
|
|
2551
|
-
}))), nn("AreaChart", () => [...
|
|
2552
|
-
let
|
|
2550
|
+
max: Math.max(0, ...e.data.map((t) => J(e)(t)).filter((e) => Number.isFinite(e)))
|
|
2551
|
+
}))), nn("AreaChart", () => [...Y, ...ce]);
|
|
2552
|
+
let le = se.length > 0, ue = le && se[0] instanceof Date, de = se.map((e) => e instanceof Date ? e.getTime() : e), fe = le ? Math.min(...de) : 0, pe = le ? Math.max(...de) : 1, me = (e) => ue ? w([new Date(fe), new Date(pe)], [0, e]) : g([fe, pe], [0, e]), X = (e, n) => e.map(t(n)), he = (e) => {
|
|
2553
2553
|
let n = t(e);
|
|
2554
2554
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2555
|
-
},
|
|
2555
|
+
}, ge = u ? 0 : Math.min(0, ...Y), _e = Math.max(...u ? (U[0]?.data ?? []).map((e, t) => U.reduce((e, n) => e + J(n)(n.data[t]), 0)) : Y), ve = W ? Math.min(0, ...ce) : ge, ye = W ? Math.max(...ce) : _e, be = g([ge, _e], [0, 1]).ticks(x).map((e) => e.toLocaleString()), xe = W ? g([ve, ye], [0, 1]).ticks(x).map((e) => F?.format ? F.format(e) : e.toLocaleString()) : [], Se = ue ? w([new Date(fe), new Date(pe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : g([fe, pe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Z = E ? We : {
|
|
2556
2556
|
...Ue,
|
|
2557
|
-
left: Ke(
|
|
2557
|
+
left: Ke(be, E),
|
|
2558
2558
|
right: qe({
|
|
2559
|
-
rightAxisLabels:
|
|
2560
|
-
bottomAxisLabels:
|
|
2561
|
-
rightAxisTitle:
|
|
2559
|
+
rightAxisLabels: xe,
|
|
2560
|
+
bottomAxisLabels: Se,
|
|
2561
|
+
rightAxisTitle: F?.label !== void 0 && F.label !== "",
|
|
2562
2562
|
plain: E
|
|
2563
2563
|
})
|
|
2564
2564
|
};
|
|
@@ -2573,28 +2573,28 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2573
2573
|
title: r,
|
|
2574
2574
|
description: i,
|
|
2575
2575
|
width: v,
|
|
2576
|
-
height:
|
|
2576
|
+
height: G,
|
|
2577
2577
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2578
2578
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2579
|
-
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }),
|
|
2580
|
-
/* @__PURE__ */ m("tbody", { children: (
|
|
2579
|
+
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), U.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2580
|
+
/* @__PURE__ */ m("tbody", { children: (U[0]?.data ?? []).map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: U[0] ? he(U[0].data[t]) : "" }), U.map((e) => /* @__PURE__ */ m("td", { children: e.data[t] == null ? "" : J(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2581
2581
|
] }),
|
|
2582
2582
|
className: T,
|
|
2583
|
-
"data-state":
|
|
2583
|
+
"data-state": le ? void 0 : "empty",
|
|
2584
2584
|
plain: E,
|
|
2585
|
-
tooltip: C !== !1 &&
|
|
2586
|
-
if (C === !1 || !
|
|
2587
|
-
let n = e -
|
|
2588
|
-
if (
|
|
2589
|
-
let e =
|
|
2585
|
+
tooltip: C !== !1 && le ? ({ width: e, height: t }) => {
|
|
2586
|
+
if (C === !1 || !le) return;
|
|
2587
|
+
let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = me(n), a = g([ge, _e], [r, 0]), o = W ? g([ve, ye], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2588
|
+
if (N === "axis") {
|
|
2589
|
+
let e = U.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2590
2590
|
for (let n = 0; n < e; n++) {
|
|
2591
|
-
let e = [], r = Infinity, a = "", o =
|
|
2592
|
-
|
|
2593
|
-
if (
|
|
2591
|
+
let e = [], r = Infinity, a = "", o = Z.left;
|
|
2592
|
+
U.forEach((t, c) => {
|
|
2593
|
+
if (oe.value.has(t.id)) return;
|
|
2594
2594
|
let l = t.data[n];
|
|
2595
2595
|
if (l === void 0) return;
|
|
2596
|
-
let u =
|
|
2597
|
-
Number.isFinite(u) && (o =
|
|
2596
|
+
let u = J(t)(l);
|
|
2597
|
+
Number.isFinite(u) && (o = Z.left + X(i, l), r = Math.min(r, s(t).map(u)), a = he(l), e.push({
|
|
2598
2598
|
label: t.label,
|
|
2599
2599
|
value: u,
|
|
2600
2600
|
color: t.color ?? dn[c % dn.length]
|
|
@@ -2602,7 +2602,7 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2602
2602
|
}), e.length !== 0 && t.push({
|
|
2603
2603
|
id: `x-${n}`,
|
|
2604
2604
|
cx: o,
|
|
2605
|
-
cy:
|
|
2605
|
+
cy: Z.top + (r === Infinity ? 0 : r),
|
|
2606
2606
|
label: a,
|
|
2607
2607
|
value: a,
|
|
2608
2608
|
segments: e
|
|
@@ -2614,36 +2614,36 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2614
2614
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2615
2615
|
};
|
|
2616
2616
|
}
|
|
2617
|
-
return { points:
|
|
2617
|
+
return { points: U.flatMap((e) => oe.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2618
2618
|
id: `${e.id}-${n}`,
|
|
2619
|
-
cx:
|
|
2620
|
-
cy:
|
|
2621
|
-
label:
|
|
2622
|
-
value:
|
|
2619
|
+
cx: Z.left + X(i, t),
|
|
2620
|
+
cy: Z.top + s(e).map(J(e)(t)),
|
|
2621
|
+
label: he(t),
|
|
2622
|
+
value: J(e)(t),
|
|
2623
2623
|
seriesId: e.id
|
|
2624
2624
|
}))) };
|
|
2625
2625
|
} : void 0,
|
|
2626
2626
|
onSelect: k,
|
|
2627
|
-
zoom: te &&
|
|
2628
|
-
window:
|
|
2629
|
-
count:
|
|
2627
|
+
zoom: te && z > 1 ? {
|
|
2628
|
+
window: V,
|
|
2629
|
+
count: z
|
|
2630
2630
|
} : void 0,
|
|
2631
|
-
toolbox:
|
|
2632
|
-
onRestore:
|
|
2633
|
-
|
|
2631
|
+
toolbox: ie,
|
|
2632
|
+
onRestore: B ? () => {
|
|
2633
|
+
V.value = [0, Math.max(0, z - 1)];
|
|
2634
2634
|
} : void 0,
|
|
2635
2635
|
children: ({ width: e, height: t }) => {
|
|
2636
|
-
let n = e -
|
|
2637
|
-
return u && (s =
|
|
2638
|
-
prefix:
|
|
2636
|
+
let n = e - Z.left - Z.right, r = t - Z.top - Z.bottom, i = me(n), a = g([ge, _e], [r, 0]), o = W ? g([ve, ye], [r, 0]) : a, s = [];
|
|
2637
|
+
return u && (s = P(U.map((e) => e.data.map((t) => J(e)(t))))), /* @__PURE__ */ h("g", { children: [f !== "solid" && /* @__PURE__ */ m(Pt, {
|
|
2638
|
+
prefix: I,
|
|
2639
2639
|
fill: f,
|
|
2640
2640
|
patternKind: _,
|
|
2641
|
-
series:
|
|
2641
|
+
series: U.map((e, t) => ({
|
|
2642
2642
|
id: e.id,
|
|
2643
2643
|
color: e.color ?? dn[t % dn.length]
|
|
2644
2644
|
}))
|
|
2645
2645
|
}), /* @__PURE__ */ h("g", {
|
|
2646
|
-
transform: `translate(${
|
|
2646
|
+
transform: `translate(${Z.left},${Z.top})`,
|
|
2647
2647
|
children: [
|
|
2648
2648
|
!E && /* @__PURE__ */ m(bt, {
|
|
2649
2649
|
scale: a,
|
|
@@ -2657,13 +2657,13 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2657
2657
|
innerW: n,
|
|
2658
2658
|
innerH: r
|
|
2659
2659
|
}),
|
|
2660
|
-
|
|
2661
|
-
if (
|
|
2660
|
+
U.map((e, t) => {
|
|
2661
|
+
if (oe.value.has(e.id)) return null;
|
|
2662
2662
|
let n = e.color ?? dn[t % dn.length], r, c;
|
|
2663
2663
|
if (u && s[t]) {
|
|
2664
2664
|
let o = s[t];
|
|
2665
|
-
r = e.data.map((e, t) => [
|
|
2666
|
-
let l = e.data.map((e, t) => [
|
|
2665
|
+
r = e.data.map((e, t) => [X(i, e), a.map(o[t][1])]);
|
|
2666
|
+
let l = e.data.map((e, t) => [X(i, e), a.map(o[t][0])]);
|
|
2667
2667
|
c = a.map(0);
|
|
2668
2668
|
let u = D(r, d), p = l[l.length - 1], g = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${p[0]},${p[1]}${_}L${g[0]},${g[1]}Z`;
|
|
2669
2669
|
return /* @__PURE__ */ h("g", {
|
|
@@ -2671,8 +2671,8 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2671
2671
|
children: [
|
|
2672
2672
|
/* @__PURE__ */ m("path", {
|
|
2673
2673
|
d: v,
|
|
2674
|
-
fill: Nt(
|
|
2675
|
-
style: f === "solid" ?
|
|
2674
|
+
fill: Nt(I, e.id, f, n),
|
|
2675
|
+
style: f === "solid" ? q : void 0,
|
|
2676
2676
|
stroke: "none"
|
|
2677
2677
|
}),
|
|
2678
2678
|
/* @__PURE__ */ m("path", {
|
|
@@ -2681,23 +2681,23 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2681
2681
|
stroke: n,
|
|
2682
2682
|
strokeWidth: 2
|
|
2683
2683
|
}),
|
|
2684
|
-
|
|
2684
|
+
L && r.map((t, n) => /* @__PURE__ */ m(kt, {
|
|
2685
2685
|
x: t[0],
|
|
2686
2686
|
y: t[1] - 8,
|
|
2687
|
-
text:
|
|
2687
|
+
text: L.format(J(e)(e.data[n]))
|
|
2688
2688
|
}, n))
|
|
2689
2689
|
]
|
|
2690
2690
|
}, e.id);
|
|
2691
2691
|
} else {
|
|
2692
2692
|
let t = e.axis === "right" ? o : a;
|
|
2693
|
-
if (r = e.data.map((n) => [
|
|
2694
|
-
let t = Re(r,
|
|
2693
|
+
if (r = e.data.map((n) => [X(i, n), t.map(J(e)(n))]), c = t.map(0), R && r.length > R.threshold) {
|
|
2694
|
+
let t = Re(r, R.threshold, R.method).map((e) => [e[0], e[1]]);
|
|
2695
2695
|
return /* @__PURE__ */ h("g", {
|
|
2696
2696
|
"data-series": e.id,
|
|
2697
2697
|
children: [/* @__PURE__ */ m("path", {
|
|
2698
|
-
d:
|
|
2699
|
-
fill: Nt(
|
|
2700
|
-
style: f === "solid" ?
|
|
2698
|
+
d: ne(t, c, d),
|
|
2699
|
+
fill: Nt(I, e.id, f, n),
|
|
2700
|
+
style: f === "solid" ? q : void 0,
|
|
2701
2701
|
stroke: "none"
|
|
2702
2702
|
}), /* @__PURE__ */ m("path", {
|
|
2703
2703
|
d: D(t, d),
|
|
@@ -2711,9 +2711,9 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2711
2711
|
"data-series": e.id,
|
|
2712
2712
|
children: [
|
|
2713
2713
|
/* @__PURE__ */ m("path", {
|
|
2714
|
-
d:
|
|
2715
|
-
fill: Nt(
|
|
2716
|
-
style: f === "solid" ?
|
|
2714
|
+
d: ne(r, c, d),
|
|
2715
|
+
fill: Nt(I, e.id, f, n),
|
|
2716
|
+
style: f === "solid" ? q : void 0,
|
|
2717
2717
|
stroke: "none"
|
|
2718
2718
|
}),
|
|
2719
2719
|
/* @__PURE__ */ m("path", {
|
|
@@ -2722,10 +2722,10 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2722
2722
|
stroke: n,
|
|
2723
2723
|
strokeWidth: 2
|
|
2724
2724
|
}),
|
|
2725
|
-
|
|
2725
|
+
L && r.map((t, n) => /* @__PURE__ */ m(kt, {
|
|
2726
2726
|
x: t[0],
|
|
2727
2727
|
y: t[1] - 8,
|
|
2728
|
-
text:
|
|
2728
|
+
text: L.format(J(e)(e.data[n]))
|
|
2729
2729
|
}, n))
|
|
2730
2730
|
]
|
|
2731
2731
|
}, e.id);
|
|
@@ -2738,7 +2738,7 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2738
2738
|
length: n,
|
|
2739
2739
|
tickCount: b,
|
|
2740
2740
|
transform: `translate(0,${r})`,
|
|
2741
|
-
...
|
|
2741
|
+
...ae ? { format: ae } : {}
|
|
2742
2742
|
}),
|
|
2743
2743
|
/* @__PURE__ */ m($, {
|
|
2744
2744
|
scale: a,
|
|
@@ -2746,16 +2746,16 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2746
2746
|
length: r,
|
|
2747
2747
|
tickCount: x
|
|
2748
2748
|
}),
|
|
2749
|
-
|
|
2749
|
+
W && /* @__PURE__ */ m($, {
|
|
2750
2750
|
scale: o,
|
|
2751
2751
|
orientation: "y-right",
|
|
2752
2752
|
length: r,
|
|
2753
2753
|
tickCount: x,
|
|
2754
2754
|
transform: `translate(${n},0)`,
|
|
2755
|
-
...
|
|
2756
|
-
...
|
|
2757
|
-
title:
|
|
2758
|
-
titleOffset: 8 + Math.ceil(
|
|
2755
|
+
...F?.format ? { format: (e) => F.format(Number(e)) } : {},
|
|
2756
|
+
...F?.label !== void 0 && F.label !== "" ? {
|
|
2757
|
+
title: F.label,
|
|
2758
|
+
titleOffset: 8 + Math.ceil(xe.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
|
|
2759
2759
|
} : {}
|
|
2760
2760
|
})
|
|
2761
2761
|
] })
|
|
@@ -2763,23 +2763,23 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2763
2763
|
})] });
|
|
2764
2764
|
}
|
|
2765
2765
|
}),
|
|
2766
|
-
A && !j &&
|
|
2767
|
-
count:
|
|
2768
|
-
window:
|
|
2766
|
+
A && !j && z > 1 && /* @__PURE__ */ m(Vt, {
|
|
2767
|
+
count: z,
|
|
2768
|
+
window: V,
|
|
2769
2769
|
label: "Range"
|
|
2770
2770
|
}),
|
|
2771
|
-
j &&
|
|
2772
|
-
count:
|
|
2773
|
-
window:
|
|
2771
|
+
j && z > 1 && /* @__PURE__ */ m(Ht, {
|
|
2772
|
+
count: z,
|
|
2773
|
+
window: V,
|
|
2774
2774
|
label: "Range"
|
|
2775
2775
|
}),
|
|
2776
|
-
|
|
2777
|
-
series:
|
|
2776
|
+
K && /* @__PURE__ */ m($t, {
|
|
2777
|
+
series: U.map((e, t) => ({
|
|
2778
2778
|
id: e.id,
|
|
2779
2779
|
label: e.label,
|
|
2780
2780
|
color: e.color ?? dn[t % dn.length]
|
|
2781
2781
|
})),
|
|
2782
|
-
hidden:
|
|
2782
|
+
hidden: oe
|
|
2783
2783
|
})
|
|
2784
2784
|
]
|
|
2785
2785
|
});
|
|
@@ -2796,17 +2796,17 @@ function hn(e) {
|
|
|
2796
2796
|
}
|
|
2797
2797
|
function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o = "vertical", mode: l = "grouped", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: ee, onSelect: k, fill: A = "solid", patternKind: j, format: te }) {
|
|
2798
2798
|
s();
|
|
2799
|
-
let M = c(),
|
|
2800
|
-
let t =
|
|
2799
|
+
let M = c(), ne = D ? null : Ot(ee), N = a(/* @__PURE__ */ new Set()), F = d ?? (D ? 48 : 300), re = D ? !1 : C ?? e.length > 1, ie = (e) => e.y ?? n, ae = (e[0]?.data ?? []).map((e) => t(e)), I = e.flatMap((e) => e.data.map((t) => ie(e)(t))), oe = ae.length > 0, L = l === "stacked" || l === "percent", R = ae.map((t, n) => e.reduce((e, t) => e + ie(t)(t.data[n]), 0)), z = () => {
|
|
2800
|
+
let t = P(e.map((e) => e.data.map((t) => ie(e)(t))));
|
|
2801
2801
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2802
|
-
let r =
|
|
2802
|
+
let r = R[n] || 1;
|
|
2803
2803
|
return [e / r, t / r];
|
|
2804
2804
|
})) : t;
|
|
2805
|
-
},
|
|
2805
|
+
}, B = L ? 0 : Math.min(0, ...I), V = oe ? Math.max(...R) : 1, H = l === "percent" ? 1 : l === "stacked" ? V : Math.max(1, ...I), U = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, W = o === "vertical", G = (W ? y : b) ?? _, K = (W ? b : y) ?? f, q = S ?? x, J = W ? g([B, H], [0, 1]).ticks(G).map((e) => U ? U(e) : e.toLocaleString()) : ae.map((e) => String(e)), se = W ? ae.map((e) => String(e)) : g([B, H], [0, 1]).ticks(K).map((e) => U ? U(e) : e.toLocaleString()), Y = D ? We : {
|
|
2806
2806
|
...Ue,
|
|
2807
|
-
left: Ke(
|
|
2807
|
+
left: Ke(J, D),
|
|
2808
2808
|
right: qe({
|
|
2809
|
-
bottomAxisLabels:
|
|
2809
|
+
bottomAxisLabels: se,
|
|
2810
2810
|
plain: D
|
|
2811
2811
|
})
|
|
2812
2812
|
};
|
|
@@ -2820,23 +2820,23 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2820
2820
|
title: r,
|
|
2821
2821
|
description: i,
|
|
2822
2822
|
width: u,
|
|
2823
|
-
height:
|
|
2823
|
+
height: F,
|
|
2824
2824
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2825
2825
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2826
2826
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2827
|
-
/* @__PURE__ */ m("tbody", { children:
|
|
2827
|
+
/* @__PURE__ */ m("tbody", { children: ae.map((t, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: t }), e.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : ie(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2828
2828
|
] }),
|
|
2829
2829
|
className: E,
|
|
2830
|
-
"data-state":
|
|
2830
|
+
"data-state": oe ? void 0 : "empty",
|
|
2831
2831
|
plain: D,
|
|
2832
|
-
tooltip: w &&
|
|
2833
|
-
if (!w || !
|
|
2834
|
-
let i = n -
|
|
2835
|
-
|
|
2836
|
-
let p =
|
|
2832
|
+
tooltip: w && oe ? ({ width: n, height: r }) => {
|
|
2833
|
+
if (!w || !oe) return;
|
|
2834
|
+
let i = n - Y.left - Y.right, a = r - Y.top - Y.bottom, s = o === "vertical", c = v(ae, s ? [0, i] : [0, a], .2), u = g([B, H], s ? [a, 0] : [0, i]), d = e.filter((e) => !N.value.has(e.id)), f = [];
|
|
2835
|
+
L && (f = z());
|
|
2836
|
+
let p = L && !T, m = ae.map((t, n) => {
|
|
2837
2837
|
let r = d.map((t) => ({
|
|
2838
2838
|
label: t.label,
|
|
2839
|
-
value:
|
|
2839
|
+
value: ie(t)(t.data[n]),
|
|
2840
2840
|
color: pn(t.color, t.data[n], n, mn[e.indexOf(t) % mn.length])
|
|
2841
2841
|
}));
|
|
2842
2842
|
return {
|
|
@@ -2847,17 +2847,17 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2847
2847
|
let r = e.indexOf(n), i = l === "grouped" ? c.bandwidth / d.length : c.bandwidth;
|
|
2848
2848
|
return n.data.map((e, a) => {
|
|
2849
2849
|
let o = c.map(t(e)) ?? 0, h, g;
|
|
2850
|
-
if (
|
|
2850
|
+
if (L && f[r]) {
|
|
2851
2851
|
let e = f[r][a];
|
|
2852
2852
|
h = e[1], g = e[0];
|
|
2853
|
-
} else h =
|
|
2853
|
+
} else h = ie(n)(e), g = B;
|
|
2854
2854
|
let _ = d.indexOf(n), v = o + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
|
|
2855
2855
|
return {
|
|
2856
2856
|
id: `${n.id}-${a}`,
|
|
2857
|
-
cx:
|
|
2858
|
-
cy:
|
|
2857
|
+
cx: Y.left + (s ? v : y),
|
|
2858
|
+
cy: Y.top + (s ? y : v),
|
|
2859
2859
|
label: t(e),
|
|
2860
|
-
value: p ? m[a].total :
|
|
2860
|
+
value: p ? m[a].total : ie(n)(e),
|
|
2861
2861
|
seriesId: n.id,
|
|
2862
2862
|
...p && { segments: m[a].segs }
|
|
2863
2863
|
};
|
|
@@ -2870,8 +2870,8 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2870
2870
|
} : void 0,
|
|
2871
2871
|
onSelect: k,
|
|
2872
2872
|
children: ({ width: n, height: r }) => {
|
|
2873
|
-
let i = n -
|
|
2874
|
-
return
|
|
2873
|
+
let i = n - Y.left - Y.right, a = r - Y.top - Y.bottom, s = o === "vertical", c = q ?? Ye(ae, s ? i : a, s ? "horizontal" : "vertical"), u = v(ae, s ? [0, i] : [0, a], .2), d = g([B, H], s ? [a, 0] : [0, i]), f = e.filter((e) => !N.value.has(e.id)), _ = [];
|
|
2874
|
+
return L && (_ = z()), /* @__PURE__ */ h("g", { children: [A !== "solid" && /* @__PURE__ */ m(Pt, {
|
|
2875
2875
|
prefix: M,
|
|
2876
2876
|
fill: A,
|
|
2877
2877
|
patternKind: j,
|
|
@@ -2880,19 +2880,19 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2880
2880
|
color: pn(e.color, e.data[0], 0, mn[t % mn.length])
|
|
2881
2881
|
}))
|
|
2882
2882
|
}), /* @__PURE__ */ h("g", {
|
|
2883
|
-
transform: `translate(${
|
|
2883
|
+
transform: `translate(${Y.left},${Y.top})`,
|
|
2884
2884
|
children: [
|
|
2885
2885
|
!D && s && /* @__PURE__ */ m(bt, {
|
|
2886
2886
|
scale: d,
|
|
2887
2887
|
orientation: "y",
|
|
2888
2888
|
length: i,
|
|
2889
|
-
tickCount:
|
|
2889
|
+
tickCount: G
|
|
2890
2890
|
}),
|
|
2891
2891
|
!D && !s && /* @__PURE__ */ m(bt, {
|
|
2892
2892
|
scale: d,
|
|
2893
2893
|
orientation: "x",
|
|
2894
2894
|
length: a,
|
|
2895
|
-
tickCount:
|
|
2895
|
+
tickCount: K
|
|
2896
2896
|
}),
|
|
2897
2897
|
!D && Tt(O, {
|
|
2898
2898
|
xScale: s ? u : d,
|
|
@@ -2904,13 +2904,13 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2904
2904
|
let i = mn[e.indexOf(n) % mn.length], a = e.indexOf(n), o = l === "grouped" ? u.bandwidth / f.length : u.bandwidth;
|
|
2905
2905
|
return n.data.map((e, c) => {
|
|
2906
2906
|
let f = u.map(t(e)) ?? 0, p, g;
|
|
2907
|
-
if (
|
|
2907
|
+
if (L && _[a]) {
|
|
2908
2908
|
let e = _[a][c];
|
|
2909
2909
|
p = e[1], g = e[0];
|
|
2910
|
-
} else p =
|
|
2910
|
+
} else p = ie(n)(e), g = B;
|
|
2911
2911
|
let v = f + (l === "grouped" ? r * o : 0), y = Math.min(d.map(p), d.map(g)), b = Math.abs(d.map(p) - d.map(g)), x = null;
|
|
2912
|
-
if (
|
|
2913
|
-
let t =
|
|
2912
|
+
if (ne) {
|
|
2913
|
+
let t = ne.format(ie(n)(e)), r = v + o / 2, i = L || b < 18 || y < 14;
|
|
2914
2914
|
if (s) x = /* @__PURE__ */ m(kt, {
|
|
2915
2915
|
x: r,
|
|
2916
2916
|
y: i ? y + 13 : y - 4,
|
|
@@ -2927,7 +2927,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2927
2927
|
tone: i ? "muted" : "default"
|
|
2928
2928
|
});
|
|
2929
2929
|
}
|
|
2930
|
-
|
|
2930
|
+
L && b < 14 && (x = null);
|
|
2931
2931
|
}
|
|
2932
2932
|
let S = pn(n.color, e, c, i);
|
|
2933
2933
|
return /* @__PURE__ */ h("g", { children: [s ? /* @__PURE__ */ m("rect", {
|
|
@@ -2955,7 +2955,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2955
2955
|
scale: u,
|
|
2956
2956
|
orientation: "x",
|
|
2957
2957
|
length: i,
|
|
2958
|
-
tickCount:
|
|
2958
|
+
tickCount: K,
|
|
2959
2959
|
labelEvery: c,
|
|
2960
2960
|
transform: `translate(0,${a})`,
|
|
2961
2961
|
...te ? { format: te } : {}
|
|
@@ -2963,33 +2963,33 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2963
2963
|
scale: d,
|
|
2964
2964
|
orientation: "y",
|
|
2965
2965
|
length: a,
|
|
2966
|
-
tickCount:
|
|
2967
|
-
...
|
|
2966
|
+
tickCount: G,
|
|
2967
|
+
...U && { format: U }
|
|
2968
2968
|
})] }),
|
|
2969
2969
|
!D && !s && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m($, {
|
|
2970
2970
|
scale: d,
|
|
2971
2971
|
orientation: "x",
|
|
2972
2972
|
length: i,
|
|
2973
|
-
tickCount:
|
|
2974
|
-
...
|
|
2973
|
+
tickCount: K,
|
|
2974
|
+
...U && { format: U },
|
|
2975
2975
|
transform: `translate(0,${a})`
|
|
2976
2976
|
}), /* @__PURE__ */ m($, {
|
|
2977
2977
|
scale: u,
|
|
2978
2978
|
orientation: "y",
|
|
2979
2979
|
length: a,
|
|
2980
|
-
tickCount:
|
|
2980
|
+
tickCount: G,
|
|
2981
2981
|
labelEvery: c
|
|
2982
2982
|
})] })
|
|
2983
2983
|
]
|
|
2984
2984
|
})] });
|
|
2985
2985
|
}
|
|
2986
|
-
}),
|
|
2986
|
+
}), re && /* @__PURE__ */ m($t, {
|
|
2987
2987
|
series: e.map((e, t) => ({
|
|
2988
2988
|
id: e.id,
|
|
2989
2989
|
label: e.label,
|
|
2990
2990
|
color: pn(e.color, e.data[0], 0, mn[t % mn.length])
|
|
2991
2991
|
})),
|
|
2992
|
-
hidden:
|
|
2992
|
+
hidden: N
|
|
2993
2993
|
})]
|
|
2994
2994
|
});
|
|
2995
2995
|
}
|
|
@@ -3059,7 +3059,7 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
|
|
|
3059
3059
|
children: ({ width: t, height: n }) => {
|
|
3060
3060
|
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !k.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || p != null);
|
|
3061
3061
|
return /* @__PURE__ */ h("g", { children: [g.map((e, t) => {
|
|
3062
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? vn[t % vn.length], u =
|
|
3062
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? vn[t % vn.length], u = N(i, a, o, c, v, r);
|
|
3063
3063
|
v = r;
|
|
3064
3064
|
let d = _ > 0 ? e.value / _ * 100 : 0, f = w && d >= 4, p = c > 0 ? (c + o) / 2 : o * .6;
|
|
3065
3065
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("path", {
|
|
@@ -3132,7 +3132,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3132
3132
|
let T = a(/* @__PURE__ */ new Set()), E = _ ? We : Ue, D = o ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, ee = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && ee > 2e3), A = a([S?.min ?? 0, S?.max ?? 1]), j = a(/* @__PURE__ */ new Set()), te = (t, { width: n, height: i }) => {
|
|
3133
3133
|
let a = n - E.left - E.right, o = i - E.top - E.bottom;
|
|
3134
3134
|
if (a <= 0 || o <= 0) return;
|
|
3135
|
-
let s = g([
|
|
3135
|
+
let s = g([P, F], [0, a]), c = g([re, ie], [o, 0]);
|
|
3136
3136
|
e.forEach((e, n) => {
|
|
3137
3137
|
if (!T.value.has(e.id)) {
|
|
3138
3138
|
t.fillStyle = tt(t, e.color ?? bn[n % bn.length]), t.globalAlpha = .7;
|
|
@@ -3142,7 +3142,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3142
3142
|
}
|
|
3143
3143
|
}
|
|
3144
3144
|
}), t.globalAlpha = 1;
|
|
3145
|
-
}, M = e.flatMap((e) => e.data.map((e) => e.x)),
|
|
3145
|
+
}, M = e.flatMap((e) => e.data.map((e) => e.x)), ne = e.flatMap((e) => e.data.map((e) => e.y)), N = M.length > 0, P = N ? Math.min(...M) : 0, F = N ? Math.max(...M) : 1, re = N ? Math.min(0, ...ne) : 0, ie = N ? Math.max(...ne) : 1;
|
|
3146
3146
|
return /* @__PURE__ */ h("div", {
|
|
3147
3147
|
style: {
|
|
3148
3148
|
display: "flex",
|
|
@@ -3169,11 +3169,11 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3169
3169
|
] }, `${e.id}-${n}`))) })
|
|
3170
3170
|
] }),
|
|
3171
3171
|
className: f,
|
|
3172
|
-
"data-state":
|
|
3172
|
+
"data-state": N ? void 0 : "empty",
|
|
3173
3173
|
plain: _,
|
|
3174
|
-
tooltip: d !== !1 &&
|
|
3175
|
-
if (d === !1 || !
|
|
3176
|
-
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([
|
|
3174
|
+
tooltip: d !== !1 && N ? ({ width: t, height: n }) => {
|
|
3175
|
+
if (d === !1 || !N) return;
|
|
3176
|
+
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([P, F], [0, r]), o = g([re, ie], [i, 0]);
|
|
3177
3177
|
return { points: e.flatMap((e) => T.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3178
3178
|
id: `${e.id}-${n}`,
|
|
3179
3179
|
cx: E.left + a.map(t.x),
|
|
@@ -3192,7 +3192,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3192
3192
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3193
3193
|
} : void 0,
|
|
3194
3194
|
children: ({ width: t, height: n }) => {
|
|
3195
|
-
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([
|
|
3195
|
+
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([P, F], [0, i]), s = g([re, ie], [a, 0]);
|
|
3196
3196
|
return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
|
|
3197
3197
|
transform: `translate(${E.left},${E.top})`,
|
|
3198
3198
|
children: [
|
|
@@ -3253,7 +3253,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3253
3253
|
}) });
|
|
3254
3254
|
}
|
|
3255
3255
|
}),
|
|
3256
|
-
S &&
|
|
3256
|
+
S && N && /* @__PURE__ */ m(Zt, {
|
|
3257
3257
|
options: S,
|
|
3258
3258
|
range: A,
|
|
3259
3259
|
hidden: j,
|
|
@@ -3308,40 +3308,47 @@ function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3308
3308
|
}
|
|
3309
3309
|
});
|
|
3310
3310
|
}
|
|
3311
|
+
var Cn = {
|
|
3312
|
+
meter: "_meter_cns3q_2",
|
|
3313
|
+
svg: "_svg_cns3q_9",
|
|
3314
|
+
label: "_label_cns3q_16",
|
|
3315
|
+
gaugeLabel: "_gaugeLabel_cns3q_22",
|
|
3316
|
+
fill: "_fill_cns3q_28"
|
|
3317
|
+
};
|
|
3311
3318
|
//#endregion
|
|
3312
3319
|
//#region src/charts/meter/meter.tsx
|
|
3313
|
-
function
|
|
3314
|
-
if (!
|
|
3315
|
-
let { warning:
|
|
3316
|
-
return
|
|
3320
|
+
function wn(e, t) {
|
|
3321
|
+
if (!t) return "var(--cascivo-chart-1)";
|
|
3322
|
+
let { warning: n, critical: r } = t;
|
|
3323
|
+
return r != null && e >= r ? "var(--cascivo-color-destructive)" : n != null && e >= n ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3317
3324
|
}
|
|
3318
|
-
function
|
|
3319
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0,
|
|
3325
|
+
function Tn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o, height: s }) {
|
|
3326
|
+
let { ref: c, width: l } = He(200, 100), u = o ?? l.value, d = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, f = wn(e, a);
|
|
3320
3327
|
if (i === "gauge") {
|
|
3321
|
-
let i = s ?? 100, a =
|
|
3328
|
+
let i = s ?? 100, a = u, o = a / 2, l = i * .9, p = Math.min(o, l) - 4, g = p * .65, _ = Math.PI, v = N(o, l, p, g, _, 2 * Math.PI), y = _ + d * Math.PI, b = d > 0 ? N(o, l, p, g, _, y) : "";
|
|
3322
3329
|
return /* @__PURE__ */ h("div", {
|
|
3330
|
+
ref: c,
|
|
3331
|
+
className: Cn.meter,
|
|
3323
3332
|
"aria-label": r,
|
|
3324
3333
|
role: "meter",
|
|
3325
3334
|
"aria-valuenow": e,
|
|
3326
3335
|
"aria-valuemin": t,
|
|
3327
3336
|
"aria-valuemax": n,
|
|
3328
3337
|
children: [/* @__PURE__ */ h("svg", {
|
|
3338
|
+
className: Cn.svg,
|
|
3329
3339
|
width: a,
|
|
3330
3340
|
height: i,
|
|
3341
|
+
viewBox: `0 0 ${a} ${i}`,
|
|
3331
3342
|
"aria-hidden": "true",
|
|
3332
3343
|
children: [/* @__PURE__ */ m("path", {
|
|
3333
|
-
d:
|
|
3344
|
+
d: v,
|
|
3334
3345
|
fill: "var(--cascivo-color-border)"
|
|
3335
|
-
}),
|
|
3336
|
-
d:
|
|
3337
|
-
fill:
|
|
3346
|
+
}), b && /* @__PURE__ */ m("path", {
|
|
3347
|
+
d: b,
|
|
3348
|
+
fill: f
|
|
3338
3349
|
})]
|
|
3339
3350
|
}), /* @__PURE__ */ h("div", {
|
|
3340
|
-
|
|
3341
|
-
textAlign: "center",
|
|
3342
|
-
fontSize: "var(--cascivo-text-sm)",
|
|
3343
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3344
|
-
},
|
|
3351
|
+
className: Cn.gaugeLabel,
|
|
3345
3352
|
children: [
|
|
3346
3353
|
r,
|
|
3347
3354
|
": ",
|
|
@@ -3350,49 +3357,45 @@ function wn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3350
3357
|
})]
|
|
3351
3358
|
});
|
|
3352
3359
|
}
|
|
3353
|
-
let
|
|
3360
|
+
let p = s ?? 12, g = u;
|
|
3354
3361
|
return /* @__PURE__ */ h("div", {
|
|
3362
|
+
ref: c,
|
|
3363
|
+
className: Cn.meter,
|
|
3355
3364
|
"aria-label": r,
|
|
3356
3365
|
role: "meter",
|
|
3357
3366
|
"aria-valuenow": e,
|
|
3358
3367
|
"aria-valuemin": t,
|
|
3359
3368
|
"aria-valuemax": n,
|
|
3360
3369
|
children: [/* @__PURE__ */ h("svg", {
|
|
3361
|
-
|
|
3362
|
-
|
|
3370
|
+
className: Cn.svg,
|
|
3371
|
+
width: g,
|
|
3372
|
+
height: p,
|
|
3373
|
+
viewBox: `0 0 ${g} ${p}`,
|
|
3363
3374
|
"aria-hidden": "true",
|
|
3364
|
-
style: { display: "block" },
|
|
3365
3375
|
children: [/* @__PURE__ */ m("rect", {
|
|
3366
3376
|
x: 0,
|
|
3367
3377
|
y: 0,
|
|
3368
|
-
width:
|
|
3369
|
-
height:
|
|
3370
|
-
rx:
|
|
3378
|
+
width: g,
|
|
3379
|
+
height: p,
|
|
3380
|
+
rx: p / 2,
|
|
3371
3381
|
fill: "var(--cascivo-color-border)"
|
|
3372
3382
|
}), /* @__PURE__ */ m("rect", {
|
|
3373
3383
|
x: 0,
|
|
3374
3384
|
y: 0,
|
|
3375
|
-
width:
|
|
3376
|
-
height:
|
|
3377
|
-
rx:
|
|
3378
|
-
fill:
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
transform: `scaleX(${c})`,
|
|
3382
|
-
transition: "transform 400ms ease"
|
|
3383
|
-
}
|
|
3385
|
+
width: g,
|
|
3386
|
+
height: p,
|
|
3387
|
+
rx: p / 2,
|
|
3388
|
+
fill: f,
|
|
3389
|
+
className: Cn.fill,
|
|
3390
|
+
style: { transform: `scaleX(${d})` }
|
|
3384
3391
|
})]
|
|
3385
3392
|
}), /* @__PURE__ */ m("div", {
|
|
3386
|
-
|
|
3387
|
-
marginTop: "var(--cascivo-space-1)",
|
|
3388
|
-
fontSize: "var(--cascivo-text-xs)",
|
|
3389
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3390
|
-
},
|
|
3393
|
+
className: Cn.label,
|
|
3391
3394
|
children: r
|
|
3392
3395
|
})]
|
|
3393
3396
|
});
|
|
3394
3397
|
}
|
|
3395
|
-
var
|
|
3398
|
+
var En = {
|
|
3396
3399
|
kpi: "_kpi_nrb8p_7",
|
|
3397
3400
|
head: "_head_nrb8p_19",
|
|
3398
3401
|
label: "_label_nrb8p_27",
|
|
@@ -3402,20 +3405,20 @@ var Tn = {
|
|
|
3402
3405
|
};
|
|
3403
3406
|
//#endregion
|
|
3404
3407
|
//#region src/charts/kpi/kpi.tsx
|
|
3405
|
-
function
|
|
3408
|
+
function Dn(e, t) {
|
|
3406
3409
|
if (typeof t == "function") return t(e);
|
|
3407
3410
|
let n = e >= 0 ? "+" : "", r = e.toLocaleString(d());
|
|
3408
3411
|
return t === "percent" ? `${n}${r}%` : `${n}${r}`;
|
|
3409
3412
|
}
|
|
3410
|
-
function
|
|
3413
|
+
function On({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirection: a = "up", deltaLabel: o, icon: s, sparkline: c, className: l }) {
|
|
3411
3414
|
let u = r != null && r >= 0, f = r != null && r < 0, p = u ? "up" : f ? "down" : "flat";
|
|
3412
3415
|
return /* @__PURE__ */ h("div", {
|
|
3413
|
-
className: [
|
|
3416
|
+
className: [En.kpi, l].filter(Boolean).join(" "),
|
|
3414
3417
|
children: [
|
|
3415
3418
|
/* @__PURE__ */ h("div", {
|
|
3416
|
-
className:
|
|
3419
|
+
className: En.head,
|
|
3417
3420
|
children: [/* @__PURE__ */ m("span", {
|
|
3418
|
-
className:
|
|
3421
|
+
className: En.label,
|
|
3419
3422
|
children: t
|
|
3420
3423
|
}), s && /* @__PURE__ */ m("span", {
|
|
3421
3424
|
"aria-hidden": "true",
|
|
@@ -3423,20 +3426,20 @@ function Dn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
|
|
|
3423
3426
|
})]
|
|
3424
3427
|
}),
|
|
3425
3428
|
/* @__PURE__ */ h("div", {
|
|
3426
|
-
className:
|
|
3429
|
+
className: En.valueRow,
|
|
3427
3430
|
children: [/* @__PURE__ */ m("span", {
|
|
3428
|
-
className:
|
|
3431
|
+
className: En.value,
|
|
3429
3432
|
children: typeof e == "number" ? e.toLocaleString(d()) : e
|
|
3430
3433
|
}), r != null && /* @__PURE__ */ h("span", {
|
|
3431
3434
|
role: "img",
|
|
3432
|
-
className:
|
|
3435
|
+
className: En.delta,
|
|
3433
3436
|
"data-trend": p,
|
|
3434
3437
|
"data-sentiment": n(p, a),
|
|
3435
|
-
"aria-label": `Trend: ${
|
|
3438
|
+
"aria-label": `Trend: ${Dn(r, i)}${o ? ` ${o}` : ""}`,
|
|
3436
3439
|
children: [
|
|
3437
3440
|
u ? "▲" : f ? "▼" : "–",
|
|
3438
3441
|
" ",
|
|
3439
|
-
|
|
3442
|
+
Dn(r, i),
|
|
3440
3443
|
o && ` ${o}`
|
|
3441
3444
|
]
|
|
3442
3445
|
})]
|
|
@@ -3451,9 +3454,9 @@ function Dn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
|
|
|
3451
3454
|
}
|
|
3452
3455
|
//#endregion
|
|
3453
3456
|
//#region src/charts/histogram/histogram.tsx
|
|
3454
|
-
function
|
|
3457
|
+
function kn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: o, className: c, plain: l, format: u }) {
|
|
3455
3458
|
s();
|
|
3456
|
-
let d = l ? We : Ue, f = o ?? (l ? 48 : 300), _ =
|
|
3459
|
+
let d = l ? We : Ue, f = o ?? (l ? 48 : 300), _ = R(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3457
3460
|
return /* @__PURE__ */ m(Q, {
|
|
3458
3461
|
title: n,
|
|
3459
3462
|
description: i,
|
|
@@ -3528,13 +3531,13 @@ function On({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3528
3531
|
}
|
|
3529
3532
|
//#endregion
|
|
3530
3533
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3531
|
-
var
|
|
3532
|
-
function
|
|
3534
|
+
var An = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3535
|
+
function jn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: o, format: c }) {
|
|
3533
3536
|
s();
|
|
3534
3537
|
let l = o ? We : Ue, u = i ?? (o ? 48 : 320), d = e.map((e) => ({
|
|
3535
3538
|
...e,
|
|
3536
|
-
stats:
|
|
3537
|
-
})), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ?
|
|
3539
|
+
stats: z(e.values)
|
|
3540
|
+
})), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ? B(f) : [0, 1];
|
|
3538
3541
|
return /* @__PURE__ */ m(Q, {
|
|
3539
3542
|
title: t,
|
|
3540
3543
|
description: n,
|
|
@@ -3593,7 +3596,7 @@ function An({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3593
3596
|
return /* @__PURE__ */ h("g", {
|
|
3594
3597
|
transform: `translate(${l.left},${l.top})`,
|
|
3595
3598
|
children: [d.map((e, t) => {
|
|
3596
|
-
let n =
|
|
3599
|
+
let n = An[t % An.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);
|
|
3597
3600
|
return /* @__PURE__ */ h("g", { children: [
|
|
3598
3601
|
/* @__PURE__ */ m("line", {
|
|
3599
3602
|
x1: i,
|
|
@@ -3671,10 +3674,10 @@ function An({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3671
3674
|
}
|
|
3672
3675
|
//#endregion
|
|
3673
3676
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3674
|
-
var
|
|
3675
|
-
function
|
|
3677
|
+
var Mn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Nn = 3, Pn = 24;
|
|
3678
|
+
function Fn({ series: e, title: t, description: n, width: r, height: i, tooltip: o, className: c, plain: l, glyph: u, format: d }) {
|
|
3676
3679
|
s();
|
|
3677
|
-
let f = a(null), _ = l ? We : Ue, v = i ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ?
|
|
3680
|
+
let f = a(null), _ = l ? We : Ue, v = i ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? B(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? B(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? B(b.map((e) => e.size)) : [0, 1], D = y([T, E], [Nn, Pn]), O = b.length > 0;
|
|
3678
3681
|
return /* @__PURE__ */ m(Q, {
|
|
3679
3682
|
title: t,
|
|
3680
3683
|
description: n,
|
|
@@ -3731,7 +3734,7 @@ function Pn({ series: e, title: t, description: n, width: r, height: i, tooltip:
|
|
|
3731
3734
|
length: r.width
|
|
3732
3735
|
}),
|
|
3733
3736
|
e.map((e, t) => {
|
|
3734
|
-
let n =
|
|
3737
|
+
let n = Mn[t % Mn.length] ?? "var(--cascivo-chart-1)";
|
|
3735
3738
|
return /* @__PURE__ */ m("g", {
|
|
3736
3739
|
opacity: f.value !== null && f.value !== e.name ? .2 : 1,
|
|
3737
3740
|
onMouseEnter: () => {
|
|
@@ -3781,8 +3784,8 @@ function Pn({ series: e, title: t, description: n, width: r, height: i, tooltip:
|
|
|
3781
3784
|
}
|
|
3782
3785
|
//#endregion
|
|
3783
3786
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3784
|
-
var
|
|
3785
|
-
function
|
|
3787
|
+
var In = "var(--cascivo-chart-1)", Ln = "var(--cascivo-chart-2)";
|
|
3788
|
+
function Rn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, barsLabel: o = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: f, tooltip: _, className: y, plain: b, annotations: x, format: S }) {
|
|
3786
3789
|
s();
|
|
3787
3790
|
let C = a(/* @__PURE__ */ new Set()), w = f ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, E = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, O = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, ee = e.length > 0, k = b ? !1 : l ?? (e.length > 0 && t.length > 0);
|
|
3788
3791
|
t.length > 0 && e.length > 0 && t.length !== e.length && rn("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).`), !i && t.length > 0 && e.length > 0 && an("ComboChart", [{
|
|
@@ -3881,14 +3884,14 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3881
3884
|
y: n,
|
|
3882
3885
|
width: o.bandwidth,
|
|
3883
3886
|
height: Math.max(0, a.height - n),
|
|
3884
|
-
fill:
|
|
3887
|
+
fill: In,
|
|
3885
3888
|
opacity: .75
|
|
3886
3889
|
}, e.label);
|
|
3887
3890
|
}),
|
|
3888
3891
|
d && !y && /* @__PURE__ */ m("path", {
|
|
3889
3892
|
d,
|
|
3890
3893
|
fill: "none",
|
|
3891
|
-
stroke:
|
|
3894
|
+
stroke: Ln,
|
|
3892
3895
|
strokeWidth: 2.5,
|
|
3893
3896
|
strokeLinejoin: "round",
|
|
3894
3897
|
strokeLinecap: "round"
|
|
@@ -3921,11 +3924,11 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3921
3924
|
series: [{
|
|
3922
3925
|
id: "bars",
|
|
3923
3926
|
label: o,
|
|
3924
|
-
color:
|
|
3927
|
+
color: In
|
|
3925
3928
|
}, ...t.length > 0 ? [{
|
|
3926
3929
|
id: "line",
|
|
3927
3930
|
label: c,
|
|
3928
|
-
color:
|
|
3931
|
+
color: Ln
|
|
3929
3932
|
}] : []],
|
|
3930
3933
|
hidden: C
|
|
3931
3934
|
})]
|
|
@@ -3933,14 +3936,14 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3933
3936
|
}
|
|
3934
3937
|
//#endregion
|
|
3935
3938
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3936
|
-
function
|
|
3939
|
+
function zn({ data: e, title: t, description: n, width: r, height: i, className: o, plain: c, visualMap: l, toolbox: u, format: d }) {
|
|
3937
3940
|
s();
|
|
3938
3941
|
let f = i ?? (c ? 48 : 320), g = c ? We : {
|
|
3939
3942
|
top: 20,
|
|
3940
3943
|
right: 20,
|
|
3941
3944
|
bottom: 60,
|
|
3942
3945
|
left: 60
|
|
3943
|
-
}, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ?
|
|
3946
|
+
}, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? B(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = a([l?.min ?? b, l?.max ?? x]), T = a(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ m(Q, {
|
|
3944
3947
|
title: t,
|
|
3945
3948
|
description: n,
|
|
3946
3949
|
width: r,
|
|
@@ -4031,8 +4034,8 @@ function Rn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4031
4034
|
}
|
|
4032
4035
|
//#endregion
|
|
4033
4036
|
//#region src/charts/treemap/treemap.tsx
|
|
4034
|
-
var
|
|
4035
|
-
function
|
|
4037
|
+
var Bn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4038
|
+
function Vn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: o }) {
|
|
4036
4039
|
s();
|
|
4037
4040
|
let l = c();
|
|
4038
4041
|
return /* @__PURE__ */ m(Q, {
|
|
@@ -4048,7 +4051,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4048
4051
|
className: a,
|
|
4049
4052
|
plain: o,
|
|
4050
4053
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
4051
|
-
if (e.length !== 0) return { points:
|
|
4054
|
+
if (e.length !== 0) return { points: W(e.map((e) => ({
|
|
4052
4055
|
id: e.id,
|
|
4053
4056
|
value: e.value
|
|
4054
4057
|
})), t, n).map((t) => {
|
|
@@ -4064,7 +4067,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4064
4067
|
} : void 0,
|
|
4065
4068
|
children: ({ width: t, height: n }) => {
|
|
4066
4069
|
if (e.length === 0) return null;
|
|
4067
|
-
let r =
|
|
4070
|
+
let r = W(e.map((e) => ({
|
|
4068
4071
|
id: e.id,
|
|
4069
4072
|
value: e.value
|
|
4070
4073
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -4077,7 +4080,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4077
4080
|
height: Math.max(0, e.h - 4)
|
|
4078
4081
|
})
|
|
4079
4082
|
}, e.id)) }), r.map((e, t) => {
|
|
4080
|
-
let n =
|
|
4083
|
+
let n = Bn[t % Bn.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
4081
4084
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("rect", {
|
|
4082
4085
|
x: e.x,
|
|
4083
4086
|
y: e.y,
|
|
@@ -4101,8 +4104,8 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4101
4104
|
}
|
|
4102
4105
|
//#endregion
|
|
4103
4106
|
//#region src/charts/radar/radar.tsx
|
|
4104
|
-
var
|
|
4105
|
-
function
|
|
4107
|
+
var Hn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Un = 4;
|
|
4108
|
+
function Wn(e, t, n, r, i) {
|
|
4106
4109
|
let a = e.length;
|
|
4107
4110
|
return e.map((e, o) => {
|
|
4108
4111
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -4112,7 +4115,7 @@ function Un(e, t, n, r, i) {
|
|
|
4112
4115
|
};
|
|
4113
4116
|
});
|
|
4114
4117
|
}
|
|
4115
|
-
function
|
|
4118
|
+
function Gn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: o, className: c, plain: l }) {
|
|
4116
4119
|
let u = o ?? (l ? 48 : 320);
|
|
4117
4120
|
s();
|
|
4118
4121
|
let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), f = e.length;
|
|
@@ -4144,7 +4147,7 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4144
4147
|
})) };
|
|
4145
4148
|
} : void 0,
|
|
4146
4149
|
children: ({ width: n, height: r }) => {
|
|
4147
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4150
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Un }, (e, t) => (t + 1) / Un * o), c = Array.from({ length: f }, (e, t) => {
|
|
4148
4151
|
let n = t / f * 2 * Math.PI - Math.PI / 2;
|
|
4149
4152
|
return {
|
|
4150
4153
|
x: T(i + Math.cos(n) * o),
|
|
@@ -4182,7 +4185,7 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4182
4185
|
}, n);
|
|
4183
4186
|
}),
|
|
4184
4187
|
t.map((e, t) => {
|
|
4185
|
-
let n =
|
|
4188
|
+
let n = Wn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Hn[t % Hn.length] ?? "var(--cascivo-chart-1)";
|
|
4186
4189
|
return /* @__PURE__ */ m("polygon", {
|
|
4187
4190
|
points: n,
|
|
4188
4191
|
fill: r,
|
|
@@ -4197,12 +4200,12 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4197
4200
|
}
|
|
4198
4201
|
//#endregion
|
|
4199
4202
|
//#region src/charts/bullet/bullet.tsx
|
|
4200
|
-
var
|
|
4203
|
+
var Kn = [
|
|
4201
4204
|
"var(--cascivo-gray-200)",
|
|
4202
4205
|
"var(--cascivo-gray-300)",
|
|
4203
4206
|
"var(--cascivo-gray-400)"
|
|
4204
4207
|
];
|
|
4205
|
-
function
|
|
4208
|
+
function qn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: o = 300, height: c = 40, className: l }) {
|
|
4206
4209
|
s();
|
|
4207
4210
|
let u = [...n].sort((e, t) => e - t), d = g([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, o]), f = c * .35, _ = (c - f) / 2, v = c * .7, y = (c - v) / 2;
|
|
4208
4211
|
return /* @__PURE__ */ h("figure", {
|
|
@@ -4229,7 +4232,7 @@ function Kn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4229
4232
|
y: 0,
|
|
4230
4233
|
width: Math.max(0, r),
|
|
4231
4234
|
height: c,
|
|
4232
|
-
fill:
|
|
4235
|
+
fill: Kn[t % Kn.length] ?? "var(--cascivo-gray-200)"
|
|
4233
4236
|
}, t);
|
|
4234
4237
|
}),
|
|
4235
4238
|
/* @__PURE__ */ m("rect", {
|
|
@@ -4256,8 +4259,8 @@ function Kn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4256
4259
|
}
|
|
4257
4260
|
//#endregion
|
|
4258
4261
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4259
|
-
var
|
|
4260
|
-
function
|
|
4262
|
+
var Jn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4263
|
+
function Yn({ data: e, title: t, description: n, size: r, width: i, height: o, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: p, legend: g, className: _, plain: v }) {
|
|
4261
4264
|
s();
|
|
4262
4265
|
let y = a(/* @__PURE__ */ new Set()), b = i ?? r, x = o ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, w = 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) => {
|
|
4263
4266
|
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));
|
|
@@ -4282,7 +4285,7 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4282
4285
|
value: e.value,
|
|
4283
4286
|
seriesId: e.id,
|
|
4284
4287
|
percent: w > 0 ? e.value / w * 100 : 0,
|
|
4285
|
-
color: e.color ??
|
|
4288
|
+
color: e.color ?? Jn[t % Jn.length]
|
|
4286
4289
|
};
|
|
4287
4290
|
}) };
|
|
4288
4291
|
}, k = /* @__PURE__ */ h("table", { children: [
|
|
@@ -4309,15 +4312,15 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4309
4312
|
children: ({ width: e, height: t }) => {
|
|
4310
4313
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4311
4314
|
return /* @__PURE__ */ h("g", { children: [s.map((e, t) => {
|
|
4312
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4315
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Jn[t % Jn.length], l = Math.max(0, Math.min(1, e.value / w)), u = D + E * l;
|
|
4313
4316
|
return /* @__PURE__ */ h("g", {
|
|
4314
4317
|
"data-series": e.id,
|
|
4315
4318
|
children: [/* @__PURE__ */ m("path", {
|
|
4316
|
-
d:
|
|
4319
|
+
d: N(n, r, a, s, D, D + E),
|
|
4317
4320
|
fill: "var(--cascivo-chart-grid)",
|
|
4318
4321
|
fillOpacity: .35
|
|
4319
4322
|
}), l > 0 && /* @__PURE__ */ m("path", {
|
|
4320
|
-
d:
|
|
4323
|
+
d: N(n, r, a, s, D, u),
|
|
4321
4324
|
fill: c
|
|
4322
4325
|
})]
|
|
4323
4326
|
}, e.id);
|
|
@@ -4365,7 +4368,7 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4365
4368
|
series: e.map((e, t) => ({
|
|
4366
4369
|
id: e.id,
|
|
4367
4370
|
label: e.label,
|
|
4368
|
-
color: e.color ??
|
|
4371
|
+
color: e.color ?? Jn[t % Jn.length]
|
|
4369
4372
|
})),
|
|
4370
4373
|
hidden: y
|
|
4371
4374
|
})]
|
|
@@ -4373,8 +4376,8 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4373
4376
|
}
|
|
4374
4377
|
//#endregion
|
|
4375
4378
|
//#region src/charts/funnel/funnel.tsx
|
|
4376
|
-
var
|
|
4377
|
-
function
|
|
4379
|
+
var Xn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4380
|
+
function Zn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: o, className: c, plain: l }) {
|
|
4378
4381
|
s();
|
|
4379
4382
|
let u = l ? We : Ue, d = i ?? (l ? 48 : 320), f = e.length > 0, p = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4380
4383
|
return /* @__PURE__ */ m(Q, {
|
|
@@ -4410,7 +4413,7 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4410
4413
|
value: e.value,
|
|
4411
4414
|
seriesId: e.id,
|
|
4412
4415
|
percent: p > 0 ? e.value / p * 100 : 0,
|
|
4413
|
-
color: e.color ??
|
|
4416
|
+
color: e.color ?? Xn[t % Xn.length]
|
|
4414
4417
|
})),
|
|
4415
4418
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4416
4419
|
};
|
|
@@ -4420,7 +4423,7 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4420
4423
|
if (r <= 0 || e.length === 0) return null;
|
|
4421
4424
|
let o = i / e.length, s = g([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4422
4425
|
return /* @__PURE__ */ m("g", { children: e.map((t, n) => {
|
|
4423
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ??
|
|
4426
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ?? Xn[n % Xn.length], v = [
|
|
4424
4427
|
[d - i, f],
|
|
4425
4428
|
[d + i, f],
|
|
4426
4429
|
[d + s, g],
|
|
@@ -4445,10 +4448,10 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4445
4448
|
}
|
|
4446
4449
|
//#endregion
|
|
4447
4450
|
//#region src/charts/stream/stream.tsx
|
|
4448
|
-
var
|
|
4449
|
-
function
|
|
4451
|
+
var Qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4452
|
+
function $n({ series: e, categories: t, title: n, description: r, offset: i = "silhouette", curve: o = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: p, format: _ }) {
|
|
4450
4453
|
s();
|
|
4451
|
-
let y = a(/* @__PURE__ */ new Set()), b = p ? We : Ue, x = l ?? (p ? 48 : 300), S = p ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w =
|
|
4454
|
+
let y = a(/* @__PURE__ */ new Set()), b = p ? We : Ue, x = l ?? (p ? 48 : 300), S = p ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = G(e.map((e) => e.values), i), [T, E] = K(w);
|
|
4452
4455
|
return /* @__PURE__ */ h("div", {
|
|
4453
4456
|
style: {
|
|
4454
4457
|
display: "flex",
|
|
@@ -4483,7 +4486,7 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4483
4486
|
label: `${e.label} · ${String(t)}`,
|
|
4484
4487
|
value: e.values[i] ?? 0,
|
|
4485
4488
|
seriesId: e.id,
|
|
4486
|
-
color: e.color ??
|
|
4489
|
+
color: e.color ?? Qn[n % Qn.length]
|
|
4487
4490
|
};
|
|
4488
4491
|
});
|
|
4489
4492
|
}) };
|
|
@@ -4496,7 +4499,7 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4496
4499
|
transform: `translate(${b.left},${b.top})`,
|
|
4497
4500
|
children: [e.map((e, n) => {
|
|
4498
4501
|
if (y.value.has(e.id)) return null;
|
|
4499
|
-
let r = w[n], i = e.color ??
|
|
4502
|
+
let r = w[n], i = e.color ?? Qn[n % Qn.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), s = t.map((e, t) => [l(t), c.map(r[t][0])]);
|
|
4500
4503
|
return /* @__PURE__ */ m("path", {
|
|
4501
4504
|
d: `${D(a, o)}${D([...s].reverse(), o).replace(/^M/, "L")}Z`,
|
|
4502
4505
|
fill: i,
|
|
@@ -4516,7 +4519,7 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4516
4519
|
series: e.map((e, t) => ({
|
|
4517
4520
|
id: e.id,
|
|
4518
4521
|
label: e.label,
|
|
4519
|
-
color: e.color ??
|
|
4522
|
+
color: e.color ?? Qn[t % Qn.length]
|
|
4520
4523
|
})),
|
|
4521
4524
|
hidden: y
|
|
4522
4525
|
})]
|
|
@@ -4524,10 +4527,10 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4524
4527
|
}
|
|
4525
4528
|
//#endregion
|
|
4526
4529
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4527
|
-
var
|
|
4528
|
-
function
|
|
4530
|
+
var er = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4531
|
+
function tr({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
|
|
4529
4532
|
s();
|
|
4530
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f =
|
|
4533
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = q(e), p = f > 0, g = J(e), _ = Math.max(1, se(g));
|
|
4531
4534
|
return /* @__PURE__ */ m(Q, {
|
|
4532
4535
|
title: t,
|
|
4533
4536
|
description: n,
|
|
@@ -4554,7 +4557,7 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4554
4557
|
label: e.node.label,
|
|
4555
4558
|
value: e.value,
|
|
4556
4559
|
percent: f > 0 ? e.value / f * 100 : 0,
|
|
4557
|
-
color: e.node.color ??
|
|
4560
|
+
color: e.node.color ?? er[t % er.length]
|
|
4558
4561
|
};
|
|
4559
4562
|
}),
|
|
4560
4563
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4563,9 +4566,9 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4563
4566
|
children: ({ width: e, height: t }) => {
|
|
4564
4567
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4565
4568
|
return /* @__PURE__ */ m("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4566
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4569
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? er[t % er.length];
|
|
4567
4570
|
return /* @__PURE__ */ m("path", {
|
|
4568
|
-
d:
|
|
4571
|
+
d: N(n, r, o, a, e.a0, e.a1),
|
|
4569
4572
|
fill: s,
|
|
4570
4573
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4571
4574
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4578,10 +4581,10 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4578
4581
|
}
|
|
4579
4582
|
//#endregion
|
|
4580
4583
|
//#region src/charts/sankey/sankey.tsx
|
|
4581
|
-
var
|
|
4582
|
-
function
|
|
4584
|
+
var nr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4585
|
+
function rr({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
|
|
4583
4586
|
s();
|
|
4584
|
-
let u = l ? We : Ue, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, p = (t, n) => e.find((e) => e.id === t)?.color ??
|
|
4587
|
+
let u = l ? We : Ue, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, p = (t, n) => e.find((e) => e.id === t)?.color ?? nr[n % nr.length];
|
|
4585
4588
|
return /* @__PURE__ */ m(Q, {
|
|
4586
4589
|
title: n,
|
|
4587
4590
|
description: r,
|
|
@@ -4605,7 +4608,7 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4605
4608
|
plain: l,
|
|
4606
4609
|
tooltip: o && f ? ({ width: n, height: r }) => {
|
|
4607
4610
|
if (!o || !f) return;
|
|
4608
|
-
let { nodes: i } =
|
|
4611
|
+
let { nodes: i } = Y(e, t, {
|
|
4609
4612
|
width: n - u.left - u.right,
|
|
4610
4613
|
height: r - u.top - u.bottom
|
|
4611
4614
|
});
|
|
@@ -4621,14 +4624,14 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4621
4624
|
children: ({ width: n, height: r }) => {
|
|
4622
4625
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4623
4626
|
if (i <= 0 || !f) return null;
|
|
4624
|
-
let { nodes: o, links: s } =
|
|
4627
|
+
let { nodes: o, links: s } = Y(e, t, {
|
|
4625
4628
|
width: i,
|
|
4626
4629
|
height: a
|
|
4627
4630
|
});
|
|
4628
4631
|
return /* @__PURE__ */ h("g", {
|
|
4629
4632
|
transform: `translate(${u.left},${u.top})`,
|
|
4630
4633
|
children: [s.map((e, t) => /* @__PURE__ */ m("path", {
|
|
4631
|
-
d:
|
|
4634
|
+
d: ce(e),
|
|
4632
4635
|
fill: p(e.source.id, o.indexOf(e.source)),
|
|
4633
4636
|
fillOpacity: .32,
|
|
4634
4637
|
"data-link": ""
|
|
@@ -4657,23 +4660,23 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4657
4660
|
}
|
|
4658
4661
|
//#endregion
|
|
4659
4662
|
//#region src/charts/calendar/calendar.tsx
|
|
4660
|
-
var
|
|
4661
|
-
function
|
|
4663
|
+
var ir = 864e5, ar = (e) => e instanceof Date ? e : new Date(e), or = (e) => e.toISOString().slice(0, 10);
|
|
4664
|
+
function sr(e) {
|
|
4662
4665
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4663
4666
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4664
4667
|
}
|
|
4665
|
-
function
|
|
4668
|
+
function cr({ data: e, title: t, description: n, from: r, to: i, width: o, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
|
|
4666
4669
|
s();
|
|
4667
4670
|
let p = e.length > 0, g = a([f?.min ?? 0, f?.max ?? 1]), _ = a(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4668
|
-
for (let t of e) v.set(ar(
|
|
4669
|
-
let y = e.map((e) =>
|
|
4671
|
+
for (let t of e) v.set(or(ar(t.day)), t.value);
|
|
4672
|
+
let y = e.map((e) => ar(e.day)), b = sr(r ? ar(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = i ? ar(i) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = p ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / ir / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4670
4673
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4671
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4674
|
+
let n = new Date(b.getTime() + (e * 7 + t) * ir);
|
|
4672
4675
|
n > x || T.push({
|
|
4673
4676
|
col: e,
|
|
4674
4677
|
row: t,
|
|
4675
4678
|
date: n,
|
|
4676
|
-
value: v.get(
|
|
4679
|
+
value: v.get(or(n)) ?? 0
|
|
4677
4680
|
});
|
|
4678
4681
|
}
|
|
4679
4682
|
let E = /* @__PURE__ */ m(Q, {
|
|
@@ -4684,7 +4687,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4684
4687
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
4685
4688
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4686
4689
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Day" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
|
|
4687
|
-
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: ar(
|
|
4690
|
+
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: or(ar(e.day)) }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
|
|
4688
4691
|
] }),
|
|
4689
4692
|
className: u,
|
|
4690
4693
|
"data-state": p ? void 0 : "empty",
|
|
@@ -4694,10 +4697,10 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4694
4697
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4695
4698
|
return {
|
|
4696
4699
|
points: T.map((e, n) => ({
|
|
4697
|
-
id: `${
|
|
4700
|
+
id: `${or(e.date)}-${n}`,
|
|
4698
4701
|
cx: e.col * (t + 2) + t / 2,
|
|
4699
4702
|
cy: e.row * (t + 2) + t / 2,
|
|
4700
|
-
label:
|
|
4703
|
+
label: or(e.date),
|
|
4701
4704
|
value: e.value
|
|
4702
4705
|
})),
|
|
4703
4706
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4715,7 +4718,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4715
4718
|
rx: 1.5,
|
|
4716
4719
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4717
4720
|
fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4718
|
-
"data-day":
|
|
4721
|
+
"data-day": or(e.date)
|
|
4719
4722
|
}, n);
|
|
4720
4723
|
}) });
|
|
4721
4724
|
}
|
|
@@ -4736,7 +4739,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4736
4739
|
}
|
|
4737
4740
|
//#endregion
|
|
4738
4741
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4739
|
-
function
|
|
4742
|
+
function lr({ data: e, title: t, description: n, width: r, height: i, yTicks: c = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: f, tooltip: _, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
|
|
4740
4743
|
s();
|
|
4741
4744
|
let O = b ? We : Ue, ee = i ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = a([0, Math.max(0, k - 1)]), te = l(null);
|
|
4742
4745
|
T && !te.current && (te.current = mt(T)), o(() => () => {
|
|
@@ -4752,7 +4755,7 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4752
4755
|
let t = j.value, n = e.window.peek();
|
|
4753
4756
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4754
4757
|
});
|
|
4755
|
-
let M = A ? e.slice(j.value[0], j.value[1] + 1) : e,
|
|
4758
|
+
let M = A ? e.slice(j.value[0], j.value[1] + 1) : e, ne = M.length > 0, N = ne ? Math.min(...M.map((e) => e.low)) : 0, P = ne ? Math.max(...M.map((e) => e.high)) : 1, F = ne ? Math.max(1, ...M.map((e) => e.volume ?? 0)) : 1, re = M.map((e) => e.t);
|
|
4756
4759
|
return /* @__PURE__ */ h("div", {
|
|
4757
4760
|
style: {
|
|
4758
4761
|
display: "flex",
|
|
@@ -4783,13 +4786,13 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4783
4786
|
] }, t)) })
|
|
4784
4787
|
] }),
|
|
4785
4788
|
className: y,
|
|
4786
|
-
"data-state":
|
|
4789
|
+
"data-state": ne ? void 0 : "empty",
|
|
4787
4790
|
plain: b,
|
|
4788
|
-
tooltip: _ !== !1 &&
|
|
4789
|
-
if (_ === !1 || !
|
|
4791
|
+
tooltip: _ !== !1 && ne ? ({ width: e, height: t }) => {
|
|
4792
|
+
if (_ === !1 || !ne) return;
|
|
4790
4793
|
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4791
4794
|
if (n <= 0) return;
|
|
4792
|
-
let i = v(
|
|
4795
|
+
let i = v(re, [0, n], .3), a = r - (f ? Math.min(r * .2, 60) : 0), o = g([N, P], [a, 0]);
|
|
4793
4796
|
if (E === "axis") return {
|
|
4794
4797
|
points: M.map((e, t) => ({
|
|
4795
4798
|
id: `c-${t}`,
|
|
@@ -4822,7 +4825,7 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4822
4825
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4823
4826
|
}
|
|
4824
4827
|
};
|
|
4825
|
-
let s = g([
|
|
4828
|
+
let s = g([N, P], [r, 0]);
|
|
4826
4829
|
return {
|
|
4827
4830
|
points: M.map((e, t) => ({
|
|
4828
4831
|
id: `c-${t}`,
|
|
@@ -4846,8 +4849,8 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4846
4849
|
} : void 0,
|
|
4847
4850
|
children: ({ width: e, height: t }) => {
|
|
4848
4851
|
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4849
|
-
if (n <= 0 || !
|
|
4850
|
-
let i = v(
|
|
4852
|
+
if (n <= 0 || !ne) return null;
|
|
4853
|
+
let i = v(re, [0, n], .3), a = g([N, P], [r, 0]), o = f ? Math.min(r * .2, 60) : 0, s = r - o, l = g([N, P], [s, 0]), _ = i.bandwidth;
|
|
4851
4854
|
return /* @__PURE__ */ h("g", {
|
|
4852
4855
|
transform: `translate(${O.left},${O.top})`,
|
|
4853
4856
|
children: [
|
|
@@ -4881,9 +4884,9 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4881
4884
|
}),
|
|
4882
4885
|
f && e.volume !== void 0 && /* @__PURE__ */ m("rect", {
|
|
4883
4886
|
x: n - _ / 2,
|
|
4884
|
-
y: s + (o - e.volume /
|
|
4887
|
+
y: s + (o - e.volume / F * o),
|
|
4885
4888
|
width: _,
|
|
4886
|
-
height: e.volume /
|
|
4889
|
+
height: e.volume / F * o,
|
|
4887
4890
|
fill: a,
|
|
4888
4891
|
fillOpacity: .4,
|
|
4889
4892
|
"data-volume": ""
|
|
@@ -4928,10 +4931,10 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4928
4931
|
}
|
|
4929
4932
|
//#endregion
|
|
4930
4933
|
//#region src/charts/polar/polar.tsx
|
|
4931
|
-
var
|
|
4932
|
-
function
|
|
4934
|
+
var ur = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4935
|
+
function dr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: o = 4, max: c, tooltip: l, className: u, plain: d }) {
|
|
4933
4936
|
s();
|
|
4934
|
-
let f = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4937
|
+
let f = 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__ */ h("table", { children: [
|
|
4935
4938
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4936
4939
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
|
|
4937
4940
|
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: e.label }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
|
|
@@ -4958,7 +4961,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4958
4961
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4959
4962
|
return {
|
|
4960
4963
|
points: e.map((e, t) => {
|
|
4961
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4964
|
+
let n = y.center(e.label) ?? 0, [o, s] = Se(r, i, a.map(e.value), n);
|
|
4962
4965
|
return {
|
|
4963
4966
|
id: `p-${t}`,
|
|
4964
4967
|
cx: o,
|
|
@@ -4974,7 +4977,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4974
4977
|
if (!g) return null;
|
|
4975
4978
|
let { cx: i, cy: a, outerR: s, rScale: c } = x(t, n), l = Array.from({ length: o }, (e, t) => s * (t + 1) / o), u = e.map((e) => {
|
|
4976
4979
|
let t = y.center(e.label) ?? 0;
|
|
4977
|
-
return
|
|
4980
|
+
return Se(i, a, c.map(e.value), t);
|
|
4978
4981
|
});
|
|
4979
4982
|
return /* @__PURE__ */ h("g", { children: [
|
|
4980
4983
|
!d && l.map((e, t) => /* @__PURE__ */ m("circle", {
|
|
@@ -4989,13 +4992,13 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4989
4992
|
r === "bar" ? e.map((e, t) => {
|
|
4990
4993
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4991
4994
|
return /* @__PURE__ */ m("path", {
|
|
4992
|
-
d:
|
|
4993
|
-
fill: e.color ??
|
|
4995
|
+
d: N(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4996
|
+
fill: e.color ?? ur[t % ur.length],
|
|
4994
4997
|
fillOpacity: .85,
|
|
4995
4998
|
"data-wedge": ""
|
|
4996
4999
|
}, t);
|
|
4997
5000
|
}) : (() => {
|
|
4998
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
5001
|
+
let t = [...u, u[0]], n = e[0]?.color ?? ur[0];
|
|
4999
5002
|
return /* @__PURE__ */ h(p, { children: [r === "area" && /* @__PURE__ */ m("path", {
|
|
5000
5003
|
d: `${D(t, "linear")}Z`,
|
|
5001
5004
|
fill: n,
|
|
@@ -5011,7 +5014,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
5011
5014
|
})] });
|
|
5012
5015
|
})(),
|
|
5013
5016
|
!d && e.map((e, t) => {
|
|
5014
|
-
let n = y.center(e.label) ?? 0, [r, o] =
|
|
5017
|
+
let n = y.center(e.label) ?? 0, [r, o] = Se(i, a, s + 12, n);
|
|
5015
5018
|
return /* @__PURE__ */ m("text", {
|
|
5016
5019
|
x: r,
|
|
5017
5020
|
y: o,
|
|
@@ -5029,10 +5032,10 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
5029
5032
|
}
|
|
5030
5033
|
//#endregion
|
|
5031
5034
|
//#region src/charts/gauge/gauge.tsx
|
|
5032
|
-
var
|
|
5033
|
-
function
|
|
5035
|
+
var fr = Math.PI / 180;
|
|
5036
|
+
function pr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: o = 5, title: c, description: l, width: u, height: d, className: f, plain: p }) {
|
|
5034
5037
|
s();
|
|
5035
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
5038
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * fr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
5036
5039
|
return /* @__PURE__ */ m(Q, {
|
|
5037
5040
|
title: c,
|
|
5038
5041
|
description: l,
|
|
@@ -5052,7 +5055,7 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5052
5055
|
}], w = t, T = Array.from({ length: o + 1 }, (e, n) => t + _ * n / o);
|
|
5053
5056
|
return /* @__PURE__ */ h("g", { children: [
|
|
5054
5057
|
/* @__PURE__ */ m("path", {
|
|
5055
|
-
d:
|
|
5058
|
+
d: N(c, l, u, f, x, x + b),
|
|
5056
5059
|
fill: "var(--cascivo-chart-grid)",
|
|
5057
5060
|
fillOpacity: .25,
|
|
5058
5061
|
"data-track": ""
|
|
@@ -5060,13 +5063,13 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5060
5063
|
C.map((e, t) => {
|
|
5061
5064
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
5062
5065
|
return w = e.upTo, /* @__PURE__ */ m("path", {
|
|
5063
|
-
d:
|
|
5066
|
+
d: N(c, l, u, f, r, i),
|
|
5064
5067
|
fill: e.color,
|
|
5065
5068
|
"data-zone": ""
|
|
5066
5069
|
}, t);
|
|
5067
5070
|
}),
|
|
5068
5071
|
!p && T.map((e, t) => {
|
|
5069
|
-
let n = S(e), [r, i] =
|
|
5072
|
+
let n = S(e), [r, i] = Se(c, l, f - 2, n), [a, o] = Se(c, l, f - 8, n), [s, u] = Se(c, l, f - 18, n);
|
|
5070
5073
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
5071
5074
|
x1: r,
|
|
5072
5075
|
y1: i,
|
|
@@ -5086,7 +5089,7 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5086
5089
|
})] }, t);
|
|
5087
5090
|
}),
|
|
5088
5091
|
(() => {
|
|
5089
|
-
let [e, t] =
|
|
5092
|
+
let [e, t] = Se(c, l, g, S(v));
|
|
5090
5093
|
return /* @__PURE__ */ m("line", {
|
|
5091
5094
|
x1: c,
|
|
5092
5095
|
y1: l,
|
|
@@ -5120,4 +5123,4 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5120
5123
|
});
|
|
5121
5124
|
}
|
|
5122
5125
|
//#endregion
|
|
5123
|
-
export { Ge as AXIS_CHAR_PX, Je as AXIS_LINE_PX, fn as AreaChart, $ as Axis, gn as BarChart,
|
|
5126
|
+
export { Ge as AXIS_CHAR_PX, Je as AXIS_LINE_PX, fn as AreaChart, $ as Axis, gn as BarChart, jn as Boxplot, Vt as Brush, Fn as BubbleChart, qn as Bullet, cr as CalendarHeatmap, lr as Candlestick, et as CanvasLayer, Pt as ChartDefs, Q as ChartFrame, Rn as ComboChart, Ue as DEFAULT_MARGINS, kt as DataLabel, Ht as DataZoom, Zn as Funnel, pr as Gauge, It as Glyph, bt as GridLines, zn as Heatmap, kn as Histogram, On as Kpi, $t as Legend, cn as LineChart, Tn as Meter, We as PLAIN_MARGINS, yn as PieChart, dr as Polar, Gn as Radar, Yn as RadialBar, rr as Sankey, xn as ScatterChart, Sn as Sparkline, $n as Stream, tr as Sunburst, Bt as Text, st as Toolbox, Vn as Treemap, Zt as VisualMap, gt as _syncGroupCount, Oe as aggregate, Z as angleBand, Et as annotationSummary, N as arcPath, ne as areaPath, Ye as autoLabelStride, v as bandScale, ke as bin, R as binValues, Ve as bindStream, z as boxStats, oe as cellPath, Re as decimate, ve as divergingRamp, dt as download, Pe as encode, Fe as encodeCategory, B as extent, Nt as fillFor, we as filter, mt as getSyncGroup, Ft as glyphPath, jt as gradientId, at as isZoomed, Ke as leftMarginForLabels, D as linePath, g as linearScale, ce as linkPath, b as logScale, Ie as lttb, Yt as mapVisual, se as maxDepth, Le as minmax, re as nearestIndex, _ as niceTicks, it as panWindow, J as partition, Mt as patternId, Jt as pieceIndex, Se as polarPoint, T as quantize, Ce as radiusScale, xe as rampLightness, ye as rampOf, be as rampStops, Me as regression, ht as releaseSyncGroup, wt as renderAnnotation, Tt as renderAnnotations, tt as resolveColor, Ot as resolveLabels, qe as rightMarginForLabels, Y as sankeyLayout, _e as sequentialRamp, lt as serializeSvg, Ee as sort, E as splitDefined, y as sqrtScale, W as squarify, P as stackSeries, K as streamExtent, G as streamLayout, q as sumValue, ut as svgToPngBlob, w as timeScale, F as toStackedSeries, He as useChartSize, Be as useStreamSeries, Xt as visualVisible, I as voronoiCells, ie as voronoiFind, zt as wrapText, rt as zoomWindow };
|