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