@cascivo/charts 0.3.10 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +699 -691
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -159,7 +159,10 @@ function S(e, t) {
|
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/engine/shape.ts
|
|
162
|
-
function C(e
|
|
162
|
+
function C(e) {
|
|
163
|
+
return Math.round(e * 100) / 100;
|
|
164
|
+
}
|
|
165
|
+
function w(e, t = !1) {
|
|
163
166
|
if (t) {
|
|
164
167
|
let t = e.filter((e) => e !== null);
|
|
165
168
|
return t.length > 0 ? [t] : [];
|
|
@@ -168,22 +171,22 @@ function C(e, t = !1) {
|
|
|
168
171
|
for (let t of e) t === null ? (r.length > 0 && n.push(r), r = []) : r.push(t);
|
|
169
172
|
return r.length > 0 && n.push(r), n;
|
|
170
173
|
}
|
|
171
|
-
function
|
|
174
|
+
function T(e, t = "linear") {
|
|
172
175
|
if (e.length === 0) return "";
|
|
173
176
|
if (e.length === 1 || t === "linear") return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
174
177
|
switch (t) {
|
|
175
|
-
case "monotone": return
|
|
178
|
+
case "monotone": return M(e);
|
|
176
179
|
case "step":
|
|
177
180
|
case "stepBefore":
|
|
178
|
-
case "stepAfter": return
|
|
179
|
-
case "natural": return
|
|
180
|
-
case "basis": return
|
|
181
|
-
case "cardinal": return
|
|
182
|
-
case "catmullRom": return
|
|
183
|
-
default: return
|
|
181
|
+
case "stepAfter": return E(e, t);
|
|
182
|
+
case "natural": return O(e);
|
|
183
|
+
case "basis": return k(e);
|
|
184
|
+
case "cardinal": return A(e, 0);
|
|
185
|
+
case "catmullRom": return j(e, .5);
|
|
186
|
+
default: return M(e);
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
|
-
function
|
|
189
|
+
function E(e, t) {
|
|
187
190
|
let n = `M${e[0][0]},${e[0][1]}`;
|
|
188
191
|
for (let r = 0; r < e.length - 1; r++) {
|
|
189
192
|
let [i, a] = e[r], [o, s] = e[r + 1];
|
|
@@ -196,7 +199,7 @@ function T(e, t) {
|
|
|
196
199
|
}
|
|
197
200
|
return n;
|
|
198
201
|
}
|
|
199
|
-
function
|
|
202
|
+
function D(e) {
|
|
200
203
|
let t = e.length - 1;
|
|
201
204
|
if (t < 1) return [[], []];
|
|
202
205
|
let n = Array(t), r = Array(t), i = Array(t);
|
|
@@ -213,14 +216,14 @@ function E(e) {
|
|
|
213
216
|
for (let n = 0; n < t - 1; n++) o[n] = 2 * e[n + 1] - a[n + 1];
|
|
214
217
|
return o[t - 1] = (e[t] + a[t - 1]) / 2, [a, o];
|
|
215
218
|
}
|
|
216
|
-
function
|
|
219
|
+
function O(e) {
|
|
217
220
|
let t = e.length;
|
|
218
221
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
219
|
-
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] =
|
|
222
|
+
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = D(n), [o, s] = D(r), c = `M${n[0]},${r[0]}`;
|
|
220
223
|
for (let e = 0; e < t - 1; e++) c += `C${i[e]},${o[e]} ${a[e]},${s[e]} ${n[e + 1]},${r[e + 1]}`;
|
|
221
224
|
return c;
|
|
222
225
|
}
|
|
223
|
-
function
|
|
226
|
+
function k(e) {
|
|
224
227
|
let t = e.length;
|
|
225
228
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
226
229
|
let n = (n) => e[Math.max(0, Math.min(t - 1, n))][0], r = (n) => e[Math.max(0, Math.min(t - 1, n))][1], i = `M${n(0)},${r(0)}`;
|
|
@@ -231,7 +234,7 @@ function O(e) {
|
|
|
231
234
|
let a = e[t - 1];
|
|
232
235
|
return i += `L${a[0]},${a[1]}`, i;
|
|
233
236
|
}
|
|
234
|
-
function
|
|
237
|
+
function A(e, t) {
|
|
235
238
|
let n = e.length;
|
|
236
239
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
237
240
|
let r = (1 - t) / 6, i = (t) => e[Math.max(0, Math.min(n - 1, t))], a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -241,7 +244,7 @@ function k(e, t) {
|
|
|
241
244
|
}
|
|
242
245
|
return a;
|
|
243
246
|
}
|
|
244
|
-
function
|
|
247
|
+
function j(e, t) {
|
|
245
248
|
let n = e.length;
|
|
246
249
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
247
250
|
let r = (t) => e[Math.max(0, Math.min(n - 1, t))], i = (e, t) => Math.hypot(t[0] - e[0], t[1] - e[1]), a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -251,7 +254,7 @@ function A(e, t) {
|
|
|
251
254
|
}
|
|
252
255
|
return a;
|
|
253
256
|
}
|
|
254
|
-
function
|
|
257
|
+
function M(e) {
|
|
255
258
|
let t = e.length, n = [], r = [], i = [];
|
|
256
259
|
for (let a = 0; a < t - 1; a++) n[a] = e[a + 1][0] - e[a][0], r[a] = e[a + 1][1] - e[a][1], i[a] = n[a] === 0 ? 0 : r[a] / n[a];
|
|
257
260
|
let a = [i[0] ?? 0];
|
|
@@ -267,23 +270,23 @@ function j(e) {
|
|
|
267
270
|
}
|
|
268
271
|
return o;
|
|
269
272
|
}
|
|
270
|
-
function
|
|
273
|
+
function N(e, t, n = "linear") {
|
|
271
274
|
if (e.length === 0) return "";
|
|
272
|
-
let r =
|
|
275
|
+
let r = T(e, n), i = e[e.length - 1], a = e[0];
|
|
273
276
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
274
277
|
}
|
|
275
|
-
function
|
|
278
|
+
function P(e, t, n, r, i, a) {
|
|
276
279
|
let o = 2 * Math.PI;
|
|
277
280
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
278
281
|
let a = i + Math.PI;
|
|
279
|
-
return
|
|
282
|
+
return P(e, t, n, r, i, a) + P(e, t, n, r, a, i + o - 1e-9);
|
|
280
283
|
}
|
|
281
|
-
let s = (n, r) => [e + n * Math.sin(r), t - n * Math.cos(r)], c = +(a - i > Math.PI),
|
|
282
|
-
if (r <= 0) return `M${e},${t}L${
|
|
283
|
-
let [
|
|
284
|
-
return `M${
|
|
284
|
+
let s = (n, r) => [C(e + n * Math.sin(r)), C(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = C(n), u = C(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
285
|
+
if (r <= 0) return `M${C(e)},${C(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
286
|
+
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
287
|
+
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
285
288
|
}
|
|
286
|
-
function
|
|
289
|
+
function F(e) {
|
|
287
290
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
288
291
|
return e.map((e) => e.map((e, t) => {
|
|
289
292
|
let r = n[t];
|
|
@@ -292,7 +295,7 @@ function P(e) {
|
|
|
292
295
|
}
|
|
293
296
|
//#endregion
|
|
294
297
|
//#region src/engine/stacked.ts
|
|
295
|
-
function
|
|
298
|
+
function I(e) {
|
|
296
299
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
297
300
|
for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
|
|
298
301
|
return {
|
|
@@ -314,7 +317,7 @@ function F(e) {
|
|
|
314
317
|
}
|
|
315
318
|
//#endregion
|
|
316
319
|
//#region src/engine/nearest.ts
|
|
317
|
-
function
|
|
320
|
+
function L(e, t) {
|
|
318
321
|
if (e.length === 0) return -1;
|
|
319
322
|
if (e.length === 1) return 0;
|
|
320
323
|
let n = 0, r = e.length - 1;
|
|
@@ -326,7 +329,7 @@ function I(e, t) {
|
|
|
326
329
|
}
|
|
327
330
|
//#endregion
|
|
328
331
|
//#region src/engine/voronoi.ts
|
|
329
|
-
function
|
|
332
|
+
function ee(e, t, n) {
|
|
330
333
|
let r = -1, i = Infinity;
|
|
331
334
|
for (let a = 0; a < e.length; a++) {
|
|
332
335
|
let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
|
|
@@ -334,7 +337,7 @@ function L(e, t, n) {
|
|
|
334
337
|
}
|
|
335
338
|
return r;
|
|
336
339
|
}
|
|
337
|
-
function
|
|
340
|
+
function te(e, t, n, r, i) {
|
|
338
341
|
if (e.length === 0) return e;
|
|
339
342
|
let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
|
|
340
343
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -346,7 +349,7 @@ function R(e, t, n, r, i) {
|
|
|
346
349
|
}
|
|
347
350
|
return a;
|
|
348
351
|
}
|
|
349
|
-
function
|
|
352
|
+
function R(e, t) {
|
|
350
353
|
let n = [
|
|
351
354
|
[t.x0, t.y0],
|
|
352
355
|
[t.x1, t.y0],
|
|
@@ -358,7 +361,7 @@ function ee(e, t) {
|
|
|
358
361
|
for (let n = 0; n < e.length && i.length > 0; n++) {
|
|
359
362
|
if (n === r) continue;
|
|
360
363
|
let a = e[n];
|
|
361
|
-
i =
|
|
364
|
+
i = te(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
|
|
362
365
|
}
|
|
363
366
|
return i;
|
|
364
367
|
});
|
|
@@ -488,8 +491,8 @@ function q(e, t, n) {
|
|
|
488
491
|
}
|
|
489
492
|
//#endregion
|
|
490
493
|
//#region src/engine/stream.ts
|
|
491
|
-
function
|
|
492
|
-
let n =
|
|
494
|
+
function ne(e, t = "silhouette") {
|
|
495
|
+
let n = F(e);
|
|
493
496
|
if (t === "zero") return n;
|
|
494
497
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
495
498
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -497,7 +500,7 @@ function J(e, t = "silhouette") {
|
|
|
497
500
|
return [e - r, t - r];
|
|
498
501
|
}));
|
|
499
502
|
}
|
|
500
|
-
function
|
|
503
|
+
function J(e) {
|
|
501
504
|
let t = 0, n = 0;
|
|
502
505
|
for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
|
|
503
506
|
return [t, n];
|
|
@@ -507,7 +510,7 @@ function te(e) {
|
|
|
507
510
|
function Y(e) {
|
|
508
511
|
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + Y(t), 0) : e.value ?? 0;
|
|
509
512
|
}
|
|
510
|
-
function
|
|
513
|
+
function re(e, t = 2 * Math.PI) {
|
|
511
514
|
let n = [], r = (e, t, i, a) => {
|
|
512
515
|
if (n.push({
|
|
513
516
|
node: e,
|
|
@@ -524,12 +527,12 @@ function X(e, t = 2 * Math.PI) {
|
|
|
524
527
|
};
|
|
525
528
|
return r(e, 0, 0, t), n;
|
|
526
529
|
}
|
|
527
|
-
function
|
|
530
|
+
function X(e) {
|
|
528
531
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
529
532
|
}
|
|
530
533
|
//#endregion
|
|
531
534
|
//#region src/engine/sankey.ts
|
|
532
|
-
function
|
|
535
|
+
function ie(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
|
|
533
536
|
let o = /* @__PURE__ */ new Map();
|
|
534
537
|
for (let t of e) o.set(t.id, {
|
|
535
538
|
...t,
|
|
@@ -583,61 +586,61 @@ function Z(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }
|
|
|
583
586
|
links: v
|
|
584
587
|
};
|
|
585
588
|
}
|
|
586
|
-
function
|
|
589
|
+
function ae(e) {
|
|
587
590
|
let t = e.source.x1, n = e.target.x0, r = (t + n) / 2, i = e.sy, a = e.sy + e.width, o = e.ty, s = e.ty + e.width;
|
|
588
591
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
589
592
|
}
|
|
590
593
|
//#endregion
|
|
591
594
|
//#region src/engine/ramp.ts
|
|
592
|
-
var
|
|
593
|
-
l:
|
|
594
|
-
c:
|
|
595
|
-
h:
|
|
596
|
-
}),
|
|
595
|
+
var oe = (e) => e < 0 ? 0 : e > 1 ? 1 : e, se = (e, t, n) => e + (t - e) * n, ce = (e, t, n) => ({
|
|
596
|
+
l: se(e.l, t.l, n),
|
|
597
|
+
c: se(e.c, t.c, n),
|
|
598
|
+
h: se(e.h, t.h, n)
|
|
599
|
+
}), le = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, ue = {
|
|
597
600
|
l: .95,
|
|
598
601
|
c: .04,
|
|
599
602
|
h: 232
|
|
600
|
-
},
|
|
603
|
+
}, de = {
|
|
601
604
|
l: .34,
|
|
602
605
|
c: .15,
|
|
603
606
|
h: 274
|
|
604
|
-
},
|
|
607
|
+
}, fe = {
|
|
605
608
|
l: .48,
|
|
606
609
|
c: .14,
|
|
607
610
|
h: 248
|
|
608
|
-
},
|
|
611
|
+
}, pe = {
|
|
609
612
|
l: .96,
|
|
610
613
|
c: .02,
|
|
611
614
|
h: 110
|
|
612
|
-
},
|
|
615
|
+
}, me = {
|
|
613
616
|
l: .52,
|
|
614
617
|
c: .15,
|
|
615
618
|
h: 42
|
|
616
619
|
};
|
|
617
|
-
function
|
|
618
|
-
return
|
|
620
|
+
function he(e) {
|
|
621
|
+
return le(ce(ue, de, oe(e)));
|
|
619
622
|
}
|
|
620
|
-
function
|
|
621
|
-
let t =
|
|
622
|
-
return
|
|
623
|
+
function ge(e) {
|
|
624
|
+
let t = oe(e);
|
|
625
|
+
return le(t < .5 ? ce(fe, pe, t * 2) : ce(pe, me, (t - .5) * 2));
|
|
623
626
|
}
|
|
624
|
-
function
|
|
625
|
-
return e === "diverging" ?
|
|
627
|
+
function _e(e) {
|
|
628
|
+
return e === "diverging" ? ge : he;
|
|
626
629
|
}
|
|
627
|
-
function
|
|
628
|
-
let n =
|
|
630
|
+
function ve(e, t = "sequential") {
|
|
631
|
+
let n = _e(t);
|
|
629
632
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
630
633
|
}
|
|
631
|
-
function
|
|
634
|
+
function ye(e) {
|
|
632
635
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
633
636
|
return t ? Number(t[1]) : NaN;
|
|
634
637
|
}
|
|
635
638
|
//#endregion
|
|
636
639
|
//#region src/engine/polar.ts
|
|
637
|
-
function
|
|
638
|
-
return [e + n * Math.sin(r), t - n * Math.cos(r)];
|
|
640
|
+
function be(e, t, n, r) {
|
|
641
|
+
return [C(e + n * Math.sin(r)), C(t - n * Math.cos(r))];
|
|
639
642
|
}
|
|
640
|
-
function
|
|
643
|
+
function xe(e, t = [0, 2 * Math.PI]) {
|
|
641
644
|
let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
|
|
642
645
|
let n = i.get(e);
|
|
643
646
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -652,25 +655,25 @@ function ye(e, t = [0, 2 * Math.PI]) {
|
|
|
652
655
|
step: r
|
|
653
656
|
};
|
|
654
657
|
}
|
|
655
|
-
function
|
|
658
|
+
function Se(e, t) {
|
|
656
659
|
return m(e, t);
|
|
657
660
|
}
|
|
658
661
|
//#endregion
|
|
659
662
|
//#region src/engine/transform.ts
|
|
660
|
-
function
|
|
663
|
+
function Ce(e, t) {
|
|
661
664
|
return e.filter((e, n) => t(e, n));
|
|
662
665
|
}
|
|
663
|
-
function
|
|
666
|
+
function we(e, t) {
|
|
664
667
|
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
|
|
665
668
|
}
|
|
666
|
-
function
|
|
669
|
+
function Te(e, t, n = "asc") {
|
|
667
670
|
let r = typeof t == "function" ? t : (e) => e[t], i = n === "desc" ? -1 : 1;
|
|
668
671
|
return e.map((e, t) => ({
|
|
669
672
|
row: e,
|
|
670
673
|
i: t
|
|
671
|
-
})).sort((e, t) =>
|
|
674
|
+
})).sort((e, t) => we(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
|
|
672
675
|
}
|
|
673
|
-
function
|
|
676
|
+
function Ee(e, t) {
|
|
674
677
|
if (e === "count") return t.length;
|
|
675
678
|
if (t.length === 0) return 0;
|
|
676
679
|
switch (e) {
|
|
@@ -684,7 +687,7 @@ function we(e, t) {
|
|
|
684
687
|
}
|
|
685
688
|
}
|
|
686
689
|
}
|
|
687
|
-
function
|
|
690
|
+
function De(e, t) {
|
|
688
691
|
let n = typeof t.groupBy == "string" ? [t.groupBy] : t.groupBy, r = /* @__PURE__ */ new Map(), i = [];
|
|
689
692
|
for (let t of e) {
|
|
690
693
|
let e = n.map((e) => String(t[e])).join("\0"), a = r.get(e);
|
|
@@ -693,11 +696,11 @@ function Te(e, t) {
|
|
|
693
696
|
return i.map((e) => {
|
|
694
697
|
let i = r.get(e), a = {};
|
|
695
698
|
for (let e of n) a[e] = i[0][e];
|
|
696
|
-
for (let [e, n] of Object.entries(t.ops)) a[e] =
|
|
699
|
+
for (let [e, n] of Object.entries(t.ops)) a[e] = Ee(n, i.map((t) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)));
|
|
697
700
|
return a;
|
|
698
701
|
});
|
|
699
702
|
}
|
|
700
|
-
function
|
|
703
|
+
function Oe(e, t = {}) {
|
|
701
704
|
let n = e.filter((e) => Number.isFinite(e)), [r, i] = t.range ?? [Math.min(...n), Math.max(...n)], a = Math.max(1, t.bins ?? (Math.ceil(Math.sqrt(n.length)) || 1)), o = (i - r) / a || 1, s = Array.from({ length: a }, (e, t) => ({
|
|
702
705
|
x0: r + t * o,
|
|
703
706
|
x1: r + (t + 1) * o,
|
|
@@ -711,7 +714,7 @@ function Ee(e, t = {}) {
|
|
|
711
714
|
}
|
|
712
715
|
return s;
|
|
713
716
|
}
|
|
714
|
-
function
|
|
717
|
+
function ke(e, t) {
|
|
715
718
|
let n = t.length, r = e.map((e, n) => [...e, t[n]]);
|
|
716
719
|
for (let e = 0; e < n; e++) {
|
|
717
720
|
let t = e;
|
|
@@ -729,12 +732,12 @@ function De(e, t) {
|
|
|
729
732
|
return Math.abs(i) < 1e-12 ? 0 : r[t][n] / i;
|
|
730
733
|
});
|
|
731
734
|
}
|
|
732
|
-
function
|
|
735
|
+
function Ae(e, t) {
|
|
733
736
|
let n = e.map((e) => e[1]), r = n.reduce((e, t) => e + t, 0) / n.length, i = 0, a = 0;
|
|
734
737
|
for (let [n, o] of e) i += (o - t(n)) ** 2, a += (o - r) ** 2;
|
|
735
738
|
return a === 0 ? 1 : 1 - i / a;
|
|
736
739
|
}
|
|
737
|
-
function
|
|
740
|
+
function je(e, t = {}) {
|
|
738
741
|
let n = t.type ?? "linear", r = [...e].sort((e, t) => e[0] - t[0]), i = r.map((e) => e[0]), a = () => {
|
|
739
742
|
let e = r.length ? r.reduce((e, t) => e + t[1], 0) / r.length : 0;
|
|
740
743
|
return {
|
|
@@ -748,11 +751,11 @@ function ke(e, t = {}) {
|
|
|
748
751
|
if (n === "exponential") {
|
|
749
752
|
let e = r.filter((e) => e[1] > 0);
|
|
750
753
|
if (e.length < 2) return a();
|
|
751
|
-
let t =
|
|
754
|
+
let t = je(e.map((e) => [e[0], Math.log(e[1])]), { type: "linear" }), n = Math.exp(t.coefficients[0]), o = t.coefficients[1], s = (e) => n * Math.exp(o * e);
|
|
752
755
|
return {
|
|
753
756
|
predict: s,
|
|
754
757
|
points: i.map((e) => [e, s(e)]),
|
|
755
|
-
r2:
|
|
758
|
+
r2: Ae(r, s),
|
|
756
759
|
coefficients: [n, o]
|
|
757
760
|
};
|
|
758
761
|
}
|
|
@@ -764,18 +767,18 @@ function ke(e, t = {}) {
|
|
|
764
767
|
for (let t = 0; t < o; t++) s[e][t] += n[e] * n[t];
|
|
765
768
|
}
|
|
766
769
|
}
|
|
767
|
-
let l =
|
|
770
|
+
let l = ke(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
|
|
768
771
|
return {
|
|
769
772
|
predict: u,
|
|
770
773
|
points: i.map((e) => [e, u(e)]),
|
|
771
|
-
r2:
|
|
774
|
+
r2: Ae(r, u),
|
|
772
775
|
coefficients: l
|
|
773
776
|
};
|
|
774
777
|
}
|
|
775
778
|
//#endregion
|
|
776
779
|
//#region src/engine/dataset.ts
|
|
777
|
-
var
|
|
778
|
-
function
|
|
780
|
+
var Me = (e) => typeof e == "number" ? e : Number(e);
|
|
781
|
+
function Ne(e, t) {
|
|
779
782
|
let n = (e) => e.x, r = (e) => e.y;
|
|
780
783
|
if (!t.series) return {
|
|
781
784
|
series: [{
|
|
@@ -783,7 +786,7 @@ function je(e, t) {
|
|
|
783
786
|
label: t.label ?? t.y,
|
|
784
787
|
data: e.map((e) => ({
|
|
785
788
|
x: e[t.x],
|
|
786
|
-
y:
|
|
789
|
+
y: Me(e[t.y])
|
|
787
790
|
}))
|
|
788
791
|
}],
|
|
789
792
|
x: n,
|
|
@@ -798,7 +801,7 @@ function je(e, t) {
|
|
|
798
801
|
data: []
|
|
799
802
|
}, i.set(e, r), a.push(e)), r.data.push({
|
|
800
803
|
x: n[t.x],
|
|
801
|
-
y:
|
|
804
|
+
y: Me(n[t.y])
|
|
802
805
|
});
|
|
803
806
|
}
|
|
804
807
|
return {
|
|
@@ -807,15 +810,15 @@ function je(e, t) {
|
|
|
807
810
|
y: r
|
|
808
811
|
};
|
|
809
812
|
}
|
|
810
|
-
function
|
|
813
|
+
function Pe(e, t) {
|
|
811
814
|
return e.map((e) => ({
|
|
812
815
|
label: String(e[t.category]),
|
|
813
|
-
value:
|
|
816
|
+
value: Me(e[t.value])
|
|
814
817
|
}));
|
|
815
818
|
}
|
|
816
819
|
//#endregion
|
|
817
820
|
//#region src/engine/decimate.ts
|
|
818
|
-
function
|
|
821
|
+
function Fe(e, t) {
|
|
819
822
|
let n = e.length;
|
|
820
823
|
if (t >= n || t < 3) return e.slice();
|
|
821
824
|
let r = [e[0]], i = (n - 2) / (t - 2), a = 0;
|
|
@@ -832,7 +835,7 @@ function Ne(e, t) {
|
|
|
832
835
|
}
|
|
833
836
|
return r.push(e[n - 1]), r;
|
|
834
837
|
}
|
|
835
|
-
function
|
|
838
|
+
function Ie(e, t) {
|
|
836
839
|
let n = e.length;
|
|
837
840
|
if (t >= n || t < 4) return e.slice();
|
|
838
841
|
let r = Math.max(1, Math.floor(t / 2)), i = n / r, a = [e[0]];
|
|
@@ -845,27 +848,27 @@ function Pe(e, t) {
|
|
|
845
848
|
}
|
|
846
849
|
return a.push(e[n - 1]), a;
|
|
847
850
|
}
|
|
848
|
-
function
|
|
849
|
-
return n === "minmax" ?
|
|
851
|
+
function Le(e, t, n = "lttb") {
|
|
852
|
+
return n === "minmax" ? Ie(e, t) : Fe(e, t);
|
|
850
853
|
}
|
|
851
854
|
//#endregion
|
|
852
855
|
//#region src/stream/use-stream-series.ts
|
|
853
|
-
function
|
|
854
|
-
return e.length <= t.to ? e :
|
|
856
|
+
function Re(e, t) {
|
|
857
|
+
return e.length <= t.to ? e : Le(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
|
|
855
858
|
}
|
|
856
|
-
function
|
|
859
|
+
function ze(e) {
|
|
857
860
|
let { capacity: n, source: i, decimate: o } = e, s = c(t({ capacity: n })).current, l = c(i);
|
|
858
861
|
return l.current = i, a(() => {
|
|
859
862
|
let e = l.current((e) => s.append(e));
|
|
860
863
|
return () => {
|
|
861
864
|
e(), s.dispose();
|
|
862
865
|
};
|
|
863
|
-
}), r(() => o ?
|
|
866
|
+
}), r(() => o ? Re(s.signal.value, o) : s.signal.value);
|
|
864
867
|
}
|
|
865
|
-
function
|
|
868
|
+
function Be(n) {
|
|
866
869
|
let { capacity: r, source: i, decimate: a } = n, o = t({ capacity: r }), s = i((e) => o.append(e));
|
|
867
870
|
return {
|
|
868
|
-
signal: a ? e(() =>
|
|
871
|
+
signal: a ? e(() => Re(o.signal.value, a)) : o.signal,
|
|
869
872
|
stop: () => {
|
|
870
873
|
s(), o.dispose();
|
|
871
874
|
}
|
|
@@ -873,53 +876,58 @@ function Re(n) {
|
|
|
873
876
|
}
|
|
874
877
|
//#endregion
|
|
875
878
|
//#region src/core/use-chart.ts
|
|
876
|
-
function
|
|
879
|
+
function Ve(e = 400, t = 300) {
|
|
877
880
|
let n = c(null), r = i(e), o = i(t);
|
|
878
881
|
return a(() => {
|
|
879
882
|
let e = n.current;
|
|
880
883
|
if (!e) return;
|
|
884
|
+
let t = (e, t) => {
|
|
885
|
+
e > 0 && e !== r.peek() && (r.value = e), t > 0 && t !== o.peek() && (o.value = t);
|
|
886
|
+
};
|
|
881
887
|
if (typeof ResizeObserver > "u") {
|
|
882
|
-
let
|
|
883
|
-
t
|
|
888
|
+
let n = e.getBoundingClientRect();
|
|
889
|
+
t(n.width, n.height);
|
|
884
890
|
return;
|
|
885
891
|
}
|
|
886
|
-
let
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
892
|
+
let i = 0, a = new ResizeObserver((e) => {
|
|
893
|
+
let n = e[e.length - 1];
|
|
894
|
+
if (!n) return;
|
|
895
|
+
let { width: r, height: a } = n.contentRect;
|
|
896
|
+
cancelAnimationFrame(i), i = requestAnimationFrame(() => t(r, a));
|
|
891
897
|
});
|
|
892
|
-
return
|
|
898
|
+
return a.observe(e), () => {
|
|
899
|
+
cancelAnimationFrame(i), a.disconnect();
|
|
900
|
+
};
|
|
893
901
|
}), {
|
|
894
902
|
ref: n,
|
|
895
903
|
width: r,
|
|
896
904
|
height: o
|
|
897
905
|
};
|
|
898
906
|
}
|
|
899
|
-
var
|
|
907
|
+
var Z = {
|
|
900
908
|
top: 8,
|
|
901
909
|
right: 8,
|
|
902
910
|
bottom: 24,
|
|
903
911
|
left: 36
|
|
904
|
-
},
|
|
912
|
+
}, He = {
|
|
905
913
|
top: 2,
|
|
906
914
|
right: 2,
|
|
907
915
|
bottom: 2,
|
|
908
916
|
left: 2
|
|
909
|
-
},
|
|
917
|
+
}, Ue = {
|
|
910
918
|
frame: "_frame_1doa7_2",
|
|
911
919
|
"cascivo-chart-in": "_cascivo-chart-in_1doa7_1",
|
|
912
920
|
fallback: "_fallback_1doa7_53"
|
|
913
921
|
};
|
|
914
922
|
//#endregion
|
|
915
923
|
//#region src/core/data-point.ts
|
|
916
|
-
function
|
|
924
|
+
function We(e) {
|
|
917
925
|
return `${e.label}: ${e.value}`;
|
|
918
926
|
}
|
|
919
927
|
//#endregion
|
|
920
928
|
//#region src/core/chart-tooltip.tsx
|
|
921
|
-
function
|
|
922
|
-
let n = t.format ? t.format(e) :
|
|
929
|
+
function Ge({ point: e, model: t }) {
|
|
930
|
+
let n = t.format ? t.format(e) : We(e), r = e.segments?.filter((e) => e.value !== 0);
|
|
923
931
|
return /* @__PURE__ */ f("div", {
|
|
924
932
|
role: "tooltip",
|
|
925
933
|
style: {
|
|
@@ -967,7 +975,7 @@ function We({ point: e, model: t }) {
|
|
|
967
975
|
}
|
|
968
976
|
//#endregion
|
|
969
977
|
//#region src/core/nearest.ts
|
|
970
|
-
function
|
|
978
|
+
function Ke(e, t, n, r = "xy") {
|
|
971
979
|
if (e.length === 0) return -1;
|
|
972
980
|
let i = 0, a = Infinity;
|
|
973
981
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -978,7 +986,7 @@ function Ge(e, t, n, r = "xy") {
|
|
|
978
986
|
}
|
|
979
987
|
//#endregion
|
|
980
988
|
//#region src/core/canvas-layer.tsx
|
|
981
|
-
function
|
|
989
|
+
function qe({ size: e, paint: t }) {
|
|
982
990
|
let n = c(null);
|
|
983
991
|
return a(() => {
|
|
984
992
|
let { width: r, height: i } = e(), a = n.current;
|
|
@@ -1003,28 +1011,28 @@ function Ke({ size: e, paint: t }) {
|
|
|
1003
1011
|
}
|
|
1004
1012
|
});
|
|
1005
1013
|
}
|
|
1006
|
-
function
|
|
1014
|
+
function Je(e, t) {
|
|
1007
1015
|
let n = /var\((--[^,)]+)/.exec(t);
|
|
1008
1016
|
return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
|
|
1009
1017
|
}
|
|
1010
1018
|
//#endregion
|
|
1011
1019
|
//#region src/core/zoom.ts
|
|
1012
|
-
var
|
|
1013
|
-
function
|
|
1020
|
+
var Ye = 1;
|
|
1021
|
+
function Xe(e, t, n, r) {
|
|
1014
1022
|
if (t <= 1) return [0, Math.max(0, t - 1)];
|
|
1015
1023
|
let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
|
|
1016
|
-
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s <
|
|
1024
|
+
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < Ye && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - Ye)), c = Math.min(t - 1, s + Ye)), [s, c];
|
|
1017
1025
|
}
|
|
1018
|
-
function
|
|
1026
|
+
function Ze(e, t, n) {
|
|
1019
1027
|
let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
|
|
1020
1028
|
return [o, o + a];
|
|
1021
1029
|
}
|
|
1022
|
-
function
|
|
1030
|
+
function Qe(e, t) {
|
|
1023
1031
|
return e[0] > 0 || e[1] < t - 1;
|
|
1024
1032
|
}
|
|
1025
1033
|
//#endregion
|
|
1026
1034
|
//#region src/chrome/toolbox.tsx
|
|
1027
|
-
var
|
|
1035
|
+
var $e = {
|
|
1028
1036
|
display: "inline-flex",
|
|
1029
1037
|
alignItems: "center",
|
|
1030
1038
|
justifyContent: "center",
|
|
@@ -1039,7 +1047,7 @@ var Qe = {
|
|
|
1039
1047
|
color: "var(--cascivo-color-foreground, inherit)",
|
|
1040
1048
|
cursor: "pointer"
|
|
1041
1049
|
};
|
|
1042
|
-
function
|
|
1050
|
+
function et({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
|
|
1043
1051
|
let o = e;
|
|
1044
1052
|
return /* @__PURE__ */ p("div", {
|
|
1045
1053
|
role: "group",
|
|
@@ -1051,26 +1059,26 @@ function $e({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1051
1059
|
children: [
|
|
1052
1060
|
o.png !== !1 && /* @__PURE__ */ f("button", {
|
|
1053
1061
|
type: "button",
|
|
1054
|
-
style:
|
|
1062
|
+
style: $e,
|
|
1055
1063
|
onClick: t,
|
|
1056
1064
|
children: u(l.charts.exportPng)
|
|
1057
1065
|
}),
|
|
1058
1066
|
o.svg !== !1 && /* @__PURE__ */ f("button", {
|
|
1059
1067
|
type: "button",
|
|
1060
|
-
style:
|
|
1068
|
+
style: $e,
|
|
1061
1069
|
onClick: n,
|
|
1062
1070
|
children: u(l.charts.exportSvg)
|
|
1063
1071
|
}),
|
|
1064
1072
|
o.dataView !== !1 && /* @__PURE__ */ f("button", {
|
|
1065
1073
|
type: "button",
|
|
1066
|
-
style:
|
|
1074
|
+
style: $e,
|
|
1067
1075
|
"aria-pressed": a,
|
|
1068
1076
|
onClick: r,
|
|
1069
1077
|
children: u(l.charts.dataView)
|
|
1070
1078
|
}),
|
|
1071
1079
|
o.restore !== !1 && /* @__PURE__ */ f("button", {
|
|
1072
1080
|
type: "button",
|
|
1073
|
-
style:
|
|
1081
|
+
style: $e,
|
|
1074
1082
|
onClick: i,
|
|
1075
1083
|
children: u(l.charts.restore)
|
|
1076
1084
|
})
|
|
@@ -1079,19 +1087,19 @@ function $e({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1079
1087
|
}
|
|
1080
1088
|
//#endregion
|
|
1081
1089
|
//#region src/core/export.ts
|
|
1082
|
-
var
|
|
1090
|
+
var tt = [
|
|
1083
1091
|
"fill",
|
|
1084
1092
|
"stroke",
|
|
1085
1093
|
"stop-color",
|
|
1086
1094
|
"color"
|
|
1087
1095
|
];
|
|
1088
|
-
function
|
|
1096
|
+
function nt(e) {
|
|
1089
1097
|
let t = e.cloneNode(!0);
|
|
1090
1098
|
if (typeof getComputedStyle == "function") {
|
|
1091
1099
|
let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
|
|
1092
1100
|
for (let e = 0; e < n.length; e++) {
|
|
1093
1101
|
let t = getComputedStyle(n[e]), i = r[e];
|
|
1094
|
-
if (i) for (let e of
|
|
1102
|
+
if (i) for (let e of tt) {
|
|
1095
1103
|
let n = t.getPropertyValue(e);
|
|
1096
1104
|
n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
|
|
1097
1105
|
}
|
|
@@ -1099,7 +1107,7 @@ function tt(e) {
|
|
|
1099
1107
|
}
|
|
1100
1108
|
return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
|
|
1101
1109
|
}
|
|
1102
|
-
function
|
|
1110
|
+
function rt(e, t) {
|
|
1103
1111
|
if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
|
|
1104
1112
|
let n = t.dpr ?? 1, r = document.createElement("canvas");
|
|
1105
1113
|
r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
|
|
@@ -1115,14 +1123,14 @@ function nt(e, t) {
|
|
|
1115
1123
|
}), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
1116
1124
|
}) : Promise.resolve(null);
|
|
1117
1125
|
}
|
|
1118
|
-
function
|
|
1126
|
+
function it(e, t) {
|
|
1119
1127
|
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
1120
1128
|
let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1121
1129
|
i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
1122
1130
|
}
|
|
1123
1131
|
//#endregion
|
|
1124
1132
|
//#region src/core/chart-frame.tsx
|
|
1125
|
-
var
|
|
1133
|
+
var at = {
|
|
1126
1134
|
position: "absolute",
|
|
1127
1135
|
insetInlineStart: "-9999px",
|
|
1128
1136
|
inlineSize: "1px",
|
|
@@ -1133,85 +1141,85 @@ var it = {
|
|
|
1133
1141
|
};
|
|
1134
1142
|
function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: k, onAfterDraw: A }) {
|
|
1135
1143
|
o();
|
|
1136
|
-
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref: P, width: F, height: I } =
|
|
1144
|
+
let j = s(), M = `${j}-desc`, N = `${j}-live`, { ref: P, width: F, height: I } = Ve(n ?? 400, r), L = i(null), te = i(!1), R = c(null), z = c(null), B = c(null), V = c(null);
|
|
1137
1145
|
a(() => {
|
|
1138
|
-
let e =
|
|
1146
|
+
let e = V.current;
|
|
1139
1147
|
if (!e || !T) return;
|
|
1140
1148
|
let t = (t) => {
|
|
1141
1149
|
t.preventDefault();
|
|
1142
1150
|
let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
|
|
1143
|
-
T.window.value =
|
|
1151
|
+
T.window.value = Xe(T.window.value, T.count, i, r);
|
|
1144
1152
|
};
|
|
1145
1153
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1146
1154
|
});
|
|
1147
|
-
let
|
|
1155
|
+
let H = () => {
|
|
1148
1156
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1149
|
-
},
|
|
1150
|
-
let t =
|
|
1151
|
-
t &&
|
|
1152
|
-
},
|
|
1153
|
-
let t =
|
|
1154
|
-
t &&
|
|
1155
|
-
width:
|
|
1156
|
-
height:
|
|
1157
|
+
}, U = n ?? F.value, W = r ?? I.value, G = E === !0 ? {} : E || null, K = () => z.current ? nt(z.current) : null, q = () => {
|
|
1158
|
+
let t = K();
|
|
1159
|
+
t && it(t, `${e || "chart"}.svg`);
|
|
1160
|
+
}, ne = () => {
|
|
1161
|
+
let t = K();
|
|
1162
|
+
t && rt(t, {
|
|
1163
|
+
width: U,
|
|
1164
|
+
height: W,
|
|
1157
1165
|
dpr: 2
|
|
1158
1166
|
}).then((t) => {
|
|
1159
|
-
t &&
|
|
1167
|
+
t && it(t, `${e || "chart"}.png`);
|
|
1160
1168
|
});
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
},
|
|
1164
|
-
width:
|
|
1165
|
-
height:
|
|
1169
|
+
}, J = () => {
|
|
1170
|
+
H(), D?.();
|
|
1171
|
+
}, Y = typeof b == "function" ? b({
|
|
1172
|
+
width: U,
|
|
1173
|
+
height: W
|
|
1166
1174
|
}) : b;
|
|
1167
1175
|
a(() => {
|
|
1168
|
-
let e =
|
|
1169
|
-
if (!
|
|
1170
|
-
let t = e === null ? void 0 :
|
|
1171
|
-
|
|
1176
|
+
let e = L.value;
|
|
1177
|
+
if (!Y || !R.current) return;
|
|
1178
|
+
let t = e === null ? void 0 : Y.points[e];
|
|
1179
|
+
R.current.textContent = t ? (Y.format ?? We)(t) : "";
|
|
1172
1180
|
});
|
|
1173
|
-
let
|
|
1181
|
+
let re = {
|
|
1174
1182
|
position: "absolute",
|
|
1175
1183
|
inset: 0,
|
|
1176
1184
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1177
1185
|
background: "transparent",
|
|
1178
1186
|
touchAction: T ? "none" : void 0
|
|
1179
|
-
},
|
|
1187
|
+
}, X = C === "canvas" && w !== void 0, ie = Y !== void 0 || T !== void 0, ae = {};
|
|
1180
1188
|
if (O && typeof O == "object") {
|
|
1181
|
-
let e =
|
|
1189
|
+
let e = ae;
|
|
1182
1190
|
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(", "));
|
|
1183
1191
|
}
|
|
1184
|
-
let
|
|
1185
|
-
...
|
|
1186
|
-
...
|
|
1192
|
+
let oe = ie || X || G || Object.keys(ae).length > 0 ? {
|
|
1193
|
+
...ae,
|
|
1194
|
+
...ie || X || G ? { position: "relative" } : {}
|
|
1187
1195
|
} : void 0;
|
|
1188
1196
|
return /* @__PURE__ */ p("div", {
|
|
1189
1197
|
ref: P,
|
|
1190
|
-
className: [
|
|
1191
|
-
style:
|
|
1198
|
+
className: [Ue.frame, g].filter(Boolean).join(" "),
|
|
1199
|
+
style: oe,
|
|
1192
1200
|
..._ !== void 0 && { "data-state": _ },
|
|
1193
1201
|
...y === !0 && { "data-plain": "" },
|
|
1194
1202
|
...O === !1 && { "data-no-anim": "" },
|
|
1195
1203
|
children: [
|
|
1196
|
-
|
|
1204
|
+
G && /* @__PURE__ */ f("div", {
|
|
1197
1205
|
style: {
|
|
1198
1206
|
position: "absolute",
|
|
1199
1207
|
top: 4,
|
|
1200
1208
|
right: 4,
|
|
1201
1209
|
zIndex: 12
|
|
1202
1210
|
},
|
|
1203
|
-
children: /* @__PURE__ */ f(
|
|
1204
|
-
options:
|
|
1205
|
-
onPng:
|
|
1206
|
-
onSvg:
|
|
1211
|
+
children: /* @__PURE__ */ f(et, {
|
|
1212
|
+
options: G,
|
|
1213
|
+
onPng: ne,
|
|
1214
|
+
onSvg: q,
|
|
1207
1215
|
onToggleData: () => {
|
|
1208
|
-
|
|
1216
|
+
te.value = !te.value;
|
|
1209
1217
|
},
|
|
1210
|
-
onRestore:
|
|
1211
|
-
showData:
|
|
1218
|
+
onRestore: J,
|
|
1219
|
+
showData: te.value
|
|
1212
1220
|
})
|
|
1213
1221
|
}),
|
|
1214
|
-
|
|
1222
|
+
X && /* @__PURE__ */ f(qe, {
|
|
1215
1223
|
size: () => ({
|
|
1216
1224
|
width: n ?? F.value,
|
|
1217
1225
|
height: r ?? I.value
|
|
@@ -1219,33 +1227,33 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1219
1227
|
paint: w
|
|
1220
1228
|
}),
|
|
1221
1229
|
/* @__PURE__ */ p("svg", {
|
|
1222
|
-
ref:
|
|
1230
|
+
ref: z,
|
|
1223
1231
|
role: "img",
|
|
1224
1232
|
"aria-label": e,
|
|
1225
1233
|
"aria-describedby": t ? M : void 0,
|
|
1226
|
-
width:
|
|
1227
|
-
height:
|
|
1228
|
-
viewBox: `0 0 ${
|
|
1234
|
+
width: U,
|
|
1235
|
+
height: W,
|
|
1236
|
+
viewBox: `0 0 ${U} ${W}`,
|
|
1229
1237
|
children: [
|
|
1230
1238
|
t && /* @__PURE__ */ f("desc", {
|
|
1231
1239
|
id: M,
|
|
1232
1240
|
children: t
|
|
1233
1241
|
}),
|
|
1234
1242
|
k?.({
|
|
1235
|
-
width:
|
|
1236
|
-
height:
|
|
1243
|
+
width: U,
|
|
1244
|
+
height: W
|
|
1237
1245
|
}),
|
|
1238
1246
|
h({
|
|
1239
|
-
width:
|
|
1240
|
-
height:
|
|
1247
|
+
width: U,
|
|
1248
|
+
height: W
|
|
1241
1249
|
}),
|
|
1242
1250
|
A?.({
|
|
1243
|
-
width:
|
|
1244
|
-
height:
|
|
1251
|
+
width: U,
|
|
1252
|
+
height: W
|
|
1245
1253
|
}),
|
|
1246
1254
|
_ === "empty" && /* @__PURE__ */ f("text", {
|
|
1247
|
-
x:
|
|
1248
|
-
y:
|
|
1255
|
+
x: U / 2,
|
|
1256
|
+
y: W / 2,
|
|
1249
1257
|
textAnchor: "middle",
|
|
1250
1258
|
dominantBaseline: "central",
|
|
1251
1259
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1256,20 +1264,20 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1256
1264
|
]
|
|
1257
1265
|
}),
|
|
1258
1266
|
m && /* @__PURE__ */ f("div", {
|
|
1259
|
-
className:
|
|
1260
|
-
style:
|
|
1267
|
+
className: Ue.fallback,
|
|
1268
|
+
style: at,
|
|
1261
1269
|
children: m
|
|
1262
1270
|
}),
|
|
1263
|
-
|
|
1271
|
+
G && te.value && m && /* @__PURE__ */ f("div", {
|
|
1264
1272
|
"data-data-view": "",
|
|
1265
1273
|
style: { overflowX: "auto" },
|
|
1266
1274
|
children: m
|
|
1267
1275
|
}),
|
|
1268
|
-
|
|
1269
|
-
|
|
1276
|
+
ie && /* @__PURE__ */ p(d, { children: [
|
|
1277
|
+
Y !== void 0 && /* @__PURE__ */ p(d, { children: [
|
|
1270
1278
|
/* @__PURE__ */ f("span", {
|
|
1271
1279
|
id: N,
|
|
1272
|
-
ref:
|
|
1280
|
+
ref: R,
|
|
1273
1281
|
"aria-live": "polite",
|
|
1274
1282
|
style: {
|
|
1275
1283
|
position: "absolute",
|
|
@@ -1283,21 +1291,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1283
1291
|
border: 0
|
|
1284
1292
|
}
|
|
1285
1293
|
}),
|
|
1286
|
-
|
|
1294
|
+
Y.mode === "axis" && L.value !== null && Y.points[L.value] !== void 0 && /* @__PURE__ */ f("div", {
|
|
1287
1295
|
"aria-hidden": "true",
|
|
1288
1296
|
style: {
|
|
1289
1297
|
position: "absolute",
|
|
1290
|
-
left:
|
|
1298
|
+
left: Y.points[L.value].cx,
|
|
1291
1299
|
top: 0,
|
|
1292
1300
|
width: 1,
|
|
1293
|
-
height:
|
|
1301
|
+
height: W,
|
|
1294
1302
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1295
1303
|
pointerEvents: "none",
|
|
1296
1304
|
zIndex: 9
|
|
1297
1305
|
}
|
|
1298
1306
|
}),
|
|
1299
|
-
|
|
1300
|
-
let e =
|
|
1307
|
+
L.value !== null && Y.points[L.value] !== void 0 && (() => {
|
|
1308
|
+
let e = Y.points[L.value];
|
|
1301
1309
|
return /* @__PURE__ */ f("div", {
|
|
1302
1310
|
"aria-hidden": "true",
|
|
1303
1311
|
style: {
|
|
@@ -1314,14 +1322,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1314
1322
|
}
|
|
1315
1323
|
});
|
|
1316
1324
|
})(),
|
|
1317
|
-
|
|
1318
|
-
point:
|
|
1319
|
-
model:
|
|
1325
|
+
L.value !== null && Y.points[L.value] !== void 0 && /* @__PURE__ */ f(Ge, {
|
|
1326
|
+
point: Y.points[L.value],
|
|
1327
|
+
model: Y
|
|
1320
1328
|
})
|
|
1321
1329
|
] }),
|
|
1322
|
-
T && !
|
|
1330
|
+
T && !G && Qe(T.window.value, T.count) && /* @__PURE__ */ f("button", {
|
|
1323
1331
|
type: "button",
|
|
1324
|
-
onClick:
|
|
1332
|
+
onClick: H,
|
|
1325
1333
|
style: {
|
|
1326
1334
|
position: "absolute",
|
|
1327
1335
|
top: 4,
|
|
@@ -1339,71 +1347,71 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1339
1347
|
children: u(l.charts.resetZoom)
|
|
1340
1348
|
}),
|
|
1341
1349
|
/* @__PURE__ */ f("div", {
|
|
1342
|
-
ref:
|
|
1350
|
+
ref: V,
|
|
1343
1351
|
role: "application",
|
|
1344
1352
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1345
1353
|
tabIndex: 0,
|
|
1346
|
-
style:
|
|
1354
|
+
style: re,
|
|
1347
1355
|
onPointerDown: (e) => {
|
|
1348
|
-
T && (
|
|
1356
|
+
T && (B.current = {
|
|
1349
1357
|
x: e.clientX,
|
|
1350
1358
|
win: [...T.window.value]
|
|
1351
1359
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1352
1360
|
},
|
|
1353
1361
|
onPointerMove: (e) => {
|
|
1354
|
-
if (T &&
|
|
1355
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1356
|
-
T.window.value =
|
|
1362
|
+
if (T && B.current && e.buttons === 1) {
|
|
1363
|
+
let t = e.currentTarget.getBoundingClientRect(), n = B.current.win[1] - B.current.win[0] + 1, r = e.clientX - B.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1364
|
+
T.window.value = Ze(B.current.win, T.count, i);
|
|
1357
1365
|
return;
|
|
1358
1366
|
}
|
|
1359
|
-
if (!
|
|
1367
|
+
if (!Y || !Y.points.length) return;
|
|
1360
1368
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1361
|
-
|
|
1369
|
+
L.value = Y.mode === "axis" ? Ke(Y.points, n, r, "x") : S === "voronoi" ? ee(Y.points.map((e) => [e.cx, e.cy]), n, r) : Ke(Y.points, n, r, "xy");
|
|
1362
1370
|
},
|
|
1363
1371
|
onPointerUp: () => {
|
|
1364
|
-
|
|
1372
|
+
B.current = null;
|
|
1365
1373
|
},
|
|
1366
1374
|
onPointerLeave: () => {
|
|
1367
|
-
|
|
1375
|
+
B.current = null, Y && (L.value = null);
|
|
1368
1376
|
},
|
|
1369
1377
|
onKeyDown: (e) => {
|
|
1370
1378
|
if (T) {
|
|
1371
1379
|
if (e.key === "+" || e.key === "=") {
|
|
1372
|
-
e.preventDefault(), T.window.value =
|
|
1380
|
+
e.preventDefault(), T.window.value = Xe(T.window.value, T.count, 1 / 1.25, .5);
|
|
1373
1381
|
return;
|
|
1374
1382
|
}
|
|
1375
1383
|
if (e.key === "-" || e.key === "_") {
|
|
1376
|
-
e.preventDefault(), T.window.value =
|
|
1384
|
+
e.preventDefault(), T.window.value = Xe(T.window.value, T.count, 1.25, .5);
|
|
1377
1385
|
return;
|
|
1378
1386
|
}
|
|
1379
1387
|
if (e.key === "0") {
|
|
1380
|
-
e.preventDefault(),
|
|
1388
|
+
e.preventDefault(), H();
|
|
1381
1389
|
return;
|
|
1382
1390
|
}
|
|
1383
1391
|
}
|
|
1384
|
-
if (!
|
|
1385
|
-
let t =
|
|
1386
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(),
|
|
1387
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(),
|
|
1388
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
1389
|
-
else if (e.key === "End") e.preventDefault(),
|
|
1390
|
-
else if (e.key === "Escape")
|
|
1392
|
+
if (!Y || !Y.points.length) return;
|
|
1393
|
+
let t = L.value;
|
|
1394
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), L.value = t === null ? 0 : Math.min(t + 1, Y.points.length - 1);
|
|
1395
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), L.value = t === null ? Y.points.length - 1 : Math.max(t - 1, 0);
|
|
1396
|
+
else if (e.key === "Home") e.preventDefault(), L.value = 0;
|
|
1397
|
+
else if (e.key === "End") e.preventDefault(), L.value = Y.points.length - 1;
|
|
1398
|
+
else if (e.key === "Escape") L.value = null;
|
|
1391
1399
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1392
1400
|
e.preventDefault();
|
|
1393
|
-
let t =
|
|
1401
|
+
let t = L.value, n = t === null ? void 0 : Y.points[t];
|
|
1394
1402
|
n && x(n);
|
|
1395
1403
|
}
|
|
1396
1404
|
},
|
|
1397
1405
|
onClick: () => {
|
|
1398
|
-
if (!
|
|
1399
|
-
let e =
|
|
1406
|
+
if (!Y) return;
|
|
1407
|
+
let e = L.value, t = e === null ? void 0 : Y.points[e];
|
|
1400
1408
|
x && t && x(t);
|
|
1401
1409
|
},
|
|
1402
1410
|
onFocus: () => {
|
|
1403
|
-
|
|
1411
|
+
Y && Y.points.length > 0 && L.value === null && (L.value = 0);
|
|
1404
1412
|
},
|
|
1405
1413
|
onBlur: () => {
|
|
1406
|
-
|
|
1414
|
+
Y && (L.value = null);
|
|
1407
1415
|
}
|
|
1408
1416
|
})
|
|
1409
1417
|
] })
|
|
@@ -1412,45 +1420,45 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: m, c
|
|
|
1412
1420
|
}
|
|
1413
1421
|
//#endregion
|
|
1414
1422
|
//#region src/core/sync.ts
|
|
1415
|
-
var
|
|
1416
|
-
function
|
|
1417
|
-
let t =
|
|
1423
|
+
var ot = /* @__PURE__ */ new Map();
|
|
1424
|
+
function st(e) {
|
|
1425
|
+
let t = ot.get(e);
|
|
1418
1426
|
return t || (t = {
|
|
1419
1427
|
group: {
|
|
1420
1428
|
window: n(null),
|
|
1421
1429
|
hoverX: n(null)
|
|
1422
1430
|
},
|
|
1423
1431
|
refs: 0
|
|
1424
|
-
},
|
|
1432
|
+
}, ot.set(e, t)), t.refs++, t.group;
|
|
1425
1433
|
}
|
|
1426
|
-
function
|
|
1427
|
-
let t =
|
|
1428
|
-
t && (t.refs--, t.refs <= 0 &&
|
|
1434
|
+
function ct(e) {
|
|
1435
|
+
let t = ot.get(e);
|
|
1436
|
+
t && (t.refs--, t.refs <= 0 && ot.delete(e));
|
|
1429
1437
|
}
|
|
1430
|
-
function
|
|
1431
|
-
return
|
|
1438
|
+
function lt() {
|
|
1439
|
+
return ot.size;
|
|
1432
1440
|
}
|
|
1433
1441
|
//#endregion
|
|
1434
1442
|
//#region src/chrome/axis.tsx
|
|
1435
|
-
function
|
|
1443
|
+
function ut(e) {
|
|
1436
1444
|
return "bandwidth" in e;
|
|
1437
1445
|
}
|
|
1438
|
-
function
|
|
1446
|
+
function dt(e) {
|
|
1439
1447
|
return "tickInterval" in e;
|
|
1440
1448
|
}
|
|
1441
|
-
function
|
|
1449
|
+
function ft(e) {
|
|
1442
1450
|
return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
1443
1451
|
}
|
|
1444
|
-
function $({ scale: e, orientation: t, length: n, format: r =
|
|
1452
|
+
function $({ scale: e, orientation: t, length: n, format: r = ft, tickCount: i = 5, labelEvery: a, transform: o }) {
|
|
1445
1453
|
let s;
|
|
1446
|
-
if (
|
|
1454
|
+
if (ut(e)) {
|
|
1447
1455
|
let t = e.domain.length - 1;
|
|
1448
1456
|
s = e.domain.map((t, n) => ({
|
|
1449
1457
|
position: (e.map(t) ?? 0) + e.bandwidth / 2,
|
|
1450
1458
|
label: r(t),
|
|
1451
1459
|
i: n
|
|
1452
1460
|
})).filter(({ i: e }) => a != null && a > 1 ? e % a === 0 || e === t : !0);
|
|
1453
|
-
} else if (
|
|
1461
|
+
} else if (dt(e)) s = e.ticks(i).map((t) => ({
|
|
1454
1462
|
position: e.map(t),
|
|
1455
1463
|
label: r(t)
|
|
1456
1464
|
}));
|
|
@@ -1494,7 +1502,7 @@ function $({ scale: e, orientation: t, length: n, format: r = dt, tickCount: i =
|
|
|
1494
1502
|
}
|
|
1495
1503
|
//#endregion
|
|
1496
1504
|
//#region src/chrome/grid-lines.tsx
|
|
1497
|
-
function
|
|
1505
|
+
function pt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
|
|
1498
1506
|
let a = e.ticks(r), o = t === "x";
|
|
1499
1507
|
return /* @__PURE__ */ f("g", {
|
|
1500
1508
|
transform: i,
|
|
@@ -1515,17 +1523,17 @@ function ft({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
|
|
|
1515
1523
|
}
|
|
1516
1524
|
//#endregion
|
|
1517
1525
|
//#region src/chrome/reference.tsx
|
|
1518
|
-
var
|
|
1519
|
-
function
|
|
1526
|
+
var mt = "var(--cascivo-color-foreground-muted)", ht = "var(--cascivo-color-accent)";
|
|
1527
|
+
function gt(e, t) {
|
|
1520
1528
|
let n = e.map(t);
|
|
1521
1529
|
if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
|
|
1522
1530
|
}
|
|
1523
|
-
function
|
|
1531
|
+
function _t(e, t, n) {
|
|
1524
1532
|
let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
|
|
1525
1533
|
if (e.kind === "line") {
|
|
1526
|
-
let t =
|
|
1534
|
+
let t = gt(e.axis === "x" ? r : i, e.value);
|
|
1527
1535
|
if (t == null) return null;
|
|
1528
|
-
let s = e.color ??
|
|
1536
|
+
let s = e.color ?? mt, c = e.dash !== !1, l = e.axis === "x";
|
|
1529
1537
|
return /* @__PURE__ */ p("g", {
|
|
1530
1538
|
"data-annotation": "line",
|
|
1531
1539
|
"aria-hidden": "true",
|
|
@@ -1556,9 +1564,9 @@ function gt(e, t, n) {
|
|
|
1556
1564
|
}, n);
|
|
1557
1565
|
}
|
|
1558
1566
|
if (e.kind === "area") {
|
|
1559
|
-
let t = e.axis === "x" ? r : i, s =
|
|
1567
|
+
let t = e.axis === "x" ? r : i, s = gt(t, e.from), c = gt(t, e.to);
|
|
1560
1568
|
if (s == null || c == null) return null;
|
|
1561
|
-
let l = e.color ??
|
|
1569
|
+
let l = e.color ?? ht, u = e.axis === "x", d = Math.min(s, c), p = Math.abs(c - s);
|
|
1562
1570
|
return /* @__PURE__ */ f("g", {
|
|
1563
1571
|
"data-annotation": "area",
|
|
1564
1572
|
"aria-hidden": "true",
|
|
@@ -1574,9 +1582,9 @@ function gt(e, t, n) {
|
|
|
1574
1582
|
}, n);
|
|
1575
1583
|
}
|
|
1576
1584
|
if (e.kind === "note") {
|
|
1577
|
-
let t =
|
|
1585
|
+
let t = gt(r, e.x), s = gt(i, e.y);
|
|
1578
1586
|
if (t == null || s == null) return null;
|
|
1579
|
-
let c = e.color ??
|
|
1587
|
+
let c = e.color ?? ht, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), m = Math.max(8, Math.min(o - 2, s + u));
|
|
1580
1588
|
return /* @__PURE__ */ p("g", {
|
|
1581
1589
|
"data-annotation": "note",
|
|
1582
1590
|
children: [
|
|
@@ -1612,7 +1620,7 @@ function gt(e, t, n) {
|
|
|
1612
1620
|
if (e.kind === "threshold") {
|
|
1613
1621
|
let t = i.map(e.value);
|
|
1614
1622
|
if (t == null || Number.isNaN(t)) return null;
|
|
1615
|
-
let r = e.color ??
|
|
1623
|
+
let r = e.color ?? ht, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
|
|
1616
1624
|
return /* @__PURE__ */ f("g", {
|
|
1617
1625
|
"data-annotation": "threshold",
|
|
1618
1626
|
"aria-hidden": "true",
|
|
@@ -1627,9 +1635,9 @@ function gt(e, t, n) {
|
|
|
1627
1635
|
})
|
|
1628
1636
|
}, n);
|
|
1629
1637
|
}
|
|
1630
|
-
let s =
|
|
1638
|
+
let s = gt(r, e.x), c = gt(i, e.y);
|
|
1631
1639
|
if (s == null || c == null) return null;
|
|
1632
|
-
let l = e.color ??
|
|
1640
|
+
let l = e.color ?? ht;
|
|
1633
1641
|
return /* @__PURE__ */ p("g", {
|
|
1634
1642
|
"data-annotation": "dot",
|
|
1635
1643
|
"aria-hidden": "true",
|
|
@@ -1651,28 +1659,28 @@ function gt(e, t, n) {
|
|
|
1651
1659
|
})]
|
|
1652
1660
|
}, n);
|
|
1653
1661
|
}
|
|
1654
|
-
function
|
|
1662
|
+
function vt(e, t) {
|
|
1655
1663
|
return !e || e.length === 0 ? null : /* @__PURE__ */ f("g", {
|
|
1656
1664
|
"data-annotations": "",
|
|
1657
|
-
children: e.map((e, n) =>
|
|
1665
|
+
children: e.map((e, n) => _t(e, t, n))
|
|
1658
1666
|
});
|
|
1659
1667
|
}
|
|
1660
|
-
function
|
|
1668
|
+
function yt(e) {
|
|
1661
1669
|
return e.kind === "line" ? e.label ?? `${e.axis}=${String(e.value)}` : e.kind === "area" ? e.label ?? `${e.axis} ${String(e.from)}–${String(e.to)}` : e.kind === "threshold" ? e.label ?? `${e.side} ${e.value}` : e.kind === "note" ? e.label : e.label ?? `(${String(e.x)}, ${e.y})`;
|
|
1662
1670
|
}
|
|
1663
1671
|
//#endregion
|
|
1664
1672
|
//#region src/chrome/data-label.tsx
|
|
1665
|
-
var
|
|
1666
|
-
function
|
|
1673
|
+
var bt = (e) => e.toLocaleString();
|
|
1674
|
+
function xt(e) {
|
|
1667
1675
|
return e ? e === !0 ? {
|
|
1668
|
-
format:
|
|
1676
|
+
format: bt,
|
|
1669
1677
|
position: "auto"
|
|
1670
1678
|
} : {
|
|
1671
|
-
format: e.format ??
|
|
1679
|
+
format: e.format ?? bt,
|
|
1672
1680
|
position: e.position ?? "auto"
|
|
1673
1681
|
} : null;
|
|
1674
1682
|
}
|
|
1675
|
-
function
|
|
1683
|
+
function St({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
|
|
1676
1684
|
return /* @__PURE__ */ f("text", {
|
|
1677
1685
|
x: e,
|
|
1678
1686
|
y: t,
|
|
@@ -1688,21 +1696,21 @@ function xt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
|
|
|
1688
1696
|
}
|
|
1689
1697
|
//#endregion
|
|
1690
1698
|
//#region src/chrome/defs.tsx
|
|
1691
|
-
function
|
|
1699
|
+
function Ct(e) {
|
|
1692
1700
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1693
1701
|
}
|
|
1694
|
-
function Ct(e, t) {
|
|
1695
|
-
return `${St(e)}-grad-${St(t)}`;
|
|
1696
|
-
}
|
|
1697
1702
|
function wt(e, t) {
|
|
1698
|
-
return `${
|
|
1703
|
+
return `${Ct(e)}-grad-${Ct(t)}`;
|
|
1699
1704
|
}
|
|
1700
|
-
function Tt(e, t
|
|
1701
|
-
return
|
|
1705
|
+
function Tt(e, t) {
|
|
1706
|
+
return `${Ct(e)}-pat-${Ct(t)}`;
|
|
1702
1707
|
}
|
|
1703
|
-
function Et(
|
|
1708
|
+
function Et(e, t, n, r) {
|
|
1709
|
+
return n === "gradient" ? `url(#${wt(e, t)})` : n === "pattern" ? `url(#${Tt(e, t)})` : r;
|
|
1710
|
+
}
|
|
1711
|
+
function Dt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
1704
1712
|
return n === "solid" ? null : /* @__PURE__ */ f("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ p("linearGradient", {
|
|
1705
|
-
id:
|
|
1713
|
+
id: wt(e, t.id),
|
|
1706
1714
|
x1: "0",
|
|
1707
1715
|
y1: "0",
|
|
1708
1716
|
x2: "0",
|
|
@@ -1717,7 +1725,7 @@ function Et({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1717
1725
|
stopOpacity: .1
|
|
1718
1726
|
})]
|
|
1719
1727
|
}, t.id) : /* @__PURE__ */ p("pattern", {
|
|
1720
|
-
id:
|
|
1728
|
+
id: Tt(e, t.id),
|
|
1721
1729
|
patternUnits: "userSpaceOnUse",
|
|
1722
1730
|
width: 6,
|
|
1723
1731
|
height: 6,
|
|
@@ -1763,7 +1771,7 @@ function Et({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1763
1771
|
}
|
|
1764
1772
|
//#endregion
|
|
1765
1773
|
//#region src/chrome/glyph.tsx
|
|
1766
|
-
function
|
|
1774
|
+
function Ot(e, t) {
|
|
1767
1775
|
let n = t / 2;
|
|
1768
1776
|
switch (e) {
|
|
1769
1777
|
case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
|
|
@@ -1784,7 +1792,7 @@ function Dt(e, t) {
|
|
|
1784
1792
|
default: return "";
|
|
1785
1793
|
}
|
|
1786
1794
|
}
|
|
1787
|
-
function
|
|
1795
|
+
function kt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
|
|
1788
1796
|
let c = {
|
|
1789
1797
|
fill: i,
|
|
1790
1798
|
fillOpacity: a,
|
|
@@ -1799,33 +1807,33 @@ function Ot({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
|
|
|
1799
1807
|
r: r / 2,
|
|
1800
1808
|
...c
|
|
1801
1809
|
}) : /* @__PURE__ */ f("path", {
|
|
1802
|
-
d:
|
|
1810
|
+
d: Ot(e, r),
|
|
1803
1811
|
transform: `translate(${t},${n})`,
|
|
1804
1812
|
...c
|
|
1805
1813
|
});
|
|
1806
1814
|
}
|
|
1807
1815
|
//#endregion
|
|
1808
1816
|
//#region src/chrome/text.tsx
|
|
1809
|
-
var
|
|
1810
|
-
function
|
|
1811
|
-
if (
|
|
1812
|
-
|
|
1813
|
-
let n =
|
|
1817
|
+
var At;
|
|
1818
|
+
function jt(e, t) {
|
|
1819
|
+
if (At === void 0 && (At = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), At) {
|
|
1820
|
+
At.font = `${t}px sans-serif`;
|
|
1821
|
+
let n = At.measureText(e).width;
|
|
1814
1822
|
if (n > 0) return n;
|
|
1815
1823
|
}
|
|
1816
1824
|
return e.length * t * .55;
|
|
1817
1825
|
}
|
|
1818
|
-
function
|
|
1826
|
+
function Mt(e, t, n) {
|
|
1819
1827
|
if (!t || t <= 0) return [e];
|
|
1820
1828
|
let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
|
|
1821
1829
|
for (let e of r) {
|
|
1822
1830
|
let r = a ? `${a} ${e}` : e;
|
|
1823
|
-
a &&
|
|
1831
|
+
a && jt(r, n) > t ? (i.push(a), a = e) : a = r;
|
|
1824
1832
|
}
|
|
1825
1833
|
return a && i.push(a), i.length ? i : [e];
|
|
1826
1834
|
}
|
|
1827
|
-
function
|
|
1828
|
-
let l = r ?
|
|
1835
|
+
function Nt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
|
|
1836
|
+
let l = r ? Mt(n, r, i) : [n];
|
|
1829
1837
|
return /* @__PURE__ */ f("text", {
|
|
1830
1838
|
x: e,
|
|
1831
1839
|
y: t,
|
|
@@ -1842,7 +1850,7 @@ function Mt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
|
|
|
1842
1850
|
}
|
|
1843
1851
|
//#endregion
|
|
1844
1852
|
//#region src/chrome/brush.tsx
|
|
1845
|
-
function
|
|
1853
|
+
function Pt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1846
1854
|
o();
|
|
1847
1855
|
let i = Math.max(1, e - 1), a = (e) => e / i * 100, [s, c] = n.value, l = t - 8, u = (t, r) => {
|
|
1848
1856
|
let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
|
|
@@ -1913,7 +1921,7 @@ function Nt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
1913
1921
|
}
|
|
1914
1922
|
//#endregion
|
|
1915
1923
|
//#region src/chrome/data-zoom.tsx
|
|
1916
|
-
function
|
|
1924
|
+
function Ft({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1917
1925
|
o();
|
|
1918
1926
|
let a = Math.max(1, e - 1), s = (e) => e / a * 100, [c, l] = n.value, u = t - 8, d = i(0), m = (e, t) => {
|
|
1919
1927
|
let n = t.getBoundingClientRect();
|
|
@@ -2008,27 +2016,27 @@ function Pt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
2008
2016
|
}
|
|
2009
2017
|
//#endregion
|
|
2010
2018
|
//#region src/chrome/visual-map.tsx
|
|
2011
|
-
var
|
|
2012
|
-
function Bt(e, t) {
|
|
2013
|
-
let n = t.pieces ?? Ft;
|
|
2014
|
-
return Math.min(n - 1, Math.max(0, Math.floor(zt(e, t) * n)));
|
|
2015
|
-
}
|
|
2019
|
+
var It = 5, Lt = [3, 14], Rt = (e) => e < 0 ? 0 : e > 1 ? 1 : e, zt = (e, t, n) => e + (t - e) * n, Bt = (e, t) => Rt((e - t.min) / (t.max - t.min || 1));
|
|
2016
2020
|
function Vt(e, t) {
|
|
2017
|
-
let n = t.
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
+
let n = t.pieces ?? It;
|
|
2022
|
+
return Math.min(n - 1, Math.max(0, Math.floor(Bt(e, t) * n)));
|
|
2023
|
+
}
|
|
2024
|
+
function Ht(e, t) {
|
|
2025
|
+
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Bt(e, t), a = {};
|
|
2026
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? ve(t.pieces ?? It, r)[Vt(e, t)] : _e(r)(i)), n === "size" || n === "both") {
|
|
2027
|
+
let [e, n] = t.sizeRange ?? Lt;
|
|
2028
|
+
a.size = zt(e, n, i);
|
|
2021
2029
|
}
|
|
2022
2030
|
return a;
|
|
2023
2031
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(
|
|
2032
|
+
function Ut(e, t, n, r) {
|
|
2033
|
+
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Vt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
|
|
2026
2034
|
}
|
|
2027
|
-
function
|
|
2035
|
+
function Wt({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
|
|
2028
2036
|
o();
|
|
2029
2037
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2030
2038
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2031
|
-
let t = e.pieces ??
|
|
2039
|
+
let t = e.pieces ?? It, i = ve(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2032
2040
|
if (!n) return;
|
|
2033
2041
|
let t = new Set(n.value);
|
|
2034
2042
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2076,9 +2084,9 @@ function Ut({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2076
2084
|
})
|
|
2077
2085
|
});
|
|
2078
2086
|
}
|
|
2079
|
-
let { min: s, max: c } = e, l = c - s || 1, u =
|
|
2087
|
+
let { min: s, max: c } = e, l = c - s || 1, u = ve(8, e.ramp ?? "sequential"), m = (e) => (e - s) / l * 100, h = t?.value[0] ?? s, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2080
2088
|
let n = t.getBoundingClientRect();
|
|
2081
|
-
return n.width === 0 ? s : s +
|
|
2089
|
+
return n.width === 0 ? s : s + Rt((e - n.left) / n.width) * l;
|
|
2082
2090
|
}, y = (e, n) => {
|
|
2083
2091
|
if (!t) return;
|
|
2084
2092
|
let r = Math.max(s, Math.min(c, n)), [i, a] = t.value;
|
|
@@ -2163,23 +2171,23 @@ function Ut({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2163
2171
|
]
|
|
2164
2172
|
});
|
|
2165
2173
|
}
|
|
2166
|
-
var
|
|
2174
|
+
var Gt = {
|
|
2167
2175
|
legend: "_legend_zczeh_2",
|
|
2168
2176
|
item: "_item_zczeh_9",
|
|
2169
2177
|
swatch: "_swatch_zczeh_27"
|
|
2170
2178
|
};
|
|
2171
2179
|
//#endregion
|
|
2172
2180
|
//#region src/chrome/legend.tsx
|
|
2173
|
-
function
|
|
2181
|
+
function Kt({ series: e, hidden: t }) {
|
|
2174
2182
|
return o(), /* @__PURE__ */ f("div", {
|
|
2175
|
-
className:
|
|
2183
|
+
className: Gt.legend,
|
|
2176
2184
|
role: "group",
|
|
2177
2185
|
"aria-label": "Chart legend",
|
|
2178
2186
|
children: e.map((e, n) => {
|
|
2179
2187
|
let r = t.value.has(e.id);
|
|
2180
2188
|
return /* @__PURE__ */ p("button", {
|
|
2181
2189
|
type: "button",
|
|
2182
|
-
className:
|
|
2190
|
+
className: Gt.item,
|
|
2183
2191
|
"data-state": r ? "off" : "on",
|
|
2184
2192
|
"aria-pressed": !r,
|
|
2185
2193
|
"aria-label": u(l.charts.legendToggle, { name: e.label }),
|
|
@@ -2188,7 +2196,7 @@ function Gt({ series: e, hidden: t }) {
|
|
|
2188
2196
|
r ? n.delete(e.id) : n.add(e.id), t.value = n;
|
|
2189
2197
|
},
|
|
2190
2198
|
children: [/* @__PURE__ */ f("span", {
|
|
2191
|
-
className:
|
|
2199
|
+
className: Gt.swatch,
|
|
2192
2200
|
style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
|
|
2193
2201
|
"aria-hidden": "true"
|
|
2194
2202
|
}), e.label]
|
|
@@ -2198,53 +2206,53 @@ function Gt({ series: e, hidden: t }) {
|
|
|
2198
2206
|
}
|
|
2199
2207
|
//#endregion
|
|
2200
2208
|
//#region src/core/dev-warn.ts
|
|
2201
|
-
function
|
|
2209
|
+
function qt() {
|
|
2202
2210
|
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
2203
2211
|
}
|
|
2204
|
-
var
|
|
2205
|
-
function
|
|
2206
|
-
if (
|
|
2212
|
+
var Jt = /* @__PURE__ */ new Set();
|
|
2213
|
+
function Yt(e, t) {
|
|
2214
|
+
if (qt() || Jt.has(e)) return;
|
|
2207
2215
|
let n = 0;
|
|
2208
2216
|
for (let e of t()) Number.isFinite(e) || n++;
|
|
2209
|
-
n !== 0 && (
|
|
2217
|
+
n !== 0 && (Jt.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
|
|
2210
2218
|
}
|
|
2211
2219
|
//#endregion
|
|
2212
2220
|
//#region src/charts/line-chart/line-chart.tsx
|
|
2213
|
-
var
|
|
2214
|
-
function
|
|
2221
|
+
var Xt = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2222
|
+
function Zt(e) {
|
|
2215
2223
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2216
2224
|
}
|
|
2217
|
-
function
|
|
2225
|
+
function Qt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: h, xTicks: g = 5, yTicks: _ = 5, legend: v, tooltip: y, formatTooltip: b, className: x, plain: C, annotations: E, labels: D, connectNulls: O, onSelect: k, brush: A, dataZoom: j, zoom: M, syncId: N, tooltipMode: P, secondAxis: F, decimate: I, toolbox: L, transition: ee, onBeforeDraw: te, onAfterDraw: R }) {
|
|
2218
2226
|
o();
|
|
2219
|
-
let
|
|
2227
|
+
let z = i(/* @__PURE__ */ new Set()), B = C ? null : xt(D), V = I === !0 ? {
|
|
2220
2228
|
method: "lttb",
|
|
2221
2229
|
threshold: 1e3
|
|
2222
2230
|
} : I ? {
|
|
2223
2231
|
method: I.method ?? "lttb",
|
|
2224
2232
|
threshold: I.threshold ?? 1e3
|
|
2225
|
-
} : null,
|
|
2226
|
-
N && !
|
|
2227
|
-
N &&
|
|
2233
|
+
} : null, H = e.reduce((e, t) => Math.max(e, t.data.length), 0), U = (A || j || M || N !== void 0) && H > 0, W = i([0, Math.max(0, H - 1)]), G = c(null);
|
|
2234
|
+
N && !G.current && (G.current = st(N)), a(() => () => {
|
|
2235
|
+
N && ct(N);
|
|
2228
2236
|
}), a(() => {
|
|
2229
|
-
let e =
|
|
2237
|
+
let e = G.current;
|
|
2230
2238
|
if (!e) return;
|
|
2231
|
-
let t = e.window.value, n =
|
|
2232
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2239
|
+
let t = e.window.value, n = W.peek();
|
|
2240
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (W.value = t);
|
|
2233
2241
|
}), a(() => {
|
|
2234
|
-
let e =
|
|
2242
|
+
let e = G.current;
|
|
2235
2243
|
if (!e) return;
|
|
2236
|
-
let t =
|
|
2244
|
+
let t = W.value, n = e.window.peek();
|
|
2237
2245
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2238
2246
|
});
|
|
2239
|
-
let
|
|
2247
|
+
let K = U ? e.map((e) => ({
|
|
2240
2248
|
...e,
|
|
2241
|
-
data: e.data.slice(
|
|
2242
|
-
})) : e,
|
|
2243
|
-
...
|
|
2249
|
+
data: e.data.slice(W.value[0], W.value[1] + 1)
|
|
2250
|
+
})) : e, q = !C && K.some((e) => e.axis === "right"), ne = C ? He : Z, J = q ? {
|
|
2251
|
+
...ne,
|
|
2244
2252
|
right: 60
|
|
2245
|
-
} :
|
|
2246
|
-
|
|
2247
|
-
let
|
|
2253
|
+
} : ne, Y = h ?? (C ? 48 : 300), re = C ? !1 : v ?? K.length > 1, X = K.flatMap((e) => e.data.map((e) => t(e))), ie = (e) => e.flatMap((e) => e.data.map((e) => n(e))).filter((e) => Number.isFinite(e)), ae = ie(q ? K.filter((e) => e.axis !== "right") : K), oe = q ? ie(K.filter((e) => e.axis === "right")) : [];
|
|
2254
|
+
Yt("LineChart", () => K.flatMap((e) => e.data.map((e) => n(e))));
|
|
2255
|
+
let se = X.length > 0, ce = se && X[0] instanceof Date;
|
|
2248
2256
|
return /* @__PURE__ */ p("div", {
|
|
2249
2257
|
style: {
|
|
2250
2258
|
display: "flex",
|
|
@@ -2256,24 +2264,24 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2256
2264
|
title: r,
|
|
2257
2265
|
description: s,
|
|
2258
2266
|
width: u,
|
|
2259
|
-
height:
|
|
2267
|
+
height: Y,
|
|
2260
2268
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2261
2269
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2262
|
-
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }),
|
|
2263
|
-
/* @__PURE__ */ f("tbody", { children: (
|
|
2270
|
+
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }), K.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2271
|
+
/* @__PURE__ */ f("tbody", { children: (K[0]?.data ?? []).map((e, r) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: String(K[0] ? t(K[0].data[r]) : "") }), K.map((e) => /* @__PURE__ */ f("td", { children: e.data[r] == null ? "" : n(e.data[r]) }, e.id))] }, r)) })
|
|
2264
2272
|
] }),
|
|
2265
2273
|
className: x,
|
|
2266
|
-
"data-state":
|
|
2267
|
-
plain:
|
|
2268
|
-
tooltip: y !== !1 &&
|
|
2269
|
-
if (y === !1 || !
|
|
2270
|
-
let i = e -
|
|
2274
|
+
"data-state": se ? void 0 : "empty",
|
|
2275
|
+
plain: C,
|
|
2276
|
+
tooltip: y !== !1 && se ? ({ width: e, height: r }) => {
|
|
2277
|
+
if (y === !1 || !se) return;
|
|
2278
|
+
let i = e - J.left - J.right, a = r - J.top - J.bottom, o = Math.min(...ce ? X.map((e) => e.getTime()) : X), s = Math.max(...ce ? X.map((e) => e.getTime()) : X), c = ce ? S([new Date(o), new Date(s)], [0, i]) : m([o, s], [0, i]), l = m(Zt(ae), [a, 0]), u = q ? m(Zt(oe), [a, 0]) : l, d = (e) => e.axis === "right" ? u : l, f = (e) => c.map(e);
|
|
2271
2279
|
if (P === "axis") {
|
|
2272
|
-
let e =
|
|
2280
|
+
let e = K.reduce((e, t) => Math.max(e, t.data.length), 0), r = [];
|
|
2273
2281
|
for (let i = 0; i < e; i++) {
|
|
2274
2282
|
let e = [], a = 0, o = 0, s = Infinity, c = "";
|
|
2275
|
-
|
|
2276
|
-
if (
|
|
2283
|
+
K.forEach((r, l) => {
|
|
2284
|
+
if (z.value.has(r.id)) return;
|
|
2277
2285
|
let u = r.data[i];
|
|
2278
2286
|
if (u === void 0) return;
|
|
2279
2287
|
let p = n(u);
|
|
@@ -2282,12 +2290,12 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2282
2290
|
a += f(m), o++, s = Math.min(s, d(r).map(p)), c = m instanceof Date ? m.toLocaleDateString() : String(m), e.push({
|
|
2283
2291
|
label: r.label,
|
|
2284
2292
|
value: p,
|
|
2285
|
-
color: r.color ??
|
|
2293
|
+
color: r.color ?? Xt[l % Xt.length]
|
|
2286
2294
|
});
|
|
2287
2295
|
}), o !== 0 && r.push({
|
|
2288
2296
|
id: `x-${i}`,
|
|
2289
|
-
cx:
|
|
2290
|
-
cy:
|
|
2297
|
+
cx: J.left + a / o,
|
|
2298
|
+
cy: J.top + (s === Infinity ? 0 : s),
|
|
2291
2299
|
label: c,
|
|
2292
2300
|
value: c,
|
|
2293
2301
|
segments: e
|
|
@@ -2299,14 +2307,14 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2299
2307
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2300
2308
|
};
|
|
2301
2309
|
}
|
|
2302
|
-
let p =
|
|
2310
|
+
let p = K.flatMap((e) => z.value.has(e.id) ? [] : e.data.flatMap((r, i) => {
|
|
2303
2311
|
let a = n(r);
|
|
2304
2312
|
if (!Number.isFinite(a)) return [];
|
|
2305
2313
|
let o = t(r), s = c.map(o), l = d(e).map(a), u = o instanceof Date ? o.toLocaleDateString() : String(o);
|
|
2306
2314
|
return {
|
|
2307
2315
|
id: `${e.id}-${i}`,
|
|
2308
|
-
cx:
|
|
2309
|
-
cy:
|
|
2316
|
+
cx: J.left + s,
|
|
2317
|
+
cy: J.top + l,
|
|
2310
2318
|
label: u,
|
|
2311
2319
|
value: n(r),
|
|
2312
2320
|
seriesId: e.id
|
|
@@ -2315,51 +2323,51 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2315
2323
|
return b ? {
|
|
2316
2324
|
points: p,
|
|
2317
2325
|
format: (e) => {
|
|
2318
|
-
let t =
|
|
2326
|
+
let t = K.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2319
2327
|
return t && t.data[n] !== void 0 ? b(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2320
2328
|
}
|
|
2321
2329
|
} : { points: p };
|
|
2322
2330
|
} : void 0,
|
|
2323
2331
|
onSelect: k,
|
|
2324
|
-
zoom: M &&
|
|
2325
|
-
window:
|
|
2326
|
-
count:
|
|
2332
|
+
zoom: M && H > 1 ? {
|
|
2333
|
+
window: W,
|
|
2334
|
+
count: H
|
|
2327
2335
|
} : void 0,
|
|
2328
2336
|
toolbox: L,
|
|
2329
|
-
onRestore:
|
|
2330
|
-
|
|
2337
|
+
onRestore: U ? () => {
|
|
2338
|
+
W.value = [0, Math.max(0, H - 1)];
|
|
2331
2339
|
} : void 0,
|
|
2332
|
-
transition:
|
|
2333
|
-
onBeforeDraw:
|
|
2334
|
-
onAfterDraw:
|
|
2340
|
+
transition: ee,
|
|
2341
|
+
onBeforeDraw: te,
|
|
2342
|
+
onAfterDraw: R,
|
|
2335
2343
|
children: ({ width: e, height: r }) => {
|
|
2336
|
-
let i = e -
|
|
2344
|
+
let i = e - J.left - J.right, a = r - J.top - J.bottom, o = Math.min(...ce ? X.map((e) => e.getTime()) : X), s = Math.max(...ce ? X.map((e) => e.getTime()) : X), c = ce ? S([new Date(o), new Date(s)], [0, i]) : m([o, s], [0, i]), u = m(Zt(ae), [a, 0]), h = q ? m(Zt(oe), [a, 0]) : u;
|
|
2337
2345
|
return /* @__PURE__ */ f("g", { children: /* @__PURE__ */ p("g", {
|
|
2338
|
-
transform: `translate(${
|
|
2346
|
+
transform: `translate(${J.left},${J.top})`,
|
|
2339
2347
|
children: [
|
|
2340
|
-
!
|
|
2348
|
+
!C && /* @__PURE__ */ f(pt, {
|
|
2341
2349
|
scale: u,
|
|
2342
2350
|
orientation: "y",
|
|
2343
2351
|
length: i,
|
|
2344
2352
|
tickCount: _
|
|
2345
2353
|
}),
|
|
2346
|
-
!
|
|
2354
|
+
!C && vt(E, {
|
|
2347
2355
|
xScale: c,
|
|
2348
2356
|
yScale: u,
|
|
2349
2357
|
innerW: i,
|
|
2350
2358
|
innerH: a
|
|
2351
2359
|
}),
|
|
2352
|
-
|
|
2353
|
-
if (
|
|
2354
|
-
let i = e.color ??
|
|
2355
|
-
if (
|
|
2360
|
+
K.map((e, r) => {
|
|
2361
|
+
if (z.value.has(e.id)) return null;
|
|
2362
|
+
let i = e.color ?? Xt[r % Xt.length], a = e.axis === "right" ? h : u, o = (e) => c.map(e);
|
|
2363
|
+
if (V && e.data.length > V.threshold) {
|
|
2356
2364
|
let r = [];
|
|
2357
2365
|
for (let i of e.data) {
|
|
2358
2366
|
let e = n(i);
|
|
2359
2367
|
Number.isFinite(e) && r.push([o(t(i)), a.map(e)]);
|
|
2360
2368
|
}
|
|
2361
2369
|
return /* @__PURE__ */ f("path", {
|
|
2362
|
-
d:
|
|
2370
|
+
d: T(Le(r, V.threshold, V.method).map((e) => [e[0], e[1]]), l),
|
|
2363
2371
|
fill: "none",
|
|
2364
2372
|
stroke: i,
|
|
2365
2373
|
strokeWidth: 2,
|
|
@@ -2372,24 +2380,24 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2372
2380
|
let r = n(e);
|
|
2373
2381
|
return Number.isFinite(r) ? [o(t(e)), a.map(r)] : null;
|
|
2374
2382
|
});
|
|
2375
|
-
return /* @__PURE__ */ p("g", { children: [
|
|
2376
|
-
d:
|
|
2383
|
+
return /* @__PURE__ */ p("g", { children: [w(s, O).map((t, n) => /* @__PURE__ */ f("path", {
|
|
2384
|
+
d: T(t, l),
|
|
2377
2385
|
fill: "none",
|
|
2378
2386
|
stroke: i,
|
|
2379
2387
|
strokeWidth: 2,
|
|
2380
2388
|
strokeLinecap: "round",
|
|
2381
2389
|
strokeLinejoin: "round",
|
|
2382
2390
|
"data-series": e.id
|
|
2383
|
-
}, n)),
|
|
2391
|
+
}, n)), B && e.data.map((e, t) => {
|
|
2384
2392
|
let r = s[t];
|
|
2385
|
-
return r ? /* @__PURE__ */ f(
|
|
2393
|
+
return r ? /* @__PURE__ */ f(St, {
|
|
2386
2394
|
x: r[0],
|
|
2387
2395
|
y: r[1] - 8,
|
|
2388
|
-
text:
|
|
2396
|
+
text: B.format(n(e))
|
|
2389
2397
|
}, t) : null;
|
|
2390
2398
|
})] }, e.id);
|
|
2391
2399
|
}),
|
|
2392
|
-
!
|
|
2400
|
+
!C && /* @__PURE__ */ p(d, { children: [
|
|
2393
2401
|
/* @__PURE__ */ f($, {
|
|
2394
2402
|
scale: c,
|
|
2395
2403
|
orientation: "x",
|
|
@@ -2403,7 +2411,7 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2403
2411
|
length: a,
|
|
2404
2412
|
tickCount: _
|
|
2405
2413
|
}),
|
|
2406
|
-
|
|
2414
|
+
q && /* @__PURE__ */ f($, {
|
|
2407
2415
|
scale: h,
|
|
2408
2416
|
orientation: "y",
|
|
2409
2417
|
length: a,
|
|
@@ -2416,61 +2424,61 @@ function Zt({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2416
2424
|
}) });
|
|
2417
2425
|
}
|
|
2418
2426
|
}),
|
|
2419
|
-
A && !j &&
|
|
2420
|
-
count:
|
|
2421
|
-
window:
|
|
2427
|
+
A && !j && H > 1 && /* @__PURE__ */ f(Pt, {
|
|
2428
|
+
count: H,
|
|
2429
|
+
window: W,
|
|
2422
2430
|
label: "Time range"
|
|
2423
2431
|
}),
|
|
2424
|
-
j &&
|
|
2425
|
-
count:
|
|
2426
|
-
window:
|
|
2432
|
+
j && H > 1 && /* @__PURE__ */ f(Ft, {
|
|
2433
|
+
count: H,
|
|
2434
|
+
window: W,
|
|
2427
2435
|
label: "Time range"
|
|
2428
2436
|
}),
|
|
2429
|
-
|
|
2430
|
-
series:
|
|
2437
|
+
re && /* @__PURE__ */ f(Kt, {
|
|
2438
|
+
series: K.map((e, t) => ({
|
|
2431
2439
|
id: e.id,
|
|
2432
2440
|
label: e.label,
|
|
2433
|
-
color: e.color ??
|
|
2441
|
+
color: e.color ?? Xt[t % Xt.length]
|
|
2434
2442
|
})),
|
|
2435
|
-
hidden:
|
|
2443
|
+
hidden: z
|
|
2436
2444
|
})
|
|
2437
2445
|
]
|
|
2438
2446
|
});
|
|
2439
2447
|
}
|
|
2440
2448
|
//#endregion
|
|
2441
2449
|
//#region src/charts/area-chart/area-chart.tsx
|
|
2442
|
-
var
|
|
2443
|
-
function
|
|
2450
|
+
var $t = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" }, en = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2451
|
+
function tn({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: h = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: w, plain: E, annotations: D, labels: O, onSelect: k, brush: A, dataZoom: j, zoom: M, syncId: P, tooltipMode: I, secondAxis: L, decimate: ee, toolbox: te }) {
|
|
2444
2452
|
o();
|
|
2445
|
-
let
|
|
2453
|
+
let R = s(), z = i(/* @__PURE__ */ new Set()), B = E ? null : xt(O), V = ee === !0 ? {
|
|
2446
2454
|
method: "lttb",
|
|
2447
2455
|
threshold: 1e3
|
|
2448
|
-
} :
|
|
2449
|
-
method:
|
|
2450
|
-
threshold:
|
|
2451
|
-
} : null,
|
|
2452
|
-
|
|
2453
|
-
|
|
2456
|
+
} : ee ? {
|
|
2457
|
+
method: ee.method ?? "lttb",
|
|
2458
|
+
threshold: ee.threshold ?? 1e3
|
|
2459
|
+
} : null, H = e.reduce((e, t) => Math.max(e, t.data.length), 0), U = (A || j || M || P !== void 0) && H > 0, W = i([0, Math.max(0, H - 1)]), G = c(null);
|
|
2460
|
+
P && !G.current && (G.current = st(P)), a(() => () => {
|
|
2461
|
+
P && ct(P);
|
|
2454
2462
|
}), a(() => {
|
|
2455
|
-
let e =
|
|
2463
|
+
let e = G.current;
|
|
2456
2464
|
if (!e) return;
|
|
2457
|
-
let t = e.window.value, n =
|
|
2458
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2465
|
+
let t = e.window.value, n = W.peek();
|
|
2466
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (W.value = t);
|
|
2459
2467
|
}), a(() => {
|
|
2460
|
-
let e =
|
|
2468
|
+
let e = G.current;
|
|
2461
2469
|
if (!e) return;
|
|
2462
|
-
let t =
|
|
2470
|
+
let t = W.value, n = e.window.peek();
|
|
2463
2471
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2464
2472
|
});
|
|
2465
|
-
let
|
|
2473
|
+
let K = U ? e.map((e) => ({
|
|
2466
2474
|
...e,
|
|
2467
|
-
data: e.data.slice(
|
|
2468
|
-
})) : e,
|
|
2469
|
-
...
|
|
2475
|
+
data: e.data.slice(W.value[0], W.value[1] + 1)
|
|
2476
|
+
})) : e, q = !E && !u && K.some((e) => e.axis === "right"), ne = E ? He : Z, J = q ? {
|
|
2477
|
+
...ne,
|
|
2470
2478
|
right: 60
|
|
2471
|
-
} :
|
|
2472
|
-
|
|
2473
|
-
let
|
|
2479
|
+
} : ne, Y = y ?? (E ? 48 : 300), re = E ? !1 : S ?? K.length > 1, X = (K[0]?.data ?? []).map((e) => t(e)), ie = (q ? K.filter((e) => e.axis !== "right") : K).flatMap((e) => e.data.map((e) => n(e))), ae = q ? K.filter((e) => e.axis === "right").flatMap((e) => e.data.map((e) => n(e))) : [];
|
|
2480
|
+
Yt("AreaChart", () => [...ie, ...ae]);
|
|
2481
|
+
let oe = X.length > 0, se = oe ? Math.min(...X) : 0, ce = oe ? Math.max(...X) : 1, le = u ? 0 : Math.min(0, ...ie), ue = Math.max(...u ? (K[0]?.data ?? []).map((e, t) => K.reduce((e, r) => e + n(r.data[t]), 0)) : ie), de = q ? Math.min(0, ...ae) : le, fe = q ? Math.max(...ae) : ue;
|
|
2474
2482
|
return /* @__PURE__ */ p("div", {
|
|
2475
2483
|
style: {
|
|
2476
2484
|
display: "flex",
|
|
@@ -2482,36 +2490,36 @@ function $t({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2482
2490
|
title: r,
|
|
2483
2491
|
description: l,
|
|
2484
2492
|
width: v,
|
|
2485
|
-
height:
|
|
2493
|
+
height: Y,
|
|
2486
2494
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2487
2495
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2488
|
-
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }),
|
|
2489
|
-
/* @__PURE__ */ f("tbody", { children: (
|
|
2496
|
+
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "X" }), K.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2497
|
+
/* @__PURE__ */ f("tbody", { children: (K[0]?.data ?? []).map((e, r) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: K[0] ? String(t(K[0].data[r])) : "" }), K.map((e) => /* @__PURE__ */ f("td", { children: e.data[r] == null ? "" : n(e.data[r]) }, e.id))] }, r)) })
|
|
2490
2498
|
] }),
|
|
2491
|
-
className:
|
|
2492
|
-
"data-state":
|
|
2499
|
+
className: w,
|
|
2500
|
+
"data-state": oe ? void 0 : "empty",
|
|
2493
2501
|
plain: E,
|
|
2494
|
-
tooltip: C !== !1 &&
|
|
2495
|
-
if (C === !1 || !
|
|
2496
|
-
let i = e -
|
|
2502
|
+
tooltip: C !== !1 && oe ? ({ width: e, height: r }) => {
|
|
2503
|
+
if (C === !1 || !oe) return;
|
|
2504
|
+
let i = e - J.left - J.right, a = r - J.top - J.bottom, o = m([se, ce], [0, i]), s = m([le, ue], [a, 0]), c = q ? m([de, fe], [a, 0]) : s, l = (e) => e.axis === "right" ? c : s;
|
|
2497
2505
|
if (I === "axis") {
|
|
2498
|
-
let e =
|
|
2506
|
+
let e = K.reduce((e, t) => Math.max(e, t.data.length), 0), r = [];
|
|
2499
2507
|
for (let i = 0; i < e; i++) {
|
|
2500
|
-
let e = [], a = Infinity, s = "", c =
|
|
2501
|
-
|
|
2502
|
-
if (
|
|
2508
|
+
let e = [], a = Infinity, s = "", c = J.left;
|
|
2509
|
+
K.forEach((r, u) => {
|
|
2510
|
+
if (z.value.has(r.id)) return;
|
|
2503
2511
|
let d = r.data[i];
|
|
2504
2512
|
if (d === void 0) return;
|
|
2505
2513
|
let f = n(d);
|
|
2506
|
-
Number.isFinite(f) && (c =
|
|
2514
|
+
Number.isFinite(f) && (c = J.left + o.map(t(d)), a = Math.min(a, l(r).map(f)), s = String(t(d)), e.push({
|
|
2507
2515
|
label: r.label,
|
|
2508
2516
|
value: f,
|
|
2509
|
-
color: r.color ??
|
|
2517
|
+
color: r.color ?? en[u % en.length]
|
|
2510
2518
|
}));
|
|
2511
2519
|
}), e.length !== 0 && r.push({
|
|
2512
2520
|
id: `x-${i}`,
|
|
2513
2521
|
cx: c,
|
|
2514
|
-
cy:
|
|
2522
|
+
cy: J.top + (a === Infinity ? 0 : a),
|
|
2515
2523
|
label: s,
|
|
2516
2524
|
value: s,
|
|
2517
2525
|
segments: e
|
|
@@ -2523,93 +2531,93 @@ function $t({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2523
2531
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2524
2532
|
};
|
|
2525
2533
|
}
|
|
2526
|
-
return { points:
|
|
2534
|
+
return { points: K.flatMap((e) => z.value.has(e.id) ? [] : e.data.map((r, i) => ({
|
|
2527
2535
|
id: `${e.id}-${i}`,
|
|
2528
|
-
cx:
|
|
2529
|
-
cy:
|
|
2536
|
+
cx: J.left + o.map(t(r)),
|
|
2537
|
+
cy: J.top + l(e).map(n(r)),
|
|
2530
2538
|
label: String(t(r)),
|
|
2531
2539
|
value: n(r),
|
|
2532
2540
|
seriesId: e.id
|
|
2533
2541
|
}))) };
|
|
2534
2542
|
} : void 0,
|
|
2535
2543
|
onSelect: k,
|
|
2536
|
-
zoom:
|
|
2537
|
-
window:
|
|
2538
|
-
count:
|
|
2544
|
+
zoom: M && H > 1 ? {
|
|
2545
|
+
window: W,
|
|
2546
|
+
count: H
|
|
2539
2547
|
} : void 0,
|
|
2540
|
-
toolbox:
|
|
2541
|
-
onRestore:
|
|
2542
|
-
|
|
2548
|
+
toolbox: te,
|
|
2549
|
+
onRestore: U ? () => {
|
|
2550
|
+
W.value = [0, Math.max(0, H - 1)];
|
|
2543
2551
|
} : void 0,
|
|
2544
2552
|
children: ({ width: e, height: r }) => {
|
|
2545
|
-
let i = e -
|
|
2546
|
-
return u && (l =
|
|
2547
|
-
prefix:
|
|
2553
|
+
let i = e - J.left - J.right, a = r - J.top - J.bottom, o = m([se, ce], [0, i]), s = m([le, ue], [a, 0]), c = q ? m([de, fe], [a, 0]) : s, l = [];
|
|
2554
|
+
return u && (l = F(K.map((e) => e.data.map((e) => n(e))))), /* @__PURE__ */ p("g", { children: [g !== "solid" && /* @__PURE__ */ f(Dt, {
|
|
2555
|
+
prefix: R,
|
|
2548
2556
|
fill: g,
|
|
2549
2557
|
patternKind: _,
|
|
2550
|
-
series:
|
|
2558
|
+
series: K.map((e, t) => ({
|
|
2551
2559
|
id: e.id,
|
|
2552
|
-
color: e.color ??
|
|
2560
|
+
color: e.color ?? en[t % en.length]
|
|
2553
2561
|
}))
|
|
2554
2562
|
}), /* @__PURE__ */ p("g", {
|
|
2555
|
-
transform: `translate(${
|
|
2563
|
+
transform: `translate(${J.left},${J.top})`,
|
|
2556
2564
|
children: [
|
|
2557
|
-
!E && /* @__PURE__ */ f(
|
|
2565
|
+
!E && /* @__PURE__ */ f(pt, {
|
|
2558
2566
|
scale: s,
|
|
2559
2567
|
orientation: "y",
|
|
2560
2568
|
length: i,
|
|
2561
2569
|
tickCount: x
|
|
2562
2570
|
}),
|
|
2563
|
-
!E &&
|
|
2571
|
+
!E && vt(D, {
|
|
2564
2572
|
xScale: o,
|
|
2565
2573
|
yScale: s,
|
|
2566
2574
|
innerW: i,
|
|
2567
2575
|
innerH: a
|
|
2568
2576
|
}),
|
|
2569
|
-
|
|
2570
|
-
if (
|
|
2571
|
-
let i = e.color ??
|
|
2577
|
+
K.map((e, r) => {
|
|
2578
|
+
if (z.value.has(e.id)) return null;
|
|
2579
|
+
let i = e.color ?? en[r % en.length], a, d;
|
|
2572
2580
|
if (u && l[r]) {
|
|
2573
2581
|
let c = l[r];
|
|
2574
2582
|
a = e.data.map((e, n) => [o.map(t(e)), s.map(c[n][1])]);
|
|
2575
2583
|
let u = e.data.map((e, n) => [o.map(t(e)), s.map(c[n][0])]);
|
|
2576
2584
|
d = s.map(0);
|
|
2577
|
-
let m =
|
|
2585
|
+
let m = T(a, h), _ = u[u.length - 1], v = u[0], y = [...u].reverse().map(([e, t]) => `L${e},${t}`).join(""), b = `${m}L${_[0]},${_[1]}${y}L${v[0]},${v[1]}Z`;
|
|
2578
2586
|
return /* @__PURE__ */ p("g", {
|
|
2579
2587
|
"data-series": e.id,
|
|
2580
2588
|
children: [
|
|
2581
2589
|
/* @__PURE__ */ f("path", {
|
|
2582
2590
|
d: b,
|
|
2583
|
-
fill:
|
|
2584
|
-
|
|
2591
|
+
fill: Et(R, e.id, g, i),
|
|
2592
|
+
style: g === "solid" ? $t : void 0,
|
|
2585
2593
|
stroke: "none"
|
|
2586
2594
|
}),
|
|
2587
2595
|
/* @__PURE__ */ f("path", {
|
|
2588
|
-
d:
|
|
2596
|
+
d: T(a, h),
|
|
2589
2597
|
fill: "none",
|
|
2590
2598
|
stroke: i,
|
|
2591
2599
|
strokeWidth: 2
|
|
2592
2600
|
}),
|
|
2593
|
-
|
|
2601
|
+
B && a.map((t, r) => /* @__PURE__ */ f(St, {
|
|
2594
2602
|
x: t[0],
|
|
2595
2603
|
y: t[1] - 8,
|
|
2596
|
-
text:
|
|
2604
|
+
text: B.format(n(e.data[r]))
|
|
2597
2605
|
}, r))
|
|
2598
2606
|
]
|
|
2599
2607
|
}, e.id);
|
|
2600
2608
|
} else {
|
|
2601
2609
|
let r = e.axis === "right" ? c : s;
|
|
2602
|
-
if (a = e.data.map((e) => [o.map(t(e)), r.map(n(e))]), d = r.map(0),
|
|
2603
|
-
let t =
|
|
2610
|
+
if (a = e.data.map((e) => [o.map(t(e)), r.map(n(e))]), d = r.map(0), V && a.length > V.threshold) {
|
|
2611
|
+
let t = Le(a, V.threshold, V.method).map((e) => [e[0], e[1]]);
|
|
2604
2612
|
return /* @__PURE__ */ p("g", {
|
|
2605
2613
|
"data-series": e.id,
|
|
2606
2614
|
children: [/* @__PURE__ */ f("path", {
|
|
2607
|
-
d:
|
|
2608
|
-
fill:
|
|
2609
|
-
|
|
2615
|
+
d: N(t, d, h),
|
|
2616
|
+
fill: Et(R, e.id, g, i),
|
|
2617
|
+
style: g === "solid" ? $t : void 0,
|
|
2610
2618
|
stroke: "none"
|
|
2611
2619
|
}), /* @__PURE__ */ f("path", {
|
|
2612
|
-
d:
|
|
2620
|
+
d: T(t, h),
|
|
2613
2621
|
fill: "none",
|
|
2614
2622
|
stroke: i,
|
|
2615
2623
|
strokeWidth: 2
|
|
@@ -2620,21 +2628,21 @@ function $t({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2620
2628
|
"data-series": e.id,
|
|
2621
2629
|
children: [
|
|
2622
2630
|
/* @__PURE__ */ f("path", {
|
|
2623
|
-
d:
|
|
2624
|
-
fill:
|
|
2625
|
-
|
|
2631
|
+
d: N(a, d, h),
|
|
2632
|
+
fill: Et(R, e.id, g, i),
|
|
2633
|
+
style: g === "solid" ? $t : void 0,
|
|
2626
2634
|
stroke: "none"
|
|
2627
2635
|
}),
|
|
2628
2636
|
/* @__PURE__ */ f("path", {
|
|
2629
|
-
d:
|
|
2637
|
+
d: T(a, h),
|
|
2630
2638
|
fill: "none",
|
|
2631
2639
|
stroke: i,
|
|
2632
2640
|
strokeWidth: 2
|
|
2633
2641
|
}),
|
|
2634
|
-
|
|
2642
|
+
B && a.map((t, r) => /* @__PURE__ */ f(St, {
|
|
2635
2643
|
x: t[0],
|
|
2636
2644
|
y: t[1] - 8,
|
|
2637
|
-
text:
|
|
2645
|
+
text: B.format(n(e.data[r]))
|
|
2638
2646
|
}, r))
|
|
2639
2647
|
]
|
|
2640
2648
|
}, e.id);
|
|
@@ -2654,7 +2662,7 @@ function $t({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2654
2662
|
length: a,
|
|
2655
2663
|
tickCount: x
|
|
2656
2664
|
}),
|
|
2657
|
-
|
|
2665
|
+
q && /* @__PURE__ */ f($, {
|
|
2658
2666
|
scale: c,
|
|
2659
2667
|
orientation: "y",
|
|
2660
2668
|
length: a,
|
|
@@ -2667,43 +2675,43 @@ function $t({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2667
2675
|
})] });
|
|
2668
2676
|
}
|
|
2669
2677
|
}),
|
|
2670
|
-
A && !j &&
|
|
2671
|
-
count:
|
|
2672
|
-
window:
|
|
2678
|
+
A && !j && H > 1 && /* @__PURE__ */ f(Pt, {
|
|
2679
|
+
count: H,
|
|
2680
|
+
window: W,
|
|
2673
2681
|
label: "Range"
|
|
2674
2682
|
}),
|
|
2675
|
-
j &&
|
|
2676
|
-
count:
|
|
2677
|
-
window:
|
|
2683
|
+
j && H > 1 && /* @__PURE__ */ f(Ft, {
|
|
2684
|
+
count: H,
|
|
2685
|
+
window: W,
|
|
2678
2686
|
label: "Range"
|
|
2679
2687
|
}),
|
|
2680
|
-
|
|
2681
|
-
series:
|
|
2688
|
+
re && /* @__PURE__ */ f(Kt, {
|
|
2689
|
+
series: K.map((e, t) => ({
|
|
2682
2690
|
id: e.id,
|
|
2683
2691
|
label: e.label,
|
|
2684
|
-
color: e.color ??
|
|
2692
|
+
color: e.color ?? en[t % en.length]
|
|
2685
2693
|
})),
|
|
2686
|
-
hidden:
|
|
2694
|
+
hidden: z
|
|
2687
2695
|
})
|
|
2688
2696
|
]
|
|
2689
2697
|
});
|
|
2690
2698
|
}
|
|
2691
2699
|
//#endregion
|
|
2692
2700
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2693
|
-
var
|
|
2694
|
-
function
|
|
2701
|
+
var nn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2702
|
+
function rn(e) {
|
|
2695
2703
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2696
2704
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2697
2705
|
}
|
|
2698
|
-
function
|
|
2706
|
+
function an({ series: e, x: t, y: n, title: r, description: a, orientation: c = "vertical", mode: l = "grouped", width: u, height: h, xTicks: _ = 5, yTicks: v = 5, xLabelEvery: y, legend: b, tooltip: x, tooltipFormat: S, className: C, plain: w, annotations: T, labels: E, onSelect: D, fill: O = "solid", patternKind: k }) {
|
|
2699
2707
|
o();
|
|
2700
|
-
let A = s(), j = w ? null :
|
|
2701
|
-
let t =
|
|
2708
|
+
let A = s(), j = w ? null : xt(E), M = i(/* @__PURE__ */ new Set()), N = w ? He : Z, P = h ?? (w ? 48 : 300), I = w ? !1 : b ?? e.length > 1, L = (e[0]?.data ?? []).map((e) => t(e)), ee = e.flatMap((e) => e.data.map((e) => n(e))), te = L.length > 0, R = l === "stacked" || l === "percent", z = L.map((t, r) => e.reduce((e, t) => e + n(t.data[r]), 0)), B = () => {
|
|
2709
|
+
let t = F(e.map((e) => e.data.map((e) => n(e))));
|
|
2702
2710
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2703
|
-
let r =
|
|
2711
|
+
let r = z[n] || 1;
|
|
2704
2712
|
return [e / r, t / r];
|
|
2705
2713
|
})) : t;
|
|
2706
|
-
},
|
|
2714
|
+
}, V = R ? 0 : Math.min(0, ...ee), H = te ? Math.max(...z) : 1, U = l === "percent" ? 1 : l === "stacked" ? H : Math.max(1, ...ee), W = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0;
|
|
2707
2715
|
return /* @__PURE__ */ p("div", {
|
|
2708
2716
|
style: {
|
|
2709
2717
|
display: "flex",
|
|
@@ -2714,24 +2722,24 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2714
2722
|
title: r,
|
|
2715
2723
|
description: a,
|
|
2716
2724
|
width: u,
|
|
2717
|
-
height:
|
|
2725
|
+
height: P,
|
|
2718
2726
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2719
2727
|
/* @__PURE__ */ f("caption", { children: r }),
|
|
2720
2728
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ f("th", { children: e.label }, e.id))] }) }),
|
|
2721
2729
|
/* @__PURE__ */ f("tbody", { children: L.map((t, r) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: t }), e.map((e) => /* @__PURE__ */ f("td", { children: e.data[r] == null ? "" : n(e.data[r]) }, e.id))] }, t)) })
|
|
2722
2730
|
] }),
|
|
2723
2731
|
className: C,
|
|
2724
|
-
"data-state":
|
|
2732
|
+
"data-state": te ? void 0 : "empty",
|
|
2725
2733
|
plain: w,
|
|
2726
|
-
tooltip: x &&
|
|
2727
|
-
if (!x || !
|
|
2728
|
-
let a = r - N.left - N.right, o = i - N.top - N.bottom, s = c === "vertical", u = g(L, s ? [0, a] : [0, o], .2), d = m([
|
|
2729
|
-
|
|
2730
|
-
let h =
|
|
2734
|
+
tooltip: x && te ? ({ width: r, height: i }) => {
|
|
2735
|
+
if (!x || !te) return;
|
|
2736
|
+
let a = r - N.left - N.right, o = i - N.top - N.bottom, s = c === "vertical", u = g(L, s ? [0, a] : [0, o], .2), d = m([V, U], s ? [o, 0] : [0, a]), f = e.filter((e) => !M.value.has(e.id)), p = [];
|
|
2737
|
+
R && (p = B());
|
|
2738
|
+
let h = R && !S, _ = L.map((t, r) => {
|
|
2731
2739
|
let i = f.map((t) => ({
|
|
2732
2740
|
label: t.label,
|
|
2733
2741
|
value: n(t.data[r]),
|
|
2734
|
-
color: t.color ??
|
|
2742
|
+
color: t.color ?? nn[e.indexOf(t) % nn.length]
|
|
2735
2743
|
}));
|
|
2736
2744
|
return {
|
|
2737
2745
|
segs: i,
|
|
@@ -2741,10 +2749,10 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2741
2749
|
let i = e.indexOf(r), a = l === "grouped" ? u.bandwidth / f.length : u.bandwidth;
|
|
2742
2750
|
return r.data.map((e, o) => {
|
|
2743
2751
|
let c = u.map(t(e)) ?? 0, m, g;
|
|
2744
|
-
if (
|
|
2752
|
+
if (R && p[i]) {
|
|
2745
2753
|
let e = p[i][o];
|
|
2746
2754
|
m = e[1], g = e[0];
|
|
2747
|
-
} else m = n(e), g =
|
|
2755
|
+
} else m = n(e), g = V;
|
|
2748
2756
|
let v = f.indexOf(r), y = c + (l === "grouped" ? v * a : 0) + a / 2, b = (Math.min(d.map(m), d.map(g)) + Math.max(d.map(m), d.map(g))) / 2;
|
|
2749
2757
|
return {
|
|
2750
2758
|
id: `${r.id}-${o}`,
|
|
@@ -2756,7 +2764,7 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2756
2764
|
...h && { segments: _[o].segs }
|
|
2757
2765
|
};
|
|
2758
2766
|
});
|
|
2759
|
-
}), y = S ?? (h ?
|
|
2767
|
+
}), y = S ?? (h ? rn : void 0);
|
|
2760
2768
|
return y ? {
|
|
2761
2769
|
points: v,
|
|
2762
2770
|
format: y
|
|
@@ -2764,48 +2772,48 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2764
2772
|
} : void 0,
|
|
2765
2773
|
onSelect: D,
|
|
2766
2774
|
children: ({ width: r, height: i }) => {
|
|
2767
|
-
let a = r - N.left - N.right, o = i - N.top - N.bottom, s = c === "vertical", u = g(L, s ? [0, a] : [0, o], .2), h = m([
|
|
2768
|
-
return
|
|
2775
|
+
let a = r - N.left - N.right, o = i - N.top - N.bottom, s = c === "vertical", u = g(L, s ? [0, a] : [0, o], .2), h = m([V, U], s ? [o, 0] : [0, a]), b = e.filter((e) => !M.value.has(e.id)), x = [];
|
|
2776
|
+
return R && (x = B()), /* @__PURE__ */ p("g", { children: [O !== "solid" && /* @__PURE__ */ f(Dt, {
|
|
2769
2777
|
prefix: A,
|
|
2770
2778
|
fill: O,
|
|
2771
2779
|
patternKind: k,
|
|
2772
2780
|
series: e.map((e, t) => ({
|
|
2773
2781
|
id: e.id,
|
|
2774
|
-
color: e.color ??
|
|
2782
|
+
color: e.color ?? nn[t % nn.length]
|
|
2775
2783
|
}))
|
|
2776
2784
|
}), /* @__PURE__ */ p("g", {
|
|
2777
2785
|
transform: `translate(${N.left},${N.top})`,
|
|
2778
2786
|
children: [
|
|
2779
|
-
!w && s && /* @__PURE__ */ f(
|
|
2787
|
+
!w && s && /* @__PURE__ */ f(pt, {
|
|
2780
2788
|
scale: h,
|
|
2781
2789
|
orientation: "y",
|
|
2782
2790
|
length: a,
|
|
2783
2791
|
tickCount: v
|
|
2784
2792
|
}),
|
|
2785
|
-
!w && !s && /* @__PURE__ */ f(
|
|
2793
|
+
!w && !s && /* @__PURE__ */ f(pt, {
|
|
2786
2794
|
scale: h,
|
|
2787
2795
|
orientation: "x",
|
|
2788
2796
|
length: o,
|
|
2789
2797
|
tickCount: _
|
|
2790
2798
|
}),
|
|
2791
|
-
!w &&
|
|
2799
|
+
!w && vt(T, {
|
|
2792
2800
|
xScale: s ? u : h,
|
|
2793
2801
|
yScale: s ? h : u,
|
|
2794
2802
|
innerW: a,
|
|
2795
2803
|
innerH: o
|
|
2796
2804
|
}),
|
|
2797
2805
|
b.map((r, i) => {
|
|
2798
|
-
let a = r.color ??
|
|
2806
|
+
let a = r.color ?? nn[e.indexOf(r) % nn.length], o = e.indexOf(r), c = l === "grouped" ? u.bandwidth / b.length : u.bandwidth;
|
|
2799
2807
|
return r.data.map((e, d) => {
|
|
2800
2808
|
let m = u.map(t(e)) ?? 0, g, _;
|
|
2801
|
-
if (
|
|
2809
|
+
if (R && x[o]) {
|
|
2802
2810
|
let e = x[o][d];
|
|
2803
2811
|
g = e[1], _ = e[0];
|
|
2804
|
-
} else g = n(e), _ =
|
|
2812
|
+
} else g = n(e), _ = V;
|
|
2805
2813
|
let v = m + (l === "grouped" ? i * c : 0), y = Math.min(h.map(g), h.map(_)), b = Math.abs(h.map(g) - h.map(_)), S = null;
|
|
2806
2814
|
if (j) {
|
|
2807
|
-
let t = j.format(n(e)), r = v + c / 2, i =
|
|
2808
|
-
if (s) S = /* @__PURE__ */ f(
|
|
2815
|
+
let t = j.format(n(e)), r = v + c / 2, i = R || b < 18 || y < 14;
|
|
2816
|
+
if (s) S = /* @__PURE__ */ f(St, {
|
|
2809
2817
|
x: r,
|
|
2810
2818
|
y: i ? y + 13 : y - 4,
|
|
2811
2819
|
text: t,
|
|
@@ -2813,7 +2821,7 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2813
2821
|
});
|
|
2814
2822
|
else {
|
|
2815
2823
|
let e = y + b;
|
|
2816
|
-
S = /* @__PURE__ */ f(
|
|
2824
|
+
S = /* @__PURE__ */ f(St, {
|
|
2817
2825
|
x: i ? e - 4 : e + 4,
|
|
2818
2826
|
y: r + 4,
|
|
2819
2827
|
text: t,
|
|
@@ -2821,14 +2829,14 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2821
2829
|
tone: i ? "muted" : "default"
|
|
2822
2830
|
});
|
|
2823
2831
|
}
|
|
2824
|
-
|
|
2832
|
+
R && b < 14 && (S = null);
|
|
2825
2833
|
}
|
|
2826
2834
|
return /* @__PURE__ */ p("g", { children: [s ? /* @__PURE__ */ f("rect", {
|
|
2827
2835
|
x: v,
|
|
2828
2836
|
y,
|
|
2829
2837
|
width: c,
|
|
2830
2838
|
height: b,
|
|
2831
|
-
fill:
|
|
2839
|
+
fill: Et(A, r.id, O, a),
|
|
2832
2840
|
rx: 2,
|
|
2833
2841
|
"data-series": r.id
|
|
2834
2842
|
}) : /* @__PURE__ */ f("rect", {
|
|
@@ -2836,7 +2844,7 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2836
2844
|
y: v,
|
|
2837
2845
|
width: b,
|
|
2838
2846
|
height: c,
|
|
2839
|
-
fill:
|
|
2847
|
+
fill: Et(A, r.id, O, a),
|
|
2840
2848
|
rx: 2,
|
|
2841
2849
|
"data-series": r.id
|
|
2842
2850
|
}), S] }, `${r.id}-${d}`);
|
|
@@ -2854,14 +2862,14 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2854
2862
|
orientation: "y",
|
|
2855
2863
|
length: o,
|
|
2856
2864
|
tickCount: v,
|
|
2857
|
-
...
|
|
2865
|
+
...W && { format: W }
|
|
2858
2866
|
})] }),
|
|
2859
2867
|
!w && !s && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f($, {
|
|
2860
2868
|
scale: h,
|
|
2861
2869
|
orientation: "x",
|
|
2862
2870
|
length: a,
|
|
2863
2871
|
tickCount: _,
|
|
2864
|
-
...
|
|
2872
|
+
...W && { format: W },
|
|
2865
2873
|
transform: `translate(0,${o})`
|
|
2866
2874
|
}), /* @__PURE__ */ f($, {
|
|
2867
2875
|
scale: u,
|
|
@@ -2873,11 +2881,11 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2873
2881
|
]
|
|
2874
2882
|
})] });
|
|
2875
2883
|
}
|
|
2876
|
-
}), I && /* @__PURE__ */ f(
|
|
2884
|
+
}), I && /* @__PURE__ */ f(Kt, {
|
|
2877
2885
|
series: e.map((e, t) => ({
|
|
2878
2886
|
id: e.id,
|
|
2879
2887
|
label: e.label,
|
|
2880
|
-
color: e.color ??
|
|
2888
|
+
color: e.color ?? nn[t % nn.length]
|
|
2881
2889
|
})),
|
|
2882
2890
|
hidden: M
|
|
2883
2891
|
})]
|
|
@@ -2885,15 +2893,15 @@ function nn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2885
2893
|
}
|
|
2886
2894
|
//#endregion
|
|
2887
2895
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2888
|
-
function
|
|
2896
|
+
function on(e) {
|
|
2889
2897
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2890
2898
|
return `${e.value} (${t}%)`;
|
|
2891
2899
|
}
|
|
2892
|
-
var
|
|
2893
|
-
function
|
|
2894
|
-
let
|
|
2900
|
+
var sn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2901
|
+
function cn({ data: e, title: t, description: n, donut: r = !1, width: a, height: s, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: m, centerSlot: h, emptyLabel: g, tooltipFormat: _, legend: v, className: y, plain: b, labels: x, onSelect: S }) {
|
|
2902
|
+
let w = b ? null : xt(x), T = typeof x == "object" && !!x && x.format != null, E = a ?? c, D = s ?? c ?? (b ? 48 : 300), O = b ? !1 : v ?? !0;
|
|
2895
2903
|
o();
|
|
2896
|
-
let
|
|
2904
|
+
let k = i(/* @__PURE__ */ new Set()), A = e.length > 0;
|
|
2897
2905
|
return /* @__PURE__ */ p("div", {
|
|
2898
2906
|
style: {
|
|
2899
2907
|
display: "flex",
|
|
@@ -2903,8 +2911,8 @@ function on({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2903
2911
|
children: [/* @__PURE__ */ f(Q, {
|
|
2904
2912
|
title: t,
|
|
2905
2913
|
description: n,
|
|
2906
|
-
width:
|
|
2907
|
-
height:
|
|
2914
|
+
width: E,
|
|
2915
|
+
height: D,
|
|
2908
2916
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
2909
2917
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
2910
2918
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [
|
|
@@ -2922,46 +2930,46 @@ function on({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2922
2930
|
}) })
|
|
2923
2931
|
] }),
|
|
2924
2932
|
className: y,
|
|
2925
|
-
"data-state":
|
|
2933
|
+
"data-state": A ? void 0 : "empty",
|
|
2926
2934
|
emptyLabel: g,
|
|
2927
2935
|
plain: b,
|
|
2928
|
-
tooltip:
|
|
2929
|
-
if (!
|
|
2930
|
-
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !
|
|
2936
|
+
tooltip: A ? ({ width: t, height: n }) => {
|
|
2937
|
+
if (!A) return;
|
|
2938
|
+
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !k.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
|
|
2931
2939
|
return {
|
|
2932
2940
|
points: o.map((e, t) => {
|
|
2933
2941
|
let n = s > 0 ? e.value / s * 2 * Math.PI : 0, o = c + n, l = (c + o) / 2;
|
|
2934
2942
|
return c = o, {
|
|
2935
2943
|
id: e.id,
|
|
2936
|
-
cx: r + Math.sin(l) * a * .65,
|
|
2937
|
-
cy: i - Math.cos(l) * a * .65,
|
|
2944
|
+
cx: C(r + Math.sin(l) * a * .65),
|
|
2945
|
+
cy: C(i - Math.cos(l) * a * .65),
|
|
2938
2946
|
label: e.label,
|
|
2939
2947
|
value: e.value,
|
|
2940
2948
|
seriesId: String(t),
|
|
2941
2949
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
2942
|
-
color: e.color ??
|
|
2950
|
+
color: e.color ?? sn[t % sn.length]
|
|
2943
2951
|
};
|
|
2944
2952
|
}),
|
|
2945
|
-
format: _ ??
|
|
2953
|
+
format: _ ?? on
|
|
2946
2954
|
};
|
|
2947
2955
|
} : void 0,
|
|
2948
2956
|
onSelect: S,
|
|
2949
2957
|
children: ({ width: t, height: n }) => {
|
|
2950
|
-
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) => !
|
|
2958
|
+
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !k.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || m != null || h != null);
|
|
2951
2959
|
return /* @__PURE__ */ p("g", { children: [g.map((e, t) => {
|
|
2952
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
2960
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? sn[t % sn.length], u = P(i, a, o, c, v, r);
|
|
2953
2961
|
v = r;
|
|
2954
|
-
let d = _ > 0 ? e.value / _ * 100 : 0, m =
|
|
2962
|
+
let d = _ > 0 ? e.value / _ * 100 : 0, m = w && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
2955
2963
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("path", {
|
|
2956
2964
|
d: u,
|
|
2957
2965
|
fill: l,
|
|
2958
2966
|
stroke: "var(--cascivo-color-surface)",
|
|
2959
2967
|
strokeWidth: 1,
|
|
2960
2968
|
"data-series": e.id
|
|
2961
|
-
}), m && /* @__PURE__ */ f(
|
|
2962
|
-
x: i + Math.sin(s) * h,
|
|
2963
|
-
y: a - Math.cos(s) * h + 4,
|
|
2964
|
-
text:
|
|
2969
|
+
}), m && /* @__PURE__ */ f(St, {
|
|
2970
|
+
x: C(i + Math.sin(s) * h),
|
|
2971
|
+
y: C(a - Math.cos(s) * h + 4),
|
|
2972
|
+
text: T ? w.format(e.value) : `${Math.round(d)}%`,
|
|
2965
2973
|
tone: "muted"
|
|
2966
2974
|
})] }, e.id);
|
|
2967
2975
|
}), y && (h == null ? /* @__PURE__ */ p("g", {
|
|
@@ -3004,35 +3012,35 @@ function on({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3004
3012
|
})
|
|
3005
3013
|
}))] });
|
|
3006
3014
|
}
|
|
3007
|
-
}),
|
|
3015
|
+
}), O && /* @__PURE__ */ f(Kt, {
|
|
3008
3016
|
series: e.map((e, t) => ({
|
|
3009
3017
|
id: e.id,
|
|
3010
3018
|
label: e.label,
|
|
3011
|
-
color: e.color ??
|
|
3019
|
+
color: e.color ?? sn[t % sn.length]
|
|
3012
3020
|
})),
|
|
3013
|
-
hidden:
|
|
3021
|
+
hidden: k
|
|
3014
3022
|
})]
|
|
3015
3023
|
});
|
|
3016
3024
|
}
|
|
3017
3025
|
//#endregion
|
|
3018
3026
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3019
|
-
var
|
|
3020
|
-
function
|
|
3027
|
+
var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3028
|
+
function un({ series: e, title: t, description: n, r = 4, width: a, height: s, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: h, className: g, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C }) {
|
|
3021
3029
|
o();
|
|
3022
|
-
let w = i(/* @__PURE__ */ new Set()), T = _ ?
|
|
3030
|
+
let w = i(/* @__PURE__ */ new Set()), T = _ ? He : Z, E = s ?? (_ ? 48 : 300), D = _ ? !1 : u ?? e.length > 1, O = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && O > 2e3), A = i([S?.min ?? 0, S?.max ?? 1]), j = i(/* @__PURE__ */ new Set()), M = (t, { width: n, height: i }) => {
|
|
3023
3031
|
let a = n - T.left - T.right, o = i - T.top - T.bottom;
|
|
3024
3032
|
if (a <= 0 || o <= 0) return;
|
|
3025
|
-
let s = m([I, L], [0, a]), c = m([
|
|
3033
|
+
let s = m([I, L], [0, a]), c = m([ee, te], [o, 0]);
|
|
3026
3034
|
e.forEach((e, n) => {
|
|
3027
3035
|
if (!w.value.has(e.id)) {
|
|
3028
|
-
t.fillStyle =
|
|
3036
|
+
t.fillStyle = Je(t, e.color ?? ln[n % ln.length]), t.globalAlpha = .7;
|
|
3029
3037
|
for (let n of e.data) {
|
|
3030
3038
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3031
3039
|
t.beginPath(), t.arc(T.left + s.map(n.x), T.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3032
3040
|
}
|
|
3033
3041
|
}
|
|
3034
3042
|
}), t.globalAlpha = 1;
|
|
3035
|
-
}, N = e.flatMap((e) => e.data.map((e) => e.x)), P = e.flatMap((e) => e.data.map((e) => e.y)), F = N.length > 0, I = F ? Math.min(...N) : 0, L = F ? Math.max(...N) : 1,
|
|
3043
|
+
}, N = e.flatMap((e) => e.data.map((e) => e.x)), P = e.flatMap((e) => e.data.map((e) => e.y)), F = N.length > 0, I = F ? Math.min(...N) : 0, L = F ? Math.max(...N) : 1, ee = F ? Math.min(0, ...P) : 0, te = F ? Math.max(...P) : 1;
|
|
3036
3044
|
return /* @__PURE__ */ p("div", {
|
|
3037
3045
|
style: {
|
|
3038
3046
|
display: "flex",
|
|
@@ -3063,7 +3071,7 @@ function cn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3063
3071
|
plain: _,
|
|
3064
3072
|
tooltip: h !== !1 && F ? ({ width: t, height: n }) => {
|
|
3065
3073
|
if (h === !1 || !F) return;
|
|
3066
|
-
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = m([I, L], [0, r]), o = m([
|
|
3074
|
+
let r = t - T.left - T.right, i = n - T.top - T.bottom, a = m([I, L], [0, r]), o = m([ee, te], [i, 0]);
|
|
3067
3075
|
return { points: e.flatMap((e) => w.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3068
3076
|
id: `${e.id}-${n}`,
|
|
3069
3077
|
cx: T.left + a.map(t.x),
|
|
@@ -3082,17 +3090,17 @@ function cn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3082
3090
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3083
3091
|
} : void 0,
|
|
3084
3092
|
children: ({ width: t, height: n }) => {
|
|
3085
|
-
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = m([I, L], [0, i]), s = m([
|
|
3093
|
+
let i = t - T.left - T.right, a = n - T.top - T.bottom, o = m([I, L], [0, i]), s = m([ee, te], [a, 0]);
|
|
3086
3094
|
return /* @__PURE__ */ f("g", { children: /* @__PURE__ */ p("g", {
|
|
3087
3095
|
transform: `translate(${T.left},${T.top})`,
|
|
3088
3096
|
children: [
|
|
3089
|
-
!_ && /* @__PURE__ */ f(
|
|
3097
|
+
!_ && /* @__PURE__ */ f(pt, {
|
|
3090
3098
|
scale: s,
|
|
3091
3099
|
orientation: "y",
|
|
3092
3100
|
length: i,
|
|
3093
3101
|
tickCount: l
|
|
3094
3102
|
}),
|
|
3095
|
-
!_ &&
|
|
3103
|
+
!_ && vt(v, {
|
|
3096
3104
|
xScale: o,
|
|
3097
3105
|
yScale: s,
|
|
3098
3106
|
innerW: i,
|
|
@@ -3100,12 +3108,12 @@ function cn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3100
3108
|
}),
|
|
3101
3109
|
!k && e.map((e, t) => {
|
|
3102
3110
|
if (w.value.has(e.id)) return null;
|
|
3103
|
-
let n = e.color ??
|
|
3111
|
+
let n = e.color ?? ln[t % ln.length];
|
|
3104
3112
|
return /* @__PURE__ */ f("g", {
|
|
3105
3113
|
"data-series": e.id,
|
|
3106
3114
|
children: e.data.map((t, i) => {
|
|
3107
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3108
|
-
return m && m !== "circle" ? /* @__PURE__ */ f(
|
|
3115
|
+
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? Ht(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? Ut(t.y, S, A.value, j.value) : !0, p = d ? .7 : .1, m = typeof b == "function" ? b(t, e.id) : b;
|
|
3116
|
+
return m && m !== "circle" ? /* @__PURE__ */ f(kt, {
|
|
3109
3117
|
shape: m,
|
|
3110
3118
|
x: o.map(t.x),
|
|
3111
3119
|
y: s.map(t.y),
|
|
@@ -3142,17 +3150,17 @@ function cn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3142
3150
|
}) });
|
|
3143
3151
|
}
|
|
3144
3152
|
}),
|
|
3145
|
-
S && F && /* @__PURE__ */ f(
|
|
3153
|
+
S && F && /* @__PURE__ */ f(Wt, {
|
|
3146
3154
|
options: S,
|
|
3147
3155
|
range: A,
|
|
3148
3156
|
hidden: j,
|
|
3149
3157
|
label: t
|
|
3150
3158
|
}),
|
|
3151
|
-
D && /* @__PURE__ */ f(
|
|
3159
|
+
D && /* @__PURE__ */ f(Kt, {
|
|
3152
3160
|
series: e.map((e, t) => ({
|
|
3153
3161
|
id: e.id,
|
|
3154
3162
|
label: e.label,
|
|
3155
|
-
color: e.color ??
|
|
3163
|
+
color: e.color ?? ln[t % ln.length]
|
|
3156
3164
|
})),
|
|
3157
3165
|
hidden: w
|
|
3158
3166
|
})
|
|
@@ -3161,7 +3169,7 @@ function cn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3161
3169
|
}
|
|
3162
3170
|
//#endregion
|
|
3163
3171
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3164
|
-
function
|
|
3172
|
+
function dn({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var(--cascivo-chart-1)", endDot: a = !0 }) {
|
|
3165
3173
|
return /* @__PURE__ */ f(Q, {
|
|
3166
3174
|
title: r,
|
|
3167
3175
|
width: t,
|
|
@@ -3180,7 +3188,7 @@ function ln({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var
|
|
|
3180
3188
|
})() : void 0,
|
|
3181
3189
|
children: () => {
|
|
3182
3190
|
if (e.length === 0) return null;
|
|
3183
|
-
let r = m([0, e.length - 1], [2, t - 2]), o = Math.min(...e), s = Math.max(...e), c = m([o === s ? o - 1 : o, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u =
|
|
3191
|
+
let r = m([0, e.length - 1], [2, t - 2]), o = Math.min(...e), s = Math.max(...e), c = m([o === s ? o - 1 : o, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u = T(l, "monotone"), h = l[l.length - 1];
|
|
3184
3192
|
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("path", {
|
|
3185
3193
|
d: u,
|
|
3186
3194
|
fill: "none",
|
|
@@ -3199,15 +3207,15 @@ function ln({ data: e, width: t = 120, height: n = 32, label: r, color: i = "var
|
|
|
3199
3207
|
}
|
|
3200
3208
|
//#endregion
|
|
3201
3209
|
//#region src/charts/meter/meter.tsx
|
|
3202
|
-
function
|
|
3210
|
+
function fn(e, t, n, r) {
|
|
3203
3211
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3204
3212
|
let { warning: i, critical: a } = r;
|
|
3205
3213
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3206
3214
|
}
|
|
3207
|
-
function
|
|
3208
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l =
|
|
3215
|
+
function pn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o = 200, height: s }) {
|
|
3216
|
+
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l = fn(e, t, n, a);
|
|
3209
3217
|
if (i === "gauge") {
|
|
3210
|
-
let i = s ?? 100, a = o, u = a / 2, d = i * .9, m = Math.min(u, d) - 4, h = m * .65, g = Math.PI, _ =
|
|
3218
|
+
let i = s ?? 100, a = o, u = a / 2, d = i * .9, m = Math.min(u, d) - 4, h = m * .65, g = Math.PI, _ = P(u, d, m, h, g, 2 * Math.PI), v = g + c * Math.PI, y = c > 0 ? P(u, d, m, h, g, v) : "";
|
|
3211
3219
|
return /* @__PURE__ */ p("div", {
|
|
3212
3220
|
"aria-label": r,
|
|
3213
3221
|
role: "meter",
|
|
@@ -3283,10 +3291,10 @@ function dn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3283
3291
|
}
|
|
3284
3292
|
//#endregion
|
|
3285
3293
|
//#region src/charts/kpi/kpi.tsx
|
|
3286
|
-
function
|
|
3294
|
+
function mn(e) {
|
|
3287
3295
|
return `${e >= 0 ? "+" : ""}${e.toLocaleString()}`;
|
|
3288
3296
|
}
|
|
3289
|
-
function
|
|
3297
|
+
function hn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a, className: o }) {
|
|
3290
3298
|
let s = n != null && n >= 0, c = n != null && n < 0;
|
|
3291
3299
|
return /* @__PURE__ */ p("div", {
|
|
3292
3300
|
className: o,
|
|
@@ -3338,16 +3346,16 @@ function pn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3338
3346
|
fontWeight: 500,
|
|
3339
3347
|
color: s ? "var(--cascivo-color-success-foreground)" : c ? "var(--cascivo-color-destructive-foreground)" : "var(--cascivo-color-foreground-muted)"
|
|
3340
3348
|
},
|
|
3341
|
-
"aria-label": `Trend: ${
|
|
3349
|
+
"aria-label": `Trend: ${mn(n)}${r ? ` ${r}` : ""}`,
|
|
3342
3350
|
children: [
|
|
3343
3351
|
s ? "▲" : c ? "▼" : "–",
|
|
3344
3352
|
" ",
|
|
3345
|
-
|
|
3353
|
+
mn(n),
|
|
3346
3354
|
r && ` ${r}`
|
|
3347
3355
|
]
|
|
3348
3356
|
})]
|
|
3349
3357
|
}),
|
|
3350
|
-
a && a.length > 0 && /* @__PURE__ */ f(
|
|
3358
|
+
a && a.length > 0 && /* @__PURE__ */ f(dn, {
|
|
3351
3359
|
data: a,
|
|
3352
3360
|
label: `${t} trend`,
|
|
3353
3361
|
width: 120,
|
|
@@ -3358,9 +3366,9 @@ function pn({ value: e, label: t, delta: n, deltaLabel: r, icon: i, sparkline: a
|
|
|
3358
3366
|
}
|
|
3359
3367
|
//#endregion
|
|
3360
3368
|
//#region src/charts/histogram/histogram.tsx
|
|
3361
|
-
function
|
|
3369
|
+
function gn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3362
3370
|
o();
|
|
3363
|
-
let u = l ?
|
|
3371
|
+
let u = l ? He : Z, h = s ?? (l ? 48 : 300), g = V(e, t), _ = g.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3364
3372
|
return /* @__PURE__ */ f(Q, {
|
|
3365
3373
|
title: n,
|
|
3366
3374
|
description: i,
|
|
@@ -3401,7 +3409,7 @@ function mn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3401
3409
|
return /* @__PURE__ */ p("g", {
|
|
3402
3410
|
transform: `translate(${u.left},${u.top})`,
|
|
3403
3411
|
children: [
|
|
3404
|
-
!l && /* @__PURE__ */ f(
|
|
3412
|
+
!l && /* @__PURE__ */ f(pt, {
|
|
3405
3413
|
scale: i,
|
|
3406
3414
|
orientation: "y",
|
|
3407
3415
|
length: n.width
|
|
@@ -3434,10 +3442,10 @@ function mn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3434
3442
|
}
|
|
3435
3443
|
//#endregion
|
|
3436
3444
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3437
|
-
var
|
|
3438
|
-
function
|
|
3445
|
+
var _n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3446
|
+
function vn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: s }) {
|
|
3439
3447
|
o();
|
|
3440
|
-
let c = s ?
|
|
3448
|
+
let c = s ? He : Z, l = i ?? (s ? 48 : 320), u = e.map((e) => ({
|
|
3441
3449
|
...e,
|
|
3442
3450
|
stats: H(e.values)
|
|
3443
3451
|
})), h = e.flatMap((e) => e.values), [_, v] = h.length > 0 ? U(h) : [0, 1];
|
|
@@ -3499,7 +3507,7 @@ function gn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3499
3507
|
return /* @__PURE__ */ p("g", {
|
|
3500
3508
|
transform: `translate(${c.left},${c.top})`,
|
|
3501
3509
|
children: [u.map((e, t) => {
|
|
3502
|
-
let n =
|
|
3510
|
+
let n = _n[t % _n.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), m = a.map(e.stats.max);
|
|
3503
3511
|
return /* @__PURE__ */ p("g", { children: [
|
|
3504
3512
|
/* @__PURE__ */ f("line", {
|
|
3505
3513
|
x1: i,
|
|
@@ -3576,10 +3584,10 @@ function gn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3576
3584
|
}
|
|
3577
3585
|
//#endregion
|
|
3578
3586
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3579
|
-
var
|
|
3580
|
-
function
|
|
3587
|
+
var yn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), bn = 3, xn = 24;
|
|
3588
|
+
function Sn({ series: e, title: t, description: n, width: r, height: a, tooltip: s, className: c, plain: l, glyph: u }) {
|
|
3581
3589
|
o();
|
|
3582
|
-
let h = i(null), g = l ?
|
|
3590
|
+
let h = i(null), g = l ? He : Z, v = a ?? (l ? 48 : 320), y = e.flatMap((e) => e.data), [b, x] = y.length > 0 ? U(y.map((e) => e.x)) : [0, 1], [S, C] = y.length > 0 ? U(y.map((e) => e.y)) : [0, 1], [w, T] = y.length > 0 ? U(y.map((e) => e.size)) : [0, 1], E = _([w, T], [bn, xn]), D = y.length > 0;
|
|
3583
3591
|
return /* @__PURE__ */ f(Q, {
|
|
3584
3592
|
title: t,
|
|
3585
3593
|
description: n,
|
|
@@ -3630,13 +3638,13 @@ function bn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3630
3638
|
return /* @__PURE__ */ p("g", {
|
|
3631
3639
|
transform: `translate(${g.left},${g.top})`,
|
|
3632
3640
|
children: [
|
|
3633
|
-
!l && /* @__PURE__ */ f(
|
|
3641
|
+
!l && /* @__PURE__ */ f(pt, {
|
|
3634
3642
|
scale: s,
|
|
3635
3643
|
orientation: "y",
|
|
3636
3644
|
length: r.width
|
|
3637
3645
|
}),
|
|
3638
3646
|
e.map((e, t) => {
|
|
3639
|
-
let n =
|
|
3647
|
+
let n = yn[t % yn.length] ?? "var(--cascivo-chart-1)";
|
|
3640
3648
|
return /* @__PURE__ */ f("g", {
|
|
3641
3649
|
opacity: h.value !== null && h.value !== e.name ? .2 : 1,
|
|
3642
3650
|
onMouseEnter: () => {
|
|
@@ -3647,7 +3655,7 @@ function bn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3647
3655
|
},
|
|
3648
3656
|
children: e.data.map((t, r) => {
|
|
3649
3657
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3650
|
-
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(
|
|
3658
|
+
return i && i !== "circle" ? /* @__PURE__ */ f("g", { children: /* @__PURE__ */ f(kt, {
|
|
3651
3659
|
shape: i,
|
|
3652
3660
|
x: o.map(t.x),
|
|
3653
3661
|
y: s.map(t.y),
|
|
@@ -3685,11 +3693,11 @@ function bn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3685
3693
|
}
|
|
3686
3694
|
//#endregion
|
|
3687
3695
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3688
|
-
function
|
|
3696
|
+
function Cn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, width: a, height: s, tooltip: c, className: l, plain: u, annotations: h }) {
|
|
3689
3697
|
o();
|
|
3690
|
-
let _ = s ?? (u ? 48 : 320), v = u ?
|
|
3691
|
-
...
|
|
3692
|
-
right: i ? 60 :
|
|
3698
|
+
let _ = s ?? (u ? 48 : 320), v = u ? He : {
|
|
3699
|
+
...Z,
|
|
3700
|
+
right: i ? 60 : Z.right
|
|
3693
3701
|
}, y = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, b = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, x = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, S = e.length > 0;
|
|
3694
3702
|
return /* @__PURE__ */ f(Q, {
|
|
3695
3703
|
title: n,
|
|
@@ -3736,16 +3744,16 @@ function xn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3736
3744
|
height: r - v.top - v.bottom
|
|
3737
3745
|
};
|
|
3738
3746
|
if (a.width <= 0 || e.length === 0) return null;
|
|
3739
|
-
let o = g(e.map((e) => e.label), [0, a.width], .2), s = m([0, y], [a.height, 0]), c = i ? m([b, x || b + 1], [a.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), _ = l.length > 1 ?
|
|
3747
|
+
let o = g(e.map((e) => e.label), [0, a.width], .2), s = m([0, y], [a.height, 0]), c = i ? m([b, x || b + 1], [a.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), _ = l.length > 1 ? T(l, "monotone") : "";
|
|
3740
3748
|
return /* @__PURE__ */ p("g", {
|
|
3741
3749
|
transform: `translate(${v.left},${v.top})`,
|
|
3742
3750
|
children: [
|
|
3743
|
-
!u && /* @__PURE__ */ f(
|
|
3751
|
+
!u && /* @__PURE__ */ f(pt, {
|
|
3744
3752
|
scale: s,
|
|
3745
3753
|
orientation: "y",
|
|
3746
3754
|
length: a.width
|
|
3747
3755
|
}),
|
|
3748
|
-
!u &&
|
|
3756
|
+
!u && vt(h, {
|
|
3749
3757
|
xScale: o,
|
|
3750
3758
|
yScale: s,
|
|
3751
3759
|
innerW: a.width,
|
|
@@ -3796,9 +3804,9 @@ function xn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, wi
|
|
|
3796
3804
|
}
|
|
3797
3805
|
//#endregion
|
|
3798
3806
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3799
|
-
function
|
|
3807
|
+
function wn({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u }) {
|
|
3800
3808
|
o();
|
|
3801
|
-
let m = a ?? (c ? 48 : 320), h = c ?
|
|
3809
|
+
let m = a ?? (c ? 48 : 320), h = c ? He : {
|
|
3802
3810
|
top: 20,
|
|
3803
3811
|
right: 20,
|
|
3804
3812
|
bottom: 60,
|
|
@@ -3853,7 +3861,7 @@ function Sn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3853
3861
|
return /* @__PURE__ */ p("g", {
|
|
3854
3862
|
transform: `translate(${h.left},${h.top})`,
|
|
3855
3863
|
children: [e.map((e, t) => {
|
|
3856
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ?
|
|
3864
|
+
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(S(e.value) * 100), s = l ? Ht(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-color-neutral-100))`, c = l ? Ut(e.value, l, C.value, w.value) : !0;
|
|
3857
3865
|
return /* @__PURE__ */ f("rect", {
|
|
3858
3866
|
x: n,
|
|
3859
3867
|
y: r,
|
|
@@ -3883,7 +3891,7 @@ function Sn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3883
3891
|
flexDirection: "column",
|
|
3884
3892
|
gap: "0.5rem"
|
|
3885
3893
|
},
|
|
3886
|
-
children: [T, /* @__PURE__ */ f(
|
|
3894
|
+
children: [T, /* @__PURE__ */ f(Wt, {
|
|
3887
3895
|
options: l,
|
|
3888
3896
|
range: C,
|
|
3889
3897
|
hidden: w,
|
|
@@ -3893,8 +3901,8 @@ function Sn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3893
3901
|
}
|
|
3894
3902
|
//#endregion
|
|
3895
3903
|
//#region src/charts/treemap/treemap.tsx
|
|
3896
|
-
var
|
|
3897
|
-
function
|
|
3904
|
+
var Tn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3905
|
+
function En({ data: e, title: t, description: n, width: r, height: i, className: a, plain: c }) {
|
|
3898
3906
|
o();
|
|
3899
3907
|
let l = s();
|
|
3900
3908
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -3939,7 +3947,7 @@ function wn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3939
3947
|
height: Math.max(0, e.h - 4)
|
|
3940
3948
|
})
|
|
3941
3949
|
}, e.id)) }), r.map((e, t) => {
|
|
3942
|
-
let n =
|
|
3950
|
+
let n = Tn[t % Tn.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
3943
3951
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("rect", {
|
|
3944
3952
|
x: e.x,
|
|
3945
3953
|
y: e.y,
|
|
@@ -3963,18 +3971,18 @@ function wn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3963
3971
|
}
|
|
3964
3972
|
//#endregion
|
|
3965
3973
|
//#region src/charts/radar/radar.tsx
|
|
3966
|
-
var
|
|
3967
|
-
function
|
|
3974
|
+
var Dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), On = 4;
|
|
3975
|
+
function kn(e, t, n, r, i) {
|
|
3968
3976
|
let a = e.length;
|
|
3969
3977
|
return e.map((e, o) => {
|
|
3970
3978
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
3971
3979
|
return {
|
|
3972
|
-
x: n + Math.cos(s) * c,
|
|
3973
|
-
y: r + Math.sin(s) * c
|
|
3980
|
+
x: C(n + Math.cos(s) * c),
|
|
3981
|
+
y: C(r + Math.sin(s) * c)
|
|
3974
3982
|
};
|
|
3975
3983
|
});
|
|
3976
3984
|
}
|
|
3977
|
-
function
|
|
3985
|
+
function An({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
3978
3986
|
let u = s ?? (l ? 48 : 320);
|
|
3979
3987
|
o();
|
|
3980
3988
|
let m = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -3997,8 +4005,8 @@ function On({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
3997
4005
|
let s = r / h * 2 * Math.PI - Math.PI / 2, c = n / m * o;
|
|
3998
4006
|
return {
|
|
3999
4007
|
id: `${t.id}-${r}`,
|
|
4000
|
-
cx: i + Math.cos(s) * c,
|
|
4001
|
-
cy: a + Math.sin(s) * c,
|
|
4008
|
+
cx: C(i + Math.cos(s) * c),
|
|
4009
|
+
cy: C(a + Math.sin(s) * c),
|
|
4002
4010
|
label: e[r] ?? String(r),
|
|
4003
4011
|
value: n,
|
|
4004
4012
|
seriesId: t.id
|
|
@@ -4006,15 +4014,15 @@ function On({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4006
4014
|
})) };
|
|
4007
4015
|
} : void 0,
|
|
4008
4016
|
children: ({ width: n, height: r }) => {
|
|
4009
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4017
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: On }, (e, t) => (t + 1) / On * o), c = Array.from({ length: h }, (e, t) => {
|
|
4010
4018
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4011
4019
|
return {
|
|
4012
|
-
x: i + Math.cos(n) * o,
|
|
4013
|
-
y: a + Math.sin(n) * o
|
|
4020
|
+
x: C(i + Math.cos(n) * o),
|
|
4021
|
+
y: C(a + Math.sin(n) * o)
|
|
4014
4022
|
};
|
|
4015
4023
|
}), u = s.map((e) => Array.from({ length: h }, (t, n) => {
|
|
4016
4024
|
let r = n / h * 2 * Math.PI - Math.PI / 2;
|
|
4017
|
-
return `${i + Math.cos(r) * e},${a + Math.sin(r) * e}`;
|
|
4025
|
+
return `${C(i + Math.cos(r) * e)},${C(a + Math.sin(r) * e)}`;
|
|
4018
4026
|
}).join(" "));
|
|
4019
4027
|
return /* @__PURE__ */ p(d, { children: [
|
|
4020
4028
|
!l && u.map((e, t) => /* @__PURE__ */ f("polygon", {
|
|
@@ -4034,8 +4042,8 @@ function On({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4034
4042
|
!l && c.map((t, n) => {
|
|
4035
4043
|
let r = n / h * 2 * Math.PI - Math.PI / 2;
|
|
4036
4044
|
return /* @__PURE__ */ f("text", {
|
|
4037
|
-
x: i + Math.cos(r) * (o + 18),
|
|
4038
|
-
y: a + Math.sin(r) * (o + 18),
|
|
4045
|
+
x: C(i + Math.cos(r) * (o + 18)),
|
|
4046
|
+
y: C(a + Math.sin(r) * (o + 18)),
|
|
4039
4047
|
fontSize: 11,
|
|
4040
4048
|
textAnchor: "middle",
|
|
4041
4049
|
dominantBaseline: "middle",
|
|
@@ -4044,7 +4052,7 @@ function On({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4044
4052
|
}, n);
|
|
4045
4053
|
}),
|
|
4046
4054
|
t.map((e, t) => {
|
|
4047
|
-
let n =
|
|
4055
|
+
let n = kn(e.values, m, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Dn[t % Dn.length] ?? "var(--cascivo-chart-1)";
|
|
4048
4056
|
return /* @__PURE__ */ f("polygon", {
|
|
4049
4057
|
points: n,
|
|
4050
4058
|
fill: r,
|
|
@@ -4059,12 +4067,12 @@ function On({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4059
4067
|
}
|
|
4060
4068
|
//#endregion
|
|
4061
4069
|
//#region src/charts/bullet/bullet.tsx
|
|
4062
|
-
var
|
|
4070
|
+
var jn = [
|
|
4063
4071
|
"var(--cascivo-color-neutral-200)",
|
|
4064
4072
|
"var(--cascivo-color-neutral-300)",
|
|
4065
4073
|
"var(--cascivo-color-neutral-400)"
|
|
4066
4074
|
];
|
|
4067
|
-
function
|
|
4075
|
+
function Mn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: s = 300, height: c = 40, className: l }) {
|
|
4068
4076
|
o();
|
|
4069
4077
|
let u = [...n].sort((e, t) => e - t), h = m([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, s]), g = c * .35, _ = (c - g) / 2, v = c * .7, y = (c - v) / 2;
|
|
4070
4078
|
return /* @__PURE__ */ p("figure", {
|
|
@@ -4091,7 +4099,7 @@ function An({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4091
4099
|
y: 0,
|
|
4092
4100
|
width: Math.max(0, r),
|
|
4093
4101
|
height: c,
|
|
4094
|
-
fill:
|
|
4102
|
+
fill: jn[t % jn.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4095
4103
|
}, t);
|
|
4096
4104
|
}),
|
|
4097
4105
|
/* @__PURE__ */ f("rect", {
|
|
@@ -4118,10 +4126,10 @@ function An({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4118
4126
|
}
|
|
4119
4127
|
//#endregion
|
|
4120
4128
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4121
|
-
var
|
|
4122
|
-
function
|
|
4129
|
+
var Nn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4130
|
+
function Pn({ data: e, title: t, description: n, size: r, width: a, height: s, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: m, tooltip: h, legend: g, className: _, plain: v }) {
|
|
4123
4131
|
o();
|
|
4124
|
-
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1,
|
|
4132
|
+
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, w = e.length > 0, T = c ?? Math.max(1, ...e.map((e) => e.value)), E = Math.min(360, Math.max(0, l)) * Math.PI / 180, D = -E / 2, O = (t, n) => {
|
|
4125
4133
|
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));
|
|
4126
4134
|
return {
|
|
4127
4135
|
cx: r,
|
|
@@ -4131,27 +4139,27 @@ function Mn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4131
4139
|
span: s.length > 0 ? (a - o) / s.length : 0,
|
|
4132
4140
|
visible: s
|
|
4133
4141
|
};
|
|
4134
|
-
},
|
|
4135
|
-
if (h === !1 || !
|
|
4136
|
-
let { cx: n, cy: r, maxR: i, span: a, visible: o } =
|
|
4142
|
+
}, k = ({ width: e, height: t }) => {
|
|
4143
|
+
if (h === !1 || !w) return;
|
|
4144
|
+
let { cx: n, cy: r, maxR: i, span: a, visible: o } = O(e, t);
|
|
4137
4145
|
return { points: o.map((e, t) => {
|
|
4138
|
-
let o = i - t * a, s = (o + (o - a * .7)) / 2, c =
|
|
4146
|
+
let o = i - t * a, s = (o + (o - a * .7)) / 2, c = D + E * Math.min(1, e.value / T);
|
|
4139
4147
|
return {
|
|
4140
4148
|
id: e.id,
|
|
4141
|
-
cx: n + Math.sin(c) * s,
|
|
4142
|
-
cy: r - Math.cos(c) * s,
|
|
4149
|
+
cx: C(n + Math.sin(c) * s),
|
|
4150
|
+
cy: C(r - Math.cos(c) * s),
|
|
4143
4151
|
label: e.label,
|
|
4144
4152
|
value: e.value,
|
|
4145
4153
|
seriesId: e.id,
|
|
4146
|
-
percent:
|
|
4147
|
-
color: e.color ??
|
|
4154
|
+
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4155
|
+
color: e.color ?? Nn[t % Nn.length]
|
|
4148
4156
|
};
|
|
4149
4157
|
}) };
|
|
4150
|
-
},
|
|
4158
|
+
}, A = /* @__PURE__ */ p("table", { children: [
|
|
4151
4159
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4152
4160
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Label" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4153
4161
|
/* @__PURE__ */ f("tbody", { children: e.map((e) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: e.label }), /* @__PURE__ */ f("td", { children: e.value })] }, e.id)) })
|
|
4154
|
-
] }),
|
|
4162
|
+
] }), j = u != null || d != null || m != null;
|
|
4155
4163
|
return /* @__PURE__ */ p("div", {
|
|
4156
4164
|
style: {
|
|
4157
4165
|
display: "flex",
|
|
@@ -4163,27 +4171,27 @@ function Mn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4163
4171
|
description: n,
|
|
4164
4172
|
width: b,
|
|
4165
4173
|
height: x,
|
|
4166
|
-
fallback:
|
|
4174
|
+
fallback: A,
|
|
4167
4175
|
className: _,
|
|
4168
|
-
"data-state":
|
|
4176
|
+
"data-state": w ? void 0 : "empty",
|
|
4169
4177
|
plain: v,
|
|
4170
|
-
tooltip: h !== !1 &&
|
|
4178
|
+
tooltip: h !== !1 && w ? k : void 0,
|
|
4171
4179
|
children: ({ width: e, height: t }) => {
|
|
4172
|
-
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } =
|
|
4180
|
+
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4173
4181
|
return /* @__PURE__ */ p("g", { children: [s.map((e, t) => {
|
|
4174
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4182
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Nn[t % Nn.length], l = Math.max(0, Math.min(1, e.value / T)), u = D + E * l;
|
|
4175
4183
|
return /* @__PURE__ */ p("g", {
|
|
4176
4184
|
"data-series": e.id,
|
|
4177
4185
|
children: [/* @__PURE__ */ f("path", {
|
|
4178
|
-
d:
|
|
4186
|
+
d: P(n, r, a, s, D, D + E),
|
|
4179
4187
|
fill: "var(--cascivo-chart-grid)",
|
|
4180
4188
|
fillOpacity: .35
|
|
4181
4189
|
}), l > 0 && /* @__PURE__ */ f("path", {
|
|
4182
|
-
d:
|
|
4190
|
+
d: P(n, r, a, s, D, u),
|
|
4183
4191
|
fill: c
|
|
4184
4192
|
})]
|
|
4185
4193
|
}, e.id);
|
|
4186
|
-
}), !v &&
|
|
4194
|
+
}), !v && j && (m == null ? /* @__PURE__ */ p("g", {
|
|
4187
4195
|
"data-center": "",
|
|
4188
4196
|
children: [u != null && /* @__PURE__ */ f("text", {
|
|
4189
4197
|
x: n,
|
|
@@ -4223,11 +4231,11 @@ function Mn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4223
4231
|
})
|
|
4224
4232
|
}))] });
|
|
4225
4233
|
}
|
|
4226
|
-
}), S && /* @__PURE__ */ f(
|
|
4234
|
+
}), S && /* @__PURE__ */ f(Kt, {
|
|
4227
4235
|
series: e.map((e, t) => ({
|
|
4228
4236
|
id: e.id,
|
|
4229
4237
|
label: e.label,
|
|
4230
|
-
color: e.color ??
|
|
4238
|
+
color: e.color ?? Nn[t % Nn.length]
|
|
4231
4239
|
})),
|
|
4232
4240
|
hidden: y
|
|
4233
4241
|
})]
|
|
@@ -4235,10 +4243,10 @@ function Mn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4235
4243
|
}
|
|
4236
4244
|
//#endregion
|
|
4237
4245
|
//#region src/charts/funnel/funnel.tsx
|
|
4238
|
-
var
|
|
4239
|
-
function
|
|
4246
|
+
var Fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4247
|
+
function In({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: s, className: c, plain: l }) {
|
|
4240
4248
|
o();
|
|
4241
|
-
let u = l ?
|
|
4249
|
+
let u = l ? He : Z, d = i ?? (l ? 48 : 320), h = e.length > 0, g = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4242
4250
|
return /* @__PURE__ */ f(Q, {
|
|
4243
4251
|
title: t,
|
|
4244
4252
|
description: n,
|
|
@@ -4272,7 +4280,7 @@ function Pn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4272
4280
|
value: e.value,
|
|
4273
4281
|
seriesId: e.id,
|
|
4274
4282
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4275
|
-
color: e.color ??
|
|
4283
|
+
color: e.color ?? Fn[t % Fn.length]
|
|
4276
4284
|
})),
|
|
4277
4285
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4278
4286
|
};
|
|
@@ -4282,7 +4290,7 @@ function Pn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4282
4290
|
if (r <= 0 || e.length === 0) return null;
|
|
4283
4291
|
let o = i / e.length, s = m([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4284
4292
|
return /* @__PURE__ */ f("g", { children: e.map((t, n) => {
|
|
4285
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), m = u.top + n * o, h = m + o * (r ? 1 : .9), _ = t.color ??
|
|
4293
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), m = u.top + n * o, h = m + o * (r ? 1 : .9), _ = t.color ?? Fn[n % Fn.length], v = [
|
|
4286
4294
|
[d - i, m],
|
|
4287
4295
|
[d + i, m],
|
|
4288
4296
|
[d + s, h],
|
|
@@ -4294,7 +4302,7 @@ function Pn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4294
4302
|
points: v,
|
|
4295
4303
|
fill: _,
|
|
4296
4304
|
fillOpacity: .85
|
|
4297
|
-
}), !l && /* @__PURE__ */ f(
|
|
4305
|
+
}), !l && /* @__PURE__ */ f(St, {
|
|
4298
4306
|
x: d,
|
|
4299
4307
|
y: m + o / 2,
|
|
4300
4308
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4307,10 +4315,10 @@ function Pn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4307
4315
|
}
|
|
4308
4316
|
//#endregion
|
|
4309
4317
|
//#region src/charts/stream/stream.tsx
|
|
4310
|
-
var
|
|
4311
|
-
function
|
|
4318
|
+
var Ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4319
|
+
function Rn({ series: e, categories: t, title: n, description: r, offset: a = "silhouette", curve: s = "basis", width: c, height: l, legend: u, tooltip: d, className: h, plain: _ }) {
|
|
4312
4320
|
o();
|
|
4313
|
-
let v = i(/* @__PURE__ */ new Set()), y = _ ?
|
|
4321
|
+
let v = i(/* @__PURE__ */ new Set()), y = _ ? He : Z, b = l ?? (_ ? 48 : 300), x = _ ? !1 : u ?? e.length > 1, S = t.length > 0 && e.length > 0, C = ne(e.map((e) => e.values), a), [w, E] = J(C);
|
|
4314
4322
|
return /* @__PURE__ */ p("div", {
|
|
4315
4323
|
style: {
|
|
4316
4324
|
display: "flex",
|
|
@@ -4332,7 +4340,7 @@ function In({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4332
4340
|
plain: _,
|
|
4333
4341
|
tooltip: d && S ? ({ width: n, height: r }) => {
|
|
4334
4342
|
if (!d || !S) return;
|
|
4335
|
-
let i = n - y.left - y.right, a = r - y.top - y.bottom, o = g(t.map(String), [0, i], 0), s = m([
|
|
4343
|
+
let i = n - y.left - y.right, a = r - y.top - y.bottom, o = g(t.map(String), [0, i], 0), s = m([w, E], [a, 0]);
|
|
4336
4344
|
return { points: e.flatMap((e, n) => {
|
|
4337
4345
|
if (v.value.has(e.id)) return [];
|
|
4338
4346
|
let r = C[n];
|
|
@@ -4345,7 +4353,7 @@ function In({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4345
4353
|
label: `${e.label} · ${String(t)}`,
|
|
4346
4354
|
value: e.values[i] ?? 0,
|
|
4347
4355
|
seriesId: e.id,
|
|
4348
|
-
color: e.color ??
|
|
4356
|
+
color: e.color ?? Ln[n % Ln.length]
|
|
4349
4357
|
};
|
|
4350
4358
|
});
|
|
4351
4359
|
}) };
|
|
@@ -4353,14 +4361,14 @@ function In({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4353
4361
|
children: ({ width: n, height: r }) => {
|
|
4354
4362
|
let i = n - y.left - y.right, a = r - y.top - y.bottom;
|
|
4355
4363
|
if (i <= 0 || !S) return null;
|
|
4356
|
-
let o = g(t.map(String), [0, i], 0), c = m([
|
|
4364
|
+
let o = g(t.map(String), [0, i], 0), c = m([w, E], [a, 0]), l = (e) => (o.map(String(t[e])) ?? 0) + o.bandwidth / 2;
|
|
4357
4365
|
return /* @__PURE__ */ p("g", {
|
|
4358
4366
|
transform: `translate(${y.left},${y.top})`,
|
|
4359
4367
|
children: [e.map((e, n) => {
|
|
4360
4368
|
if (v.value.has(e.id)) return null;
|
|
4361
|
-
let r = C[n], i = e.color ??
|
|
4369
|
+
let r = C[n], i = e.color ?? Ln[n % Ln.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), o = t.map((e, t) => [l(t), c.map(r[t][0])]);
|
|
4362
4370
|
return /* @__PURE__ */ f("path", {
|
|
4363
|
-
d: `${
|
|
4371
|
+
d: `${T(a, s)}${T([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4364
4372
|
fill: i,
|
|
4365
4373
|
fillOpacity: .85,
|
|
4366
4374
|
"data-series": e.id
|
|
@@ -4373,11 +4381,11 @@ function In({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4373
4381
|
})]
|
|
4374
4382
|
});
|
|
4375
4383
|
}
|
|
4376
|
-
}), x && /* @__PURE__ */ f(
|
|
4384
|
+
}), x && /* @__PURE__ */ f(Kt, {
|
|
4377
4385
|
series: e.map((e, t) => ({
|
|
4378
4386
|
id: e.id,
|
|
4379
4387
|
label: e.label,
|
|
4380
|
-
color: e.color ??
|
|
4388
|
+
color: e.color ?? Ln[t % Ln.length]
|
|
4381
4389
|
})),
|
|
4382
4390
|
hidden: v
|
|
4383
4391
|
})]
|
|
@@ -4385,10 +4393,10 @@ function In({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4385
4393
|
}
|
|
4386
4394
|
//#endregion
|
|
4387
4395
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4388
|
-
var
|
|
4389
|
-
function
|
|
4396
|
+
var zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4397
|
+
function Bn({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4390
4398
|
o();
|
|
4391
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), m = Y(e), h = m > 0, g =
|
|
4399
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), m = Y(e), h = m > 0, g = re(e), _ = Math.max(1, X(g));
|
|
4392
4400
|
return /* @__PURE__ */ f(Q, {
|
|
4393
4401
|
title: t,
|
|
4394
4402
|
description: n,
|
|
@@ -4410,12 +4418,12 @@ function Rn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4410
4418
|
let a = (e.a0 + e.a1) / 2, o = (e.depth - .5) * i;
|
|
4411
4419
|
return {
|
|
4412
4420
|
id: `${e.node.label}-${t}`,
|
|
4413
|
-
cx: n + Math.sin(a) * o,
|
|
4414
|
-
cy: r - Math.cos(a) * o,
|
|
4421
|
+
cx: C(n + Math.sin(a) * o),
|
|
4422
|
+
cy: C(r - Math.cos(a) * o),
|
|
4415
4423
|
label: e.node.label,
|
|
4416
4424
|
value: e.value,
|
|
4417
4425
|
percent: m > 0 ? e.value / m * 100 : 0,
|
|
4418
|
-
color: e.node.color ??
|
|
4426
|
+
color: e.node.color ?? zn[t % zn.length]
|
|
4419
4427
|
};
|
|
4420
4428
|
}),
|
|
4421
4429
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4424,9 +4432,9 @@ function Rn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4424
4432
|
children: ({ width: e, height: t }) => {
|
|
4425
4433
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4426
4434
|
return /* @__PURE__ */ f("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4427
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4435
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? zn[t % zn.length];
|
|
4428
4436
|
return /* @__PURE__ */ f("path", {
|
|
4429
|
-
d:
|
|
4437
|
+
d: P(n, r, o, a, e.a0, e.a1),
|
|
4430
4438
|
fill: s,
|
|
4431
4439
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4432
4440
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4439,10 +4447,10 @@ function Rn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4439
4447
|
}
|
|
4440
4448
|
//#endregion
|
|
4441
4449
|
//#region src/charts/sankey/sankey.tsx
|
|
4442
|
-
var
|
|
4443
|
-
function
|
|
4450
|
+
var Vn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4451
|
+
function Hn({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4444
4452
|
o();
|
|
4445
|
-
let u = l ?
|
|
4453
|
+
let u = l ? He : Z, d = a ?? (l ? 48 : 320), m = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ?? Vn[n % Vn.length];
|
|
4446
4454
|
return /* @__PURE__ */ f(Q, {
|
|
4447
4455
|
title: n,
|
|
4448
4456
|
description: r,
|
|
@@ -4466,7 +4474,7 @@ function Bn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4466
4474
|
plain: l,
|
|
4467
4475
|
tooltip: s && m ? ({ width: n, height: r }) => {
|
|
4468
4476
|
if (!s || !m) return;
|
|
4469
|
-
let { nodes: i } =
|
|
4477
|
+
let { nodes: i } = ie(e, t, {
|
|
4470
4478
|
width: n - u.left - u.right,
|
|
4471
4479
|
height: r - u.top - u.bottom
|
|
4472
4480
|
});
|
|
@@ -4482,14 +4490,14 @@ function Bn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4482
4490
|
children: ({ width: n, height: r }) => {
|
|
4483
4491
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4484
4492
|
if (i <= 0 || !m) return null;
|
|
4485
|
-
let { nodes: o, links: s } =
|
|
4493
|
+
let { nodes: o, links: s } = ie(e, t, {
|
|
4486
4494
|
width: i,
|
|
4487
4495
|
height: a
|
|
4488
4496
|
});
|
|
4489
4497
|
return /* @__PURE__ */ p("g", {
|
|
4490
4498
|
transform: `translate(${u.left},${u.top})`,
|
|
4491
4499
|
children: [s.map((e, t) => /* @__PURE__ */ f("path", {
|
|
4492
|
-
d:
|
|
4500
|
+
d: ae(e),
|
|
4493
4501
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4494
4502
|
fillOpacity: .32,
|
|
4495
4503
|
"data-link": ""
|
|
@@ -4518,23 +4526,23 @@ function Bn({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4518
4526
|
}
|
|
4519
4527
|
//#endregion
|
|
4520
4528
|
//#region src/charts/calendar/calendar.tsx
|
|
4521
|
-
var
|
|
4522
|
-
function
|
|
4529
|
+
var Un = 864e5, Wn = (e) => e instanceof Date ? e : new Date(e), Gn = (e) => e.toISOString().slice(0, 10);
|
|
4530
|
+
function Kn(e) {
|
|
4523
4531
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4524
4532
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4525
4533
|
}
|
|
4526
|
-
function
|
|
4534
|
+
function qn({ data: e, title: t, description: n, from: r, to: a, width: s, height: c, tooltip: l, className: u, plain: d, visualMap: m }) {
|
|
4527
4535
|
o();
|
|
4528
4536
|
let h = e.length > 0, g = i([m?.min ?? 0, m?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4529
|
-
for (let t of e) v.set(
|
|
4530
|
-
let y = e.map((e) =>
|
|
4537
|
+
for (let t of e) v.set(Gn(Wn(t.day)), t.value);
|
|
4538
|
+
let y = e.map((e) => Wn(e.day)), b = Kn(r ? Wn(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = a ? Wn(a) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = h ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / Un / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4531
4539
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4532
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4540
|
+
let n = new Date(b.getTime() + (e * 7 + t) * Un);
|
|
4533
4541
|
n > x || T.push({
|
|
4534
4542
|
col: e,
|
|
4535
4543
|
row: t,
|
|
4536
4544
|
date: n,
|
|
4537
|
-
value: v.get(
|
|
4545
|
+
value: v.get(Gn(n)) ?? 0
|
|
4538
4546
|
});
|
|
4539
4547
|
}
|
|
4540
4548
|
let E = /* @__PURE__ */ f(Q, {
|
|
@@ -4545,7 +4553,7 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4545
4553
|
fallback: /* @__PURE__ */ p("table", { children: [
|
|
4546
4554
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4547
4555
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Day" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4548
|
-
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children:
|
|
4556
|
+
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: Gn(Wn(e.day)) }), /* @__PURE__ */ f("td", { children: e.value })] }, t)) })
|
|
4549
4557
|
] }),
|
|
4550
4558
|
className: u,
|
|
4551
4559
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4555,10 +4563,10 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4555
4563
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4556
4564
|
return {
|
|
4557
4565
|
points: T.map((e, n) => ({
|
|
4558
|
-
id: `${
|
|
4566
|
+
id: `${Gn(e.date)}-${n}`,
|
|
4559
4567
|
cx: e.col * (t + 2) + t / 2,
|
|
4560
4568
|
cy: e.row * (t + 2) + t / 2,
|
|
4561
|
-
label:
|
|
4569
|
+
label: Gn(e.date),
|
|
4562
4570
|
value: e.value
|
|
4563
4571
|
})),
|
|
4564
4572
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4567,7 +4575,7 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4567
4575
|
children: ({ width: e }) => {
|
|
4568
4576
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4569
4577
|
return /* @__PURE__ */ f("g", { children: T.map((e, n) => {
|
|
4570
|
-
let r = m ?
|
|
4578
|
+
let r = m ? Ht(e.value, m).color : void 0, i = m ? Ut(e.value, m, g.value, _.value) : !0;
|
|
4571
4579
|
return /* @__PURE__ */ f("rect", {
|
|
4572
4580
|
x: e.col * (t + 2),
|
|
4573
4581
|
y: e.row * (t + 2),
|
|
@@ -4576,7 +4584,7 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4576
4584
|
rx: 1.5,
|
|
4577
4585
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4578
4586
|
fillOpacity: m ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4579
|
-
"data-day":
|
|
4587
|
+
"data-day": Gn(e.date)
|
|
4580
4588
|
}, n);
|
|
4581
4589
|
}) });
|
|
4582
4590
|
}
|
|
@@ -4587,7 +4595,7 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4587
4595
|
flexDirection: "column",
|
|
4588
4596
|
gap: "0.5rem"
|
|
4589
4597
|
},
|
|
4590
|
-
children: [E, /* @__PURE__ */ f(
|
|
4598
|
+
children: [E, /* @__PURE__ */ f(Wt, {
|
|
4591
4599
|
options: m,
|
|
4592
4600
|
range: g,
|
|
4593
4601
|
hidden: _,
|
|
@@ -4597,11 +4605,11 @@ function Gn({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4597
4605
|
}
|
|
4598
4606
|
//#endregion
|
|
4599
4607
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4600
|
-
function
|
|
4608
|
+
function Jn({ data: e, title: t, description: n, width: r, height: s, yTicks: l = 5, upColor: u = "var(--cascivo-chart-2)", downColor: h = "var(--cascivo-chart-4)", volume: _, tooltip: v, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E }) {
|
|
4601
4609
|
o();
|
|
4602
|
-
let D = b ?
|
|
4603
|
-
T && !M.current && (M.current =
|
|
4604
|
-
T &&
|
|
4610
|
+
let D = b ? He : Z, O = s ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = i([0, Math.max(0, k - 1)]), M = c(null);
|
|
4611
|
+
T && !M.current && (M.current = st(T)), a(() => () => {
|
|
4612
|
+
T && ct(T);
|
|
4605
4613
|
}), a(() => {
|
|
4606
4614
|
let e = M.current;
|
|
4607
4615
|
if (!e) return;
|
|
@@ -4613,7 +4621,7 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4613
4621
|
let t = j.value, n = e.window.peek();
|
|
4614
4622
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4615
4623
|
});
|
|
4616
|
-
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e, P = N.length > 0, F = P ? Math.min(...N.map((e) => e.low)) : 0, I = P ? Math.max(...N.map((e) => e.high)) : 1, L = P ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1,
|
|
4624
|
+
let N = A ? e.slice(j.value[0], j.value[1] + 1) : e, P = N.length > 0, F = P ? Math.min(...N.map((e) => e.low)) : 0, I = P ? Math.max(...N.map((e) => e.high)) : 1, L = P ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1, ee = N.map((e) => e.t);
|
|
4617
4625
|
return /* @__PURE__ */ p("div", {
|
|
4618
4626
|
style: {
|
|
4619
4627
|
display: "flex",
|
|
@@ -4650,7 +4658,7 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4650
4658
|
if (v === !1 || !P) return;
|
|
4651
4659
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4652
4660
|
if (n <= 0) return;
|
|
4653
|
-
let i = g(
|
|
4661
|
+
let i = g(ee, [0, n], .3), a = r - (_ ? Math.min(r * .2, 60) : 0), o = m([F, I], [a, 0]);
|
|
4654
4662
|
if (E === "axis") return {
|
|
4655
4663
|
points: N.map((e, t) => ({
|
|
4656
4664
|
id: `c-${t}`,
|
|
@@ -4708,11 +4716,11 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4708
4716
|
children: ({ width: e, height: t }) => {
|
|
4709
4717
|
let n = e - D.left - D.right, r = t - D.top - D.bottom;
|
|
4710
4718
|
if (n <= 0 || !P) return null;
|
|
4711
|
-
let i = g(
|
|
4719
|
+
let i = g(ee, [0, n], .3), a = m([F, I], [r, 0]), o = _ ? Math.min(r * .2, 60) : 0, s = r - o, c = m([F, I], [s, 0]), v = i.bandwidth;
|
|
4712
4720
|
return /* @__PURE__ */ p("g", {
|
|
4713
4721
|
transform: `translate(${D.left},${D.top})`,
|
|
4714
4722
|
children: [
|
|
4715
|
-
!b && /* @__PURE__ */ f(
|
|
4723
|
+
!b && /* @__PURE__ */ f(pt, {
|
|
4716
4724
|
scale: a,
|
|
4717
4725
|
orientation: "y",
|
|
4718
4726
|
length: n,
|
|
@@ -4752,7 +4760,7 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4752
4760
|
]
|
|
4753
4761
|
}, t);
|
|
4754
4762
|
}),
|
|
4755
|
-
!b &&
|
|
4763
|
+
!b && vt(x, {
|
|
4756
4764
|
xScale: i,
|
|
4757
4765
|
yScale: c,
|
|
4758
4766
|
innerW: n,
|
|
@@ -4773,12 +4781,12 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4773
4781
|
});
|
|
4774
4782
|
}
|
|
4775
4783
|
}),
|
|
4776
|
-
S && !C && k > 1 && /* @__PURE__ */ f(
|
|
4784
|
+
S && !C && k > 1 && /* @__PURE__ */ f(Pt, {
|
|
4777
4785
|
count: k,
|
|
4778
4786
|
window: j,
|
|
4779
4787
|
label: "Time range"
|
|
4780
4788
|
}),
|
|
4781
|
-
C && k > 1 && /* @__PURE__ */ f(
|
|
4789
|
+
C && k > 1 && /* @__PURE__ */ f(Ft, {
|
|
4782
4790
|
count: k,
|
|
4783
4791
|
window: j,
|
|
4784
4792
|
label: "Time range"
|
|
@@ -4788,10 +4796,10 @@ function Kn({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4788
4796
|
}
|
|
4789
4797
|
//#endregion
|
|
4790
4798
|
//#region src/charts/polar/polar.tsx
|
|
4791
|
-
var
|
|
4792
|
-
function
|
|
4799
|
+
var Yn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4800
|
+
function Xn({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: s = 4, max: c, tooltip: l, className: u, plain: m }) {
|
|
4793
4801
|
o();
|
|
4794
|
-
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4802
|
+
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y = xe(_), b = /* @__PURE__ */ p("table", { children: [
|
|
4795
4803
|
/* @__PURE__ */ f("caption", { children: t }),
|
|
4796
4804
|
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("th", { children: "Category" }), /* @__PURE__ */ f("th", { children: "Value" })] }) }),
|
|
4797
4805
|
/* @__PURE__ */ f("tbody", { children: e.map((e, t) => /* @__PURE__ */ p("tr", { children: [/* @__PURE__ */ f("td", { children: e.label }), /* @__PURE__ */ f("td", { children: e.value })] }, t)) })
|
|
@@ -4801,7 +4809,7 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4801
4809
|
cx: n,
|
|
4802
4810
|
cy: r,
|
|
4803
4811
|
outerR: i,
|
|
4804
|
-
rScale:
|
|
4812
|
+
rScale: Se([0, v], [0, i])
|
|
4805
4813
|
};
|
|
4806
4814
|
};
|
|
4807
4815
|
return /* @__PURE__ */ f(Q, {
|
|
@@ -4818,7 +4826,7 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4818
4826
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4819
4827
|
return {
|
|
4820
4828
|
points: e.map((e, t) => {
|
|
4821
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4829
|
+
let n = y.center(e.label) ?? 0, [o, s] = be(r, i, a.map(e.value), n);
|
|
4822
4830
|
return {
|
|
4823
4831
|
id: `p-${t}`,
|
|
4824
4832
|
cx: o,
|
|
@@ -4834,7 +4842,7 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4834
4842
|
if (!g) return null;
|
|
4835
4843
|
let { cx: i, cy: a, outerR: o, rScale: c } = x(t, n), l = Array.from({ length: s }, (e, t) => o * (t + 1) / s), u = e.map((e) => {
|
|
4836
4844
|
let t = y.center(e.label) ?? 0;
|
|
4837
|
-
return
|
|
4845
|
+
return be(i, a, c.map(e.value), t);
|
|
4838
4846
|
});
|
|
4839
4847
|
return /* @__PURE__ */ p("g", { children: [
|
|
4840
4848
|
!m && l.map((e, t) => /* @__PURE__ */ f("circle", {
|
|
@@ -4849,21 +4857,21 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4849
4857
|
r === "bar" ? e.map((e, t) => {
|
|
4850
4858
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4851
4859
|
return /* @__PURE__ */ f("path", {
|
|
4852
|
-
d:
|
|
4853
|
-
fill: e.color ??
|
|
4860
|
+
d: P(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4861
|
+
fill: e.color ?? Yn[t % Yn.length],
|
|
4854
4862
|
fillOpacity: .85,
|
|
4855
4863
|
"data-wedge": ""
|
|
4856
4864
|
}, t);
|
|
4857
4865
|
}) : (() => {
|
|
4858
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4866
|
+
let t = [...u, u[0]], n = e[0]?.color ?? Yn[0];
|
|
4859
4867
|
return /* @__PURE__ */ p(d, { children: [r === "area" && /* @__PURE__ */ f("path", {
|
|
4860
|
-
d: `${
|
|
4868
|
+
d: `${T(t, "linear")}Z`,
|
|
4861
4869
|
fill: n,
|
|
4862
4870
|
fillOpacity: .25,
|
|
4863
4871
|
stroke: "none",
|
|
4864
4872
|
"data-area": ""
|
|
4865
4873
|
}), /* @__PURE__ */ f("path", {
|
|
4866
|
-
d:
|
|
4874
|
+
d: T(t, "linear"),
|
|
4867
4875
|
fill: "none",
|
|
4868
4876
|
stroke: n,
|
|
4869
4877
|
strokeWidth: 2,
|
|
@@ -4871,7 +4879,7 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4871
4879
|
})] });
|
|
4872
4880
|
})(),
|
|
4873
4881
|
!m && e.map((e, t) => {
|
|
4874
|
-
let n = y.center(e.label) ?? 0, [r, s] =
|
|
4882
|
+
let n = y.center(e.label) ?? 0, [r, s] = be(i, a, o + 12, n);
|
|
4875
4883
|
return /* @__PURE__ */ f("text", {
|
|
4876
4884
|
x: r,
|
|
4877
4885
|
y: s,
|
|
@@ -4889,10 +4897,10 @@ function Jn({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4889
4897
|
}
|
|
4890
4898
|
//#endregion
|
|
4891
4899
|
//#region src/charts/gauge/gauge.tsx
|
|
4892
|
-
var
|
|
4893
|
-
function
|
|
4900
|
+
var Zn = Math.PI / 180;
|
|
4901
|
+
function Qn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: s = 5, title: c, description: l, width: u, height: d, className: m, plain: h }) {
|
|
4894
4902
|
o();
|
|
4895
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
4903
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * Zn, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
4896
4904
|
return /* @__PURE__ */ f(Q, {
|
|
4897
4905
|
title: c,
|
|
4898
4906
|
description: l,
|
|
@@ -4912,7 +4920,7 @@ function Xn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4912
4920
|
}], w = t, T = Array.from({ length: s + 1 }, (e, n) => t + _ * n / s);
|
|
4913
4921
|
return /* @__PURE__ */ p("g", { children: [
|
|
4914
4922
|
/* @__PURE__ */ f("path", {
|
|
4915
|
-
d:
|
|
4923
|
+
d: P(c, l, u, m, x, x + b),
|
|
4916
4924
|
fill: "var(--cascivo-chart-grid)",
|
|
4917
4925
|
fillOpacity: .25,
|
|
4918
4926
|
"data-track": ""
|
|
@@ -4920,13 +4928,13 @@ function Xn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4920
4928
|
C.map((e, t) => {
|
|
4921
4929
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
4922
4930
|
return w = e.upTo, /* @__PURE__ */ f("path", {
|
|
4923
|
-
d:
|
|
4931
|
+
d: P(c, l, u, m, r, i),
|
|
4924
4932
|
fill: e.color,
|
|
4925
4933
|
"data-zone": ""
|
|
4926
4934
|
}, t);
|
|
4927
4935
|
}),
|
|
4928
4936
|
!h && T.map((e, t) => {
|
|
4929
|
-
let n = S(e), [r, i] =
|
|
4937
|
+
let n = S(e), [r, i] = be(c, l, m - 2, n), [a, o] = be(c, l, m - 8, n), [s, u] = be(c, l, m - 18, n);
|
|
4930
4938
|
return /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("line", {
|
|
4931
4939
|
x1: r,
|
|
4932
4940
|
y1: i,
|
|
@@ -4946,7 +4954,7 @@ function Xn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4946
4954
|
})] }, t);
|
|
4947
4955
|
}),
|
|
4948
4956
|
(() => {
|
|
4949
|
-
let [e, t] =
|
|
4957
|
+
let [e, t] = be(c, l, g, S(v));
|
|
4950
4958
|
return /* @__PURE__ */ f("line", {
|
|
4951
4959
|
x1: c,
|
|
4952
4960
|
y1: l,
|
|
@@ -4980,4 +4988,4 @@ function Xn({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4980
4988
|
});
|
|
4981
4989
|
}
|
|
4982
4990
|
//#endregion
|
|
4983
|
-
export {
|
|
4991
|
+
export { tn as AreaChart, $ as Axis, an as BarChart, vn as Boxplot, Pt as Brush, Sn as BubbleChart, Mn as Bullet, qn as Calendar, Jn as Candlestick, qe as CanvasLayer, Dt as ChartDefs, Q as ChartFrame, Cn as ComboChart, Z as DEFAULT_MARGINS, St as DataLabel, Ft as DataZoom, In as Funnel, Qn as Gauge, kt as Glyph, pt as GridLines, wn as Heatmap, gn as Histogram, hn as Kpi, Kt as Legend, Qt as LineChart, pn as Meter, He as PLAIN_MARGINS, cn as PieChart, Xn as Polar, An as Radar, Pn as RadialBar, Hn as Sankey, un as ScatterChart, dn as Sparkline, Rn as Stream, Bn as Sunburst, Nt as Text, et as Toolbox, En as Treemap, Wt as VisualMap, lt as _syncGroupCount, De as aggregate, xe as angleBand, yt as annotationSummary, P as arcPath, N as areaPath, g as bandScale, Oe as bin, V as binValues, Be as bindStream, H as boxStats, z as cellPath, Le as decimate, ge as divergingRamp, it as download, Ne as encode, Pe as encodeCategory, U as extent, Et as fillFor, Ce as filter, st as getSyncGroup, Ot as glyphPath, wt as gradientId, Qe as isZoomed, T as linePath, m as linearScale, ae as linkPath, v as logScale, Fe as lttb, Ht as mapVisual, X as maxDepth, Ie as minmax, L as nearestIndex, h as niceTicks, Ze as panWindow, re as partition, Tt as patternId, Vt as pieceIndex, be as polarPoint, C as quantize, Se as radiusScale, ye as rampLightness, _e as rampOf, ve as rampStops, je as regression, ct as releaseSyncGroup, _t as renderAnnotation, vt as renderAnnotations, Je as resolveColor, xt as resolveLabels, ie as sankeyLayout, he as sequentialRamp, nt as serializeSvg, Te as sort, w as splitDefined, _ as sqrtScale, q as squarify, F as stackSeries, J as streamExtent, ne as streamLayout, Y as sumValue, rt as svgToPngBlob, S as timeScale, I as toStackedSeries, Ve as useChartSize, ze as useStreamSeries, Ut as visualVisible, R as voronoiCells, ee as voronoiFind, Mt as wrapText, Xe as zoomWindow };
|