@cascivo/charts 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +225 -16
- package/dist/index.js +690 -665
- package/dist/node/index.js +5094 -0
- package/package.json +10 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import './charts.css';
|
|
2
3
|
import { computed as e, createStreamBuffer as t, signal as n, useComputed as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
3
4
|
import { useId as s, useRef as c } from "react";
|
|
4
5
|
import { builtin as l, currentLocale as u, t as d } from "@cascivo/i18n";
|
|
@@ -11,21 +12,28 @@ function h(e, t) {
|
|
|
11
12
|
range: t,
|
|
12
13
|
map: (e) => o === 0 ? i : i + (e - n) / o * (a - i),
|
|
13
14
|
invert: (e) => a - i === 0 ? n : n + (e - i) / (a - i) * o,
|
|
14
|
-
ticks: (e = 5) => g(n, r, e)
|
|
15
|
+
ticks: (e = 5, t) => g(n, r, e, t)
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function g(e, t, n = 5) {
|
|
18
|
+
function g(e, t, n = 5, r) {
|
|
18
19
|
if (!Number.isFinite(e) || !Number.isFinite(t) || e === t) return [e];
|
|
19
20
|
e > t && ([e, t] = [t, e]);
|
|
20
|
-
let r = (t - e) / Math.max(1, n),
|
|
21
|
+
let i = r ?? !(Number.isInteger(e) && Number.isInteger(t)), a = (t - e) / Math.max(1, n), o = 10 ** Math.floor(Math.log10(a)), s = i ? [
|
|
21
22
|
1,
|
|
22
23
|
2,
|
|
23
24
|
2.5,
|
|
24
25
|
5,
|
|
25
26
|
10
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
] : [
|
|
28
|
+
1,
|
|
29
|
+
2,
|
|
30
|
+
5,
|
|
31
|
+
10
|
|
32
|
+
], c = a / o, l = (s.find((e) => e >= c) ?? 10) * o;
|
|
33
|
+
i || (l = Math.max(1, Math.round(l)));
|
|
34
|
+
let u = Math.ceil(e / l), d = Math.floor(t / l + 1e-9), f = [], p = Math.max(0, Math.ceil(-Math.log10(l)) + 2);
|
|
35
|
+
for (let e = u; e <= d; e++) f.push(parseFloat((e * l).toFixed(p)));
|
|
36
|
+
return f;
|
|
29
37
|
}
|
|
30
38
|
function _(e, t, n = .1) {
|
|
31
39
|
let [r, i] = t, a = e.length, o = (i - r) / Math.max(1, a + n * (a + 1)), s = o, c = o * n, l = new Map(e.map((e, t) => [e, t]));
|
|
@@ -175,15 +183,15 @@ function E(e, t = "linear") {
|
|
|
175
183
|
if (e.length === 0) return "";
|
|
176
184
|
if (e.length === 1 || t === "linear") return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
177
185
|
switch (t) {
|
|
178
|
-
case "monotone": return
|
|
186
|
+
case "monotone": return te(e);
|
|
179
187
|
case "step":
|
|
180
188
|
case "stepBefore":
|
|
181
189
|
case "stepAfter": return D(e, t);
|
|
182
|
-
case "natural": return
|
|
183
|
-
case "basis": return
|
|
184
|
-
case "cardinal": return
|
|
185
|
-
case "catmullRom": return
|
|
186
|
-
default: return
|
|
190
|
+
case "natural": return ee(e);
|
|
191
|
+
case "basis": return k(e);
|
|
192
|
+
case "cardinal": return A(e, 0);
|
|
193
|
+
case "catmullRom": return j(e, .5);
|
|
194
|
+
default: return te(e);
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
197
|
function D(e, t) {
|
|
@@ -216,14 +224,14 @@ function O(e) {
|
|
|
216
224
|
for (let n = 0; n < t - 1; n++) o[n] = 2 * e[n + 1] - a[n + 1];
|
|
217
225
|
return o[t - 1] = (e[t] + a[t - 1]) / 2, [a, o];
|
|
218
226
|
}
|
|
219
|
-
function
|
|
227
|
+
function ee(e) {
|
|
220
228
|
let t = e.length;
|
|
221
229
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
222
230
|
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = O(n), [o, s] = O(r), c = `M${n[0]},${r[0]}`;
|
|
223
231
|
for (let e = 0; e < t - 1; e++) c += `C${i[e]},${o[e]} ${a[e]},${s[e]} ${n[e + 1]},${r[e + 1]}`;
|
|
224
232
|
return c;
|
|
225
233
|
}
|
|
226
|
-
function
|
|
234
|
+
function k(e) {
|
|
227
235
|
let t = e.length;
|
|
228
236
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
229
237
|
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)}`;
|
|
@@ -234,7 +242,7 @@ function A(e) {
|
|
|
234
242
|
let a = e[t - 1];
|
|
235
243
|
return i += `L${a[0]},${a[1]}`, i;
|
|
236
244
|
}
|
|
237
|
-
function
|
|
245
|
+
function A(e, t) {
|
|
238
246
|
let n = e.length;
|
|
239
247
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
240
248
|
let r = (1 - t) / 6, i = (t) => e[Math.max(0, Math.min(n - 1, t))], a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -244,7 +252,7 @@ function j(e, t) {
|
|
|
244
252
|
}
|
|
245
253
|
return a;
|
|
246
254
|
}
|
|
247
|
-
function
|
|
255
|
+
function j(e, t) {
|
|
248
256
|
let n = e.length;
|
|
249
257
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
250
258
|
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]}`;
|
|
@@ -254,7 +262,7 @@ function M(e, t) {
|
|
|
254
262
|
}
|
|
255
263
|
return a;
|
|
256
264
|
}
|
|
257
|
-
function
|
|
265
|
+
function te(e) {
|
|
258
266
|
let t = e.length, n = [], r = [], i = [];
|
|
259
267
|
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];
|
|
260
268
|
let a = [i[0] ?? 0];
|
|
@@ -270,23 +278,23 @@ function N(e) {
|
|
|
270
278
|
}
|
|
271
279
|
return o;
|
|
272
280
|
}
|
|
273
|
-
function
|
|
281
|
+
function M(e, t, n = "linear") {
|
|
274
282
|
if (e.length === 0) return "";
|
|
275
283
|
let r = E(e, n), i = e[e.length - 1], a = e[0];
|
|
276
284
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
277
285
|
}
|
|
278
|
-
function
|
|
286
|
+
function N(e, t, n, r, i, a) {
|
|
279
287
|
let o = 2 * Math.PI;
|
|
280
288
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
281
289
|
let a = i + Math.PI;
|
|
282
|
-
return
|
|
290
|
+
return N(e, t, n, r, i, a) + N(e, t, n, r, a, i + o - 1e-9);
|
|
283
291
|
}
|
|
284
292
|
let s = (n, r) => [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = w(n), u = w(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
285
293
|
if (r <= 0) return `M${w(e)},${w(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
286
294
|
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
287
295
|
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
288
296
|
}
|
|
289
|
-
function
|
|
297
|
+
function P(e) {
|
|
290
298
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
291
299
|
return e.map((e) => e.map((e, t) => {
|
|
292
300
|
let r = n[t];
|
|
@@ -295,7 +303,7 @@ function F(e) {
|
|
|
295
303
|
}
|
|
296
304
|
//#endregion
|
|
297
305
|
//#region src/engine/stacked.ts
|
|
298
|
-
function
|
|
306
|
+
function F(e) {
|
|
299
307
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
300
308
|
for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
|
|
301
309
|
return {
|
|
@@ -317,7 +325,7 @@ function I(e) {
|
|
|
317
325
|
}
|
|
318
326
|
//#endregion
|
|
319
327
|
//#region src/engine/nearest.ts
|
|
320
|
-
function
|
|
328
|
+
function ne(e, t) {
|
|
321
329
|
if (e.length === 0) return -1;
|
|
322
330
|
if (e.length === 1) return 0;
|
|
323
331
|
let n = 0, r = e.length - 1;
|
|
@@ -329,7 +337,7 @@ function L(e, t) {
|
|
|
329
337
|
}
|
|
330
338
|
//#endregion
|
|
331
339
|
//#region src/engine/voronoi.ts
|
|
332
|
-
function
|
|
340
|
+
function re(e, t, n) {
|
|
333
341
|
let r = -1, i = Infinity;
|
|
334
342
|
for (let a = 0; a < e.length; a++) {
|
|
335
343
|
let o = e[a][0] - t, s = e[a][1] - n, c = o * o + s * s;
|
|
@@ -337,7 +345,7 @@ function te(e, t, n) {
|
|
|
337
345
|
}
|
|
338
346
|
return r;
|
|
339
347
|
}
|
|
340
|
-
function
|
|
348
|
+
function I(e, t, n, r, i) {
|
|
341
349
|
if (e.length === 0) return e;
|
|
342
350
|
let a = [], o = (e) => (e[0] - r) * t + (e[1] - i) * n;
|
|
343
351
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -349,7 +357,7 @@ function ne(e, t, n, r, i) {
|
|
|
349
357
|
}
|
|
350
358
|
return a;
|
|
351
359
|
}
|
|
352
|
-
function
|
|
360
|
+
function ie(e, t) {
|
|
353
361
|
let n = [
|
|
354
362
|
[t.x0, t.y0],
|
|
355
363
|
[t.x1, t.y0],
|
|
@@ -361,21 +369,21 @@ function re(e, t) {
|
|
|
361
369
|
for (let n = 0; n < e.length && i.length > 0; n++) {
|
|
362
370
|
if (n === r) continue;
|
|
363
371
|
let a = e[n];
|
|
364
|
-
i =
|
|
372
|
+
i = I(i, a[0] - t[0], a[1] - t[1], (t[0] + a[0]) / 2, (t[1] + a[1]) / 2);
|
|
365
373
|
}
|
|
366
374
|
return i;
|
|
367
375
|
});
|
|
368
376
|
}
|
|
369
|
-
function
|
|
377
|
+
function L(e) {
|
|
370
378
|
return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
|
|
371
379
|
}
|
|
372
380
|
//#endregion
|
|
373
381
|
//#region src/engine/stats.ts
|
|
374
|
-
function
|
|
382
|
+
function ae(e) {
|
|
375
383
|
let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
|
|
376
384
|
return (e[Math.floor(t * .75)] ?? 0) - n;
|
|
377
385
|
}
|
|
378
|
-
function
|
|
386
|
+
function R(e, t) {
|
|
379
387
|
if (e.length === 0) return [];
|
|
380
388
|
let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
|
|
381
389
|
if (i === a) return [{
|
|
@@ -386,7 +394,7 @@ function B(e, t) {
|
|
|
386
394
|
let o;
|
|
387
395
|
if (t !== void 0 && t > 0) o = t;
|
|
388
396
|
else {
|
|
389
|
-
let e = 2 *
|
|
397
|
+
let e = 2 * ae(n) * r ** (-1 / 3);
|
|
390
398
|
o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
|
|
391
399
|
}
|
|
392
400
|
let s = (a - i) / o, c = Array.from({ length: o }, (e, t) => ({
|
|
@@ -400,7 +408,7 @@ function B(e, t) {
|
|
|
400
408
|
}
|
|
401
409
|
return c;
|
|
402
410
|
}
|
|
403
|
-
function
|
|
411
|
+
function z(e) {
|
|
404
412
|
if (e.length === 0) return {
|
|
405
413
|
min: 0,
|
|
406
414
|
q1: 0,
|
|
@@ -422,7 +430,7 @@ function V(e) {
|
|
|
422
430
|
outliers: d
|
|
423
431
|
};
|
|
424
432
|
}
|
|
425
|
-
function
|
|
433
|
+
function B(e) {
|
|
426
434
|
if (e.length === 0) return [0, 1];
|
|
427
435
|
let t = e[0] ?? 0, n = e[0] ?? 0;
|
|
428
436
|
for (let r of e) r < t && (t = r), r > n && (n = r);
|
|
@@ -430,11 +438,11 @@ function H(e) {
|
|
|
430
438
|
}
|
|
431
439
|
//#endregion
|
|
432
440
|
//#region src/engine/treemap.ts
|
|
433
|
-
function
|
|
441
|
+
function V(e, t, n) {
|
|
434
442
|
let r = Math.max(...e), i = Math.min(...e);
|
|
435
443
|
return Math.max(t * t * r / (n * n), n * n / (t * t * i));
|
|
436
444
|
}
|
|
437
|
-
function
|
|
445
|
+
function H(e, t, n, r, i, a, o) {
|
|
438
446
|
let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
|
|
439
447
|
for (let t = 0; t < e.length; t++) {
|
|
440
448
|
let n = e[t] ?? 0, u = a[t] ?? "";
|
|
@@ -459,40 +467,40 @@ function W(e, t, n, r, i, a, o) {
|
|
|
459
467
|
}
|
|
460
468
|
}
|
|
461
469
|
}
|
|
462
|
-
function
|
|
470
|
+
function U(e, t, n, r, i, a) {
|
|
463
471
|
if (e.length === 0 || r <= 0 || i <= 0) return;
|
|
464
472
|
let o = e.reduce((e, t) => e + t.value, 0);
|
|
465
473
|
if (o === 0) return;
|
|
466
474
|
let s = r * i, c = e.map((e) => e.value / o * s), l = e.map((e) => e.id), u = [], d = [], f = Math.min(r, i), p = 0, m = 0;
|
|
467
475
|
for (; m < c.length;) {
|
|
468
476
|
let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
|
|
469
|
-
if (u.length === 0 ||
|
|
477
|
+
if (u.length === 0 || V(g, f, _) <= V(u, f, p)) u = g, d = [...d, h], p = _, m++;
|
|
470
478
|
else {
|
|
471
479
|
let o = p / s;
|
|
472
480
|
if (r >= i) {
|
|
473
481
|
let s = o * r;
|
|
474
|
-
|
|
482
|
+
H(u, t, n, s, i, d, a), U(e.slice(m), t + s, n, r - s, i, a);
|
|
475
483
|
} else {
|
|
476
484
|
let s = o * i;
|
|
477
|
-
|
|
485
|
+
H(u, t, n, r, s, d, a), U(e.slice(m), t, n + s, r, i - s, a);
|
|
478
486
|
}
|
|
479
487
|
return;
|
|
480
488
|
}
|
|
481
489
|
}
|
|
482
490
|
if (u.length > 0) {
|
|
483
491
|
let e = p / s;
|
|
484
|
-
r >= i ?
|
|
492
|
+
r >= i ? H(u, t, n, e * r, i, d, a) : H(u, t, n, r, e * i, d, a);
|
|
485
493
|
}
|
|
486
494
|
}
|
|
487
|
-
function
|
|
495
|
+
function W(e, t, n) {
|
|
488
496
|
if (e.length === 0 || t <= 0 || n <= 0) return [];
|
|
489
497
|
let r = [...e].sort((e, t) => t.value - e.value), i = [];
|
|
490
|
-
return
|
|
498
|
+
return U(r, 0, 0, t, n, i), i;
|
|
491
499
|
}
|
|
492
500
|
//#endregion
|
|
493
501
|
//#region src/engine/stream.ts
|
|
494
|
-
function
|
|
495
|
-
let n =
|
|
502
|
+
function G(e, t = "silhouette") {
|
|
503
|
+
let n = P(e);
|
|
496
504
|
if (t === "zero") return n;
|
|
497
505
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
498
506
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -500,34 +508,34 @@ function ie(e, t = "silhouette") {
|
|
|
500
508
|
return [e - r, t - r];
|
|
501
509
|
}));
|
|
502
510
|
}
|
|
503
|
-
function
|
|
511
|
+
function K(e) {
|
|
504
512
|
let t = 0, n = 0;
|
|
505
513
|
for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
|
|
506
514
|
return [t, n];
|
|
507
515
|
}
|
|
508
516
|
//#endregion
|
|
509
517
|
//#region src/engine/hierarchy.ts
|
|
510
|
-
function
|
|
511
|
-
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e +
|
|
518
|
+
function q(e) {
|
|
519
|
+
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + q(t), 0) : e.value ?? 0;
|
|
512
520
|
}
|
|
513
|
-
function
|
|
521
|
+
function J(e, t = 2 * Math.PI) {
|
|
514
522
|
let n = [], r = (e, t, i, a) => {
|
|
515
523
|
if (n.push({
|
|
516
524
|
node: e,
|
|
517
525
|
depth: t,
|
|
518
526
|
a0: i,
|
|
519
527
|
a1: a,
|
|
520
|
-
value:
|
|
528
|
+
value: q(e)
|
|
521
529
|
}), !e.children) return;
|
|
522
|
-
let o = a - i, s =
|
|
530
|
+
let o = a - i, s = q(e) || 1, c = i;
|
|
523
531
|
for (let n of e.children) {
|
|
524
|
-
let e = c + o *
|
|
532
|
+
let e = c + o * q(n) / s;
|
|
525
533
|
r(n, t + 1, c, e), c = e;
|
|
526
534
|
}
|
|
527
535
|
};
|
|
528
536
|
return r(e, 0, 0, t), n;
|
|
529
537
|
}
|
|
530
|
-
function
|
|
538
|
+
function Y(e) {
|
|
531
539
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
532
540
|
}
|
|
533
541
|
//#endregion
|
|
@@ -586,61 +594,61 @@ function oe(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12
|
|
|
586
594
|
links: v
|
|
587
595
|
};
|
|
588
596
|
}
|
|
589
|
-
function
|
|
597
|
+
function X(e) {
|
|
590
598
|
let t = e.source.x1, n = e.target.x0, r = (t + n) / 2, i = e.sy, a = e.sy + e.width, o = e.ty, s = e.ty + e.width;
|
|
591
599
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
592
600
|
}
|
|
593
601
|
//#endregion
|
|
594
602
|
//#region src/engine/ramp.ts
|
|
595
|
-
var
|
|
596
|
-
l:
|
|
597
|
-
c:
|
|
598
|
-
h:
|
|
599
|
-
}),
|
|
603
|
+
var se = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ce = (e, t, n) => e + (t - e) * n, le = (e, t, n) => ({
|
|
604
|
+
l: ce(e.l, t.l, n),
|
|
605
|
+
c: ce(e.c, t.c, n),
|
|
606
|
+
h: ce(e.h, t.h, n)
|
|
607
|
+
}), ue = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, de = {
|
|
600
608
|
l: .95,
|
|
601
609
|
c: .04,
|
|
602
610
|
h: 232
|
|
603
|
-
},
|
|
611
|
+
}, fe = {
|
|
604
612
|
l: .34,
|
|
605
613
|
c: .15,
|
|
606
614
|
h: 274
|
|
607
|
-
},
|
|
615
|
+
}, pe = {
|
|
608
616
|
l: .48,
|
|
609
617
|
c: .14,
|
|
610
618
|
h: 248
|
|
611
|
-
},
|
|
619
|
+
}, Z = {
|
|
612
620
|
l: .96,
|
|
613
621
|
c: .02,
|
|
614
622
|
h: 110
|
|
615
|
-
},
|
|
623
|
+
}, me = {
|
|
616
624
|
l: .52,
|
|
617
625
|
c: .15,
|
|
618
626
|
h: 42
|
|
619
627
|
};
|
|
628
|
+
function he(e) {
|
|
629
|
+
return ue(le(de, fe, se(e)));
|
|
630
|
+
}
|
|
620
631
|
function ge(e) {
|
|
621
|
-
|
|
632
|
+
let t = se(e);
|
|
633
|
+
return ue(t < .5 ? le(pe, Z, t * 2) : le(Z, me, (t - .5) * 2));
|
|
622
634
|
}
|
|
623
635
|
function _e(e) {
|
|
624
|
-
|
|
625
|
-
return de(t < .5 ? ue(X, me, t * 2) : ue(me, he, (t - .5) * 2));
|
|
636
|
+
return e === "diverging" ? ge : he;
|
|
626
637
|
}
|
|
627
|
-
function ve(e) {
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
function ye(e, t = "sequential") {
|
|
631
|
-
let n = ve(t);
|
|
638
|
+
function ve(e, t = "sequential") {
|
|
639
|
+
let n = _e(t);
|
|
632
640
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
633
641
|
}
|
|
634
|
-
function
|
|
642
|
+
function ye(e) {
|
|
635
643
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
636
644
|
return t ? Number(t[1]) : NaN;
|
|
637
645
|
}
|
|
638
646
|
//#endregion
|
|
639
647
|
//#region src/engine/polar.ts
|
|
640
|
-
function
|
|
648
|
+
function be(e, t, n, r) {
|
|
641
649
|
return [w(e + n * Math.sin(r)), w(t - n * Math.cos(r))];
|
|
642
650
|
}
|
|
643
|
-
function
|
|
651
|
+
function xe(e, t = [0, 2 * Math.PI]) {
|
|
644
652
|
let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
|
|
645
653
|
let n = i.get(e);
|
|
646
654
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -1156,11 +1164,11 @@ var ut = {
|
|
|
1156
1164
|
clipPath: "inset(50%)",
|
|
1157
1165
|
whiteSpace: "nowrap"
|
|
1158
1166
|
};
|
|
1159
|
-
function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw:
|
|
1167
|
+
function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, children: h, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: ee, onAfterDraw: k }) {
|
|
1160
1168
|
o();
|
|
1161
|
-
let
|
|
1169
|
+
let A = s(), j = `${A}-desc`, te = `${A}-live`, { ref: M, width: N, height: P } = Ve(n ?? 400, r), F = i(null), ne = i(!1), I = c(null), ie = c(null), L = c(null), ae = c(null);
|
|
1162
1170
|
a(() => {
|
|
1163
|
-
let e =
|
|
1171
|
+
let e = ae.current;
|
|
1164
1172
|
if (!e || !T) return;
|
|
1165
1173
|
let t = (t) => {
|
|
1166
1174
|
t.preventDefault();
|
|
@@ -1169,56 +1177,56 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1169
1177
|
};
|
|
1170
1178
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1171
1179
|
});
|
|
1172
|
-
let
|
|
1180
|
+
let R = () => {
|
|
1173
1181
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1174
|
-
},
|
|
1175
|
-
let t =
|
|
1182
|
+
}, z = n ?? N.value, B = r ?? P.value, V = E === !0 ? {} : E || null, H = () => ie.current ? st(ie.current) : null, U = () => {
|
|
1183
|
+
let t = H();
|
|
1176
1184
|
t && lt(t, `${e || "chart"}.svg`);
|
|
1177
|
-
},
|
|
1178
|
-
let t =
|
|
1185
|
+
}, W = () => {
|
|
1186
|
+
let t = H();
|
|
1179
1187
|
t && ct(t, {
|
|
1180
|
-
width:
|
|
1181
|
-
height:
|
|
1188
|
+
width: z,
|
|
1189
|
+
height: B,
|
|
1182
1190
|
dpr: 2
|
|
1183
1191
|
}).then((t) => {
|
|
1184
1192
|
t && lt(t, `${e || "chart"}.png`);
|
|
1185
1193
|
});
|
|
1186
|
-
},
|
|
1187
|
-
|
|
1188
|
-
},
|
|
1189
|
-
width:
|
|
1190
|
-
height:
|
|
1194
|
+
}, G = () => {
|
|
1195
|
+
R(), D?.();
|
|
1196
|
+
}, K = typeof b == "function" ? b({
|
|
1197
|
+
width: z,
|
|
1198
|
+
height: B
|
|
1191
1199
|
}) : b;
|
|
1192
1200
|
a(() => {
|
|
1193
|
-
let e =
|
|
1194
|
-
if (!
|
|
1195
|
-
let t = e === null ? void 0 :
|
|
1196
|
-
|
|
1201
|
+
let e = F.value;
|
|
1202
|
+
if (!K || !I.current) return;
|
|
1203
|
+
let t = e === null ? void 0 : K.points[e];
|
|
1204
|
+
I.current.textContent = t ? (K.format ?? Ye)(t) : "";
|
|
1197
1205
|
});
|
|
1198
|
-
let
|
|
1206
|
+
let q = {
|
|
1199
1207
|
position: "absolute",
|
|
1200
1208
|
inset: 0,
|
|
1201
1209
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1202
1210
|
background: "transparent",
|
|
1203
1211
|
touchAction: T ? "none" : void 0
|
|
1204
|
-
},
|
|
1212
|
+
}, J = C === "canvas" && w !== void 0, Y = K !== void 0 || T !== void 0, oe = {};
|
|
1205
1213
|
if (O && typeof O == "object") {
|
|
1206
1214
|
let e = oe;
|
|
1207
1215
|
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(", "));
|
|
1208
1216
|
}
|
|
1209
|
-
let
|
|
1217
|
+
let X = Y || J || V || Object.keys(oe).length > 0 ? {
|
|
1210
1218
|
...oe,
|
|
1211
|
-
...
|
|
1219
|
+
...Y || J || V ? { position: "relative" } : {}
|
|
1212
1220
|
} : void 0;
|
|
1213
1221
|
return /* @__PURE__ */ m("div", {
|
|
1214
|
-
ref:
|
|
1222
|
+
ref: M,
|
|
1215
1223
|
className: [Je.frame, g].filter(Boolean).join(" "),
|
|
1216
|
-
style:
|
|
1224
|
+
style: X,
|
|
1217
1225
|
..._ !== void 0 && { "data-state": _ },
|
|
1218
1226
|
...y === !0 && { "data-plain": "" },
|
|
1219
1227
|
...O === !1 && { "data-no-anim": "" },
|
|
1220
1228
|
children: [
|
|
1221
|
-
|
|
1229
|
+
V && /* @__PURE__ */ p("div", {
|
|
1222
1230
|
style: {
|
|
1223
1231
|
position: "absolute",
|
|
1224
1232
|
top: 4,
|
|
@@ -1226,51 +1234,51 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1226
1234
|
zIndex: 12
|
|
1227
1235
|
},
|
|
1228
1236
|
children: /* @__PURE__ */ p(at, {
|
|
1229
|
-
options:
|
|
1230
|
-
onPng:
|
|
1231
|
-
onSvg:
|
|
1237
|
+
options: V,
|
|
1238
|
+
onPng: W,
|
|
1239
|
+
onSvg: U,
|
|
1232
1240
|
onToggleData: () => {
|
|
1233
|
-
|
|
1241
|
+
ne.value = !ne.value;
|
|
1234
1242
|
},
|
|
1235
|
-
onRestore:
|
|
1236
|
-
showData:
|
|
1243
|
+
onRestore: G,
|
|
1244
|
+
showData: ne.value
|
|
1237
1245
|
})
|
|
1238
1246
|
}),
|
|
1239
|
-
|
|
1247
|
+
J && /* @__PURE__ */ p(Qe, {
|
|
1240
1248
|
size: () => ({
|
|
1241
|
-
width: n ??
|
|
1242
|
-
height: r ??
|
|
1249
|
+
width: n ?? N.value,
|
|
1250
|
+
height: r ?? P.value
|
|
1243
1251
|
}),
|
|
1244
1252
|
paint: w
|
|
1245
1253
|
}),
|
|
1246
1254
|
/* @__PURE__ */ m("svg", {
|
|
1247
|
-
ref:
|
|
1255
|
+
ref: ie,
|
|
1248
1256
|
role: "img",
|
|
1249
1257
|
"aria-label": e,
|
|
1250
|
-
"aria-describedby": t ?
|
|
1251
|
-
width:
|
|
1252
|
-
height:
|
|
1253
|
-
viewBox: `0 0 ${
|
|
1258
|
+
"aria-describedby": t ? j : void 0,
|
|
1259
|
+
width: z,
|
|
1260
|
+
height: B,
|
|
1261
|
+
viewBox: `0 0 ${z} ${B}`,
|
|
1254
1262
|
children: [
|
|
1255
1263
|
t && /* @__PURE__ */ p("desc", {
|
|
1256
|
-
id:
|
|
1264
|
+
id: j,
|
|
1257
1265
|
children: t
|
|
1258
1266
|
}),
|
|
1259
|
-
|
|
1260
|
-
width:
|
|
1261
|
-
height:
|
|
1267
|
+
ee?.({
|
|
1268
|
+
width: z,
|
|
1269
|
+
height: B
|
|
1262
1270
|
}),
|
|
1263
1271
|
h({
|
|
1264
|
-
width:
|
|
1265
|
-
height:
|
|
1272
|
+
width: z,
|
|
1273
|
+
height: B
|
|
1266
1274
|
}),
|
|
1267
|
-
|
|
1268
|
-
width:
|
|
1269
|
-
height:
|
|
1275
|
+
k?.({
|
|
1276
|
+
width: z,
|
|
1277
|
+
height: B
|
|
1270
1278
|
}),
|
|
1271
1279
|
_ === "empty" && /* @__PURE__ */ p("text", {
|
|
1272
|
-
x:
|
|
1273
|
-
y:
|
|
1280
|
+
x: z / 2,
|
|
1281
|
+
y: B / 2,
|
|
1274
1282
|
textAnchor: "middle",
|
|
1275
1283
|
dominantBaseline: "central",
|
|
1276
1284
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1285,16 +1293,16 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1285
1293
|
style: ut,
|
|
1286
1294
|
children: u
|
|
1287
1295
|
}),
|
|
1288
|
-
|
|
1296
|
+
V && ne.value && u && /* @__PURE__ */ p("div", {
|
|
1289
1297
|
"data-data-view": "",
|
|
1290
1298
|
style: { overflowX: "auto" },
|
|
1291
1299
|
children: u
|
|
1292
1300
|
}),
|
|
1293
|
-
|
|
1294
|
-
|
|
1301
|
+
Y && /* @__PURE__ */ m(f, { children: [
|
|
1302
|
+
K !== void 0 && /* @__PURE__ */ m(f, { children: [
|
|
1295
1303
|
/* @__PURE__ */ p("span", {
|
|
1296
|
-
id:
|
|
1297
|
-
ref:
|
|
1304
|
+
id: te,
|
|
1305
|
+
ref: I,
|
|
1298
1306
|
"aria-live": "polite",
|
|
1299
1307
|
style: {
|
|
1300
1308
|
position: "absolute",
|
|
@@ -1308,21 +1316,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1308
1316
|
border: 0
|
|
1309
1317
|
}
|
|
1310
1318
|
}),
|
|
1311
|
-
|
|
1319
|
+
K.mode === "axis" && F.value !== null && K.points[F.value] !== void 0 && /* @__PURE__ */ p("div", {
|
|
1312
1320
|
"aria-hidden": "true",
|
|
1313
1321
|
style: {
|
|
1314
1322
|
position: "absolute",
|
|
1315
|
-
left:
|
|
1323
|
+
left: K.points[F.value].cx,
|
|
1316
1324
|
top: 0,
|
|
1317
1325
|
width: 1,
|
|
1318
|
-
height:
|
|
1326
|
+
height: B,
|
|
1319
1327
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1320
1328
|
pointerEvents: "none",
|
|
1321
1329
|
zIndex: 9
|
|
1322
1330
|
}
|
|
1323
1331
|
}),
|
|
1324
|
-
|
|
1325
|
-
let e =
|
|
1332
|
+
F.value !== null && K.points[F.value] !== void 0 && (() => {
|
|
1333
|
+
let e = K.points[F.value];
|
|
1326
1334
|
return /* @__PURE__ */ p("div", {
|
|
1327
1335
|
"aria-hidden": "true",
|
|
1328
1336
|
style: {
|
|
@@ -1339,14 +1347,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1339
1347
|
}
|
|
1340
1348
|
});
|
|
1341
1349
|
})(),
|
|
1342
|
-
|
|
1343
|
-
point:
|
|
1344
|
-
model:
|
|
1350
|
+
F.value !== null && K.points[F.value] !== void 0 && /* @__PURE__ */ p(Xe, {
|
|
1351
|
+
point: K.points[F.value],
|
|
1352
|
+
model: K
|
|
1345
1353
|
})
|
|
1346
1354
|
] }),
|
|
1347
|
-
T && !
|
|
1355
|
+
T && !V && rt(T.window.value, T.count) && /* @__PURE__ */ p("button", {
|
|
1348
1356
|
type: "button",
|
|
1349
|
-
onClick:
|
|
1357
|
+
onClick: R,
|
|
1350
1358
|
style: {
|
|
1351
1359
|
position: "absolute",
|
|
1352
1360
|
top: 4,
|
|
@@ -1364,32 +1372,32 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1364
1372
|
children: d(l.charts.resetZoom)
|
|
1365
1373
|
}),
|
|
1366
1374
|
/* @__PURE__ */ p("div", {
|
|
1367
|
-
ref:
|
|
1375
|
+
ref: ae,
|
|
1368
1376
|
role: "application",
|
|
1369
1377
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1370
1378
|
tabIndex: 0,
|
|
1371
|
-
style:
|
|
1379
|
+
style: q,
|
|
1372
1380
|
onPointerDown: (e) => {
|
|
1373
|
-
T && (
|
|
1381
|
+
T && (L.current = {
|
|
1374
1382
|
x: e.clientX,
|
|
1375
1383
|
win: [...T.window.value]
|
|
1376
1384
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1377
1385
|
},
|
|
1378
1386
|
onPointerMove: (e) => {
|
|
1379
|
-
if (T &&
|
|
1380
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1381
|
-
T.window.value = nt(
|
|
1387
|
+
if (T && L.current && e.buttons === 1) {
|
|
1388
|
+
let t = e.currentTarget.getBoundingClientRect(), n = L.current.win[1] - L.current.win[0] + 1, r = e.clientX - L.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1389
|
+
T.window.value = nt(L.current.win, T.count, i);
|
|
1382
1390
|
return;
|
|
1383
1391
|
}
|
|
1384
|
-
if (!
|
|
1392
|
+
if (!K || !K.points.length) return;
|
|
1385
1393
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1386
|
-
|
|
1394
|
+
F.value = K.mode === "axis" ? Ze(K.points, n, r, "x") : S === "voronoi" ? re(K.points.map((e) => [e.cx, e.cy]), n, r) : Ze(K.points, n, r, "xy");
|
|
1387
1395
|
},
|
|
1388
1396
|
onPointerUp: () => {
|
|
1389
|
-
|
|
1397
|
+
L.current = null;
|
|
1390
1398
|
},
|
|
1391
1399
|
onPointerLeave: () => {
|
|
1392
|
-
|
|
1400
|
+
L.current = null, K && (F.value = null);
|
|
1393
1401
|
},
|
|
1394
1402
|
onKeyDown: (e) => {
|
|
1395
1403
|
if (T) {
|
|
@@ -1402,33 +1410,33 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: u, c
|
|
|
1402
1410
|
return;
|
|
1403
1411
|
}
|
|
1404
1412
|
if (e.key === "0") {
|
|
1405
|
-
e.preventDefault(),
|
|
1413
|
+
e.preventDefault(), R();
|
|
1406
1414
|
return;
|
|
1407
1415
|
}
|
|
1408
1416
|
}
|
|
1409
|
-
if (!
|
|
1410
|
-
let t =
|
|
1411
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(),
|
|
1412
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(),
|
|
1413
|
-
else if (e.key === "Home") e.preventDefault(),
|
|
1414
|
-
else if (e.key === "End") e.preventDefault(),
|
|
1415
|
-
else if (e.key === "Escape")
|
|
1417
|
+
if (!K || !K.points.length) return;
|
|
1418
|
+
let t = F.value;
|
|
1419
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), F.value = t === null ? 0 : Math.min(t + 1, K.points.length - 1);
|
|
1420
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), F.value = t === null ? K.points.length - 1 : Math.max(t - 1, 0);
|
|
1421
|
+
else if (e.key === "Home") e.preventDefault(), F.value = 0;
|
|
1422
|
+
else if (e.key === "End") e.preventDefault(), F.value = K.points.length - 1;
|
|
1423
|
+
else if (e.key === "Escape") F.value = null;
|
|
1416
1424
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1417
1425
|
e.preventDefault();
|
|
1418
|
-
let t =
|
|
1426
|
+
let t = F.value, n = t === null ? void 0 : K.points[t];
|
|
1419
1427
|
n && x(n);
|
|
1420
1428
|
}
|
|
1421
1429
|
},
|
|
1422
1430
|
onClick: () => {
|
|
1423
|
-
if (!
|
|
1424
|
-
let e =
|
|
1431
|
+
if (!K) return;
|
|
1432
|
+
let e = F.value, t = e === null ? void 0 : K.points[e];
|
|
1425
1433
|
x && t && x(t);
|
|
1426
1434
|
},
|
|
1427
1435
|
onFocus: () => {
|
|
1428
|
-
|
|
1436
|
+
K && K.points.length > 0 && F.value === null && (F.value = 0);
|
|
1429
1437
|
},
|
|
1430
1438
|
onBlur: () => {
|
|
1431
|
-
|
|
1439
|
+
K && (F.value = null);
|
|
1432
1440
|
}
|
|
1433
1441
|
})
|
|
1434
1442
|
] })
|
|
@@ -2044,7 +2052,7 @@ function Kt(e, t) {
|
|
|
2044
2052
|
}
|
|
2045
2053
|
function qt(e, t) {
|
|
2046
2054
|
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Gt(e, t), a = {};
|
|
2047
|
-
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ?
|
|
2055
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? ve(t.pieces ?? Vt, r)[Kt(e, t)] : _e(r)(i)), n === "size" || n === "both") {
|
|
2048
2056
|
let [e, n] = t.sizeRange ?? Ht;
|
|
2049
2057
|
a.size = Wt(e, n, i);
|
|
2050
2058
|
}
|
|
@@ -2057,7 +2065,7 @@ function Yt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2057
2065
|
o();
|
|
2058
2066
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2059
2067
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2060
|
-
let t = e.pieces ?? Vt, i =
|
|
2068
|
+
let t = e.pieces ?? Vt, i = ve(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2061
2069
|
if (!n) return;
|
|
2062
2070
|
let t = new Set(n.value);
|
|
2063
2071
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2105,7 +2113,7 @@ function Yt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2105
2113
|
})
|
|
2106
2114
|
});
|
|
2107
2115
|
}
|
|
2108
|
-
let { min: s, max: c } = e, l = c - s || 1, u =
|
|
2116
|
+
let { min: s, max: c } = e, l = c - s || 1, u = ve(8, e.ramp ?? "sequential"), d = (e) => (e - s) / l * 100, h = t?.value[0] ?? s, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2109
2117
|
let n = t.getBoundingClientRect();
|
|
2110
2118
|
return n.width === 0 ? s : s + Ut((e - n.left) / n.width) * l;
|
|
2111
2119
|
}, y = (e, n) => {
|
|
@@ -2253,40 +2261,40 @@ var rn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
|
2253
2261
|
function an(e) {
|
|
2254
2262
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2255
2263
|
}
|
|
2256
|
-
function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: d, xTicks: g = 5, yTicks: _ = 5,
|
|
2264
|
+
function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monotone", width: u, height: d, xTicks: g = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: w, annotations: D, labels: O, connectNulls: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: M, tooltipMode: N, secondAxis: P, decimate: F, toolbox: ne, transition: re, onBeforeDraw: I, onAfterDraw: ie }) {
|
|
2257
2265
|
o();
|
|
2258
|
-
let
|
|
2266
|
+
let L = i(/* @__PURE__ */ new Set()), ae = w ? null : Et(O), R = F === !0 ? {
|
|
2259
2267
|
method: "lttb",
|
|
2260
2268
|
threshold: 1e3
|
|
2261
2269
|
} : F ? {
|
|
2262
2270
|
method: F.method ?? "lttb",
|
|
2263
2271
|
threshold: F.threshold ?? 1e3
|
|
2264
|
-
} : null,
|
|
2265
|
-
|
|
2266
|
-
|
|
2272
|
+
} : null, z = e.reduce((e, t) => Math.max(e, t.data.length), 0), B = (A || j || te || M !== void 0) && z > 0, V = i([0, Math.max(0, z - 1)]), H = c(null);
|
|
2273
|
+
M && !H.current && (H.current = ft(M)), a(() => () => {
|
|
2274
|
+
M && pt(M);
|
|
2267
2275
|
}), a(() => {
|
|
2268
|
-
let e =
|
|
2276
|
+
let e = H.current;
|
|
2269
2277
|
if (!e) return;
|
|
2270
|
-
let t = e.window.value, n =
|
|
2271
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2278
|
+
let t = e.window.value, n = V.peek();
|
|
2279
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (V.value = t);
|
|
2272
2280
|
}), a(() => {
|
|
2273
|
-
let e =
|
|
2281
|
+
let e = H.current;
|
|
2274
2282
|
if (!e) return;
|
|
2275
|
-
let t =
|
|
2283
|
+
let t = V.value, n = e.window.peek();
|
|
2276
2284
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2277
2285
|
});
|
|
2278
|
-
let
|
|
2286
|
+
let U = B ? e.map((e) => ({
|
|
2279
2287
|
...e,
|
|
2280
|
-
data: e.data.slice(
|
|
2281
|
-
})) : e,
|
|
2282
|
-
en("LineChart", () =>
|
|
2283
|
-
let se = J.length > 0, ce = h(an(
|
|
2288
|
+
data: e.data.slice(V.value[0], V.value[1] + 1)
|
|
2289
|
+
})) : e, W = !w && U.some((e) => e.axis === "right"), G = d ?? (w ? 48 : 300), K = w ? !1 : y ?? U.length > 1, q = (e) => e.y ?? n, J = U.flatMap((e) => e.data.map((e) => t(e))), Y = (e) => e.flatMap((e) => e.data.map((t) => q(e)(t))).filter((e) => Number.isFinite(e)), oe = Y(W ? U.filter((e) => e.axis !== "right") : U), X = W ? Y(U.filter((e) => e.axis === "right")) : [];
|
|
2290
|
+
en("LineChart", () => U.flatMap((e) => e.data.map((t) => q(e)(t))));
|
|
2291
|
+
let se = J.length > 0, ce = h(an(oe), [0, 1]).ticks(_).map((e) => e.toLocaleString()), le = se && J[0] instanceof Date, ue = W ? h(an(X), [0, 1]).ticks(_).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], de = J.filter((e) => typeof e == "number"), fe = J.filter((e) => e instanceof Date), pe = se ? le ? C([new Date(Math.min(...fe.map((e) => e.getTime()))), new Date(Math.max(...fe.map((e) => e.getTime())))], [0, 1]).ticks(g).map((e) => e.toLocaleDateString()) : h([Math.min(...de), Math.max(...de)], [0, 1]).ticks(g).map((e) => e.toLocaleString()) : [], Z = w ? Ue : {
|
|
2284
2292
|
...He,
|
|
2285
|
-
left: Ge(ce,
|
|
2293
|
+
left: Ge(ce, w),
|
|
2286
2294
|
right: Ke({
|
|
2287
2295
|
rightAxisLabels: ue,
|
|
2288
2296
|
bottomAxisLabels: pe,
|
|
2289
|
-
plain:
|
|
2297
|
+
plain: w
|
|
2290
2298
|
})
|
|
2291
2299
|
};
|
|
2292
2300
|
return /* @__PURE__ */ m("div", {
|
|
@@ -2300,24 +2308,24 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2300
2308
|
title: r,
|
|
2301
2309
|
description: s,
|
|
2302
2310
|
width: u,
|
|
2303
|
-
height:
|
|
2311
|
+
height: G,
|
|
2304
2312
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2305
2313
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2306
|
-
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }),
|
|
2307
|
-
/* @__PURE__ */ p("tbody", { children: (
|
|
2314
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), U.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2315
|
+
/* @__PURE__ */ p("tbody", { children: (U[0]?.data ?? []).map((e, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(U[0] ? t(U[0].data[n]) : "") }), U.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : q(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2308
2316
|
] }),
|
|
2309
|
-
className:
|
|
2317
|
+
className: S,
|
|
2310
2318
|
"data-state": se ? void 0 : "empty",
|
|
2311
|
-
plain:
|
|
2312
|
-
tooltip:
|
|
2313
|
-
if (
|
|
2314
|
-
let r = e -
|
|
2315
|
-
if (
|
|
2316
|
-
let e =
|
|
2319
|
+
plain: w,
|
|
2320
|
+
tooltip: b !== !1 && se ? ({ width: e, height: n }) => {
|
|
2321
|
+
if (b === !1 || !se) return;
|
|
2322
|
+
let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(oe), [i, 0]), l = W ? h(an(X), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2323
|
+
if (N === "axis") {
|
|
2324
|
+
let e = U.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2317
2325
|
for (let r = 0; r < e; r++) {
|
|
2318
2326
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
2319
|
-
|
|
2320
|
-
if (
|
|
2327
|
+
U.forEach((n, c) => {
|
|
2328
|
+
if (L.value.has(n.id)) return;
|
|
2321
2329
|
let l = n.data[r];
|
|
2322
2330
|
if (l === void 0) return;
|
|
2323
2331
|
let f = q(n)(l);
|
|
@@ -2330,8 +2338,8 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2330
2338
|
});
|
|
2331
2339
|
}), a !== 0 && n.push({
|
|
2332
2340
|
id: `x-${r}`,
|
|
2333
|
-
cx:
|
|
2334
|
-
cy:
|
|
2341
|
+
cx: Z.left + i / a,
|
|
2342
|
+
cy: Z.top + (o === Infinity ? 0 : o),
|
|
2335
2343
|
label: s,
|
|
2336
2344
|
value: s,
|
|
2337
2345
|
segments: e
|
|
@@ -2343,67 +2351,67 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2343
2351
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2344
2352
|
};
|
|
2345
2353
|
}
|
|
2346
|
-
let f =
|
|
2354
|
+
let f = U.flatMap((e) => L.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2347
2355
|
let i = q(e)(n);
|
|
2348
2356
|
if (!Number.isFinite(i)) return [];
|
|
2349
2357
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2350
2358
|
return {
|
|
2351
2359
|
id: `${e.id}-${r}`,
|
|
2352
|
-
cx:
|
|
2353
|
-
cy:
|
|
2360
|
+
cx: Z.left + o,
|
|
2361
|
+
cy: Z.top + c,
|
|
2354
2362
|
label: l,
|
|
2355
2363
|
value: q(e)(n),
|
|
2356
2364
|
seriesId: e.id
|
|
2357
2365
|
};
|
|
2358
2366
|
}));
|
|
2359
|
-
return
|
|
2367
|
+
return x ? {
|
|
2360
2368
|
points: f,
|
|
2361
2369
|
format: (e) => {
|
|
2362
|
-
let t =
|
|
2363
|
-
return t && t.data[n] !== void 0 ?
|
|
2370
|
+
let t = U.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2371
|
+
return t && t.data[n] !== void 0 ? x(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2364
2372
|
}
|
|
2365
2373
|
} : { points: f };
|
|
2366
2374
|
} : void 0,
|
|
2367
2375
|
onSelect: k,
|
|
2368
|
-
zoom:
|
|
2369
|
-
window:
|
|
2370
|
-
count:
|
|
2376
|
+
zoom: te && z > 1 ? {
|
|
2377
|
+
window: V,
|
|
2378
|
+
count: z
|
|
2371
2379
|
} : void 0,
|
|
2372
|
-
toolbox:
|
|
2373
|
-
onRestore:
|
|
2374
|
-
|
|
2380
|
+
toolbox: ne,
|
|
2381
|
+
onRestore: B ? () => {
|
|
2382
|
+
V.value = [0, Math.max(0, z - 1)];
|
|
2375
2383
|
} : void 0,
|
|
2376
|
-
transition:
|
|
2377
|
-
onBeforeDraw:
|
|
2378
|
-
onAfterDraw:
|
|
2384
|
+
transition: re,
|
|
2385
|
+
onBeforeDraw: I,
|
|
2386
|
+
onAfterDraw: ie,
|
|
2379
2387
|
children: ({ width: e, height: n }) => {
|
|
2380
|
-
let r = e -
|
|
2388
|
+
let r = e - Z.left - Z.right, i = n - Z.top - Z.bottom, a = Math.min(...le ? J.map((e) => e.getTime()) : J), o = Math.max(...le ? J.map((e) => e.getTime()) : J), s = le ? C([new Date(a), new Date(o)], [0, r]) : h([a, o], [0, r]), c = h(an(oe), [i, 0]), u = W ? h(an(X), [i, 0]) : c;
|
|
2381
2389
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
2382
|
-
transform: `translate(${
|
|
2390
|
+
transform: `translate(${Z.left},${Z.top})`,
|
|
2383
2391
|
children: [
|
|
2384
|
-
!
|
|
2392
|
+
!w && /* @__PURE__ */ p(vt, {
|
|
2385
2393
|
scale: c,
|
|
2386
2394
|
orientation: "y",
|
|
2387
2395
|
length: r,
|
|
2388
2396
|
tickCount: _
|
|
2389
2397
|
}),
|
|
2390
|
-
!
|
|
2398
|
+
!w && Ct(D, {
|
|
2391
2399
|
xScale: s,
|
|
2392
2400
|
yScale: c,
|
|
2393
2401
|
innerW: r,
|
|
2394
2402
|
innerH: i
|
|
2395
2403
|
}),
|
|
2396
|
-
|
|
2397
|
-
if (
|
|
2404
|
+
U.map((e, n) => {
|
|
2405
|
+
if (L.value.has(e.id)) return null;
|
|
2398
2406
|
let r = e.color ?? rn[n % rn.length], i = e.axis === "right" ? u : c, a = (e) => s.map(e);
|
|
2399
|
-
if (
|
|
2407
|
+
if (R && e.data.length > R.threshold) {
|
|
2400
2408
|
let n = [];
|
|
2401
2409
|
for (let r of e.data) {
|
|
2402
2410
|
let o = q(e)(r);
|
|
2403
2411
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2404
2412
|
}
|
|
2405
2413
|
return /* @__PURE__ */ p("path", {
|
|
2406
|
-
d: E(Le(n,
|
|
2414
|
+
d: E(Le(n, R.threshold, R.method).map((e) => [e[0], e[1]]), l),
|
|
2407
2415
|
fill: "none",
|
|
2408
2416
|
stroke: r,
|
|
2409
2417
|
strokeWidth: 2,
|
|
@@ -2416,7 +2424,7 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2416
2424
|
let r = q(e)(n);
|
|
2417
2425
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2418
2426
|
});
|
|
2419
|
-
return /* @__PURE__ */ m("g", { children: [T(o,
|
|
2427
|
+
return /* @__PURE__ */ m("g", { children: [T(o, ee).map((t, n) => /* @__PURE__ */ p("path", {
|
|
2420
2428
|
d: E(t, l),
|
|
2421
2429
|
fill: "none",
|
|
2422
2430
|
stroke: r,
|
|
@@ -2424,22 +2432,23 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2424
2432
|
strokeLinecap: "round",
|
|
2425
2433
|
strokeLinejoin: "round",
|
|
2426
2434
|
"data-series": e.id
|
|
2427
|
-
}, n)),
|
|
2435
|
+
}, n)), ae && e.data.map((t, n) => {
|
|
2428
2436
|
let r = o[n];
|
|
2429
2437
|
return r ? /* @__PURE__ */ p(Dt, {
|
|
2430
2438
|
x: r[0],
|
|
2431
2439
|
y: r[1] - 8,
|
|
2432
|
-
text:
|
|
2440
|
+
text: ae.format(q(e)(t))
|
|
2433
2441
|
}, n) : null;
|
|
2434
2442
|
})] }, e.id);
|
|
2435
2443
|
}),
|
|
2436
|
-
!
|
|
2444
|
+
!w && /* @__PURE__ */ m(f, { children: [
|
|
2437
2445
|
/* @__PURE__ */ p($, {
|
|
2438
2446
|
scale: s,
|
|
2439
2447
|
orientation: "x",
|
|
2440
2448
|
length: r,
|
|
2441
2449
|
tickCount: g,
|
|
2442
|
-
transform: `translate(0,${i})
|
|
2450
|
+
transform: `translate(0,${i})`,
|
|
2451
|
+
...v ? { format: v } : {}
|
|
2443
2452
|
}),
|
|
2444
2453
|
/* @__PURE__ */ p($, {
|
|
2445
2454
|
scale: c,
|
|
@@ -2447,7 +2456,7 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2447
2456
|
length: i,
|
|
2448
2457
|
tickCount: _
|
|
2449
2458
|
}),
|
|
2450
|
-
|
|
2459
|
+
W && /* @__PURE__ */ p($, {
|
|
2451
2460
|
scale: u,
|
|
2452
2461
|
orientation: "y-right",
|
|
2453
2462
|
length: i,
|
|
@@ -2460,23 +2469,23 @@ function on({ series: e, x: t, y: n, title: r, description: s, curve: l = "monot
|
|
|
2460
2469
|
}) });
|
|
2461
2470
|
}
|
|
2462
2471
|
}),
|
|
2463
|
-
A && !j &&
|
|
2464
|
-
count:
|
|
2465
|
-
window:
|
|
2472
|
+
A && !j && z > 1 && /* @__PURE__ */ p(zt, {
|
|
2473
|
+
count: z,
|
|
2474
|
+
window: V,
|
|
2466
2475
|
label: "Time range"
|
|
2467
2476
|
}),
|
|
2468
|
-
j &&
|
|
2469
|
-
count:
|
|
2470
|
-
window:
|
|
2477
|
+
j && z > 1 && /* @__PURE__ */ p(Bt, {
|
|
2478
|
+
count: z,
|
|
2479
|
+
window: V,
|
|
2471
2480
|
label: "Time range"
|
|
2472
2481
|
}),
|
|
2473
|
-
|
|
2474
|
-
series:
|
|
2482
|
+
K && /* @__PURE__ */ p(Zt, {
|
|
2483
|
+
series: U.map((e, t) => ({
|
|
2475
2484
|
id: e.id,
|
|
2476
2485
|
label: e.label,
|
|
2477
2486
|
color: e.color ?? rn[t % rn.length]
|
|
2478
2487
|
})),
|
|
2479
|
-
hidden:
|
|
2488
|
+
hidden: L
|
|
2480
2489
|
})
|
|
2481
2490
|
]
|
|
2482
2491
|
});
|
|
@@ -2488,40 +2497,40 @@ function cn(e, t) {
|
|
|
2488
2497
|
return t || e <= 1 ? sn : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
|
|
2489
2498
|
}
|
|
2490
2499
|
var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2491
|
-
function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: d = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: w, className: T, plain: D, annotations: O, labels:
|
|
2500
|
+
function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1, curve: d = "monotone", fill: g = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: w, className: T, plain: D, annotations: O, labels: ee, onSelect: k, brush: A, dataZoom: j, zoom: te, syncId: N, tooltipMode: F, secondAxis: ne, decimate: re, toolbox: I, format: ie }) {
|
|
2492
2501
|
o();
|
|
2493
|
-
let
|
|
2502
|
+
let L = s(), ae = i(/* @__PURE__ */ new Set()), R = D ? null : Et(ee), z = re === !0 ? {
|
|
2494
2503
|
method: "lttb",
|
|
2495
2504
|
threshold: 1e3
|
|
2496
|
-
} :
|
|
2497
|
-
method:
|
|
2498
|
-
threshold:
|
|
2499
|
-
} : null,
|
|
2500
|
-
|
|
2501
|
-
|
|
2505
|
+
} : re ? {
|
|
2506
|
+
method: re.method ?? "lttb",
|
|
2507
|
+
threshold: re.threshold ?? 1e3
|
|
2508
|
+
} : null, B = e.reduce((e, t) => Math.max(e, t.data.length), 0), V = (A || j || te || N !== void 0) && B > 0, H = i([0, Math.max(0, B - 1)]), U = c(null);
|
|
2509
|
+
N && !U.current && (U.current = ft(N)), a(() => () => {
|
|
2510
|
+
N && pt(N);
|
|
2502
2511
|
}), a(() => {
|
|
2503
|
-
let e =
|
|
2512
|
+
let e = U.current;
|
|
2504
2513
|
if (!e) return;
|
|
2505
|
-
let t = e.window.value, n =
|
|
2506
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2514
|
+
let t = e.window.value, n = H.peek();
|
|
2515
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (H.value = t);
|
|
2507
2516
|
}), a(() => {
|
|
2508
|
-
let e =
|
|
2517
|
+
let e = U.current;
|
|
2509
2518
|
if (!e) return;
|
|
2510
|
-
let t =
|
|
2519
|
+
let t = H.value, n = e.window.peek();
|
|
2511
2520
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2512
2521
|
});
|
|
2513
|
-
let
|
|
2522
|
+
let W = V ? e.map((e) => ({
|
|
2514
2523
|
...e,
|
|
2515
|
-
data: e.data.slice(
|
|
2516
|
-
})) : e,
|
|
2517
|
-
!
|
|
2524
|
+
data: e.data.slice(H.value[0], H.value[1] + 1)
|
|
2525
|
+
})) : e, G = !D && !u && W.some((e) => e.axis === "right"), K = y ?? (D ? 48 : 300), q = D ? !1 : S ?? W.length > 1, J = cn(W.length, u), Y = (e) => e.y ?? n, oe = (W[0]?.data ?? []).map((e) => t(e)), X = (G ? W.filter((e) => e.axis !== "right") : W).flatMap((e) => e.data.map((t) => Y(e)(t))), se = G ? W.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Y(e)(t))) : [];
|
|
2526
|
+
!G && !u && W.length > 1 && nn("AreaChart", W.map((e) => ({
|
|
2518
2527
|
label: e.label,
|
|
2519
2528
|
max: Math.max(0, ...e.data.map((t) => Y(e)(t)).filter((e) => Number.isFinite(e)))
|
|
2520
|
-
}))), en("AreaChart", () => [...
|
|
2521
|
-
let ce =
|
|
2529
|
+
}))), en("AreaChart", () => [...X, ...se]);
|
|
2530
|
+
let ce = oe.length > 0, le = ce && oe[0] instanceof Date, ue = oe.map((e) => e instanceof Date ? e.getTime() : e), de = ce ? Math.min(...ue) : 0, fe = ce ? Math.max(...ue) : 1, pe = (e) => le ? C([new Date(de), new Date(fe)], [0, e]) : h([de, fe], [0, e]), Z = (e, n) => e.map(t(n)), me = (e) => {
|
|
2522
2531
|
let n = t(e);
|
|
2523
2532
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2524
|
-
}, he = u ? 0 : Math.min(0, ...
|
|
2533
|
+
}, he = u ? 0 : Math.min(0, ...X), ge = Math.max(...u ? (W[0]?.data ?? []).map((e, t) => W.reduce((e, n) => e + Y(n)(n.data[t]), 0)) : X), _e = G ? Math.min(0, ...se) : he, ve = G ? Math.max(...se) : ge, ye = h([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = G ? h([_e, ve], [0, 1]).ticks(x).map((e) => ne?.format ? ne.format(e) : e.toLocaleString()) : [], xe = le ? C([new Date(de), new Date(fe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : h([de, fe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Se = D ? Ue : {
|
|
2525
2534
|
...He,
|
|
2526
2535
|
left: Ge(ye, D),
|
|
2527
2536
|
right: Ke({
|
|
@@ -2541,28 +2550,28 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2541
2550
|
title: r,
|
|
2542
2551
|
description: l,
|
|
2543
2552
|
width: v,
|
|
2544
|
-
height:
|
|
2553
|
+
height: K,
|
|
2545
2554
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2546
2555
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2547
|
-
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }),
|
|
2548
|
-
/* @__PURE__ */ p("tbody", { children: (
|
|
2556
|
+
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "X" }), W.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2557
|
+
/* @__PURE__ */ p("tbody", { children: (W[0]?.data ?? []).map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: W[0] ? me(W[0].data[t]) : "" }), W.map((e) => /* @__PURE__ */ p("td", { children: e.data[t] == null ? "" : Y(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2549
2558
|
] }),
|
|
2550
2559
|
className: T,
|
|
2551
2560
|
"data-state": ce ? void 0 : "empty",
|
|
2552
2561
|
plain: D,
|
|
2553
2562
|
tooltip: w !== !1 && ce ? ({ width: e, height: t }) => {
|
|
2554
2563
|
if (w === !1 || !ce) return;
|
|
2555
|
-
let n = e -
|
|
2556
|
-
if (
|
|
2557
|
-
let e =
|
|
2564
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = G ? h([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2565
|
+
if (F === "axis") {
|
|
2566
|
+
let e = W.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2558
2567
|
for (let n = 0; n < e; n++) {
|
|
2559
|
-
let e = [], r = Infinity, a = "", o =
|
|
2560
|
-
|
|
2561
|
-
if (
|
|
2568
|
+
let e = [], r = Infinity, a = "", o = Se.left;
|
|
2569
|
+
W.forEach((t, c) => {
|
|
2570
|
+
if (ae.value.has(t.id)) return;
|
|
2562
2571
|
let l = t.data[n];
|
|
2563
2572
|
if (l === void 0) return;
|
|
2564
2573
|
let u = Y(t)(l);
|
|
2565
|
-
Number.isFinite(u) && (o =
|
|
2574
|
+
Number.isFinite(u) && (o = Se.left + Z(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
|
|
2566
2575
|
label: t.label,
|
|
2567
2576
|
value: u,
|
|
2568
2577
|
color: t.color ?? ln[c % ln.length]
|
|
@@ -2570,7 +2579,7 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2570
2579
|
}), e.length !== 0 && t.push({
|
|
2571
2580
|
id: `x-${n}`,
|
|
2572
2581
|
cx: o,
|
|
2573
|
-
cy:
|
|
2582
|
+
cy: Se.top + (r === Infinity ? 0 : r),
|
|
2574
2583
|
label: a,
|
|
2575
2584
|
value: a,
|
|
2576
2585
|
segments: e
|
|
@@ -2582,36 +2591,36 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2582
2591
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2583
2592
|
};
|
|
2584
2593
|
}
|
|
2585
|
-
return { points:
|
|
2594
|
+
return { points: W.flatMap((e) => ae.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2586
2595
|
id: `${e.id}-${n}`,
|
|
2587
|
-
cx:
|
|
2588
|
-
cy:
|
|
2596
|
+
cx: Se.left + Z(i, t),
|
|
2597
|
+
cy: Se.top + s(e).map(Y(e)(t)),
|
|
2589
2598
|
label: me(t),
|
|
2590
2599
|
value: Y(e)(t),
|
|
2591
2600
|
seriesId: e.id
|
|
2592
2601
|
}))) };
|
|
2593
2602
|
} : void 0,
|
|
2594
|
-
onSelect:
|
|
2595
|
-
zoom:
|
|
2596
|
-
window:
|
|
2597
|
-
count:
|
|
2603
|
+
onSelect: k,
|
|
2604
|
+
zoom: te && B > 1 ? {
|
|
2605
|
+
window: H,
|
|
2606
|
+
count: B
|
|
2598
2607
|
} : void 0,
|
|
2599
|
-
toolbox:
|
|
2600
|
-
onRestore:
|
|
2601
|
-
|
|
2608
|
+
toolbox: I,
|
|
2609
|
+
onRestore: V ? () => {
|
|
2610
|
+
H.value = [0, Math.max(0, B - 1)];
|
|
2602
2611
|
} : void 0,
|
|
2603
2612
|
children: ({ width: e, height: t }) => {
|
|
2604
|
-
let n = e -
|
|
2605
|
-
return u && (s =
|
|
2606
|
-
prefix:
|
|
2613
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = h([he, ge], [r, 0]), o = G ? h([_e, ve], [r, 0]) : a, s = [];
|
|
2614
|
+
return u && (s = P(W.map((e) => e.data.map((t) => Y(e)(t))))), /* @__PURE__ */ m("g", { children: [g !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2615
|
+
prefix: L,
|
|
2607
2616
|
fill: g,
|
|
2608
2617
|
patternKind: _,
|
|
2609
|
-
series:
|
|
2618
|
+
series: W.map((e, t) => ({
|
|
2610
2619
|
id: e.id,
|
|
2611
2620
|
color: e.color ?? ln[t % ln.length]
|
|
2612
2621
|
}))
|
|
2613
2622
|
}), /* @__PURE__ */ m("g", {
|
|
2614
|
-
transform: `translate(${
|
|
2623
|
+
transform: `translate(${Se.left},${Se.top})`,
|
|
2615
2624
|
children: [
|
|
2616
2625
|
!D && /* @__PURE__ */ p(vt, {
|
|
2617
2626
|
scale: a,
|
|
@@ -2625,13 +2634,13 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2625
2634
|
innerW: n,
|
|
2626
2635
|
innerH: r
|
|
2627
2636
|
}),
|
|
2628
|
-
|
|
2629
|
-
if (
|
|
2637
|
+
W.map((e, t) => {
|
|
2638
|
+
if (ae.value.has(e.id)) return null;
|
|
2630
2639
|
let n = e.color ?? ln[t % ln.length], r, c;
|
|
2631
2640
|
if (u && s[t]) {
|
|
2632
2641
|
let o = s[t];
|
|
2633
|
-
r = e.data.map((e, t) => [
|
|
2634
|
-
let l = e.data.map((e, t) => [
|
|
2642
|
+
r = e.data.map((e, t) => [Z(i, e), a.map(o[t][1])]);
|
|
2643
|
+
let l = e.data.map((e, t) => [Z(i, e), a.map(o[t][0])]);
|
|
2635
2644
|
c = a.map(0);
|
|
2636
2645
|
let u = E(r, d), f = l[l.length - 1], h = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${f[0]},${f[1]}${_}L${h[0]},${h[1]}Z`;
|
|
2637
2646
|
return /* @__PURE__ */ m("g", {
|
|
@@ -2639,7 +2648,7 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2639
2648
|
children: [
|
|
2640
2649
|
/* @__PURE__ */ p("path", {
|
|
2641
2650
|
d: v,
|
|
2642
|
-
fill: jt(
|
|
2651
|
+
fill: jt(L, e.id, g, n),
|
|
2643
2652
|
style: g === "solid" ? J : void 0,
|
|
2644
2653
|
stroke: "none"
|
|
2645
2654
|
}),
|
|
@@ -2649,22 +2658,22 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2649
2658
|
stroke: n,
|
|
2650
2659
|
strokeWidth: 2
|
|
2651
2660
|
}),
|
|
2652
|
-
|
|
2661
|
+
R && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2653
2662
|
x: t[0],
|
|
2654
2663
|
y: t[1] - 8,
|
|
2655
|
-
text:
|
|
2664
|
+
text: R.format(Y(e)(e.data[n]))
|
|
2656
2665
|
}, n))
|
|
2657
2666
|
]
|
|
2658
2667
|
}, e.id);
|
|
2659
2668
|
} else {
|
|
2660
2669
|
let t = e.axis === "right" ? o : a;
|
|
2661
|
-
if (r = e.data.map((n) => [
|
|
2662
|
-
let t = Le(r,
|
|
2670
|
+
if (r = e.data.map((n) => [Z(i, n), t.map(Y(e)(n))]), c = t.map(0), z && r.length > z.threshold) {
|
|
2671
|
+
let t = Le(r, z.threshold, z.method).map((e) => [e[0], e[1]]);
|
|
2663
2672
|
return /* @__PURE__ */ m("g", {
|
|
2664
2673
|
"data-series": e.id,
|
|
2665
2674
|
children: [/* @__PURE__ */ p("path", {
|
|
2666
|
-
d:
|
|
2667
|
-
fill: jt(
|
|
2675
|
+
d: M(t, c, d),
|
|
2676
|
+
fill: jt(L, e.id, g, n),
|
|
2668
2677
|
style: g === "solid" ? J : void 0,
|
|
2669
2678
|
stroke: "none"
|
|
2670
2679
|
}), /* @__PURE__ */ p("path", {
|
|
@@ -2679,8 +2688,8 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2679
2688
|
"data-series": e.id,
|
|
2680
2689
|
children: [
|
|
2681
2690
|
/* @__PURE__ */ p("path", {
|
|
2682
|
-
d:
|
|
2683
|
-
fill: jt(
|
|
2691
|
+
d: M(r, c, d),
|
|
2692
|
+
fill: jt(L, e.id, g, n),
|
|
2684
2693
|
style: g === "solid" ? J : void 0,
|
|
2685
2694
|
stroke: "none"
|
|
2686
2695
|
}),
|
|
@@ -2690,10 +2699,10 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2690
2699
|
stroke: n,
|
|
2691
2700
|
strokeWidth: 2
|
|
2692
2701
|
}),
|
|
2693
|
-
|
|
2702
|
+
R && r.map((t, n) => /* @__PURE__ */ p(Dt, {
|
|
2694
2703
|
x: t[0],
|
|
2695
2704
|
y: t[1] - 8,
|
|
2696
|
-
text:
|
|
2705
|
+
text: R.format(Y(e)(e.data[n]))
|
|
2697
2706
|
}, n))
|
|
2698
2707
|
]
|
|
2699
2708
|
}, e.id);
|
|
@@ -2705,7 +2714,8 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2705
2714
|
orientation: "x",
|
|
2706
2715
|
length: n,
|
|
2707
2716
|
tickCount: b,
|
|
2708
|
-
transform: `translate(0,${r})
|
|
2717
|
+
transform: `translate(0,${r})`,
|
|
2718
|
+
...ie ? { format: ie } : {}
|
|
2709
2719
|
}),
|
|
2710
2720
|
/* @__PURE__ */ p($, {
|
|
2711
2721
|
scale: a,
|
|
@@ -2713,61 +2723,64 @@ function un({ series: e, x: t, y: n, title: r, description: l, stacked: u = !1,
|
|
|
2713
2723
|
length: r,
|
|
2714
2724
|
tickCount: x
|
|
2715
2725
|
}),
|
|
2716
|
-
|
|
2726
|
+
G && /* @__PURE__ */ p($, {
|
|
2717
2727
|
scale: o,
|
|
2718
2728
|
orientation: "y-right",
|
|
2719
2729
|
length: r,
|
|
2720
2730
|
tickCount: x,
|
|
2721
2731
|
transform: `translate(${n},0)`,
|
|
2722
|
-
...
|
|
2732
|
+
...ne?.format ? { format: (e) => ne.format(Number(e)) } : {}
|
|
2723
2733
|
})
|
|
2724
2734
|
] })
|
|
2725
2735
|
]
|
|
2726
2736
|
})] });
|
|
2727
2737
|
}
|
|
2728
2738
|
}),
|
|
2729
|
-
|
|
2730
|
-
count:
|
|
2731
|
-
window:
|
|
2739
|
+
A && !j && B > 1 && /* @__PURE__ */ p(zt, {
|
|
2740
|
+
count: B,
|
|
2741
|
+
window: H,
|
|
2732
2742
|
label: "Range"
|
|
2733
2743
|
}),
|
|
2734
|
-
|
|
2735
|
-
count:
|
|
2736
|
-
window:
|
|
2744
|
+
j && B > 1 && /* @__PURE__ */ p(Bt, {
|
|
2745
|
+
count: B,
|
|
2746
|
+
window: H,
|
|
2737
2747
|
label: "Range"
|
|
2738
2748
|
}),
|
|
2739
2749
|
q && /* @__PURE__ */ p(Zt, {
|
|
2740
|
-
series:
|
|
2750
|
+
series: W.map((e, t) => ({
|
|
2741
2751
|
id: e.id,
|
|
2742
2752
|
label: e.label,
|
|
2743
2753
|
color: e.color ?? ln[t % ln.length]
|
|
2744
2754
|
})),
|
|
2745
|
-
hidden:
|
|
2755
|
+
hidden: ae
|
|
2746
2756
|
})
|
|
2747
2757
|
]
|
|
2748
2758
|
});
|
|
2749
2759
|
}
|
|
2750
2760
|
//#endregion
|
|
2751
2761
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2752
|
-
|
|
2753
|
-
function
|
|
2762
|
+
function dn(e, t, n, r) {
|
|
2763
|
+
return typeof e == "function" ? t === void 0 ? r : e(t, n) : e ?? r;
|
|
2764
|
+
}
|
|
2765
|
+
var fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2766
|
+
function pn(e) {
|
|
2754
2767
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2755
2768
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2756
2769
|
}
|
|
2757
|
-
function
|
|
2770
|
+
function mn({ series: e, x: t, y: n, title: r, description: a, orientation: c = "vertical", mode: l = "grouped", width: u, height: d, xTicks: g = 5, yTicks: v = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: ee, onSelect: k, fill: A = "solid", patternKind: j, format: te }) {
|
|
2758
2771
|
o();
|
|
2759
|
-
let
|
|
2760
|
-
let t =
|
|
2772
|
+
let M = s(), N = D ? null : Et(ee), F = i(/* @__PURE__ */ new Set()), ne = d ?? (D ? 48 : 300), re = D ? !1 : C ?? e.length > 1, I = (e) => e.y ?? n, ie = (e[0]?.data ?? []).map((e) => t(e)), L = e.flatMap((e) => e.data.map((t) => I(e)(t))), ae = ie.length > 0, R = l === "stacked" || l === "percent", z = ie.map((t, n) => e.reduce((e, t) => e + I(t)(t.data[n]), 0)), B = () => {
|
|
2773
|
+
let t = P(e.map((e) => e.data.map((t) => I(e)(t))));
|
|
2761
2774
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2762
|
-
let r =
|
|
2775
|
+
let r = z[n] || 1;
|
|
2763
2776
|
return [e / r, t / r];
|
|
2764
2777
|
})) : t;
|
|
2765
|
-
},
|
|
2778
|
+
}, V = R ? 0 : Math.min(0, ...L), H = ae ? Math.max(...z) : 1, U = l === "percent" ? 1 : l === "stacked" ? H : Math.max(1, ...L), W = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, G = c === "vertical", K = (G ? y : b) ?? v, q = (G ? b : y) ?? g, J = S ?? x, Y = G ? h([V, U], [0, 1]).ticks(K).map((e) => W ? W(e) : e.toLocaleString()) : ie.map((e) => String(e)), oe = G ? ie.map((e) => String(e)) : h([V, U], [0, 1]).ticks(q).map((e) => W ? W(e) : e.toLocaleString()), X = D ? Ue : {
|
|
2766
2779
|
...He,
|
|
2767
|
-
left: Ge(
|
|
2780
|
+
left: Ge(Y, D),
|
|
2768
2781
|
right: Ke({
|
|
2769
|
-
bottomAxisLabels:
|
|
2770
|
-
plain:
|
|
2782
|
+
bottomAxisLabels: oe,
|
|
2783
|
+
plain: D
|
|
2771
2784
|
})
|
|
2772
2785
|
};
|
|
2773
2786
|
return /* @__PURE__ */ m("div", {
|
|
@@ -2780,24 +2793,24 @@ function pn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2780
2793
|
title: r,
|
|
2781
2794
|
description: a,
|
|
2782
2795
|
width: u,
|
|
2783
|
-
height:
|
|
2796
|
+
height: ne,
|
|
2784
2797
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
2785
2798
|
/* @__PURE__ */ p("caption", { children: r }),
|
|
2786
2799
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
2787
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
2800
|
+
/* @__PURE__ */ p("tbody", { children: ie.map((t, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: t }), e.map((e) => /* @__PURE__ */ p("td", { children: e.data[n] == null ? "" : I(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2788
2801
|
] }),
|
|
2789
|
-
className:
|
|
2790
|
-
"data-state":
|
|
2791
|
-
plain:
|
|
2792
|
-
tooltip:
|
|
2793
|
-
if (!
|
|
2794
|
-
let i = n -
|
|
2795
|
-
|
|
2796
|
-
let p =
|
|
2802
|
+
className: E,
|
|
2803
|
+
"data-state": ae ? void 0 : "empty",
|
|
2804
|
+
plain: D,
|
|
2805
|
+
tooltip: w && ae ? ({ width: n, height: r }) => {
|
|
2806
|
+
if (!w || !ae) return;
|
|
2807
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, o = c === "vertical", s = _(ie, o ? [0, i] : [0, a], .2), u = h([V, U], o ? [a, 0] : [0, i]), d = e.filter((e) => !F.value.has(e.id)), f = [];
|
|
2808
|
+
R && (f = B());
|
|
2809
|
+
let p = R && !T, m = ie.map((t, n) => {
|
|
2797
2810
|
let r = d.map((t) => ({
|
|
2798
2811
|
label: t.label,
|
|
2799
|
-
value:
|
|
2800
|
-
color: t.color
|
|
2812
|
+
value: I(t)(t.data[n]),
|
|
2813
|
+
color: dn(t.color, t.data[n], n, fn[e.indexOf(t) % fn.length])
|
|
2801
2814
|
}));
|
|
2802
2815
|
return {
|
|
2803
2816
|
segs: r,
|
|
@@ -2807,79 +2820,79 @@ function pn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2807
2820
|
let r = e.indexOf(n), i = l === "grouped" ? s.bandwidth / d.length : s.bandwidth;
|
|
2808
2821
|
return n.data.map((e, a) => {
|
|
2809
2822
|
let c = s.map(t(e)) ?? 0, h, g;
|
|
2810
|
-
if (
|
|
2823
|
+
if (R && f[r]) {
|
|
2811
2824
|
let e = f[r][a];
|
|
2812
2825
|
h = e[1], g = e[0];
|
|
2813
|
-
} else h =
|
|
2826
|
+
} else h = I(n)(e), g = V;
|
|
2814
2827
|
let _ = d.indexOf(n), v = c + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
|
|
2815
2828
|
return {
|
|
2816
2829
|
id: `${n.id}-${a}`,
|
|
2817
|
-
cx:
|
|
2818
|
-
cy:
|
|
2830
|
+
cx: X.left + (o ? v : y),
|
|
2831
|
+
cy: X.top + (o ? y : v),
|
|
2819
2832
|
label: t(e),
|
|
2820
|
-
value: p ? m[a].total :
|
|
2833
|
+
value: p ? m[a].total : I(n)(e),
|
|
2821
2834
|
seriesId: n.id,
|
|
2822
2835
|
...p && { segments: m[a].segs }
|
|
2823
2836
|
};
|
|
2824
2837
|
});
|
|
2825
|
-
}), v =
|
|
2838
|
+
}), v = T ?? (p ? pn : void 0);
|
|
2826
2839
|
return v ? {
|
|
2827
2840
|
points: g,
|
|
2828
2841
|
format: v
|
|
2829
2842
|
} : { points: g };
|
|
2830
2843
|
} : void 0,
|
|
2831
|
-
onSelect:
|
|
2844
|
+
onSelect: k,
|
|
2832
2845
|
children: ({ width: n, height: r }) => {
|
|
2833
|
-
let i = n -
|
|
2834
|
-
return
|
|
2835
|
-
prefix:
|
|
2836
|
-
fill:
|
|
2837
|
-
patternKind:
|
|
2846
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, o = c === "vertical", s = J ?? qe(ie, o ? i : a), u = _(ie, o ? [0, i] : [0, a], .2), d = h([V, U], o ? [a, 0] : [0, i]), g = e.filter((e) => !F.value.has(e.id)), v = [];
|
|
2847
|
+
return R && (v = B()), /* @__PURE__ */ m("g", { children: [A !== "solid" && /* @__PURE__ */ p(Mt, {
|
|
2848
|
+
prefix: M,
|
|
2849
|
+
fill: A,
|
|
2850
|
+
patternKind: j,
|
|
2838
2851
|
series: e.map((e, t) => ({
|
|
2839
2852
|
id: e.id,
|
|
2840
|
-
color: e.color
|
|
2853
|
+
color: dn(e.color, e.data[0], 0, fn[t % fn.length])
|
|
2841
2854
|
}))
|
|
2842
2855
|
}), /* @__PURE__ */ m("g", {
|
|
2843
|
-
transform: `translate(${
|
|
2856
|
+
transform: `translate(${X.left},${X.top})`,
|
|
2844
2857
|
children: [
|
|
2845
|
-
!
|
|
2858
|
+
!D && o && /* @__PURE__ */ p(vt, {
|
|
2846
2859
|
scale: d,
|
|
2847
2860
|
orientation: "y",
|
|
2848
2861
|
length: i,
|
|
2849
|
-
tickCount:
|
|
2862
|
+
tickCount: K
|
|
2850
2863
|
}),
|
|
2851
|
-
!
|
|
2864
|
+
!D && !o && /* @__PURE__ */ p(vt, {
|
|
2852
2865
|
scale: d,
|
|
2853
2866
|
orientation: "x",
|
|
2854
2867
|
length: a,
|
|
2855
|
-
tickCount:
|
|
2868
|
+
tickCount: q
|
|
2856
2869
|
}),
|
|
2857
|
-
!
|
|
2870
|
+
!D && Ct(O, {
|
|
2858
2871
|
xScale: o ? u : d,
|
|
2859
2872
|
yScale: o ? d : u,
|
|
2860
2873
|
innerW: i,
|
|
2861
2874
|
innerH: a
|
|
2862
2875
|
}),
|
|
2863
|
-
|
|
2864
|
-
let i =
|
|
2876
|
+
g.map((n, r) => {
|
|
2877
|
+
let i = fn[e.indexOf(n) % fn.length], a = e.indexOf(n), s = l === "grouped" ? u.bandwidth / g.length : u.bandwidth;
|
|
2865
2878
|
return n.data.map((e, c) => {
|
|
2866
2879
|
let f = u.map(t(e)) ?? 0, h, g;
|
|
2867
|
-
if (
|
|
2868
|
-
let e =
|
|
2880
|
+
if (R && v[a]) {
|
|
2881
|
+
let e = v[a][c];
|
|
2869
2882
|
h = e[1], g = e[0];
|
|
2870
|
-
} else h =
|
|
2871
|
-
let _ = f + (l === "grouped" ? r * s : 0),
|
|
2872
|
-
if (
|
|
2873
|
-
let t =
|
|
2874
|
-
if (o)
|
|
2883
|
+
} else h = I(n)(e), g = V;
|
|
2884
|
+
let _ = f + (l === "grouped" ? r * s : 0), y = Math.min(d.map(h), d.map(g)), b = Math.abs(d.map(h) - d.map(g)), x = null;
|
|
2885
|
+
if (N) {
|
|
2886
|
+
let t = N.format(I(n)(e)), r = _ + s / 2, i = R || b < 18 || y < 14;
|
|
2887
|
+
if (o) x = /* @__PURE__ */ p(Dt, {
|
|
2875
2888
|
x: r,
|
|
2876
|
-
y: i ?
|
|
2889
|
+
y: i ? y + 13 : y - 4,
|
|
2877
2890
|
text: t,
|
|
2878
2891
|
tone: i ? "muted" : "default"
|
|
2879
2892
|
});
|
|
2880
2893
|
else {
|
|
2881
|
-
let e =
|
|
2882
|
-
|
|
2894
|
+
let e = y + b;
|
|
2895
|
+
x = /* @__PURE__ */ p(Dt, {
|
|
2883
2896
|
x: i ? e - 4 : e + 4,
|
|
2884
2897
|
y: r + 4,
|
|
2885
2898
|
text: t,
|
|
@@ -2887,79 +2900,83 @@ function pn({ series: e, x: t, y: n, title: r, description: a, orientation: c =
|
|
|
2887
2900
|
tone: i ? "muted" : "default"
|
|
2888
2901
|
});
|
|
2889
2902
|
}
|
|
2890
|
-
|
|
2903
|
+
R && b < 14 && (x = null);
|
|
2891
2904
|
}
|
|
2905
|
+
let S = dn(n.color, e, c, i);
|
|
2892
2906
|
return /* @__PURE__ */ m("g", { children: [o ? /* @__PURE__ */ p("rect", {
|
|
2893
2907
|
x: _,
|
|
2894
|
-
y
|
|
2908
|
+
y,
|
|
2895
2909
|
width: s,
|
|
2896
|
-
height:
|
|
2897
|
-
fill: jt(
|
|
2910
|
+
height: b,
|
|
2911
|
+
fill: jt(M, n.id, A, S),
|
|
2898
2912
|
rx: 2,
|
|
2899
|
-
"data-series": n.id
|
|
2913
|
+
"data-series": n.id,
|
|
2914
|
+
"data-x": String(t(e))
|
|
2900
2915
|
}) : /* @__PURE__ */ p("rect", {
|
|
2901
|
-
x:
|
|
2916
|
+
x: y,
|
|
2902
2917
|
y: _,
|
|
2903
|
-
width:
|
|
2918
|
+
width: b,
|
|
2904
2919
|
height: s,
|
|
2905
|
-
fill: jt(
|
|
2920
|
+
fill: jt(M, n.id, A, S),
|
|
2906
2921
|
rx: 2,
|
|
2907
|
-
"data-series": n.id
|
|
2908
|
-
|
|
2922
|
+
"data-series": n.id,
|
|
2923
|
+
"data-x": String(t(e))
|
|
2924
|
+
}), x] }, `${n.id}-${c}`);
|
|
2909
2925
|
});
|
|
2910
2926
|
}),
|
|
2911
|
-
!
|
|
2927
|
+
!D && o && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($, {
|
|
2912
2928
|
scale: u,
|
|
2913
2929
|
orientation: "x",
|
|
2914
2930
|
length: i,
|
|
2915
|
-
tickCount:
|
|
2931
|
+
tickCount: q,
|
|
2916
2932
|
labelEvery: s,
|
|
2917
|
-
transform: `translate(0,${a})
|
|
2933
|
+
transform: `translate(0,${a})`,
|
|
2934
|
+
...te ? { format: te } : {}
|
|
2918
2935
|
}), /* @__PURE__ */ p($, {
|
|
2919
2936
|
scale: d,
|
|
2920
2937
|
orientation: "y",
|
|
2921
2938
|
length: a,
|
|
2922
|
-
tickCount:
|
|
2923
|
-
...
|
|
2939
|
+
tickCount: K,
|
|
2940
|
+
...W && { format: W }
|
|
2924
2941
|
})] }),
|
|
2925
|
-
!
|
|
2942
|
+
!D && !o && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p($, {
|
|
2926
2943
|
scale: d,
|
|
2927
2944
|
orientation: "x",
|
|
2928
2945
|
length: i,
|
|
2929
|
-
tickCount:
|
|
2930
|
-
...
|
|
2946
|
+
tickCount: q,
|
|
2947
|
+
...W && { format: W },
|
|
2931
2948
|
transform: `translate(0,${a})`
|
|
2932
2949
|
}), /* @__PURE__ */ p($, {
|
|
2933
2950
|
scale: u,
|
|
2934
2951
|
orientation: "y",
|
|
2935
2952
|
length: a,
|
|
2936
|
-
tickCount:
|
|
2953
|
+
tickCount: K,
|
|
2937
2954
|
labelEvery: s
|
|
2938
2955
|
})] })
|
|
2939
2956
|
]
|
|
2940
2957
|
})] });
|
|
2941
2958
|
}
|
|
2942
|
-
}),
|
|
2959
|
+
}), re && /* @__PURE__ */ p(Zt, {
|
|
2943
2960
|
series: e.map((e, t) => ({
|
|
2944
2961
|
id: e.id,
|
|
2945
2962
|
label: e.label,
|
|
2946
|
-
color: e.color
|
|
2963
|
+
color: dn(e.color, e.data[0], 0, fn[t % fn.length])
|
|
2947
2964
|
})),
|
|
2948
|
-
hidden:
|
|
2965
|
+
hidden: F
|
|
2949
2966
|
})]
|
|
2950
2967
|
});
|
|
2951
2968
|
}
|
|
2952
2969
|
//#endregion
|
|
2953
2970
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2954
|
-
function
|
|
2971
|
+
function hn(e) {
|
|
2955
2972
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
2956
2973
|
return `${e.value} (${t}%)`;
|
|
2957
2974
|
}
|
|
2958
|
-
var
|
|
2959
|
-
function
|
|
2960
|
-
let T = x ? null : Et(S), E = typeof S == "object" && !!S && S.format != null, D = a ?? c, O = s ?? c ?? (x ? 48 : 300),
|
|
2975
|
+
var gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2976
|
+
function _n({ data: e, title: t, description: n, donut: r = !1, width: a, height: s, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: h, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
|
|
2977
|
+
let T = x ? null : Et(S), E = typeof S == "object" && !!S && S.format != null, D = a ?? c, O = s ?? c ?? (x ? 48 : 300), ee = x ? !1 : y ?? !0;
|
|
2961
2978
|
o();
|
|
2962
|
-
let
|
|
2979
|
+
let k = i(/* @__PURE__ */ new Set()), A = e.length > 0;
|
|
2963
2980
|
return /* @__PURE__ */ m("div", {
|
|
2964
2981
|
style: {
|
|
2965
2982
|
display: "flex",
|
|
@@ -2988,12 +3005,12 @@ function gn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
2988
3005
|
}) })
|
|
2989
3006
|
] }),
|
|
2990
3007
|
className: b,
|
|
2991
|
-
"data-state":
|
|
3008
|
+
"data-state": A ? void 0 : "empty",
|
|
2992
3009
|
emptyLabel: g,
|
|
2993
3010
|
plain: x,
|
|
2994
|
-
tooltip: _ !== !1 &&
|
|
2995
|
-
if (!
|
|
2996
|
-
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !
|
|
3011
|
+
tooltip: _ !== !1 && A ? ({ width: t, height: n }) => {
|
|
3012
|
+
if (!A) return;
|
|
3013
|
+
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;
|
|
2997
3014
|
return {
|
|
2998
3015
|
points: o.map((e, t) => {
|
|
2999
3016
|
let n = s > 0 ? e.value / s * 2 * Math.PI : 0, o = c + n, l = (c + o) / 2;
|
|
@@ -3005,17 +3022,17 @@ function gn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3005
3022
|
value: e.value,
|
|
3006
3023
|
seriesId: String(t),
|
|
3007
3024
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
3008
|
-
color: e.color ??
|
|
3025
|
+
color: e.color ?? gn[t % gn.length]
|
|
3009
3026
|
};
|
|
3010
3027
|
}),
|
|
3011
|
-
format: v ??
|
|
3028
|
+
format: v ?? hn
|
|
3012
3029
|
};
|
|
3013
3030
|
} : void 0,
|
|
3014
3031
|
onSelect: C,
|
|
3015
3032
|
children: ({ width: t, height: n }) => {
|
|
3016
|
-
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !
|
|
3033
|
+
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !k.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || h != null);
|
|
3017
3034
|
return /* @__PURE__ */ m("g", { children: [g.map((e, t) => {
|
|
3018
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
3035
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? gn[t % gn.length], u = N(i, a, o, c, v, r);
|
|
3019
3036
|
v = r;
|
|
3020
3037
|
let d = _ > 0 ? e.value / _ * 100 : 0, f = T && d >= 4, h = c > 0 ? (c + o) / 2 : o * .6;
|
|
3021
3038
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("path", {
|
|
@@ -3070,35 +3087,35 @@ function gn({ data: e, title: t, description: n, donut: r = !1, width: a, height
|
|
|
3070
3087
|
})
|
|
3071
3088
|
}))] });
|
|
3072
3089
|
}
|
|
3073
|
-
}),
|
|
3090
|
+
}), ee && /* @__PURE__ */ p(Zt, {
|
|
3074
3091
|
series: e.map((e, t) => ({
|
|
3075
3092
|
id: e.id,
|
|
3076
3093
|
label: e.label,
|
|
3077
|
-
color: e.color ??
|
|
3094
|
+
color: e.color ?? gn[t % gn.length]
|
|
3078
3095
|
})),
|
|
3079
|
-
hidden:
|
|
3096
|
+
hidden: k
|
|
3080
3097
|
})]
|
|
3081
3098
|
});
|
|
3082
3099
|
}
|
|
3083
3100
|
//#endregion
|
|
3084
3101
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3085
|
-
var
|
|
3086
|
-
function
|
|
3102
|
+
var vn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3103
|
+
function yn({ series: e, title: t, description: n, r = 4, width: a, height: s, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: g, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C, format: w }) {
|
|
3087
3104
|
o();
|
|
3088
|
-
let
|
|
3089
|
-
let a = n -
|
|
3105
|
+
let T = i(/* @__PURE__ */ new Set()), E = _ ? Ue : He, D = s ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, ee = e.reduce((e, t) => e + t.data.length, 0), k = !S && (x === "canvas" || x === "auto" && ee > 2e3), A = i([S?.min ?? 0, S?.max ?? 1]), j = i(/* @__PURE__ */ new Set()), te = (t, { width: n, height: i }) => {
|
|
3106
|
+
let a = n - E.left - E.right, o = i - E.top - E.bottom;
|
|
3090
3107
|
if (a <= 0 || o <= 0) return;
|
|
3091
|
-
let s = h([F,
|
|
3108
|
+
let s = h([F, ne], [0, a]), c = h([re, I], [o, 0]);
|
|
3092
3109
|
e.forEach((e, n) => {
|
|
3093
|
-
if (!
|
|
3094
|
-
t.fillStyle = $e(t, e.color ??
|
|
3110
|
+
if (!T.value.has(e.id)) {
|
|
3111
|
+
t.fillStyle = $e(t, e.color ?? vn[n % vn.length]), t.globalAlpha = .7;
|
|
3095
3112
|
for (let n of e.data) {
|
|
3096
3113
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3097
|
-
t.beginPath(), t.arc(
|
|
3114
|
+
t.beginPath(), t.arc(E.left + s.map(n.x), E.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3098
3115
|
}
|
|
3099
3116
|
}
|
|
3100
3117
|
}), t.globalAlpha = 1;
|
|
3101
|
-
},
|
|
3118
|
+
}, M = e.flatMap((e) => e.data.map((e) => e.x)), N = e.flatMap((e) => e.data.map((e) => e.y)), P = M.length > 0, F = P ? Math.min(...M) : 0, ne = P ? Math.max(...M) : 1, re = P ? Math.min(0, ...N) : 0, I = P ? Math.max(...N) : 1;
|
|
3102
3119
|
return /* @__PURE__ */ m("div", {
|
|
3103
3120
|
style: {
|
|
3104
3121
|
display: "flex",
|
|
@@ -3110,7 +3127,7 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3110
3127
|
title: t,
|
|
3111
3128
|
description: n,
|
|
3112
3129
|
width: a,
|
|
3113
|
-
height:
|
|
3130
|
+
height: D,
|
|
3114
3131
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3115
3132
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3116
3133
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3129,11 +3146,11 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3129
3146
|
plain: _,
|
|
3130
3147
|
tooltip: d !== !1 && P ? ({ width: t, height: n }) => {
|
|
3131
3148
|
if (d === !1 || !P) return;
|
|
3132
|
-
let r = t -
|
|
3133
|
-
return { points: e.flatMap((e) =>
|
|
3149
|
+
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = h([F, ne], [0, r]), o = h([re, I], [i, 0]);
|
|
3150
|
+
return { points: e.flatMap((e) => T.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3134
3151
|
id: `${e.id}-${n}`,
|
|
3135
|
-
cx:
|
|
3136
|
-
cy:
|
|
3152
|
+
cx: E.left + a.map(t.x),
|
|
3153
|
+
cy: E.top + o.map(t.y),
|
|
3137
3154
|
label: `(${t.x}, ${t.y})`,
|
|
3138
3155
|
value: t.y,
|
|
3139
3156
|
seriesId: e.id
|
|
@@ -3142,15 +3159,15 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3142
3159
|
onSelect: y,
|
|
3143
3160
|
hover: "voronoi",
|
|
3144
3161
|
renderer: k ? "canvas" : "svg",
|
|
3145
|
-
paint: k ?
|
|
3162
|
+
paint: k ? te : void 0,
|
|
3146
3163
|
toolbox: C,
|
|
3147
3164
|
onRestore: S ? () => {
|
|
3148
3165
|
A.value = [S.min, S.max], j.value = /* @__PURE__ */ new Set();
|
|
3149
3166
|
} : void 0,
|
|
3150
3167
|
children: ({ width: t, height: n }) => {
|
|
3151
|
-
let i = t -
|
|
3168
|
+
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = h([F, ne], [0, i]), s = h([re, I], [a, 0]);
|
|
3152
3169
|
return /* @__PURE__ */ p("g", { children: /* @__PURE__ */ m("g", {
|
|
3153
|
-
transform: `translate(${
|
|
3170
|
+
transform: `translate(${E.left},${E.top})`,
|
|
3154
3171
|
children: [
|
|
3155
3172
|
!_ && /* @__PURE__ */ p(vt, {
|
|
3156
3173
|
scale: s,
|
|
@@ -3165,8 +3182,8 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3165
3182
|
innerH: a
|
|
3166
3183
|
}),
|
|
3167
3184
|
!k && e.map((e, t) => {
|
|
3168
|
-
if (
|
|
3169
|
-
let n = e.color ??
|
|
3185
|
+
if (T.value.has(e.id)) return null;
|
|
3186
|
+
let n = e.color ?? vn[t % vn.length];
|
|
3170
3187
|
return /* @__PURE__ */ p("g", {
|
|
3171
3188
|
"data-series": e.id,
|
|
3172
3189
|
children: e.data.map((t, i) => {
|
|
@@ -3197,7 +3214,8 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3197
3214
|
orientation: "x",
|
|
3198
3215
|
length: i,
|
|
3199
3216
|
tickCount: c,
|
|
3200
|
-
transform: `translate(0,${a})
|
|
3217
|
+
transform: `translate(0,${a})`,
|
|
3218
|
+
...w ? { format: w } : {}
|
|
3201
3219
|
}), /* @__PURE__ */ p($, {
|
|
3202
3220
|
scale: s,
|
|
3203
3221
|
orientation: "y",
|
|
@@ -3214,20 +3232,20 @@ function vn({ series: e, title: t, description: n, r = 4, width: a, height: s, x
|
|
|
3214
3232
|
hidden: j,
|
|
3215
3233
|
label: t
|
|
3216
3234
|
}),
|
|
3217
|
-
|
|
3235
|
+
O && /* @__PURE__ */ p(Zt, {
|
|
3218
3236
|
series: e.map((e, t) => ({
|
|
3219
3237
|
id: e.id,
|
|
3220
3238
|
label: e.label,
|
|
3221
|
-
color: e.color ??
|
|
3239
|
+
color: e.color ?? vn[t % vn.length]
|
|
3222
3240
|
})),
|
|
3223
|
-
hidden:
|
|
3241
|
+
hidden: T
|
|
3224
3242
|
})
|
|
3225
3243
|
]
|
|
3226
3244
|
});
|
|
3227
3245
|
}
|
|
3228
3246
|
//#endregion
|
|
3229
3247
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3230
|
-
function
|
|
3248
|
+
function bn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
|
|
3231
3249
|
return /* @__PURE__ */ p(Q, {
|
|
3232
3250
|
title: r ?? i,
|
|
3233
3251
|
width: t,
|
|
@@ -3265,15 +3283,15 @@ function yn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3265
3283
|
}
|
|
3266
3284
|
//#endregion
|
|
3267
3285
|
//#region src/charts/meter/meter.tsx
|
|
3268
|
-
function
|
|
3286
|
+
function xn(e, t, n, r) {
|
|
3269
3287
|
if (!r) return "var(--cascivo-chart-1)";
|
|
3270
3288
|
let { warning: i, critical: a } = r;
|
|
3271
3289
|
return a != null && e >= a ? "var(--cascivo-color-destructive)" : i != null && e >= i ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3272
3290
|
}
|
|
3273
|
-
function
|
|
3274
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l =
|
|
3291
|
+
function Sn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o = 200, height: s }) {
|
|
3292
|
+
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, l = xn(e, t, n, a);
|
|
3275
3293
|
if (i === "gauge") {
|
|
3276
|
-
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ =
|
|
3294
|
+
let i = s ?? 100, a = o, u = a / 2, d = i * .9, f = Math.min(u, d) - 4, h = f * .65, g = Math.PI, _ = N(u, d, f, h, g, 2 * Math.PI), v = g + c * Math.PI, y = c > 0 ? N(u, d, f, h, g, v) : "";
|
|
3277
3295
|
return /* @__PURE__ */ m("div", {
|
|
3278
3296
|
"aria-label": r,
|
|
3279
3297
|
role: "meter",
|
|
@@ -3347,7 +3365,7 @@ function xn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3347
3365
|
})]
|
|
3348
3366
|
});
|
|
3349
3367
|
}
|
|
3350
|
-
var
|
|
3368
|
+
var Cn = {
|
|
3351
3369
|
kpi: "_kpi_1k88k_7",
|
|
3352
3370
|
head: "_head_1k88k_19",
|
|
3353
3371
|
label: "_label_1k88k_27",
|
|
@@ -3357,20 +3375,20 @@ var Sn = {
|
|
|
3357
3375
|
};
|
|
3358
3376
|
//#endregion
|
|
3359
3377
|
//#region src/charts/kpi/kpi.tsx
|
|
3360
|
-
function
|
|
3378
|
+
function wn(e, t) {
|
|
3361
3379
|
if (typeof t == "function") return t(e);
|
|
3362
3380
|
let n = e >= 0 ? "+" : "", r = e.toLocaleString(u());
|
|
3363
3381
|
return t === "percent" ? `${n}${r}%` : `${n}${r}`;
|
|
3364
3382
|
}
|
|
3365
|
-
function
|
|
3383
|
+
function Tn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabel: i, icon: a, sparkline: o, className: s }) {
|
|
3366
3384
|
let c = n != null && n >= 0, l = n != null && n < 0;
|
|
3367
3385
|
return /* @__PURE__ */ m("div", {
|
|
3368
|
-
className: [
|
|
3386
|
+
className: [Cn.kpi, s].filter(Boolean).join(" "),
|
|
3369
3387
|
children: [
|
|
3370
3388
|
/* @__PURE__ */ m("div", {
|
|
3371
|
-
className:
|
|
3389
|
+
className: Cn.head,
|
|
3372
3390
|
children: [/* @__PURE__ */ p("span", {
|
|
3373
|
-
className:
|
|
3391
|
+
className: Cn.label,
|
|
3374
3392
|
children: t
|
|
3375
3393
|
}), a && /* @__PURE__ */ p("span", {
|
|
3376
3394
|
"aria-hidden": "true",
|
|
@@ -3378,24 +3396,24 @@ function wn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3378
3396
|
})]
|
|
3379
3397
|
}),
|
|
3380
3398
|
/* @__PURE__ */ m("div", {
|
|
3381
|
-
className:
|
|
3399
|
+
className: Cn.valueRow,
|
|
3382
3400
|
children: [/* @__PURE__ */ p("span", {
|
|
3383
|
-
className:
|
|
3401
|
+
className: Cn.value,
|
|
3384
3402
|
children: typeof e == "number" ? e.toLocaleString(u()) : e
|
|
3385
3403
|
}), n != null && /* @__PURE__ */ m("span", {
|
|
3386
3404
|
role: "img",
|
|
3387
|
-
className:
|
|
3405
|
+
className: Cn.delta,
|
|
3388
3406
|
"data-trend": c ? "up" : l ? "down" : "flat",
|
|
3389
|
-
"aria-label": `Trend: ${
|
|
3407
|
+
"aria-label": `Trend: ${wn(n, r)}${i ? ` ${i}` : ""}`,
|
|
3390
3408
|
children: [
|
|
3391
3409
|
c ? "▲" : l ? "▼" : "–",
|
|
3392
3410
|
" ",
|
|
3393
|
-
|
|
3411
|
+
wn(n, r),
|
|
3394
3412
|
i && ` ${i}`
|
|
3395
3413
|
]
|
|
3396
3414
|
})]
|
|
3397
3415
|
}),
|
|
3398
|
-
o && o.length > 0 && /* @__PURE__ */ p(
|
|
3416
|
+
o && o.length > 0 && /* @__PURE__ */ p(bn, {
|
|
3399
3417
|
data: o,
|
|
3400
3418
|
label: `${t} trend`,
|
|
3401
3419
|
height: 32
|
|
@@ -3405,18 +3423,18 @@ function wn({ value: e, label: t, delta: n, deltaFormat: r = "number", deltaLabe
|
|
|
3405
3423
|
}
|
|
3406
3424
|
//#endregion
|
|
3407
3425
|
//#region src/charts/histogram/histogram.tsx
|
|
3408
|
-
function
|
|
3426
|
+
function En({ data: e, bins: t, title: n, label: r, description: i, width: a, height: s, className: c, plain: l, format: u }) {
|
|
3409
3427
|
o();
|
|
3410
|
-
let
|
|
3428
|
+
let d = l ? Ue : He, g = s ?? (l ? 48 : 300), _ = R(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3411
3429
|
return /* @__PURE__ */ p(Q, {
|
|
3412
3430
|
title: n,
|
|
3413
3431
|
description: i,
|
|
3414
3432
|
width: a,
|
|
3415
|
-
height:
|
|
3433
|
+
height: g,
|
|
3416
3434
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3417
3435
|
/* @__PURE__ */ p("caption", { children: n }),
|
|
3418
3436
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Range" }), /* @__PURE__ */ p("th", { children: "Count" })] }) }),
|
|
3419
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
3437
|
+
/* @__PURE__ */ p("tbody", { children: _.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ m("td", { children: [
|
|
3420
3438
|
e.x0.toFixed(2),
|
|
3421
3439
|
" – ",
|
|
3422
3440
|
e.x1.toFixed(2)
|
|
@@ -3424,15 +3442,15 @@ function Tn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3424
3442
|
] }),
|
|
3425
3443
|
className: c,
|
|
3426
3444
|
plain: l,
|
|
3427
|
-
tooltip:
|
|
3428
|
-
if (
|
|
3429
|
-
let n = e -
|
|
3430
|
-
return { points:
|
|
3445
|
+
tooltip: _.length > 0 ? ({ width: e, height: t }) => {
|
|
3446
|
+
if (_.length === 0) return;
|
|
3447
|
+
let n = e - d.left - d.right, r = t - d.top - d.bottom, i = h([_[0]?.x0 ?? 0, _[_.length - 1]?.x1 ?? 1], [0, n]), a = h([0, v || 1], [r, 0]);
|
|
3448
|
+
return { points: _.map((e, t) => {
|
|
3431
3449
|
let n = i.map(e.x0), r = Math.max(0, i.map(e.x1) - n - 1);
|
|
3432
3450
|
return {
|
|
3433
3451
|
id: `bin-${t}`,
|
|
3434
|
-
cx:
|
|
3435
|
-
cy:
|
|
3452
|
+
cx: d.left + n + r / 2,
|
|
3453
|
+
cy: d.top + a.map(e.count),
|
|
3436
3454
|
label: `${e.x0.toFixed(2)}–${e.x1.toFixed(2)}`,
|
|
3437
3455
|
value: e.count
|
|
3438
3456
|
};
|
|
@@ -3440,20 +3458,20 @@ function Tn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3440
3458
|
} : void 0,
|
|
3441
3459
|
children: ({ width: e, height: t }) => {
|
|
3442
3460
|
let n = {
|
|
3443
|
-
width: e -
|
|
3444
|
-
height: t -
|
|
3461
|
+
width: e - d.left - d.right,
|
|
3462
|
+
height: t - d.top - d.bottom
|
|
3445
3463
|
};
|
|
3446
|
-
if (n.width <= 0 ||
|
|
3447
|
-
let r = h([
|
|
3464
|
+
if (n.width <= 0 || _.length === 0) return null;
|
|
3465
|
+
let r = h([_[0]?.x0 ?? 0, _[_.length - 1]?.x1 ?? 1], [0, n.width]), i = h([0, v || 1], [n.height, 0]);
|
|
3448
3466
|
return /* @__PURE__ */ m("g", {
|
|
3449
|
-
transform: `translate(${
|
|
3467
|
+
transform: `translate(${d.left},${d.top})`,
|
|
3450
3468
|
children: [
|
|
3451
3469
|
!l && /* @__PURE__ */ p(vt, {
|
|
3452
3470
|
scale: i,
|
|
3453
3471
|
orientation: "y",
|
|
3454
3472
|
length: n.width
|
|
3455
3473
|
}),
|
|
3456
|
-
|
|
3474
|
+
_.map((e, t) => {
|
|
3457
3475
|
let a = r.map(e.x0), o = Math.max(0, r.map(e.x1) - a - 1), s = i.map(e.count), c = n.height - s;
|
|
3458
3476
|
return /* @__PURE__ */ p("rect", {
|
|
3459
3477
|
x: a,
|
|
@@ -3468,7 +3486,8 @@ function Tn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3468
3486
|
scale: r,
|
|
3469
3487
|
orientation: "x",
|
|
3470
3488
|
length: n.width,
|
|
3471
|
-
transform: `translate(0,${n.height})
|
|
3489
|
+
transform: `translate(0,${n.height})`,
|
|
3490
|
+
...u ? { format: u } : {}
|
|
3472
3491
|
}), /* @__PURE__ */ p($, {
|
|
3473
3492
|
scale: i,
|
|
3474
3493
|
orientation: "y",
|
|
@@ -3481,18 +3500,18 @@ function Tn({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3481
3500
|
}
|
|
3482
3501
|
//#endregion
|
|
3483
3502
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3484
|
-
var
|
|
3485
|
-
function
|
|
3503
|
+
var Dn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3504
|
+
function On({ series: e, title: t, description: n, width: r, height: i, className: a, plain: s, format: c }) {
|
|
3486
3505
|
o();
|
|
3487
|
-
let
|
|
3506
|
+
let l = s ? Ue : He, u = i ?? (s ? 48 : 320), d = e.map((e) => ({
|
|
3488
3507
|
...e,
|
|
3489
|
-
stats:
|
|
3490
|
-
})),
|
|
3508
|
+
stats: z(e.values)
|
|
3509
|
+
})), g = e.flatMap((e) => e.values), [v, y] = g.length > 0 ? B(g) : [0, 1];
|
|
3491
3510
|
return /* @__PURE__ */ p(Q, {
|
|
3492
3511
|
title: t,
|
|
3493
3512
|
description: n,
|
|
3494
3513
|
width: r,
|
|
3495
|
-
height:
|
|
3514
|
+
height: u,
|
|
3496
3515
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3497
3516
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3498
3517
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3503,7 +3522,7 @@ function Dn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3503
3522
|
/* @__PURE__ */ p("th", { children: "Q3" }),
|
|
3504
3523
|
/* @__PURE__ */ p("th", { children: "Max" })
|
|
3505
3524
|
] }) }),
|
|
3506
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
3525
|
+
/* @__PURE__ */ p("tbody", { children: d.map((e) => /* @__PURE__ */ m("tr", { children: [
|
|
3507
3526
|
/* @__PURE__ */ p("td", { children: e.label }),
|
|
3508
3527
|
/* @__PURE__ */ p("td", { children: e.stats.min.toFixed(2) }),
|
|
3509
3528
|
/* @__PURE__ */ p("td", { children: e.stats.q1.toFixed(2) }),
|
|
@@ -3514,39 +3533,39 @@ function Dn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3514
3533
|
] }),
|
|
3515
3534
|
className: a,
|
|
3516
3535
|
plain: s,
|
|
3517
|
-
tooltip:
|
|
3518
|
-
if (
|
|
3519
|
-
let n = e -
|
|
3536
|
+
tooltip: d.length > 0 ? ({ width: e, height: t }) => {
|
|
3537
|
+
if (d.length === 0) return;
|
|
3538
|
+
let n = e - l.left - l.right, r = t - l.top - l.bottom;
|
|
3520
3539
|
if (n <= 0) return;
|
|
3521
|
-
let i = _(
|
|
3540
|
+
let i = _(d.map((e) => e.id), [0, n], .3), a = (y - v) * .05 || 1, o = h([v - a, y + a], [r, 0]);
|
|
3522
3541
|
return {
|
|
3523
|
-
points:
|
|
3542
|
+
points: d.map((e) => {
|
|
3524
3543
|
let t = (i.map(e.id) ?? 0) + i.bandwidth / 2;
|
|
3525
3544
|
return {
|
|
3526
3545
|
id: e.id,
|
|
3527
|
-
cx:
|
|
3528
|
-
cy:
|
|
3546
|
+
cx: l.left + t,
|
|
3547
|
+
cy: l.top + o.map(e.stats.median),
|
|
3529
3548
|
label: e.label,
|
|
3530
3549
|
value: e.stats.median
|
|
3531
3550
|
};
|
|
3532
3551
|
}),
|
|
3533
3552
|
format: (e) => {
|
|
3534
|
-
let t =
|
|
3553
|
+
let t = d.find((t) => t.id === e.id);
|
|
3535
3554
|
return t ? `${t.label}: min ${t.stats.min.toFixed(2)} / Q1 ${t.stats.q1.toFixed(2)} / med ${t.stats.median.toFixed(2)} / Q3 ${t.stats.q3.toFixed(2)} / max ${t.stats.max.toFixed(2)}` : `${e.label}: ${e.value}`;
|
|
3536
3555
|
}
|
|
3537
3556
|
};
|
|
3538
3557
|
} : void 0,
|
|
3539
3558
|
children: ({ width: e, height: t }) => {
|
|
3540
3559
|
let n = {
|
|
3541
|
-
width: e -
|
|
3542
|
-
height: t -
|
|
3560
|
+
width: e - l.left - l.right,
|
|
3561
|
+
height: t - l.top - l.bottom
|
|
3543
3562
|
};
|
|
3544
|
-
if (n.width <= 0 ||
|
|
3545
|
-
let r = _(
|
|
3563
|
+
if (n.width <= 0 || d.length === 0) return null;
|
|
3564
|
+
let r = _(d.map((e) => e.id), [0, n.width], .3), i = (y - v) * .05 || 1, a = h([v - i, y + i], [n.height, 0]);
|
|
3546
3565
|
return /* @__PURE__ */ m("g", {
|
|
3547
|
-
transform: `translate(${
|
|
3548
|
-
children: [
|
|
3549
|
-
let n =
|
|
3566
|
+
transform: `translate(${l.left},${l.top})`,
|
|
3567
|
+
children: [d.map((e, t) => {
|
|
3568
|
+
let n = Dn[t % Dn.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
|
|
3550
3569
|
return /* @__PURE__ */ m("g", { children: [
|
|
3551
3570
|
/* @__PURE__ */ p("line", {
|
|
3552
3571
|
x1: i,
|
|
@@ -3611,7 +3630,8 @@ function Dn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3611
3630
|
scale: r,
|
|
3612
3631
|
orientation: "x",
|
|
3613
3632
|
length: n.width,
|
|
3614
|
-
transform: `translate(0,${n.height})
|
|
3633
|
+
transform: `translate(0,${n.height})`,
|
|
3634
|
+
...c ? { format: c } : {}
|
|
3615
3635
|
}), /* @__PURE__ */ p($, {
|
|
3616
3636
|
scale: a,
|
|
3617
3637
|
orientation: "y",
|
|
@@ -3623,15 +3643,15 @@ function Dn({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3623
3643
|
}
|
|
3624
3644
|
//#endregion
|
|
3625
3645
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3626
|
-
var
|
|
3627
|
-
function
|
|
3646
|
+
var kn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), An = 3, jn = 24;
|
|
3647
|
+
function Mn({ series: e, title: t, description: n, width: r, height: a, tooltip: s, className: c, plain: l, glyph: u, format: d }) {
|
|
3628
3648
|
o();
|
|
3629
|
-
let
|
|
3649
|
+
let g = i(null), _ = l ? Ue : He, y = a ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? B(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? B(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? B(b.map((e) => e.size)) : [0, 1], D = v([T, E], [An, jn]), O = b.length > 0;
|
|
3630
3650
|
return /* @__PURE__ */ p(Q, {
|
|
3631
3651
|
title: t,
|
|
3632
3652
|
description: n,
|
|
3633
3653
|
width: r,
|
|
3634
|
-
height:
|
|
3654
|
+
height: y,
|
|
3635
3655
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3636
3656
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3637
3657
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3649,18 +3669,18 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3649
3669
|
] }),
|
|
3650
3670
|
className: c,
|
|
3651
3671
|
plain: l,
|
|
3652
|
-
tooltip: s !== !1 &&
|
|
3653
|
-
if (s === !1 || !
|
|
3672
|
+
tooltip: s !== !1 && O ? ({ width: t, height: n }) => {
|
|
3673
|
+
if (s === !1 || !O) return;
|
|
3654
3674
|
let r = {
|
|
3655
|
-
width: t -
|
|
3656
|
-
height: n -
|
|
3675
|
+
width: t - _.left - _.right,
|
|
3676
|
+
height: n - _.top - _.bottom
|
|
3657
3677
|
};
|
|
3658
3678
|
if (r.width <= 0) return;
|
|
3659
|
-
let i = (
|
|
3679
|
+
let i = (S - x) * .05 || 1, a = (w - C) * .05 || 1, o = h([x - i, S + i], [0, r.width]), c = h([C - a, w + a], [r.height, 0]);
|
|
3660
3680
|
return { points: e.flatMap((e, t) => e.data.map((n, r) => ({
|
|
3661
3681
|
id: `${t}-${r}`,
|
|
3662
|
-
cx:
|
|
3663
|
-
cy:
|
|
3682
|
+
cx: _.left + o.map(n.x),
|
|
3683
|
+
cy: _.top + c.map(n.y),
|
|
3664
3684
|
label: `${e.name} (${n.x}, ${n.y})`,
|
|
3665
3685
|
value: n.y,
|
|
3666
3686
|
seriesId: e.name
|
|
@@ -3669,13 +3689,13 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3669
3689
|
hover: "voronoi",
|
|
3670
3690
|
children: ({ width: t, height: n }) => {
|
|
3671
3691
|
let r = {
|
|
3672
|
-
width: t -
|
|
3673
|
-
height: n -
|
|
3692
|
+
width: t - _.left - _.right,
|
|
3693
|
+
height: n - _.top - _.bottom
|
|
3674
3694
|
};
|
|
3675
|
-
if (r.width <= 0 ||
|
|
3676
|
-
let i = (
|
|
3695
|
+
if (r.width <= 0 || b.length === 0) return null;
|
|
3696
|
+
let i = (S - x) * .05 || 1, a = (w - C) * .05 || 1, o = h([x - i, S + i], [0, r.width]), s = h([C - a, w + a], [r.height, 0]);
|
|
3677
3697
|
return /* @__PURE__ */ m("g", {
|
|
3678
|
-
transform: `translate(${
|
|
3698
|
+
transform: `translate(${_.left},${_.top})`,
|
|
3679
3699
|
children: [
|
|
3680
3700
|
!l && /* @__PURE__ */ p(vt, {
|
|
3681
3701
|
scale: s,
|
|
@@ -3683,14 +3703,14 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3683
3703
|
length: r.width
|
|
3684
3704
|
}),
|
|
3685
3705
|
e.map((e, t) => {
|
|
3686
|
-
let n =
|
|
3706
|
+
let n = kn[t % kn.length] ?? "var(--cascivo-chart-1)";
|
|
3687
3707
|
return /* @__PURE__ */ p("g", {
|
|
3688
|
-
opacity:
|
|
3708
|
+
opacity: g.value !== null && g.value !== e.name ? .2 : 1,
|
|
3689
3709
|
onMouseEnter: () => {
|
|
3690
|
-
|
|
3710
|
+
g.value = e.name;
|
|
3691
3711
|
},
|
|
3692
3712
|
onMouseLeave: () => {
|
|
3693
|
-
|
|
3713
|
+
g.value = null;
|
|
3694
3714
|
},
|
|
3695
3715
|
children: e.data.map((t, r) => {
|
|
3696
3716
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
@@ -3698,7 +3718,7 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3698
3718
|
shape: i,
|
|
3699
3719
|
x: o.map(t.x),
|
|
3700
3720
|
y: s.map(t.y),
|
|
3701
|
-
size:
|
|
3721
|
+
size: D(t.size) * 2,
|
|
3702
3722
|
color: n,
|
|
3703
3723
|
opacity: .6,
|
|
3704
3724
|
stroke: n,
|
|
@@ -3706,7 +3726,7 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3706
3726
|
}) }, r) : /* @__PURE__ */ p("circle", {
|
|
3707
3727
|
cx: o.map(t.x),
|
|
3708
3728
|
cy: s.map(t.y),
|
|
3709
|
-
r:
|
|
3729
|
+
r: D(t.size),
|
|
3710
3730
|
fill: n,
|
|
3711
3731
|
fillOpacity: .6,
|
|
3712
3732
|
stroke: n,
|
|
@@ -3719,7 +3739,8 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3719
3739
|
scale: o,
|
|
3720
3740
|
orientation: "x",
|
|
3721
3741
|
length: r.width,
|
|
3722
|
-
transform: `translate(0,${r.height})
|
|
3742
|
+
transform: `translate(0,${r.height})`,
|
|
3743
|
+
...d ? { format: d } : {}
|
|
3723
3744
|
}), /* @__PURE__ */ p($, {
|
|
3724
3745
|
scale: s,
|
|
3725
3746
|
orientation: "y",
|
|
@@ -3732,18 +3753,18 @@ function jn({ series: e, title: t, description: n, width: r, height: a, tooltip:
|
|
|
3732
3753
|
}
|
|
3733
3754
|
//#endregion
|
|
3734
3755
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3735
|
-
var
|
|
3736
|
-
function
|
|
3756
|
+
var Nn = "var(--cascivo-chart-1)", Pn = "var(--cascivo-chart-2)";
|
|
3757
|
+
function Fn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, barsLabel: s = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: g, tooltip: v, className: y, plain: b, annotations: x, format: S }) {
|
|
3737
3758
|
o();
|
|
3738
|
-
let
|
|
3759
|
+
let C = i(/* @__PURE__ */ new Set()), w = g ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, D = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, O = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, ee = e.length > 0, k = b ? !1 : l ?? (e.length > 0 && t.length > 0);
|
|
3739
3760
|
t.length > 0 && e.length > 0 && t.length !== e.length && tn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !a && t.length > 0 && e.length > 0 && nn("ComboChart", [{
|
|
3740
3761
|
label: s,
|
|
3741
|
-
max:
|
|
3762
|
+
max: T
|
|
3742
3763
|
}, {
|
|
3743
3764
|
label: c,
|
|
3744
|
-
max:
|
|
3765
|
+
max: O
|
|
3745
3766
|
}]);
|
|
3746
|
-
let A = h([0,
|
|
3767
|
+
let A = h([0, T], [0, 1]).ticks(5).map((e) => e.toLocaleString()), j = a ? h([D, O || D + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], te = e.map((e) => e.label), M = b ? Ue : {
|
|
3747
3768
|
...He,
|
|
3748
3769
|
left: Ge(A, b),
|
|
3749
3770
|
right: Ke({
|
|
@@ -3762,7 +3783,7 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3762
3783
|
title: n,
|
|
3763
3784
|
description: r,
|
|
3764
3785
|
width: d,
|
|
3765
|
-
height:
|
|
3786
|
+
height: w,
|
|
3766
3787
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3767
3788
|
/* @__PURE__ */ p("caption", { children: n }),
|
|
3768
3789
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3777,17 +3798,17 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3777
3798
|
] }, e.label)) })
|
|
3778
3799
|
] }),
|
|
3779
3800
|
plain: b,
|
|
3780
|
-
tooltip: v !== !1 &&
|
|
3781
|
-
if (v === !1 || !
|
|
3801
|
+
tooltip: v !== !1 && ee ? ({ width: n, height: r }) => {
|
|
3802
|
+
if (v === !1 || !ee) return;
|
|
3782
3803
|
let i = {
|
|
3783
|
-
width: n -
|
|
3784
|
-
height: r -
|
|
3804
|
+
width: n - M.left - M.right,
|
|
3805
|
+
height: r - M.top - M.bottom
|
|
3785
3806
|
};
|
|
3786
3807
|
if (i.width <= 0) return;
|
|
3787
|
-
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0,
|
|
3808
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, T], [i.height, 0]), c = a ? h([D, O || D + 1], [i.height, 0]) : s, l = e.map((e, t) => ({
|
|
3788
3809
|
id: `bar-${t}`,
|
|
3789
|
-
cx:
|
|
3790
|
-
cy:
|
|
3810
|
+
cx: M.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
|
|
3811
|
+
cy: M.top + s.map(e.value),
|
|
3791
3812
|
label: e.label,
|
|
3792
3813
|
value: e.value,
|
|
3793
3814
|
seriesId: "bars"
|
|
@@ -3795,8 +3816,8 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3795
3816
|
let a = e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1);
|
|
3796
3817
|
return {
|
|
3797
3818
|
id: `line-${r}`,
|
|
3798
|
-
cx:
|
|
3799
|
-
cy:
|
|
3819
|
+
cx: M.left + a,
|
|
3820
|
+
cy: M.top + c.map(n.y),
|
|
3800
3821
|
label: e[r]?.label ?? String(n.x),
|
|
3801
3822
|
value: n.y,
|
|
3802
3823
|
seriesId: "line"
|
|
@@ -3806,13 +3827,13 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3806
3827
|
} : void 0,
|
|
3807
3828
|
children: ({ width: n, height: r }) => {
|
|
3808
3829
|
let i = {
|
|
3809
|
-
width: n -
|
|
3810
|
-
height: r -
|
|
3830
|
+
width: n - M.left - M.right,
|
|
3831
|
+
height: r - M.top - M.bottom
|
|
3811
3832
|
};
|
|
3812
3833
|
if (i.width <= 0 || e.length === 0) return null;
|
|
3813
|
-
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0,
|
|
3834
|
+
let o = _(e.map((e) => e.label), [0, i.width], .2), s = h([0, T], [i.height, 0]), c = a ? h([D, O || D + 1], [i.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : i.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? E(l, "monotone") : "", g = u ?? qe(te, i.width), v = C.value.has("bars"), y = C.value.has("line");
|
|
3814
3835
|
return /* @__PURE__ */ m("g", {
|
|
3815
|
-
transform: `translate(${
|
|
3836
|
+
transform: `translate(${M.left},${M.top})`,
|
|
3816
3837
|
children: [
|
|
3817
3838
|
!b && /* @__PURE__ */ p(vt, {
|
|
3818
3839
|
scale: s,
|
|
@@ -3832,14 +3853,14 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3832
3853
|
y: n,
|
|
3833
3854
|
width: o.bandwidth,
|
|
3834
3855
|
height: Math.max(0, i.height - n),
|
|
3835
|
-
fill:
|
|
3856
|
+
fill: Nn,
|
|
3836
3857
|
opacity: .75
|
|
3837
3858
|
}, e.label);
|
|
3838
3859
|
}),
|
|
3839
3860
|
d && !y && /* @__PURE__ */ p("path", {
|
|
3840
3861
|
d,
|
|
3841
3862
|
fill: "none",
|
|
3842
|
-
stroke:
|
|
3863
|
+
stroke: Pn,
|
|
3843
3864
|
strokeWidth: 2.5,
|
|
3844
3865
|
strokeLinejoin: "round",
|
|
3845
3866
|
strokeLinecap: "round"
|
|
@@ -3850,7 +3871,8 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3850
3871
|
orientation: "x",
|
|
3851
3872
|
length: i.width,
|
|
3852
3873
|
labelEvery: g,
|
|
3853
|
-
transform: `translate(0,${i.height})
|
|
3874
|
+
transform: `translate(0,${i.height})`,
|
|
3875
|
+
...S ? { format: S } : {}
|
|
3854
3876
|
}),
|
|
3855
3877
|
/* @__PURE__ */ p($, {
|
|
3856
3878
|
scale: s,
|
|
@@ -3871,30 +3893,30 @@ function Pn({ bars: e, line: t, title: n, description: r, secondAxis: a = !1, ba
|
|
|
3871
3893
|
series: [{
|
|
3872
3894
|
id: "bars",
|
|
3873
3895
|
label: s,
|
|
3874
|
-
color:
|
|
3896
|
+
color: Nn
|
|
3875
3897
|
}, ...t.length > 0 ? [{
|
|
3876
3898
|
id: "line",
|
|
3877
3899
|
label: c,
|
|
3878
|
-
color:
|
|
3900
|
+
color: Pn
|
|
3879
3901
|
}] : []],
|
|
3880
|
-
hidden:
|
|
3902
|
+
hidden: C
|
|
3881
3903
|
})]
|
|
3882
3904
|
});
|
|
3883
3905
|
}
|
|
3884
3906
|
//#endregion
|
|
3885
3907
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3886
|
-
function
|
|
3908
|
+
function In({ data: e, title: t, description: n, width: r, height: a, className: s, plain: c, visualMap: l, toolbox: u, format: d }) {
|
|
3887
3909
|
o();
|
|
3888
|
-
let
|
|
3910
|
+
let h = a ?? (c ? 48 : 320), g = c ? Ue : {
|
|
3889
3911
|
top: 20,
|
|
3890
3912
|
right: 20,
|
|
3891
3913
|
bottom: 60,
|
|
3892
3914
|
left: 60
|
|
3893
|
-
},
|
|
3915
|
+
}, v = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? B(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = i([l?.min ?? b, l?.max ?? x]), T = i(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ p(Q, {
|
|
3894
3916
|
title: t,
|
|
3895
3917
|
description: n,
|
|
3896
3918
|
width: r,
|
|
3897
|
-
height:
|
|
3919
|
+
height: h,
|
|
3898
3920
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
3899
3921
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
3900
3922
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -3912,15 +3934,15 @@ function Fn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3912
3934
|
plain: c,
|
|
3913
3935
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
3914
3936
|
if (e.length === 0) return;
|
|
3915
|
-
let r = t -
|
|
3937
|
+
let r = t - g.left - g.right, i = n - g.top - g.bottom;
|
|
3916
3938
|
if (r <= 0) return;
|
|
3917
|
-
let a = _(
|
|
3939
|
+
let a = _(v, [0, r], .05), o = _(y, [0, i], .05);
|
|
3918
3940
|
return { points: e.map((e, t) => {
|
|
3919
3941
|
let n = a.map(e.x) ?? 0, r = o.map(e.y) ?? 0;
|
|
3920
3942
|
return {
|
|
3921
3943
|
id: `cell-${t}`,
|
|
3922
|
-
cx:
|
|
3923
|
-
cy:
|
|
3944
|
+
cx: g.left + n + a.bandwidth / 2,
|
|
3945
|
+
cy: g.top + r + o.bandwidth / 2,
|
|
3924
3946
|
label: `${e.x}×${e.y}`,
|
|
3925
3947
|
value: e.value
|
|
3926
3948
|
};
|
|
@@ -3928,19 +3950,19 @@ function Fn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3928
3950
|
} : void 0,
|
|
3929
3951
|
toolbox: u,
|
|
3930
3952
|
onRestore: l ? () => {
|
|
3931
|
-
|
|
3953
|
+
w.value = [l.min, l.max], T.value = /* @__PURE__ */ new Set();
|
|
3932
3954
|
} : void 0,
|
|
3933
3955
|
children: ({ width: t, height: n }) => {
|
|
3934
3956
|
let r = {
|
|
3935
|
-
width: t -
|
|
3936
|
-
height: n -
|
|
3957
|
+
width: t - g.left - g.right,
|
|
3958
|
+
height: n - g.top - g.bottom
|
|
3937
3959
|
};
|
|
3938
3960
|
if (r.width <= 0 || e.length === 0) return null;
|
|
3939
|
-
let i = _(
|
|
3961
|
+
let i = _(v, [0, r.width], .05), a = _(y, [0, r.height], .05);
|
|
3940
3962
|
return /* @__PURE__ */ m("g", {
|
|
3941
|
-
transform: `translate(${
|
|
3963
|
+
transform: `translate(${g.left},${g.top})`,
|
|
3942
3964
|
children: [e.map((e, t) => {
|
|
3943
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(
|
|
3965
|
+
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(C(e.value) * 100), s = l ? qt(e.value, l).color ?? "var(--cascivo-chart-1)" : `color-mix(in oklab, var(--cascivo-chart-1) ${o}%, var(--cascivo-color-neutral-100))`, c = l ? Jt(e.value, l, w.value, T.value) : !0;
|
|
3944
3966
|
return /* @__PURE__ */ p("rect", {
|
|
3945
3967
|
x: n,
|
|
3946
3968
|
y: r,
|
|
@@ -3955,7 +3977,8 @@ function Fn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3955
3977
|
scale: i,
|
|
3956
3978
|
orientation: "x",
|
|
3957
3979
|
length: r.width,
|
|
3958
|
-
transform: `translate(0,${r.height})
|
|
3980
|
+
transform: `translate(0,${r.height})`,
|
|
3981
|
+
...d ? { format: d } : {}
|
|
3959
3982
|
}), /* @__PURE__ */ p($, {
|
|
3960
3983
|
scale: a,
|
|
3961
3984
|
orientation: "y",
|
|
@@ -3964,24 +3987,24 @@ function Fn({ data: e, title: t, description: n, width: r, height: a, className:
|
|
|
3964
3987
|
});
|
|
3965
3988
|
}
|
|
3966
3989
|
});
|
|
3967
|
-
return !l || e.length === 0 ?
|
|
3990
|
+
return !l || e.length === 0 ? E : /* @__PURE__ */ m("div", {
|
|
3968
3991
|
style: {
|
|
3969
3992
|
display: "flex",
|
|
3970
3993
|
flexDirection: "column",
|
|
3971
3994
|
gap: "0.5rem"
|
|
3972
3995
|
},
|
|
3973
|
-
children: [
|
|
3996
|
+
children: [E, /* @__PURE__ */ p(Yt, {
|
|
3974
3997
|
options: l,
|
|
3975
|
-
range:
|
|
3976
|
-
hidden:
|
|
3998
|
+
range: w,
|
|
3999
|
+
hidden: T,
|
|
3977
4000
|
label: t
|
|
3978
4001
|
})]
|
|
3979
4002
|
});
|
|
3980
4003
|
}
|
|
3981
4004
|
//#endregion
|
|
3982
4005
|
//#region src/charts/treemap/treemap.tsx
|
|
3983
|
-
var
|
|
3984
|
-
function
|
|
4006
|
+
var Ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4007
|
+
function Rn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: c }) {
|
|
3985
4008
|
o();
|
|
3986
4009
|
let l = s();
|
|
3987
4010
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -3997,7 +4020,7 @@ function Ln({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3997
4020
|
className: a,
|
|
3998
4021
|
plain: c,
|
|
3999
4022
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
4000
|
-
if (e.length !== 0) return { points:
|
|
4023
|
+
if (e.length !== 0) return { points: W(e.map((e) => ({
|
|
4001
4024
|
id: e.id,
|
|
4002
4025
|
value: e.value
|
|
4003
4026
|
})), t, n).map((t) => {
|
|
@@ -4013,7 +4036,7 @@ function Ln({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4013
4036
|
} : void 0,
|
|
4014
4037
|
children: ({ width: t, height: n }) => {
|
|
4015
4038
|
if (e.length === 0) return null;
|
|
4016
|
-
let r =
|
|
4039
|
+
let r = W(e.map((e) => ({
|
|
4017
4040
|
id: e.id,
|
|
4018
4041
|
value: e.value
|
|
4019
4042
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -4026,7 +4049,7 @@ function Ln({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4026
4049
|
height: Math.max(0, e.h - 4)
|
|
4027
4050
|
})
|
|
4028
4051
|
}, e.id)) }), r.map((e, t) => {
|
|
4029
|
-
let n =
|
|
4052
|
+
let n = Ln[t % Ln.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
4030
4053
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("rect", {
|
|
4031
4054
|
x: e.x,
|
|
4032
4055
|
y: e.y,
|
|
@@ -4050,8 +4073,8 @@ function Ln({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4050
4073
|
}
|
|
4051
4074
|
//#endregion
|
|
4052
4075
|
//#region src/charts/radar/radar.tsx
|
|
4053
|
-
var
|
|
4054
|
-
function
|
|
4076
|
+
var zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Bn = 4;
|
|
4077
|
+
function Vn(e, t, n, r, i) {
|
|
4055
4078
|
let a = e.length;
|
|
4056
4079
|
return e.map((e, o) => {
|
|
4057
4080
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
@@ -4061,7 +4084,7 @@ function Bn(e, t, n, r, i) {
|
|
|
4061
4084
|
};
|
|
4062
4085
|
});
|
|
4063
4086
|
}
|
|
4064
|
-
function
|
|
4087
|
+
function Hn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: s, className: c, plain: l }) {
|
|
4065
4088
|
let u = s ?? (l ? 48 : 320);
|
|
4066
4089
|
o();
|
|
4067
4090
|
let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), h = e.length;
|
|
@@ -4093,7 +4116,7 @@ function Vn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4093
4116
|
})) };
|
|
4094
4117
|
} : void 0,
|
|
4095
4118
|
children: ({ width: n, height: r }) => {
|
|
4096
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4119
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Bn }, (e, t) => (t + 1) / Bn * o), c = Array.from({ length: h }, (e, t) => {
|
|
4097
4120
|
let n = t / h * 2 * Math.PI - Math.PI / 2;
|
|
4098
4121
|
return {
|
|
4099
4122
|
x: w(i + Math.cos(n) * o),
|
|
@@ -4131,7 +4154,7 @@ function Vn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4131
4154
|
}, n);
|
|
4132
4155
|
}),
|
|
4133
4156
|
t.map((e, t) => {
|
|
4134
|
-
let n =
|
|
4157
|
+
let n = Vn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = zn[t % zn.length] ?? "var(--cascivo-chart-1)";
|
|
4135
4158
|
return /* @__PURE__ */ p("polygon", {
|
|
4136
4159
|
points: n,
|
|
4137
4160
|
fill: r,
|
|
@@ -4146,12 +4169,12 @@ function Vn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4146
4169
|
}
|
|
4147
4170
|
//#endregion
|
|
4148
4171
|
//#region src/charts/bullet/bullet.tsx
|
|
4149
|
-
var
|
|
4172
|
+
var Un = [
|
|
4150
4173
|
"var(--cascivo-color-neutral-200)",
|
|
4151
4174
|
"var(--cascivo-color-neutral-300)",
|
|
4152
4175
|
"var(--cascivo-color-neutral-400)"
|
|
4153
4176
|
];
|
|
4154
|
-
function
|
|
4177
|
+
function Wn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: s = 300, height: c = 40, className: l }) {
|
|
4155
4178
|
o();
|
|
4156
4179
|
let u = [...n].sort((e, t) => e - t), d = h([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, s]), g = c * .35, _ = (c - g) / 2, v = c * .7, y = (c - v) / 2;
|
|
4157
4180
|
return /* @__PURE__ */ m("figure", {
|
|
@@ -4178,7 +4201,7 @@ function Un({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4178
4201
|
y: 0,
|
|
4179
4202
|
width: Math.max(0, r),
|
|
4180
4203
|
height: c,
|
|
4181
|
-
fill:
|
|
4204
|
+
fill: Un[t % Un.length] ?? "var(--cascivo-color-neutral-200)"
|
|
4182
4205
|
}, t);
|
|
4183
4206
|
}),
|
|
4184
4207
|
/* @__PURE__ */ p("rect", {
|
|
@@ -4205,8 +4228,8 @@ function Un({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4205
4228
|
}
|
|
4206
4229
|
//#endregion
|
|
4207
4230
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4208
|
-
var
|
|
4209
|
-
function
|
|
4231
|
+
var Gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4232
|
+
function Kn({ data: e, title: t, description: n, size: r, width: a, height: s, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: h, legend: g, className: _, plain: v }) {
|
|
4210
4233
|
o();
|
|
4211
4234
|
let y = i(/* @__PURE__ */ new Set()), b = a ?? r, x = s ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, T = c ?? Math.max(1, ...e.map((e) => e.value)), E = Math.min(360, Math.max(0, l)) * Math.PI / 180, D = -E / 2, O = (t, n) => {
|
|
4212
4235
|
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));
|
|
@@ -4218,7 +4241,7 @@ function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4218
4241
|
span: s.length > 0 ? (a - o) / s.length : 0,
|
|
4219
4242
|
visible: s
|
|
4220
4243
|
};
|
|
4221
|
-
},
|
|
4244
|
+
}, ee = ({ width: e, height: t }) => {
|
|
4222
4245
|
if (h === !1 || !C) return;
|
|
4223
4246
|
let { cx: n, cy: r, maxR: i, span: a, visible: o } = O(e, t);
|
|
4224
4247
|
return { points: o.map((e, t) => {
|
|
@@ -4231,14 +4254,14 @@ function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4231
4254
|
value: e.value,
|
|
4232
4255
|
seriesId: e.id,
|
|
4233
4256
|
percent: T > 0 ? e.value / T * 100 : 0,
|
|
4234
|
-
color: e.color ??
|
|
4257
|
+
color: e.color ?? Gn[t % Gn.length]
|
|
4235
4258
|
};
|
|
4236
4259
|
}) };
|
|
4237
|
-
},
|
|
4260
|
+
}, k = /* @__PURE__ */ m("table", { children: [
|
|
4238
4261
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4239
4262
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Label" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4240
4263
|
/* @__PURE__ */ p("tbody", { children: e.map((e) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: e.label }), /* @__PURE__ */ p("td", { children: e.value })] }, e.id)) })
|
|
4241
|
-
] }),
|
|
4264
|
+
] }), A = u != null || d != null || f != null;
|
|
4242
4265
|
return /* @__PURE__ */ m("div", {
|
|
4243
4266
|
style: {
|
|
4244
4267
|
display: "flex",
|
|
@@ -4250,27 +4273,27 @@ function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4250
4273
|
description: n,
|
|
4251
4274
|
width: b,
|
|
4252
4275
|
height: x,
|
|
4253
|
-
fallback:
|
|
4276
|
+
fallback: k,
|
|
4254
4277
|
className: _,
|
|
4255
4278
|
"data-state": C ? void 0 : "empty",
|
|
4256
4279
|
plain: v,
|
|
4257
|
-
tooltip: h !== !1 && C ?
|
|
4280
|
+
tooltip: h !== !1 && C ? ee : void 0,
|
|
4258
4281
|
children: ({ width: e, height: t }) => {
|
|
4259
4282
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4260
4283
|
return /* @__PURE__ */ m("g", { children: [s.map((e, t) => {
|
|
4261
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4284
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Gn[t % Gn.length], l = Math.max(0, Math.min(1, e.value / T)), u = D + E * l;
|
|
4262
4285
|
return /* @__PURE__ */ m("g", {
|
|
4263
4286
|
"data-series": e.id,
|
|
4264
4287
|
children: [/* @__PURE__ */ p("path", {
|
|
4265
|
-
d:
|
|
4288
|
+
d: N(n, r, a, s, D, D + E),
|
|
4266
4289
|
fill: "var(--cascivo-chart-grid)",
|
|
4267
4290
|
fillOpacity: .35
|
|
4268
4291
|
}), l > 0 && /* @__PURE__ */ p("path", {
|
|
4269
|
-
d:
|
|
4292
|
+
d: N(n, r, a, s, D, u),
|
|
4270
4293
|
fill: c
|
|
4271
4294
|
})]
|
|
4272
4295
|
}, e.id);
|
|
4273
|
-
}), !v &&
|
|
4296
|
+
}), !v && A && (f == null ? /* @__PURE__ */ m("g", {
|
|
4274
4297
|
"data-center": "",
|
|
4275
4298
|
children: [u != null && /* @__PURE__ */ p("text", {
|
|
4276
4299
|
x: n,
|
|
@@ -4314,7 +4337,7 @@ function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4314
4337
|
series: e.map((e, t) => ({
|
|
4315
4338
|
id: e.id,
|
|
4316
4339
|
label: e.label,
|
|
4317
|
-
color: e.color ??
|
|
4340
|
+
color: e.color ?? Gn[t % Gn.length]
|
|
4318
4341
|
})),
|
|
4319
4342
|
hidden: y
|
|
4320
4343
|
})]
|
|
@@ -4322,8 +4345,8 @@ function Gn({ data: e, title: t, description: n, size: r, width: a, height: s, m
|
|
|
4322
4345
|
}
|
|
4323
4346
|
//#endregion
|
|
4324
4347
|
//#region src/charts/funnel/funnel.tsx
|
|
4325
|
-
var
|
|
4326
|
-
function
|
|
4348
|
+
var qn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4349
|
+
function Jn({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: s, className: c, plain: l }) {
|
|
4327
4350
|
o();
|
|
4328
4351
|
let u = l ? Ue : He, d = i ?? (l ? 48 : 320), f = e.length > 0, g = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4329
4352
|
return /* @__PURE__ */ p(Q, {
|
|
@@ -4359,7 +4382,7 @@ function qn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4359
4382
|
value: e.value,
|
|
4360
4383
|
seriesId: e.id,
|
|
4361
4384
|
percent: g > 0 ? e.value / g * 100 : 0,
|
|
4362
|
-
color: e.color ??
|
|
4385
|
+
color: e.color ?? qn[t % qn.length]
|
|
4363
4386
|
})),
|
|
4364
4387
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4365
4388
|
};
|
|
@@ -4369,7 +4392,7 @@ function qn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4369
4392
|
if (r <= 0 || e.length === 0) return null;
|
|
4370
4393
|
let o = i / e.length, s = h([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4371
4394
|
return /* @__PURE__ */ p("g", { children: e.map((t, n) => {
|
|
4372
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ??
|
|
4395
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, h = f + o * (r ? 1 : .9), _ = t.color ?? qn[n % qn.length], v = [
|
|
4373
4396
|
[d - i, f],
|
|
4374
4397
|
[d + i, f],
|
|
4375
4398
|
[d + s, h],
|
|
@@ -4394,10 +4417,10 @@ function qn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4394
4417
|
}
|
|
4395
4418
|
//#endregion
|
|
4396
4419
|
//#region src/charts/stream/stream.tsx
|
|
4397
|
-
var
|
|
4398
|
-
function
|
|
4420
|
+
var Yn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4421
|
+
function Xn({ series: e, categories: t, title: n, description: r, offset: a = "silhouette", curve: s = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: g, format: v }) {
|
|
4399
4422
|
o();
|
|
4400
|
-
let
|
|
4423
|
+
let y = i(/* @__PURE__ */ new Set()), b = g ? Ue : He, x = l ?? (g ? 48 : 300), S = g ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = G(e.map((e) => e.values), a), [T, D] = K(w);
|
|
4401
4424
|
return /* @__PURE__ */ m("div", {
|
|
4402
4425
|
style: {
|
|
4403
4426
|
display: "flex",
|
|
@@ -4408,44 +4431,44 @@ function Yn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4408
4431
|
title: n,
|
|
4409
4432
|
description: r,
|
|
4410
4433
|
width: c,
|
|
4411
|
-
height:
|
|
4434
|
+
height: x,
|
|
4412
4435
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4413
4436
|
/* @__PURE__ */ p("caption", { children: n }),
|
|
4414
4437
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ p("th", { children: e.label }, e.id))] }) }),
|
|
4415
4438
|
/* @__PURE__ */ p("tbody", { children: t.map((t, n) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: String(t) }), e.map((e) => /* @__PURE__ */ p("td", { children: e.values[n] ?? "" }, e.id))] }, String(t))) })
|
|
4416
4439
|
] }),
|
|
4417
4440
|
className: f,
|
|
4418
|
-
"data-state":
|
|
4441
|
+
"data-state": C ? void 0 : "empty",
|
|
4419
4442
|
plain: g,
|
|
4420
|
-
tooltip: d &&
|
|
4421
|
-
if (!d || !
|
|
4422
|
-
let i = n -
|
|
4443
|
+
tooltip: d && C ? ({ width: n, height: r }) => {
|
|
4444
|
+
if (!d || !C) return;
|
|
4445
|
+
let i = n - b.left - b.right, a = r - b.top - b.bottom, o = _(t.map(String), [0, i], 0), s = h([T, D], [a, 0]);
|
|
4423
4446
|
return { points: e.flatMap((e, n) => {
|
|
4424
|
-
if (
|
|
4425
|
-
let r =
|
|
4447
|
+
if (y.value.has(e.id)) return [];
|
|
4448
|
+
let r = w[n];
|
|
4426
4449
|
return t.map((t, i) => {
|
|
4427
4450
|
let a = (r[i][0] + r[i][1]) / 2;
|
|
4428
4451
|
return {
|
|
4429
4452
|
id: `${e.id}-${i}`,
|
|
4430
|
-
cx:
|
|
4431
|
-
cy:
|
|
4453
|
+
cx: b.left + (o.map(String(t)) ?? 0) + o.bandwidth / 2,
|
|
4454
|
+
cy: b.top + s.map(a),
|
|
4432
4455
|
label: `${e.label} · ${String(t)}`,
|
|
4433
4456
|
value: e.values[i] ?? 0,
|
|
4434
4457
|
seriesId: e.id,
|
|
4435
|
-
color: e.color ??
|
|
4458
|
+
color: e.color ?? Yn[n % Yn.length]
|
|
4436
4459
|
};
|
|
4437
4460
|
});
|
|
4438
4461
|
}) };
|
|
4439
4462
|
} : void 0,
|
|
4440
4463
|
children: ({ width: n, height: r }) => {
|
|
4441
|
-
let i = n -
|
|
4442
|
-
if (i <= 0 || !
|
|
4443
|
-
let o = _(t.map(String), [0, i], 0), c = h([
|
|
4464
|
+
let i = n - b.left - b.right, a = r - b.top - b.bottom;
|
|
4465
|
+
if (i <= 0 || !C) return null;
|
|
4466
|
+
let o = _(t.map(String), [0, i], 0), c = h([T, D], [a, 0]), l = (e) => (o.map(String(t[e])) ?? 0) + o.bandwidth / 2;
|
|
4444
4467
|
return /* @__PURE__ */ m("g", {
|
|
4445
|
-
transform: `translate(${
|
|
4468
|
+
transform: `translate(${b.left},${b.top})`,
|
|
4446
4469
|
children: [e.map((e, n) => {
|
|
4447
|
-
if (
|
|
4448
|
-
let r =
|
|
4470
|
+
if (y.value.has(e.id)) return null;
|
|
4471
|
+
let r = w[n], i = e.color ?? Yn[n % Yn.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])]);
|
|
4449
4472
|
return /* @__PURE__ */ p("path", {
|
|
4450
4473
|
d: `${E(a, s)}${E([...o].reverse(), s).replace(/^M/, "L")}Z`,
|
|
4451
4474
|
fill: i,
|
|
@@ -4456,26 +4479,27 @@ function Yn({ series: e, categories: t, title: n, description: r, offset: a = "s
|
|
|
4456
4479
|
scale: o,
|
|
4457
4480
|
orientation: "x",
|
|
4458
4481
|
length: i,
|
|
4459
|
-
transform: `translate(0,${a})
|
|
4482
|
+
transform: `translate(0,${a})`,
|
|
4483
|
+
...v ? { format: v } : {}
|
|
4460
4484
|
})]
|
|
4461
4485
|
});
|
|
4462
4486
|
}
|
|
4463
|
-
}),
|
|
4487
|
+
}), S && /* @__PURE__ */ p(Zt, {
|
|
4464
4488
|
series: e.map((e, t) => ({
|
|
4465
4489
|
id: e.id,
|
|
4466
4490
|
label: e.label,
|
|
4467
|
-
color: e.color ??
|
|
4491
|
+
color: e.color ?? Yn[t % Yn.length]
|
|
4468
4492
|
})),
|
|
4469
|
-
hidden:
|
|
4493
|
+
hidden: y
|
|
4470
4494
|
})]
|
|
4471
4495
|
});
|
|
4472
4496
|
}
|
|
4473
4497
|
//#endregion
|
|
4474
4498
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4475
|
-
var
|
|
4476
|
-
function
|
|
4499
|
+
var Zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4500
|
+
function Qn({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4477
4501
|
o();
|
|
4478
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f =
|
|
4502
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = q(e), h = f > 0, g = J(e), _ = Math.max(1, Y(g));
|
|
4479
4503
|
return /* @__PURE__ */ p(Q, {
|
|
4480
4504
|
title: t,
|
|
4481
4505
|
description: n,
|
|
@@ -4502,7 +4526,7 @@ function Zn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4502
4526
|
label: e.node.label,
|
|
4503
4527
|
value: e.value,
|
|
4504
4528
|
percent: f > 0 ? e.value / f * 100 : 0,
|
|
4505
|
-
color: e.node.color ??
|
|
4529
|
+
color: e.node.color ?? Zn[t % Zn.length]
|
|
4506
4530
|
};
|
|
4507
4531
|
}),
|
|
4508
4532
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4511,9 +4535,9 @@ function Zn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4511
4535
|
children: ({ width: e, height: t }) => {
|
|
4512
4536
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4513
4537
|
return /* @__PURE__ */ p("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4514
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4538
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? Zn[t % Zn.length];
|
|
4515
4539
|
return /* @__PURE__ */ p("path", {
|
|
4516
|
-
d:
|
|
4540
|
+
d: N(n, r, o, a, e.a0, e.a1),
|
|
4517
4541
|
fill: s,
|
|
4518
4542
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4519
4543
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4526,10 +4550,10 @@ function Zn({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4526
4550
|
}
|
|
4527
4551
|
//#endregion
|
|
4528
4552
|
//#region src/charts/sankey/sankey.tsx
|
|
4529
|
-
var
|
|
4530
|
-
function
|
|
4553
|
+
var $n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4554
|
+
function er({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: s, className: c, plain: l }) {
|
|
4531
4555
|
o();
|
|
4532
|
-
let u = l ? Ue : He, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ??
|
|
4556
|
+
let u = l ? Ue : He, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, h = (t, n) => e.find((e) => e.id === t)?.color ?? $n[n % $n.length];
|
|
4533
4557
|
return /* @__PURE__ */ p(Q, {
|
|
4534
4558
|
title: n,
|
|
4535
4559
|
description: r,
|
|
@@ -4576,7 +4600,7 @@ function $n({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4576
4600
|
return /* @__PURE__ */ m("g", {
|
|
4577
4601
|
transform: `translate(${u.left},${u.top})`,
|
|
4578
4602
|
children: [s.map((e, t) => /* @__PURE__ */ p("path", {
|
|
4579
|
-
d:
|
|
4603
|
+
d: X(e),
|
|
4580
4604
|
fill: h(e.source.id, o.indexOf(e.source)),
|
|
4581
4605
|
fillOpacity: .32,
|
|
4582
4606
|
"data-link": ""
|
|
@@ -4605,23 +4629,23 @@ function $n({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4605
4629
|
}
|
|
4606
4630
|
//#endregion
|
|
4607
4631
|
//#region src/charts/calendar/calendar.tsx
|
|
4608
|
-
var
|
|
4609
|
-
function
|
|
4632
|
+
var tr = 864e5, nr = (e) => e instanceof Date ? e : new Date(e), rr = (e) => e.toISOString().slice(0, 10);
|
|
4633
|
+
function ir(e) {
|
|
4610
4634
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4611
4635
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4612
4636
|
}
|
|
4613
|
-
function
|
|
4637
|
+
function ar({ data: e, title: t, description: n, from: r, to: a, width: s, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
|
|
4614
4638
|
o();
|
|
4615
4639
|
let h = e.length > 0, g = i([f?.min ?? 0, f?.max ?? 1]), _ = i(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4616
|
-
for (let t of e) v.set(nr(
|
|
4617
|
-
let y = e.map((e) =>
|
|
4640
|
+
for (let t of e) v.set(rr(nr(t.day)), t.value);
|
|
4641
|
+
let y = e.map((e) => nr(e.day)), b = ir(r ? nr(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = a ? nr(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()) / tr / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4618
4642
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4619
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4643
|
+
let n = new Date(b.getTime() + (e * 7 + t) * tr);
|
|
4620
4644
|
n > x || T.push({
|
|
4621
4645
|
col: e,
|
|
4622
4646
|
row: t,
|
|
4623
4647
|
date: n,
|
|
4624
|
-
value: v.get(
|
|
4648
|
+
value: v.get(rr(n)) ?? 0
|
|
4625
4649
|
});
|
|
4626
4650
|
}
|
|
4627
4651
|
let E = /* @__PURE__ */ p(Q, {
|
|
@@ -4632,7 +4656,7 @@ function ir({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4632
4656
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4633
4657
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4634
4658
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Day" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4635
|
-
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: nr(
|
|
4659
|
+
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: rr(nr(e.day)) }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
4636
4660
|
] }),
|
|
4637
4661
|
className: u,
|
|
4638
4662
|
"data-state": h ? void 0 : "empty",
|
|
@@ -4642,10 +4666,10 @@ function ir({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4642
4666
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4643
4667
|
return {
|
|
4644
4668
|
points: T.map((e, n) => ({
|
|
4645
|
-
id: `${
|
|
4669
|
+
id: `${rr(e.date)}-${n}`,
|
|
4646
4670
|
cx: e.col * (t + 2) + t / 2,
|
|
4647
4671
|
cy: e.row * (t + 2) + t / 2,
|
|
4648
|
-
label:
|
|
4672
|
+
label: rr(e.date),
|
|
4649
4673
|
value: e.value
|
|
4650
4674
|
})),
|
|
4651
4675
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4663,7 +4687,7 @@ function ir({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4663
4687
|
rx: 1.5,
|
|
4664
4688
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4665
4689
|
fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4666
|
-
"data-day":
|
|
4690
|
+
"data-day": rr(e.date)
|
|
4667
4691
|
}, n);
|
|
4668
4692
|
}) });
|
|
4669
4693
|
}
|
|
@@ -4684,23 +4708,23 @@ function ir({ data: e, title: t, description: n, from: r, to: a, width: s, heigh
|
|
|
4684
4708
|
}
|
|
4685
4709
|
//#endregion
|
|
4686
4710
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4687
|
-
function
|
|
4711
|
+
function or({ data: e, title: t, description: n, width: r, height: s, yTicks: l = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: g, tooltip: v, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
|
|
4688
4712
|
o();
|
|
4689
|
-
let
|
|
4690
|
-
T && !
|
|
4713
|
+
let O = b ? Ue : He, ee = s ?? (b ? 64 : 320), k = e.length, A = (S || C || w || T !== void 0) && k > 0, j = i([0, Math.max(0, k - 1)]), te = c(null);
|
|
4714
|
+
T && !te.current && (te.current = ft(T)), a(() => () => {
|
|
4691
4715
|
T && pt(T);
|
|
4692
4716
|
}), a(() => {
|
|
4693
|
-
let e =
|
|
4717
|
+
let e = te.current;
|
|
4694
4718
|
if (!e) return;
|
|
4695
4719
|
let t = e.window.value, n = j.peek();
|
|
4696
4720
|
t && (t[0] !== n[0] || t[1] !== n[1]) && (j.value = t);
|
|
4697
4721
|
}), a(() => {
|
|
4698
|
-
let e =
|
|
4722
|
+
let e = te.current;
|
|
4699
4723
|
if (!e) return;
|
|
4700
4724
|
let t = j.value, n = e.window.peek();
|
|
4701
4725
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4702
4726
|
});
|
|
4703
|
-
let
|
|
4727
|
+
let M = A ? e.slice(j.value[0], j.value[1] + 1) : e, N = M.length > 0, P = N ? Math.min(...M.map((e) => e.low)) : 0, F = N ? Math.max(...M.map((e) => e.high)) : 1, ne = N ? Math.max(1, ...M.map((e) => e.volume ?? 0)) : 1, re = M.map((e) => e.t);
|
|
4704
4728
|
return /* @__PURE__ */ m("div", {
|
|
4705
4729
|
style: {
|
|
4706
4730
|
display: "flex",
|
|
@@ -4712,7 +4736,7 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4712
4736
|
title: t,
|
|
4713
4737
|
description: n,
|
|
4714
4738
|
width: r,
|
|
4715
|
-
height:
|
|
4739
|
+
height: ee,
|
|
4716
4740
|
fallback: /* @__PURE__ */ m("table", { children: [
|
|
4717
4741
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4718
4742
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
@@ -4722,7 +4746,7 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4722
4746
|
/* @__PURE__ */ p("th", { children: "Low" }),
|
|
4723
4747
|
/* @__PURE__ */ p("th", { children: "Close" })
|
|
4724
4748
|
] }) }),
|
|
4725
|
-
/* @__PURE__ */ p("tbody", { children:
|
|
4749
|
+
/* @__PURE__ */ p("tbody", { children: M.map((e, t) => /* @__PURE__ */ m("tr", { children: [
|
|
4726
4750
|
/* @__PURE__ */ p("td", { children: e.t }),
|
|
4727
4751
|
/* @__PURE__ */ p("td", { children: e.open }),
|
|
4728
4752
|
/* @__PURE__ */ p("td", { children: e.high }),
|
|
@@ -4731,18 +4755,18 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4731
4755
|
] }, t)) })
|
|
4732
4756
|
] }),
|
|
4733
4757
|
className: y,
|
|
4734
|
-
"data-state":
|
|
4758
|
+
"data-state": N ? void 0 : "empty",
|
|
4735
4759
|
plain: b,
|
|
4736
|
-
tooltip: v !== !1 &&
|
|
4737
|
-
if (v === !1 || !
|
|
4738
|
-
let n = e -
|
|
4760
|
+
tooltip: v !== !1 && N ? ({ width: e, height: t }) => {
|
|
4761
|
+
if (v === !1 || !N) return;
|
|
4762
|
+
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4739
4763
|
if (n <= 0) return;
|
|
4740
|
-
let i = _(
|
|
4764
|
+
let i = _(re, [0, n], .3), a = r - (g ? Math.min(r * .2, 60) : 0), o = h([P, F], [a, 0]);
|
|
4741
4765
|
if (E === "axis") return {
|
|
4742
|
-
points:
|
|
4766
|
+
points: M.map((e, t) => ({
|
|
4743
4767
|
id: `c-${t}`,
|
|
4744
|
-
cx:
|
|
4745
|
-
cy:
|
|
4768
|
+
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4769
|
+
cy: O.top + o.map(e.high),
|
|
4746
4770
|
label: e.t,
|
|
4747
4771
|
value: e.close,
|
|
4748
4772
|
segments: [
|
|
@@ -4766,21 +4790,21 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4766
4790
|
})),
|
|
4767
4791
|
mode: "axis",
|
|
4768
4792
|
format: (e) => {
|
|
4769
|
-
let t =
|
|
4793
|
+
let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4770
4794
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4771
4795
|
}
|
|
4772
4796
|
};
|
|
4773
4797
|
let s = h([P, F], [r, 0]);
|
|
4774
4798
|
return {
|
|
4775
|
-
points:
|
|
4799
|
+
points: M.map((e, t) => ({
|
|
4776
4800
|
id: `c-${t}`,
|
|
4777
|
-
cx:
|
|
4778
|
-
cy:
|
|
4801
|
+
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4802
|
+
cy: O.top + s.map(e.high),
|
|
4779
4803
|
label: e.t,
|
|
4780
4804
|
value: e.close
|
|
4781
4805
|
})),
|
|
4782
4806
|
format: (e) => {
|
|
4783
|
-
let t =
|
|
4807
|
+
let t = M[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4784
4808
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4785
4809
|
}
|
|
4786
4810
|
};
|
|
@@ -4793,11 +4817,11 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4793
4817
|
j.value = [0, Math.max(0, k - 1)];
|
|
4794
4818
|
} : void 0,
|
|
4795
4819
|
children: ({ width: e, height: t }) => {
|
|
4796
|
-
let n = e -
|
|
4797
|
-
if (n <= 0 || !
|
|
4798
|
-
let i = _(
|
|
4820
|
+
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4821
|
+
if (n <= 0 || !N) return null;
|
|
4822
|
+
let i = _(re, [0, n], .3), a = h([P, F], [r, 0]), o = g ? Math.min(r * .2, 60) : 0, s = r - o, c = h([P, F], [s, 0]), v = i.bandwidth;
|
|
4799
4823
|
return /* @__PURE__ */ m("g", {
|
|
4800
|
-
transform: `translate(${
|
|
4824
|
+
transform: `translate(${O.left},${O.top})`,
|
|
4801
4825
|
children: [
|
|
4802
4826
|
!b && /* @__PURE__ */ p(vt, {
|
|
4803
4827
|
scale: a,
|
|
@@ -4805,7 +4829,7 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4805
4829
|
length: n,
|
|
4806
4830
|
tickCount: l
|
|
4807
4831
|
}),
|
|
4808
|
-
|
|
4832
|
+
M.map((e, t) => {
|
|
4809
4833
|
let n = (i.map(e.t) ?? 0) + v / 2, r = e.close >= e.open, a = r ? u : d, l = c.map(e.open), f = c.map(e.close), h = Math.min(l, f), _ = Math.max(1, Math.abs(f - l));
|
|
4810
4834
|
return /* @__PURE__ */ m("g", {
|
|
4811
4835
|
"data-candle": r ? "up" : "down",
|
|
@@ -4829,9 +4853,9 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4829
4853
|
}),
|
|
4830
4854
|
g && e.volume !== void 0 && /* @__PURE__ */ p("rect", {
|
|
4831
4855
|
x: n - v / 2,
|
|
4832
|
-
y: s + (o - e.volume /
|
|
4856
|
+
y: s + (o - e.volume / ne * o),
|
|
4833
4857
|
width: v,
|
|
4834
|
-
height: e.volume /
|
|
4858
|
+
height: e.volume / ne * o,
|
|
4835
4859
|
fill: a,
|
|
4836
4860
|
fillOpacity: .4,
|
|
4837
4861
|
"data-volume": ""
|
|
@@ -4849,7 +4873,8 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4849
4873
|
scale: i,
|
|
4850
4874
|
orientation: "x",
|
|
4851
4875
|
length: n,
|
|
4852
|
-
transform: `translate(0,${r})
|
|
4876
|
+
transform: `translate(0,${r})`,
|
|
4877
|
+
...D ? { format: D } : {}
|
|
4853
4878
|
}), /* @__PURE__ */ p($, {
|
|
4854
4879
|
scale: a,
|
|
4855
4880
|
orientation: "y",
|
|
@@ -4875,10 +4900,10 @@ function ar({ data: e, title: t, description: n, width: r, height: s, yTicks: l
|
|
|
4875
4900
|
}
|
|
4876
4901
|
//#endregion
|
|
4877
4902
|
//#region src/charts/polar/polar.tsx
|
|
4878
|
-
var
|
|
4879
|
-
function
|
|
4903
|
+
var sr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4904
|
+
function cr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: s = 4, max: c, tooltip: l, className: u, plain: d }) {
|
|
4880
4905
|
o();
|
|
4881
|
-
let h = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4906
|
+
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__ */ m("table", { children: [
|
|
4882
4907
|
/* @__PURE__ */ p("caption", { children: t }),
|
|
4883
4908
|
/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", { children: "Category" }), /* @__PURE__ */ p("th", { children: "Value" })] }) }),
|
|
4884
4909
|
/* @__PURE__ */ p("tbody", { children: e.map((e, t) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("td", { children: e.label }), /* @__PURE__ */ p("td", { children: e.value })] }, t)) })
|
|
@@ -4905,7 +4930,7 @@ function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4905
4930
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4906
4931
|
return {
|
|
4907
4932
|
points: e.map((e, t) => {
|
|
4908
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
4933
|
+
let n = y.center(e.label) ?? 0, [o, s] = be(r, i, a.map(e.value), n);
|
|
4909
4934
|
return {
|
|
4910
4935
|
id: `p-${t}`,
|
|
4911
4936
|
cx: o,
|
|
@@ -4921,7 +4946,7 @@ function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4921
4946
|
if (!g) return null;
|
|
4922
4947
|
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) => {
|
|
4923
4948
|
let t = y.center(e.label) ?? 0;
|
|
4924
|
-
return
|
|
4949
|
+
return be(i, a, c.map(e.value), t);
|
|
4925
4950
|
});
|
|
4926
4951
|
return /* @__PURE__ */ m("g", { children: [
|
|
4927
4952
|
!d && l.map((e, t) => /* @__PURE__ */ p("circle", {
|
|
@@ -4936,13 +4961,13 @@ function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4936
4961
|
r === "bar" ? e.map((e, t) => {
|
|
4937
4962
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4938
4963
|
return /* @__PURE__ */ p("path", {
|
|
4939
|
-
d:
|
|
4940
|
-
fill: e.color ??
|
|
4964
|
+
d: N(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
4965
|
+
fill: e.color ?? sr[t % sr.length],
|
|
4941
4966
|
fillOpacity: .85,
|
|
4942
4967
|
"data-wedge": ""
|
|
4943
4968
|
}, t);
|
|
4944
4969
|
}) : (() => {
|
|
4945
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
4970
|
+
let t = [...u, u[0]], n = e[0]?.color ?? sr[0];
|
|
4946
4971
|
return /* @__PURE__ */ m(f, { children: [r === "area" && /* @__PURE__ */ p("path", {
|
|
4947
4972
|
d: `${E(t, "linear")}Z`,
|
|
4948
4973
|
fill: n,
|
|
@@ -4958,7 +4983,7 @@ function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4958
4983
|
})] });
|
|
4959
4984
|
})(),
|
|
4960
4985
|
!d && e.map((e, t) => {
|
|
4961
|
-
let n = y.center(e.label) ?? 0, [r, s] =
|
|
4986
|
+
let n = y.center(e.label) ?? 0, [r, s] = be(i, a, o + 12, n);
|
|
4962
4987
|
return /* @__PURE__ */ p("text", {
|
|
4963
4988
|
x: r,
|
|
4964
4989
|
y: s,
|
|
@@ -4976,10 +5001,10 @@ function sr({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4976
5001
|
}
|
|
4977
5002
|
//#endregion
|
|
4978
5003
|
//#region src/charts/gauge/gauge.tsx
|
|
4979
|
-
var
|
|
4980
|
-
function
|
|
5004
|
+
var lr = Math.PI / 180;
|
|
5005
|
+
function ur({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: s = 5, title: c, description: l, width: u, height: d, className: f, plain: h }) {
|
|
4981
5006
|
o();
|
|
4982
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
5007
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * lr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
4983
5008
|
return /* @__PURE__ */ p(Q, {
|
|
4984
5009
|
title: c,
|
|
4985
5010
|
description: l,
|
|
@@ -4999,7 +5024,7 @@ function lr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
4999
5024
|
}], w = t, T = Array.from({ length: s + 1 }, (e, n) => t + _ * n / s);
|
|
5000
5025
|
return /* @__PURE__ */ m("g", { children: [
|
|
5001
5026
|
/* @__PURE__ */ p("path", {
|
|
5002
|
-
d:
|
|
5027
|
+
d: N(c, l, u, f, x, x + b),
|
|
5003
5028
|
fill: "var(--cascivo-chart-grid)",
|
|
5004
5029
|
fillOpacity: .25,
|
|
5005
5030
|
"data-track": ""
|
|
@@ -5007,13 +5032,13 @@ function lr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5007
5032
|
C.map((e, t) => {
|
|
5008
5033
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
5009
5034
|
return w = e.upTo, /* @__PURE__ */ p("path", {
|
|
5010
|
-
d:
|
|
5035
|
+
d: N(c, l, u, f, r, i),
|
|
5011
5036
|
fill: e.color,
|
|
5012
5037
|
"data-zone": ""
|
|
5013
5038
|
}, t);
|
|
5014
5039
|
}),
|
|
5015
5040
|
!h && T.map((e, t) => {
|
|
5016
|
-
let n = S(e), [r, i] =
|
|
5041
|
+
let n = S(e), [r, i] = be(c, l, f - 2, n), [a, o] = be(c, l, f - 8, n), [s, u] = be(c, l, f - 18, n);
|
|
5017
5042
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("line", {
|
|
5018
5043
|
x1: r,
|
|
5019
5044
|
y1: i,
|
|
@@ -5033,7 +5058,7 @@ function lr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5033
5058
|
})] }, t);
|
|
5034
5059
|
}),
|
|
5035
5060
|
(() => {
|
|
5036
|
-
let [e, t] =
|
|
5061
|
+
let [e, t] = be(c, l, g, S(v));
|
|
5037
5062
|
return /* @__PURE__ */ p("line", {
|
|
5038
5063
|
x1: c,
|
|
5039
5064
|
y1: l,
|
|
@@ -5067,4 +5092,4 @@ function lr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5067
5092
|
});
|
|
5068
5093
|
}
|
|
5069
5094
|
//#endregion
|
|
5070
|
-
export { We as AXIS_CHAR_PX, un as AreaChart, $ as Axis,
|
|
5095
|
+
export { We as AXIS_CHAR_PX, un as AreaChart, $ as Axis, mn as BarChart, On as Boxplot, zt as Brush, Mn as BubbleChart, Wn as Bullet, ar as Calendar, or as Candlestick, Qe as CanvasLayer, Mt as ChartDefs, Q as ChartFrame, Fn as ComboChart, He as DEFAULT_MARGINS, Dt as DataLabel, Bt as DataZoom, Jn as Funnel, ur as Gauge, Pt as Glyph, vt as GridLines, In as Heatmap, En as Histogram, Tn as Kpi, Zt as Legend, on as LineChart, Sn as Meter, Ue as PLAIN_MARGINS, _n as PieChart, cr as Polar, Hn as Radar, Kn as RadialBar, er as Sankey, yn as ScatterChart, bn as Sparkline, Xn as Stream, Qn as Sunburst, Rt as Text, at as Toolbox, Rn as Treemap, Yt as VisualMap, mt as _syncGroupCount, De as aggregate, xe as angleBand, wt as annotationSummary, N as arcPath, M as areaPath, qe as autoLabelStride, _ as bandScale, Oe as bin, R as binValues, Be as bindStream, z as boxStats, L as cellPath, Le as decimate, ge as divergingRamp, lt as download, Ne as encode, Pe as encodeCategory, B as extent, jt as fillFor, Ce as filter, ft as getSyncGroup, Nt as glyphPath, kt as gradientId, rt as isZoomed, Ge as leftMarginForLabels, E as linePath, h as linearScale, X as linkPath, y as logScale, Fe as lttb, qt as mapVisual, Y as maxDepth, Ie as minmax, ne as nearestIndex, g as niceTicks, nt as panWindow, J as partition, At as patternId, Kt as pieceIndex, be as polarPoint, w as quantize, Se as radiusScale, ye as rampLightness, _e as rampOf, ve as rampStops, je as regression, pt as releaseSyncGroup, St as renderAnnotation, Ct as renderAnnotations, $e as resolveColor, Et as resolveLabels, Ke as rightMarginForLabels, oe as sankeyLayout, he as sequentialRamp, st as serializeSvg, Te as sort, T as splitDefined, v as sqrtScale, W as squarify, P as stackSeries, K as streamExtent, G as streamLayout, q as sumValue, ct as svgToPngBlob, C as timeScale, F as toStackedSeries, Ve as useChartSize, ze as useStreamSeries, Jt as visualVisible, ie as voronoiCells, re as voronoiFind, Lt as wrapText, tt as zoomWindow };
|