@cascivo/charts 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts.css +1 -1
- package/dist/index.d.ts +47 -16
- package/dist/index.js +941 -890
- package/dist/node/index.js +941 -890
- package/package.json +3 -3
package/dist/node/index.js
CHANGED
|
@@ -78,98 +78,140 @@ function b(e, t) {
|
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/engine/scale-time.ts
|
|
81
|
-
var x =
|
|
81
|
+
var x = {
|
|
82
|
+
minute: 6e4,
|
|
83
|
+
hour: 36e5,
|
|
84
|
+
day: 864e5,
|
|
85
|
+
week: 6048e5,
|
|
86
|
+
month: 26298e5,
|
|
87
|
+
quarter: 78894e5,
|
|
88
|
+
year: 315576e5
|
|
89
|
+
}, S = [
|
|
82
90
|
{
|
|
83
91
|
unit: "minute",
|
|
84
|
-
|
|
92
|
+
step: 1
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
unit: "minute",
|
|
96
|
+
step: 5
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
unit: "minute",
|
|
100
|
+
step: 15
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
unit: "minute",
|
|
104
|
+
step: 30
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
unit: "hour",
|
|
108
|
+
step: 1
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
unit: "hour",
|
|
112
|
+
step: 2
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
unit: "hour",
|
|
116
|
+
step: 3
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
unit: "hour",
|
|
120
|
+
step: 6
|
|
85
121
|
},
|
|
86
122
|
{
|
|
87
123
|
unit: "hour",
|
|
88
|
-
|
|
124
|
+
step: 12
|
|
89
125
|
},
|
|
90
126
|
{
|
|
91
127
|
unit: "day",
|
|
92
|
-
|
|
128
|
+
step: 1
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
unit: "day",
|
|
132
|
+
step: 2
|
|
93
133
|
},
|
|
94
134
|
{
|
|
95
135
|
unit: "week",
|
|
96
|
-
|
|
136
|
+
step: 1
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
unit: "month",
|
|
140
|
+
step: 1
|
|
97
141
|
},
|
|
98
142
|
{
|
|
99
143
|
unit: "month",
|
|
100
|
-
|
|
144
|
+
step: 3
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
unit: "year",
|
|
148
|
+
step: 1
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
unit: "year",
|
|
152
|
+
step: 2
|
|
101
153
|
},
|
|
102
154
|
{
|
|
103
|
-
unit: "
|
|
104
|
-
|
|
155
|
+
unit: "year",
|
|
156
|
+
step: 5
|
|
105
157
|
},
|
|
106
158
|
{
|
|
107
159
|
unit: "year",
|
|
108
|
-
|
|
160
|
+
step: 10
|
|
109
161
|
}
|
|
110
162
|
];
|
|
111
|
-
function
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
if (t === "quarter") return new Date(Date.UTC(n, Math.floor(r / 3) * 3, 1));
|
|
115
|
-
if (t === "month") return new Date(Date.UTC(n, r, 1));
|
|
116
|
-
if (t === "week") {
|
|
117
|
-
let t = e.getUTCDate() - e.getUTCDay();
|
|
118
|
-
return new Date(Date.UTC(n, r, t));
|
|
119
|
-
}
|
|
120
|
-
return t === "day" ? new Date(Date.UTC(n, r, e.getUTCDate())) : t === "hour" ? new Date(Date.UTC(n, r, e.getUTCDate(), e.getUTCHours())) : new Date(Date.UTC(n, r, e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes()));
|
|
163
|
+
function C(e, t, n) {
|
|
164
|
+
let r = e.getUTCFullYear(), i = e.getUTCMonth(), a = e.getUTCDate();
|
|
165
|
+
return t === "year" ? new Date(Date.UTC(Math.floor(r / n) * n, 0, 1)) : t === "quarter" ? new Date(Date.UTC(r, Math.floor(i / 3) * 3, 1)) : t === "month" ? new Date(Date.UTC(r, Math.floor(i / n) * n, 1)) : t === "week" ? new Date(Date.UTC(r, i, a - e.getUTCDay())) : t === "day" ? new Date(Date.UTC(r, i, a)) : t === "hour" ? new Date(Date.UTC(r, i, a, Math.floor(e.getUTCHours() / n) * n)) : new Date(Date.UTC(r, i, a, e.getUTCHours(), Math.floor(e.getUTCMinutes() / n) * n));
|
|
121
166
|
}
|
|
122
|
-
function
|
|
167
|
+
function w(e, t, n) {
|
|
123
168
|
let r = e.getUTCFullYear(), i = e.getUTCMonth();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
169
|
+
return t === "year" ? new Date(Date.UTC(r + n, i, 1)) : t === "quarter" ? new Date(Date.UTC(r, i + 3 * n, 1)) : t === "month" ? new Date(Date.UTC(r, i + n, 1)) : new Date(e.getTime() + x[t] * n);
|
|
170
|
+
}
|
|
171
|
+
function T(e) {
|
|
172
|
+
return e === "minute" ? {
|
|
173
|
+
hour: "numeric",
|
|
174
|
+
minute: "2-digit"
|
|
175
|
+
} : e === "hour" ? { hour: "numeric" } : e === "day" || e === "week" ? {
|
|
176
|
+
month: "short",
|
|
177
|
+
day: "numeric"
|
|
178
|
+
} : e === "month" || e === "quarter" ? {
|
|
179
|
+
month: "short",
|
|
180
|
+
year: "numeric"
|
|
181
|
+
} : { year: "numeric" };
|
|
182
|
+
}
|
|
183
|
+
function E(e, t) {
|
|
136
184
|
let [n, r] = e, [i, a] = t, o = r.getTime() - n.getTime();
|
|
137
185
|
function s(e) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
month: "short",
|
|
147
|
-
day: "numeric"
|
|
148
|
-
} : e === "month" || e === "quarter" ? {
|
|
149
|
-
month: "short",
|
|
150
|
-
year: "numeric"
|
|
151
|
-
} : { year: "numeric" };
|
|
186
|
+
let t = Math.max(2, e), n = S[S.length - 1], r = Infinity;
|
|
187
|
+
for (let e of S) {
|
|
188
|
+
let i = o / (x[e.unit] * e.step);
|
|
189
|
+
if (i < 1.5) continue;
|
|
190
|
+
let a = Math.abs(Math.log(i / t));
|
|
191
|
+
a < r && (r = a, n = e);
|
|
192
|
+
}
|
|
193
|
+
return n;
|
|
152
194
|
}
|
|
153
195
|
return {
|
|
154
196
|
domain: e,
|
|
155
197
|
range: t,
|
|
156
198
|
map: (e) => o === 0 ? i : i + (e.getTime() - n.getTime()) / o * (a - i),
|
|
157
199
|
invert: (e) => new Date(n.getTime() + (e - i) / (a - i) * o),
|
|
158
|
-
tickInterval: () => s(
|
|
159
|
-
tickFormat: () =>
|
|
200
|
+
tickInterval: (e = 5) => s(e).unit,
|
|
201
|
+
tickFormat: (e = 5) => T(s(e).unit),
|
|
160
202
|
ticks: (e = 5) => {
|
|
161
|
-
let t = s(e),
|
|
162
|
-
for (;
|
|
163
|
-
return
|
|
203
|
+
let { unit: t, step: i } = s(e), a = C(n, t, i), o = [], c = a.getTime() >= n.getTime() ? a : w(a, t, i), l = 0;
|
|
204
|
+
for (; c.getTime() <= r.getTime() && l++ < 500;) o.push(c), c = w(c, t, i);
|
|
205
|
+
return o;
|
|
164
206
|
}
|
|
165
207
|
};
|
|
166
208
|
}
|
|
167
209
|
//#endregion
|
|
168
210
|
//#region src/engine/shape.ts
|
|
169
|
-
function
|
|
211
|
+
function D(e) {
|
|
170
212
|
return Math.round(e * 100) / 100;
|
|
171
213
|
}
|
|
172
|
-
function
|
|
214
|
+
function O(e, t = !1) {
|
|
173
215
|
if (t) {
|
|
174
216
|
let t = e.filter((e) => e !== null);
|
|
175
217
|
return t.length > 0 ? [t] : [];
|
|
@@ -178,22 +220,22 @@ function E(e, t = !1) {
|
|
|
178
220
|
for (let t of e) t === null ? (r.length > 0 && n.push(r), r = []) : r.push(t);
|
|
179
221
|
return r.length > 0 && n.push(r), n;
|
|
180
222
|
}
|
|
181
|
-
function
|
|
223
|
+
function k(e, t = "linear") {
|
|
182
224
|
if (e.length === 0) return "";
|
|
183
225
|
if (e.length === 1 || t === "linear") return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
184
226
|
switch (t) {
|
|
185
|
-
case "monotone": return
|
|
227
|
+
case "monotone": return P(e);
|
|
186
228
|
case "step":
|
|
187
229
|
case "stepBefore":
|
|
188
|
-
case "stepAfter": return
|
|
189
|
-
case "natural": return
|
|
190
|
-
case "basis": return
|
|
191
|
-
case "cardinal": return
|
|
230
|
+
case "stepAfter": return A(e, t);
|
|
231
|
+
case "natural": return M(e);
|
|
232
|
+
case "basis": return ee(e);
|
|
233
|
+
case "cardinal": return N(e, 0);
|
|
192
234
|
case "catmullRom": return te(e, .5);
|
|
193
|
-
default: return
|
|
235
|
+
default: return P(e);
|
|
194
236
|
}
|
|
195
237
|
}
|
|
196
|
-
function
|
|
238
|
+
function A(e, t) {
|
|
197
239
|
let n = `M${e[0][0]},${e[0][1]}`;
|
|
198
240
|
for (let r = 0; r < e.length - 1; r++) {
|
|
199
241
|
let [i, a] = e[r], [o, s] = e[r + 1];
|
|
@@ -206,7 +248,7 @@ function O(e, t) {
|
|
|
206
248
|
}
|
|
207
249
|
return n;
|
|
208
250
|
}
|
|
209
|
-
function
|
|
251
|
+
function j(e) {
|
|
210
252
|
let t = e.length - 1;
|
|
211
253
|
if (t < 1) return [[], []];
|
|
212
254
|
let n = Array(t), r = Array(t), i = Array(t);
|
|
@@ -223,14 +265,14 @@ function ee(e) {
|
|
|
223
265
|
for (let n = 0; n < t - 1; n++) o[n] = 2 * e[n + 1] - a[n + 1];
|
|
224
266
|
return o[t - 1] = (e[t] + a[t - 1]) / 2, [a, o];
|
|
225
267
|
}
|
|
226
|
-
function
|
|
268
|
+
function M(e) {
|
|
227
269
|
let t = e.length;
|
|
228
270
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
229
|
-
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] =
|
|
271
|
+
let n = e.map((e) => e[0]), r = e.map((e) => e[1]), [i, a] = j(n), [o, s] = j(r), c = `M${n[0]},${r[0]}`;
|
|
230
272
|
for (let e = 0; e < t - 1; e++) c += `C${i[e]},${o[e]} ${a[e]},${s[e]} ${n[e + 1]},${r[e + 1]}`;
|
|
231
273
|
return c;
|
|
232
274
|
}
|
|
233
|
-
function
|
|
275
|
+
function ee(e) {
|
|
234
276
|
let t = e.length;
|
|
235
277
|
if (t < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
236
278
|
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)}`;
|
|
@@ -241,7 +283,7 @@ function A(e) {
|
|
|
241
283
|
let a = e[t - 1];
|
|
242
284
|
return i += `L${a[0]},${a[1]}`, i;
|
|
243
285
|
}
|
|
244
|
-
function
|
|
286
|
+
function N(e, t) {
|
|
245
287
|
let n = e.length;
|
|
246
288
|
if (n < 3) return e.map(([e, t], n) => `${n === 0 ? "M" : "L"}${e},${t}`).join("");
|
|
247
289
|
let r = (1 - t) / 6, i = (t) => e[Math.max(0, Math.min(n - 1, t))], a = `M${e[0][0]},${e[0][1]}`;
|
|
@@ -261,7 +303,7 @@ function te(e, t) {
|
|
|
261
303
|
}
|
|
262
304
|
return a;
|
|
263
305
|
}
|
|
264
|
-
function
|
|
306
|
+
function P(e) {
|
|
265
307
|
let t = e.length, n = [], r = [], i = [];
|
|
266
308
|
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];
|
|
267
309
|
let a = [i[0] ?? 0];
|
|
@@ -277,23 +319,23 @@ function M(e) {
|
|
|
277
319
|
}
|
|
278
320
|
return o;
|
|
279
321
|
}
|
|
280
|
-
function
|
|
322
|
+
function F(e, t, n = "linear") {
|
|
281
323
|
if (e.length === 0) return "";
|
|
282
|
-
let r =
|
|
324
|
+
let r = k(e, n), i = e[e.length - 1], a = e[0];
|
|
283
325
|
return `${r}L${i[0]},${t}L${a[0]},${t}Z`;
|
|
284
326
|
}
|
|
285
|
-
function
|
|
327
|
+
function I(e, t, n, r, i, a) {
|
|
286
328
|
let o = 2 * Math.PI;
|
|
287
329
|
if (Math.abs(a - i) >= o - 1e-9) {
|
|
288
330
|
let a = i + Math.PI;
|
|
289
|
-
return
|
|
331
|
+
return I(e, t, n, r, i, a) + I(e, t, n, r, a, i + o - 1e-9);
|
|
290
332
|
}
|
|
291
|
-
let s = (n, r) => [
|
|
292
|
-
if (r <= 0) return `M${
|
|
333
|
+
let s = (n, r) => [D(e + n * Math.sin(r)), D(t - n * Math.cos(r))], c = +(a - i > Math.PI), l = D(n), u = D(r), [d, f] = s(n, i), [p, m] = s(n, a);
|
|
334
|
+
if (r <= 0) return `M${D(e)},${D(t)}L${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}Z`;
|
|
293
335
|
let [h, g] = s(r, a), [_, v] = s(r, i);
|
|
294
336
|
return `M${d},${f}A${l},${l} 0 ${c} 1 ${p},${m}L${h},${g}A${u},${u} 0 ${c} 0 ${_},${v}Z`;
|
|
295
337
|
}
|
|
296
|
-
function
|
|
338
|
+
function ne(e) {
|
|
297
339
|
let t = e[0]?.length ?? 0, n = Array.from({ length: t }, () => 0);
|
|
298
340
|
return e.map((e) => e.map((e, t) => {
|
|
299
341
|
let r = n[t];
|
|
@@ -302,7 +344,7 @@ function F(e) {
|
|
|
302
344
|
}
|
|
303
345
|
//#endregion
|
|
304
346
|
//#region src/engine/stacked.ts
|
|
305
|
-
function
|
|
347
|
+
function L(e) {
|
|
306
348
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
307
349
|
for (let r of e) for (let e of r.segments) n.has(e.key) ? n.get(e.key) == null && e.color != null && n.set(e.key, e.color) : (t.push(e.key), n.set(e.key, e.color));
|
|
308
350
|
return {
|
|
@@ -324,7 +366,7 @@ function I(e) {
|
|
|
324
366
|
}
|
|
325
367
|
//#endregion
|
|
326
368
|
//#region src/engine/nearest.ts
|
|
327
|
-
function
|
|
369
|
+
function R(e, t) {
|
|
328
370
|
if (e.length === 0) return -1;
|
|
329
371
|
if (e.length === 1) return 0;
|
|
330
372
|
let n = 0, r = e.length - 1;
|
|
@@ -356,7 +398,7 @@ function ie(e, t, n, r, i) {
|
|
|
356
398
|
}
|
|
357
399
|
return a;
|
|
358
400
|
}
|
|
359
|
-
function
|
|
401
|
+
function z(e, t) {
|
|
360
402
|
let n = [
|
|
361
403
|
[t.x0, t.y0],
|
|
362
404
|
[t.x1, t.y0],
|
|
@@ -373,16 +415,16 @@ function L(e, t) {
|
|
|
373
415
|
return i;
|
|
374
416
|
});
|
|
375
417
|
}
|
|
376
|
-
function
|
|
418
|
+
function B(e) {
|
|
377
419
|
return e.length === 0 ? "" : `M${e.map((e) => `${e[0]},${e[1]}`).join("L")}Z`;
|
|
378
420
|
}
|
|
379
421
|
//#endregion
|
|
380
422
|
//#region src/engine/stats.ts
|
|
381
|
-
function
|
|
423
|
+
function V(e) {
|
|
382
424
|
let t = e.length, n = e[Math.floor(t * .25)] ?? 0;
|
|
383
425
|
return (e[Math.floor(t * .75)] ?? 0) - n;
|
|
384
426
|
}
|
|
385
|
-
function
|
|
427
|
+
function H(e, t) {
|
|
386
428
|
if (e.length === 0) return [];
|
|
387
429
|
let n = [...e].sort((e, t) => e - t), r = n.length, i = n[0] ?? 0, a = n[r - 1] ?? 0;
|
|
388
430
|
if (i === a) return [{
|
|
@@ -393,7 +435,7 @@ function z(e, t) {
|
|
|
393
435
|
let o;
|
|
394
436
|
if (t !== void 0 && t > 0) o = t;
|
|
395
437
|
else {
|
|
396
|
-
let e = 2 *
|
|
438
|
+
let e = 2 * V(n) * r ** (-1 / 3);
|
|
397
439
|
o = Math.ceil(e > 0 ? (a - i) / e : Math.sqrt(r)), o = Math.max(1, Math.min(o, 200));
|
|
398
440
|
}
|
|
399
441
|
let s = (a - i) / o;
|
|
@@ -413,7 +455,7 @@ function z(e, t) {
|
|
|
413
455
|
}
|
|
414
456
|
return c;
|
|
415
457
|
}
|
|
416
|
-
function
|
|
458
|
+
function U(e) {
|
|
417
459
|
if (e.length === 0) return {
|
|
418
460
|
min: 0,
|
|
419
461
|
q1: 0,
|
|
@@ -435,7 +477,7 @@ function B(e) {
|
|
|
435
477
|
outliers: d
|
|
436
478
|
};
|
|
437
479
|
}
|
|
438
|
-
function
|
|
480
|
+
function W(e) {
|
|
439
481
|
if (e.length === 0) return [0, 1];
|
|
440
482
|
let t = e[0] ?? 0, n = e[0] ?? 0;
|
|
441
483
|
for (let r of e) r < t && (t = r), r > n && (n = r);
|
|
@@ -443,11 +485,11 @@ function V(e) {
|
|
|
443
485
|
}
|
|
444
486
|
//#endregion
|
|
445
487
|
//#region src/engine/treemap.ts
|
|
446
|
-
function
|
|
488
|
+
function G(e, t, n) {
|
|
447
489
|
let r = Math.max(...e), i = Math.min(...e);
|
|
448
490
|
return Math.max(t * t * r / (n * n), n * n / (t * t * i));
|
|
449
491
|
}
|
|
450
|
-
function
|
|
492
|
+
function K(e, t, n, r, i, a, o) {
|
|
451
493
|
let s = e.reduce((e, t) => e + t, 0), c = t, l = n;
|
|
452
494
|
for (let t = 0; t < e.length; t++) {
|
|
453
495
|
let n = e[t] ?? 0, u = a[t] ?? "";
|
|
@@ -472,40 +514,40 @@ function U(e, t, n, r, i, a, o) {
|
|
|
472
514
|
}
|
|
473
515
|
}
|
|
474
516
|
}
|
|
475
|
-
function
|
|
517
|
+
function q(e, t, n, r, i, a) {
|
|
476
518
|
if (e.length === 0 || r <= 0 || i <= 0) return;
|
|
477
519
|
let o = e.reduce((e, t) => e + t.value, 0);
|
|
478
520
|
if (o === 0) return;
|
|
479
521
|
let s = r * i, c = e.map((e) => e.value / o * s), l = e.map((e) => e.id), u = [], d = [], f = Math.min(r, i), p = 0, m = 0;
|
|
480
522
|
for (; m < c.length;) {
|
|
481
523
|
let o = c[m] ?? 0, h = l[m] ?? "", g = [...u, o], _ = p + o;
|
|
482
|
-
if (u.length === 0 ||
|
|
524
|
+
if (u.length === 0 || G(g, f, _) <= G(u, f, p)) u = g, d = [...d, h], p = _, m++;
|
|
483
525
|
else {
|
|
484
526
|
let o = p / s;
|
|
485
527
|
if (r >= i) {
|
|
486
528
|
let s = o * r;
|
|
487
|
-
|
|
529
|
+
K(u, t, n, s, i, d, a), q(e.slice(m), t + s, n, r - s, i, a);
|
|
488
530
|
} else {
|
|
489
531
|
let s = o * i;
|
|
490
|
-
|
|
532
|
+
K(u, t, n, r, s, d, a), q(e.slice(m), t, n + s, r, i - s, a);
|
|
491
533
|
}
|
|
492
534
|
return;
|
|
493
535
|
}
|
|
494
536
|
}
|
|
495
537
|
if (u.length > 0) {
|
|
496
538
|
let e = p / s;
|
|
497
|
-
r >= i ?
|
|
539
|
+
r >= i ? K(u, t, n, e * r, i, d, a) : K(u, t, n, r, e * i, d, a);
|
|
498
540
|
}
|
|
499
541
|
}
|
|
500
|
-
function
|
|
542
|
+
function ae(e, t, n) {
|
|
501
543
|
if (e.length === 0 || t <= 0 || n <= 0) return [];
|
|
502
544
|
let r = [...e].sort((e, t) => t.value - e.value), i = [];
|
|
503
|
-
return
|
|
545
|
+
return q(r, 0, 0, t, n, i), i;
|
|
504
546
|
}
|
|
505
547
|
//#endregion
|
|
506
548
|
//#region src/engine/stream.ts
|
|
507
|
-
function
|
|
508
|
-
let n =
|
|
549
|
+
function J(e, t = "silhouette") {
|
|
550
|
+
let n = ne(e);
|
|
509
551
|
if (t === "zero") return n;
|
|
510
552
|
let r = e[0]?.length ?? 0, i = Array.from({ length: r }, (t, n) => e.reduce((e, t) => e + (t[n] ?? 0), 0));
|
|
511
553
|
return n.map((e) => e.map(([e, t], n) => {
|
|
@@ -513,39 +555,39 @@ function K(e, t = "silhouette") {
|
|
|
513
555
|
return [e - r, t - r];
|
|
514
556
|
}));
|
|
515
557
|
}
|
|
516
|
-
function
|
|
558
|
+
function Y(e) {
|
|
517
559
|
let t = 0, n = 0;
|
|
518
560
|
for (let r of e) for (let [e, i] of r) t = Math.min(t, e, i), n = Math.max(n, e, i);
|
|
519
561
|
return [t, n];
|
|
520
562
|
}
|
|
521
563
|
//#endregion
|
|
522
564
|
//#region src/engine/hierarchy.ts
|
|
523
|
-
function
|
|
524
|
-
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e +
|
|
565
|
+
function oe(e) {
|
|
566
|
+
return e.children && e.children.length > 0 ? e.children.reduce((e, t) => e + oe(t), 0) : e.value ?? 0;
|
|
525
567
|
}
|
|
526
|
-
function
|
|
568
|
+
function X(e, t = 2 * Math.PI) {
|
|
527
569
|
let n = [], r = (e, t, i, a) => {
|
|
528
570
|
if (n.push({
|
|
529
571
|
node: e,
|
|
530
572
|
depth: t,
|
|
531
573
|
a0: i,
|
|
532
574
|
a1: a,
|
|
533
|
-
value:
|
|
575
|
+
value: oe(e)
|
|
534
576
|
}), !e.children) return;
|
|
535
|
-
let o = a - i, s =
|
|
577
|
+
let o = a - i, s = oe(e) || 1, c = i;
|
|
536
578
|
for (let n of e.children) {
|
|
537
|
-
let e = c + o *
|
|
579
|
+
let e = c + o * oe(n) / s;
|
|
538
580
|
r(n, t + 1, c, e), c = e;
|
|
539
581
|
}
|
|
540
582
|
};
|
|
541
583
|
return r(e, 0, 0, t), n;
|
|
542
584
|
}
|
|
543
|
-
function
|
|
585
|
+
function se(e) {
|
|
544
586
|
return e.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
545
587
|
}
|
|
546
588
|
//#endregion
|
|
547
589
|
//#region src/engine/sankey.ts
|
|
548
|
-
function
|
|
590
|
+
function ce(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }) {
|
|
549
591
|
let o = /* @__PURE__ */ new Map();
|
|
550
592
|
for (let t of e) o.set(t.id, {
|
|
551
593
|
...t,
|
|
@@ -599,61 +641,61 @@ function X(e, t, { width: n, height: r, nodeWidth: i = 16, nodePadding: a = 12 }
|
|
|
599
641
|
links: v
|
|
600
642
|
};
|
|
601
643
|
}
|
|
602
|
-
function
|
|
644
|
+
function le(e) {
|
|
603
645
|
let t = e.source.x1, n = e.target.x0, r = (t + n) / 2, i = e.sy, a = e.sy + e.width, o = e.ty, s = e.ty + e.width;
|
|
604
646
|
return `M${t},${i}C${r},${i} ${r},${o} ${n},${o}L${n},${s}C${r},${s} ${r},${a} ${t},${a}Z`;
|
|
605
647
|
}
|
|
606
648
|
//#endregion
|
|
607
649
|
//#region src/engine/ramp.ts
|
|
608
|
-
var
|
|
609
|
-
l:
|
|
610
|
-
c:
|
|
611
|
-
h:
|
|
612
|
-
}),
|
|
650
|
+
var ue = (e) => e < 0 ? 0 : e > 1 ? 1 : e, de = (e, t, n) => e + (t - e) * n, fe = (e, t, n) => ({
|
|
651
|
+
l: de(e.l, t.l, n),
|
|
652
|
+
c: de(e.c, t.c, n),
|
|
653
|
+
h: de(e.h, t.h, n)
|
|
654
|
+
}), pe = ({ l: e, c: t, h: n }) => `oklch(${e.toFixed(4)} ${t.toFixed(4)} ${n.toFixed(2)})`, Z = {
|
|
613
655
|
l: .95,
|
|
614
656
|
c: .04,
|
|
615
657
|
h: 232
|
|
616
|
-
},
|
|
658
|
+
}, me = {
|
|
617
659
|
l: .34,
|
|
618
660
|
c: .15,
|
|
619
661
|
h: 274
|
|
620
|
-
},
|
|
662
|
+
}, he = {
|
|
621
663
|
l: .48,
|
|
622
664
|
c: .14,
|
|
623
665
|
h: 248
|
|
624
|
-
},
|
|
666
|
+
}, ge = {
|
|
625
667
|
l: .96,
|
|
626
668
|
c: .02,
|
|
627
669
|
h: 110
|
|
628
|
-
},
|
|
670
|
+
}, _e = {
|
|
629
671
|
l: .52,
|
|
630
672
|
c: .15,
|
|
631
673
|
h: 42
|
|
632
674
|
};
|
|
633
|
-
function
|
|
634
|
-
return
|
|
675
|
+
function ve(e) {
|
|
676
|
+
return pe(fe(Z, me, ue(e)));
|
|
635
677
|
}
|
|
636
|
-
function
|
|
637
|
-
let t =
|
|
638
|
-
return
|
|
678
|
+
function ye(e) {
|
|
679
|
+
let t = ue(e);
|
|
680
|
+
return pe(t < .5 ? fe(he, ge, t * 2) : fe(ge, _e, (t - .5) * 2));
|
|
639
681
|
}
|
|
640
|
-
function
|
|
641
|
-
return e === "diverging" ?
|
|
682
|
+
function be(e) {
|
|
683
|
+
return e === "diverging" ? ye : ve;
|
|
642
684
|
}
|
|
643
|
-
function
|
|
644
|
-
let n =
|
|
685
|
+
function xe(e, t = "sequential") {
|
|
686
|
+
let n = be(t);
|
|
645
687
|
return e <= 1 ? [n(0)] : Array.from({ length: e }, (t, r) => n(r / (e - 1)));
|
|
646
688
|
}
|
|
647
|
-
function
|
|
689
|
+
function Se(e) {
|
|
648
690
|
let t = /oklch\(([\d.]+)/.exec(e);
|
|
649
691
|
return t ? Number(t[1]) : NaN;
|
|
650
692
|
}
|
|
651
693
|
//#endregion
|
|
652
694
|
//#region src/engine/polar.ts
|
|
653
|
-
function
|
|
654
|
-
return [
|
|
695
|
+
function Ce(e, t, n, r) {
|
|
696
|
+
return [D(e + n * Math.sin(r)), D(t - n * Math.cos(r))];
|
|
655
697
|
}
|
|
656
|
-
function
|
|
698
|
+
function we(e, t = [0, 2 * Math.PI]) {
|
|
657
699
|
let n = Math.max(1, e.length), r = (t[1] - t[0]) / n, i = new Map(e.map((e, t) => [e, t])), a = (e) => {
|
|
658
700
|
let n = i.get(e);
|
|
659
701
|
return n === void 0 ? void 0 : t[0] + n * r;
|
|
@@ -668,25 +710,25 @@ function Se(e, t = [0, 2 * Math.PI]) {
|
|
|
668
710
|
step: r
|
|
669
711
|
};
|
|
670
712
|
}
|
|
671
|
-
function
|
|
713
|
+
function Te(e, t) {
|
|
672
714
|
return g(e, t);
|
|
673
715
|
}
|
|
674
716
|
//#endregion
|
|
675
717
|
//#region src/engine/transform.ts
|
|
676
|
-
function
|
|
718
|
+
function Ee(e, t) {
|
|
677
719
|
return e.filter((e, n) => t(e, n));
|
|
678
720
|
}
|
|
679
|
-
function
|
|
721
|
+
function De(e, t) {
|
|
680
722
|
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
|
|
681
723
|
}
|
|
682
|
-
function
|
|
724
|
+
function Oe(e, t, n = "asc") {
|
|
683
725
|
let r = typeof t == "function" ? t : (e) => e[t], i = n === "desc" ? -1 : 1;
|
|
684
726
|
return e.map((e, t) => ({
|
|
685
727
|
row: e,
|
|
686
728
|
i: t
|
|
687
|
-
})).sort((e, t) =>
|
|
729
|
+
})).sort((e, t) => De(r(e.row), r(t.row)) * i || e.i - t.i).map((e) => e.row);
|
|
688
730
|
}
|
|
689
|
-
function
|
|
731
|
+
function ke(e, t) {
|
|
690
732
|
if (e === "count") return t.length;
|
|
691
733
|
if (t.length === 0) return 0;
|
|
692
734
|
switch (e) {
|
|
@@ -700,7 +742,7 @@ function De(e, t) {
|
|
|
700
742
|
}
|
|
701
743
|
}
|
|
702
744
|
}
|
|
703
|
-
function
|
|
745
|
+
function Ae(e, t) {
|
|
704
746
|
let n = typeof t.groupBy == "string" ? [t.groupBy] : t.groupBy, r = /* @__PURE__ */ new Map(), i = [];
|
|
705
747
|
for (let t of e) {
|
|
706
748
|
let e = n.map((e) => String(t[e])).join("\0"), a = r.get(e);
|
|
@@ -709,11 +751,11 @@ function Oe(e, t) {
|
|
|
709
751
|
return i.map((e) => {
|
|
710
752
|
let i = r.get(e), a = {};
|
|
711
753
|
for (let e of n) a[e] = i[0][e];
|
|
712
|
-
for (let [e, n] of Object.entries(t.ops)) a[e] =
|
|
754
|
+
for (let [e, n] of Object.entries(t.ops)) a[e] = ke(n, i.map((t) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)));
|
|
713
755
|
return a;
|
|
714
756
|
});
|
|
715
757
|
}
|
|
716
|
-
function
|
|
758
|
+
function je(e, t = {}) {
|
|
717
759
|
let n = e.filter((e) => Number.isFinite(e)), [r, i] = t.range ?? [Math.min(...n), Math.max(...n)], a = Math.max(1, t.bins ?? (Math.ceil(Math.sqrt(n.length)) || 1)), o = (i - r) / a || 1, s = Array.from({ length: a }, (e, t) => ({
|
|
718
760
|
x0: r + t * o,
|
|
719
761
|
x1: r + (t + 1) * o,
|
|
@@ -727,7 +769,7 @@ function ke(e, t = {}) {
|
|
|
727
769
|
}
|
|
728
770
|
return s;
|
|
729
771
|
}
|
|
730
|
-
function
|
|
772
|
+
function Me(e, t) {
|
|
731
773
|
let n = t.length, r = e.map((e, n) => [...e, t[n]]);
|
|
732
774
|
for (let e = 0; e < n; e++) {
|
|
733
775
|
let t = e;
|
|
@@ -745,12 +787,12 @@ function Ae(e, t) {
|
|
|
745
787
|
return Math.abs(i) < 1e-12 ? 0 : r[t][n] / i;
|
|
746
788
|
});
|
|
747
789
|
}
|
|
748
|
-
function
|
|
790
|
+
function Ne(e, t) {
|
|
749
791
|
let n = e.map((e) => e[1]), r = n.reduce((e, t) => e + t, 0) / n.length, i = 0, a = 0;
|
|
750
792
|
for (let [n, o] of e) i += (o - t(n)) ** 2, a += (o - r) ** 2;
|
|
751
793
|
return a === 0 ? 1 : 1 - i / a;
|
|
752
794
|
}
|
|
753
|
-
function
|
|
795
|
+
function Pe(e, t = {}) {
|
|
754
796
|
let n = t.type ?? "linear", r = [...e].sort((e, t) => e[0] - t[0]), i = r.map((e) => e[0]), a = () => {
|
|
755
797
|
let e = r.length ? r.reduce((e, t) => e + t[1], 0) / r.length : 0;
|
|
756
798
|
return {
|
|
@@ -764,11 +806,11 @@ function Me(e, t = {}) {
|
|
|
764
806
|
if (n === "exponential") {
|
|
765
807
|
let e = r.filter((e) => e[1] > 0);
|
|
766
808
|
if (e.length < 2) return a();
|
|
767
|
-
let t =
|
|
809
|
+
let t = Pe(e.map((e) => [e[0], Math.log(e[1])]), { type: "linear" }), n = Math.exp(t.coefficients[0]), o = t.coefficients[1], s = (e) => n * Math.exp(o * e);
|
|
768
810
|
return {
|
|
769
811
|
predict: s,
|
|
770
812
|
points: i.map((e) => [e, s(e)]),
|
|
771
|
-
r2:
|
|
813
|
+
r2: Ne(r, s),
|
|
772
814
|
coefficients: [n, o]
|
|
773
815
|
};
|
|
774
816
|
}
|
|
@@ -780,18 +822,18 @@ function Me(e, t = {}) {
|
|
|
780
822
|
for (let t = 0; t < o; t++) s[e][t] += n[e] * n[t];
|
|
781
823
|
}
|
|
782
824
|
}
|
|
783
|
-
let l =
|
|
825
|
+
let l = Me(s, c), u = (e) => l.reduce((t, n, r) => t + n * e ** r, 0);
|
|
784
826
|
return {
|
|
785
827
|
predict: u,
|
|
786
828
|
points: i.map((e) => [e, u(e)]),
|
|
787
|
-
r2:
|
|
829
|
+
r2: Ne(r, u),
|
|
788
830
|
coefficients: l
|
|
789
831
|
};
|
|
790
832
|
}
|
|
791
833
|
//#endregion
|
|
792
834
|
//#region src/engine/dataset.ts
|
|
793
|
-
var
|
|
794
|
-
function
|
|
835
|
+
var Fe = (e) => typeof e == "number" ? e : Number(e);
|
|
836
|
+
function Ie(e, t) {
|
|
795
837
|
let n = (e) => e.x, r = (e) => e.y;
|
|
796
838
|
if (!t.series) return {
|
|
797
839
|
series: [{
|
|
@@ -799,7 +841,7 @@ function Pe(e, t) {
|
|
|
799
841
|
label: t.label ?? t.y,
|
|
800
842
|
data: e.map((e) => ({
|
|
801
843
|
x: e[t.x],
|
|
802
|
-
y:
|
|
844
|
+
y: Fe(e[t.y])
|
|
803
845
|
}))
|
|
804
846
|
}],
|
|
805
847
|
x: n,
|
|
@@ -814,7 +856,7 @@ function Pe(e, t) {
|
|
|
814
856
|
data: []
|
|
815
857
|
}, i.set(e, r), a.push(e)), r.data.push({
|
|
816
858
|
x: n[t.x],
|
|
817
|
-
y:
|
|
859
|
+
y: Fe(n[t.y])
|
|
818
860
|
});
|
|
819
861
|
}
|
|
820
862
|
return {
|
|
@@ -823,15 +865,15 @@ function Pe(e, t) {
|
|
|
823
865
|
y: r
|
|
824
866
|
};
|
|
825
867
|
}
|
|
826
|
-
function
|
|
868
|
+
function Le(e, t) {
|
|
827
869
|
return e.map((e) => ({
|
|
828
870
|
label: String(e[t.category]),
|
|
829
|
-
value:
|
|
871
|
+
value: Fe(e[t.value])
|
|
830
872
|
}));
|
|
831
873
|
}
|
|
832
874
|
//#endregion
|
|
833
875
|
//#region src/engine/decimate.ts
|
|
834
|
-
function
|
|
876
|
+
function Re(e, t) {
|
|
835
877
|
let n = e.length;
|
|
836
878
|
if (t >= n || t < 3) return e.slice();
|
|
837
879
|
let r = [e[0]], i = (n - 2) / (t - 2), a = 0;
|
|
@@ -848,7 +890,7 @@ function Ie(e, t) {
|
|
|
848
890
|
}
|
|
849
891
|
return r.push(e[n - 1]), r;
|
|
850
892
|
}
|
|
851
|
-
function
|
|
893
|
+
function ze(e, t) {
|
|
852
894
|
let n = e.length;
|
|
853
895
|
if (t >= n || t < 4) return e.slice();
|
|
854
896
|
let r = Math.max(1, Math.floor(t / 2)), i = n / r, a = [e[0]];
|
|
@@ -861,27 +903,27 @@ function Le(e, t) {
|
|
|
861
903
|
}
|
|
862
904
|
return a.push(e[n - 1]), a;
|
|
863
905
|
}
|
|
864
|
-
function
|
|
865
|
-
return n === "minmax" ?
|
|
906
|
+
function Be(e, t, n = "lttb") {
|
|
907
|
+
return n === "minmax" ? ze(e, t) : Re(e, t);
|
|
866
908
|
}
|
|
867
909
|
//#endregion
|
|
868
910
|
//#region src/stream/use-stream-series.ts
|
|
869
|
-
function
|
|
870
|
-
return e.length <= t.to ? e :
|
|
911
|
+
function Ve(e, t) {
|
|
912
|
+
return e.length <= t.to ? e : Be(e.map((e, n) => [n, t.y(e)]), t.to, t.method).map(([t]) => e[t]);
|
|
871
913
|
}
|
|
872
|
-
function
|
|
914
|
+
function He(e) {
|
|
873
915
|
let { capacity: n, source: r, decimate: a } = e, s = l(t({ capacity: n })).current, c = l(r);
|
|
874
916
|
return c.current = r, o(() => {
|
|
875
917
|
let e = c.current((e) => s.append(e));
|
|
876
918
|
return () => {
|
|
877
919
|
e(), s.dispose();
|
|
878
920
|
};
|
|
879
|
-
}), i(() => a ?
|
|
921
|
+
}), i(() => a ? Ve(s.signal.value, a) : s.signal.value);
|
|
880
922
|
}
|
|
881
|
-
function
|
|
923
|
+
function Ue(n) {
|
|
882
924
|
let { capacity: r, source: i, decimate: a } = n, o = t({ capacity: r }), s = i((e) => o.append(e));
|
|
883
925
|
return {
|
|
884
|
-
signal: a ? e(() =>
|
|
926
|
+
signal: a ? e(() => Ve(o.signal.value, a)) : o.signal,
|
|
885
927
|
stop: () => {
|
|
886
928
|
s(), o.dispose();
|
|
887
929
|
}
|
|
@@ -889,7 +931,7 @@ function Ve(n) {
|
|
|
889
931
|
}
|
|
890
932
|
//#endregion
|
|
891
933
|
//#region src/core/use-chart.ts
|
|
892
|
-
function
|
|
934
|
+
function We(e = 400, t = 300) {
|
|
893
935
|
let n = l(null), r = a(e), i = a(t);
|
|
894
936
|
return o(() => {
|
|
895
937
|
let e = n.current;
|
|
@@ -917,48 +959,48 @@ function He(e = 400, t = 300) {
|
|
|
917
959
|
height: i
|
|
918
960
|
};
|
|
919
961
|
}
|
|
920
|
-
var
|
|
962
|
+
var Ge = {
|
|
921
963
|
top: 8,
|
|
922
964
|
right: 8,
|
|
923
965
|
bottom: 24,
|
|
924
966
|
left: 36
|
|
925
|
-
},
|
|
967
|
+
}, Ke = {
|
|
926
968
|
top: 2,
|
|
927
969
|
right: 2,
|
|
928
970
|
bottom: 2,
|
|
929
971
|
left: 2
|
|
930
|
-
},
|
|
931
|
-
function
|
|
932
|
-
if (t) return
|
|
972
|
+
}, qe = 6.5;
|
|
973
|
+
function Je(e, t) {
|
|
974
|
+
if (t) return Ke.left;
|
|
933
975
|
let n = e.reduce((e, t) => Math.max(e, t.length), 0);
|
|
934
|
-
return Math.max(
|
|
976
|
+
return Math.max(Ge.left, Math.ceil(n * qe + 12));
|
|
935
977
|
}
|
|
936
|
-
function
|
|
978
|
+
function Ye(e = {}) {
|
|
937
979
|
let { rightAxisLabels: t = [], bottomAxisLabels: n = [], rightAxisTitle: r = !1, plain: i } = e;
|
|
938
|
-
if (i) return
|
|
939
|
-
let a = t.reduce((e, t) => Math.max(e, t.length), 0), o = r ? 20 : 0, s = a > 0 ? Math.ceil(a *
|
|
940
|
-
return Math.max(
|
|
980
|
+
if (i) return Ke.right;
|
|
981
|
+
let a = t.reduce((e, t) => Math.max(e, t.length), 0), o = r ? 20 : 0, s = a > 0 ? Math.ceil(a * qe + 12 + o) : 0, c = n[n.length - 1] ?? "", l = c ? Math.ceil(c.length * qe / 2 + 2) : 0;
|
|
982
|
+
return Math.max(Ge.right, s, l);
|
|
941
983
|
}
|
|
942
|
-
var
|
|
943
|
-
function
|
|
984
|
+
var Xe = 14;
|
|
985
|
+
function Ze(e, t, n = "horizontal") {
|
|
944
986
|
if (e.length <= 1 || t <= 0) return;
|
|
945
|
-
let r = t / e.length, i = n === "vertical" ? 14 : e.reduce((e, t) => Math.max(e, t.length), 0) *
|
|
987
|
+
let r = t / e.length, i = n === "vertical" ? 14 : e.reduce((e, t) => Math.max(e, t.length), 0) * qe + 6;
|
|
946
988
|
if (!(r >= i)) return Math.ceil(i / r);
|
|
947
989
|
}
|
|
948
|
-
var
|
|
949
|
-
frame: "
|
|
950
|
-
"cascivo-chart-in": "_cascivo-chart-
|
|
951
|
-
fallback: "
|
|
990
|
+
var Qe = {
|
|
991
|
+
frame: "_frame_1gm0a_2",
|
|
992
|
+
"cascivo-chart-in": "_cascivo-chart-in_1gm0a_1",
|
|
993
|
+
fallback: "_fallback_1gm0a_78"
|
|
952
994
|
};
|
|
953
995
|
//#endregion
|
|
954
996
|
//#region src/core/data-point.ts
|
|
955
|
-
function
|
|
997
|
+
function $e(e) {
|
|
956
998
|
return `${e.label}: ${e.value}`;
|
|
957
999
|
}
|
|
958
1000
|
//#endregion
|
|
959
1001
|
//#region src/core/chart-tooltip.tsx
|
|
960
|
-
function
|
|
961
|
-
let n = t.format ? t.format(e) :
|
|
1002
|
+
function et({ point: e, model: t }) {
|
|
1003
|
+
let n = t.format ? t.format(e) : $e(e), r = e.segments?.filter((e) => e.value !== 0);
|
|
962
1004
|
return /* @__PURE__ */ m("div", {
|
|
963
1005
|
role: "tooltip",
|
|
964
1006
|
style: {
|
|
@@ -1006,7 +1048,7 @@ function Qe({ point: e, model: t }) {
|
|
|
1006
1048
|
}
|
|
1007
1049
|
//#endregion
|
|
1008
1050
|
//#region src/core/nearest.ts
|
|
1009
|
-
function
|
|
1051
|
+
function tt(e, t, n, r = "xy") {
|
|
1010
1052
|
if (e.length === 0) return -1;
|
|
1011
1053
|
let i = 0, a = Infinity;
|
|
1012
1054
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1017,7 +1059,7 @@ function $e(e, t, n, r = "xy") {
|
|
|
1017
1059
|
}
|
|
1018
1060
|
//#endregion
|
|
1019
1061
|
//#region src/core/canvas-layer.tsx
|
|
1020
|
-
function
|
|
1062
|
+
function nt({ size: e, paint: t }) {
|
|
1021
1063
|
let n = l(null);
|
|
1022
1064
|
return o(() => {
|
|
1023
1065
|
let { width: r, height: i } = e(), a = n.current;
|
|
@@ -1042,28 +1084,28 @@ function et({ size: e, paint: t }) {
|
|
|
1042
1084
|
}
|
|
1043
1085
|
});
|
|
1044
1086
|
}
|
|
1045
|
-
function
|
|
1087
|
+
function rt(e, t) {
|
|
1046
1088
|
let n = /var\((--[^,)]+)/.exec(t);
|
|
1047
1089
|
return !n || typeof getComputedStyle != "function" ? t : getComputedStyle(e.canvas).getPropertyValue(n[1]).trim() || t;
|
|
1048
1090
|
}
|
|
1049
1091
|
//#endregion
|
|
1050
1092
|
//#region src/core/zoom.ts
|
|
1051
|
-
var
|
|
1052
|
-
function
|
|
1093
|
+
var it = 1;
|
|
1094
|
+
function at(e, t, n, r) {
|
|
1053
1095
|
if (t <= 1) return [0, Math.max(0, t - 1)];
|
|
1054
1096
|
let [i, a] = e, o = i + r * (a - i), s = Math.round(o - (o - i) * n), c = Math.round(o + (a - o) * n);
|
|
1055
|
-
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s <
|
|
1097
|
+
return s = Math.max(0, s), c = Math.min(t - 1, c), c - s < it && (s = Math.max(0, Math.min(Math.round(o) - 1, t - 1 - it)), c = Math.min(t - 1, s + it)), [s, c];
|
|
1056
1098
|
}
|
|
1057
|
-
function
|
|
1099
|
+
function ot(e, t, n) {
|
|
1058
1100
|
let [r, i] = e, a = i - r, o = Math.max(0, Math.min(t - 1 - a, Math.round(r + n)));
|
|
1059
1101
|
return [o, o + a];
|
|
1060
1102
|
}
|
|
1061
|
-
function
|
|
1103
|
+
function st(e, t) {
|
|
1062
1104
|
return e[0] > 0 || e[1] < t - 1;
|
|
1063
1105
|
}
|
|
1064
1106
|
//#endregion
|
|
1065
1107
|
//#region src/chrome/toolbox.tsx
|
|
1066
|
-
var
|
|
1108
|
+
var ct = {
|
|
1067
1109
|
display: "inline-flex",
|
|
1068
1110
|
alignItems: "center",
|
|
1069
1111
|
justifyContent: "center",
|
|
@@ -1078,7 +1120,7 @@ var ot = {
|
|
|
1078
1120
|
color: "var(--cascivo-color-foreground, inherit)",
|
|
1079
1121
|
cursor: "pointer"
|
|
1080
1122
|
};
|
|
1081
|
-
function
|
|
1123
|
+
function lt({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, showData: a }) {
|
|
1082
1124
|
let o = e;
|
|
1083
1125
|
return /* @__PURE__ */ h("div", {
|
|
1084
1126
|
role: "group",
|
|
@@ -1090,26 +1132,26 @@ function st({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1090
1132
|
children: [
|
|
1091
1133
|
o.png !== !1 && /* @__PURE__ */ m("button", {
|
|
1092
1134
|
type: "button",
|
|
1093
|
-
style:
|
|
1135
|
+
style: ct,
|
|
1094
1136
|
onClick: t,
|
|
1095
1137
|
children: f(u.charts.exportPng)
|
|
1096
1138
|
}),
|
|
1097
1139
|
o.svg !== !1 && /* @__PURE__ */ m("button", {
|
|
1098
1140
|
type: "button",
|
|
1099
|
-
style:
|
|
1141
|
+
style: ct,
|
|
1100
1142
|
onClick: n,
|
|
1101
1143
|
children: f(u.charts.exportSvg)
|
|
1102
1144
|
}),
|
|
1103
1145
|
o.dataView !== !1 && /* @__PURE__ */ m("button", {
|
|
1104
1146
|
type: "button",
|
|
1105
|
-
style:
|
|
1147
|
+
style: ct,
|
|
1106
1148
|
"aria-pressed": a,
|
|
1107
1149
|
onClick: r,
|
|
1108
1150
|
children: f(u.charts.dataView)
|
|
1109
1151
|
}),
|
|
1110
1152
|
o.restore !== !1 && /* @__PURE__ */ m("button", {
|
|
1111
1153
|
type: "button",
|
|
1112
|
-
style:
|
|
1154
|
+
style: ct,
|
|
1113
1155
|
onClick: i,
|
|
1114
1156
|
children: f(u.charts.restore)
|
|
1115
1157
|
})
|
|
@@ -1118,19 +1160,19 @@ function st({ options: e, onPng: t, onSvg: n, onToggleData: r, onRestore: i, sho
|
|
|
1118
1160
|
}
|
|
1119
1161
|
//#endregion
|
|
1120
1162
|
//#region src/core/export.ts
|
|
1121
|
-
var
|
|
1163
|
+
var ut = [
|
|
1122
1164
|
"fill",
|
|
1123
1165
|
"stroke",
|
|
1124
1166
|
"stop-color",
|
|
1125
1167
|
"color"
|
|
1126
1168
|
];
|
|
1127
|
-
function
|
|
1169
|
+
function dt(e) {
|
|
1128
1170
|
let t = e.cloneNode(!0);
|
|
1129
1171
|
if (typeof getComputedStyle == "function") {
|
|
1130
1172
|
let n = e.querySelectorAll("*"), r = t.querySelectorAll("*");
|
|
1131
1173
|
for (let e = 0; e < n.length; e++) {
|
|
1132
1174
|
let t = getComputedStyle(n[e]), i = r[e];
|
|
1133
|
-
if (i) for (let e of
|
|
1175
|
+
if (i) for (let e of ut) {
|
|
1134
1176
|
let n = t.getPropertyValue(e);
|
|
1135
1177
|
n && n !== "none" && !n.includes("var(") && i.setAttribute(e, n);
|
|
1136
1178
|
}
|
|
@@ -1138,7 +1180,7 @@ function lt(e) {
|
|
|
1138
1180
|
}
|
|
1139
1181
|
return t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), new XMLSerializer().serializeToString(t);
|
|
1140
1182
|
}
|
|
1141
|
-
function
|
|
1183
|
+
function ft(e, t) {
|
|
1142
1184
|
if (typeof document > "u" || typeof Image > "u") return Promise.resolve(null);
|
|
1143
1185
|
let n = t.dpr ?? 1, r = document.createElement("canvas");
|
|
1144
1186
|
r.width = Math.max(1, Math.round(t.width * n)), r.height = Math.max(1, Math.round(t.height * n));
|
|
@@ -1154,14 +1196,14 @@ function ut(e, t) {
|
|
|
1154
1196
|
}), n.addEventListener("error", () => t(null)), n.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
|
|
1155
1197
|
}) : Promise.resolve(null);
|
|
1156
1198
|
}
|
|
1157
|
-
function
|
|
1199
|
+
function pt(e, t) {
|
|
1158
1200
|
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
1159
1201
|
let n = typeof e == "string" ? new Blob([e], { type: "image/svg+xml" }) : e, r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1160
1202
|
i.href = r, i.download = t, i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
1161
1203
|
}
|
|
1162
1204
|
//#endregion
|
|
1163
1205
|
//#region src/core/chart-frame.tsx
|
|
1164
|
-
var
|
|
1206
|
+
var mt = {
|
|
1165
1207
|
position: "absolute",
|
|
1166
1208
|
insetInlineStart: "-9999px",
|
|
1167
1209
|
inlineSize: "1px",
|
|
@@ -1170,121 +1212,121 @@ var ft = {
|
|
|
1170
1212
|
clipPath: "inset(50%)",
|
|
1171
1213
|
whiteSpace: "nowrap"
|
|
1172
1214
|
};
|
|
1173
|
-
function Q({ title: e, description: t, width: n, height: r
|
|
1215
|
+
function Q({ title: e, description: t, width: n, height: r, fallback: i, children: d, className: g, "data-state": _, emptyLabel: v, plain: y, tooltip: b, onSelect: x, hover: S = "rect", renderer: C = "svg", paint: w, zoom: T, toolbox: E, onRestore: D, transition: O, onBeforeDraw: k, onAfterDraw: A }) {
|
|
1174
1216
|
s();
|
|
1175
|
-
let
|
|
1217
|
+
let j = c(), M = `${j}-desc`, ee = `${j}-live`, { ref: N, width: te, height: P } = We(n ?? 400, 300), F = a(null), I = a(!1), ne = l(null), L = l(null), R = l(null), ie = l(null);
|
|
1176
1218
|
o(() => {
|
|
1177
|
-
let e =
|
|
1219
|
+
let e = ie.current;
|
|
1178
1220
|
if (!e || !T) return;
|
|
1179
1221
|
let t = (t) => {
|
|
1180
1222
|
t.preventDefault();
|
|
1181
1223
|
let n = e.getBoundingClientRect(), r = n.width ? (t.clientX - n.left) / n.width : .5, i = t.deltaY > 0 ? 1.25 : 1 / 1.25;
|
|
1182
|
-
T.window.value =
|
|
1224
|
+
T.window.value = at(T.window.value, T.count, i, r);
|
|
1183
1225
|
};
|
|
1184
1226
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1185
1227
|
});
|
|
1186
|
-
let
|
|
1228
|
+
let z = () => {
|
|
1187
1229
|
T && (T.window.value = [0, Math.max(0, T.count - 1)]);
|
|
1188
|
-
},
|
|
1189
|
-
let t =
|
|
1190
|
-
t &&
|
|
1191
|
-
},
|
|
1192
|
-
let t =
|
|
1193
|
-
t &&
|
|
1194
|
-
width:
|
|
1195
|
-
height:
|
|
1230
|
+
}, B = n ?? te.value, V = r ?? P.value, H = E === !0 ? {} : E || null, U = () => L.current ? dt(L.current) : null, W = () => {
|
|
1231
|
+
let t = U();
|
|
1232
|
+
t && pt(t, `${e || "chart"}.svg`);
|
|
1233
|
+
}, G = () => {
|
|
1234
|
+
let t = U();
|
|
1235
|
+
t && ft(t, {
|
|
1236
|
+
width: B,
|
|
1237
|
+
height: V,
|
|
1196
1238
|
dpr: 2
|
|
1197
1239
|
}).then((t) => {
|
|
1198
|
-
t &&
|
|
1240
|
+
t && pt(t, `${e || "chart"}.png`);
|
|
1199
1241
|
});
|
|
1200
|
-
},
|
|
1201
|
-
|
|
1202
|
-
},
|
|
1203
|
-
width:
|
|
1204
|
-
height:
|
|
1242
|
+
}, K = () => {
|
|
1243
|
+
z(), D?.();
|
|
1244
|
+
}, q = typeof b == "function" ? b({
|
|
1245
|
+
width: B,
|
|
1246
|
+
height: V
|
|
1205
1247
|
}) : b;
|
|
1206
1248
|
o(() => {
|
|
1207
1249
|
let e = F.value;
|
|
1208
|
-
if (!
|
|
1209
|
-
let t = e === null ? void 0 :
|
|
1210
|
-
ne.current.textContent = t ? (
|
|
1250
|
+
if (!q || !ne.current) return;
|
|
1251
|
+
let t = e === null ? void 0 : q.points[e];
|
|
1252
|
+
ne.current.textContent = t ? (q.format ?? $e)(t) : "";
|
|
1211
1253
|
});
|
|
1212
|
-
let
|
|
1254
|
+
let ae = {
|
|
1213
1255
|
position: "absolute",
|
|
1214
1256
|
inset: 0,
|
|
1215
1257
|
cursor: T ? "grab" : x ? "pointer" : "crosshair",
|
|
1216
1258
|
background: "transparent",
|
|
1217
1259
|
touchAction: T ? "none" : void 0
|
|
1218
|
-
}, J = C === "canvas" && w !== void 0, Y =
|
|
1260
|
+
}, J = C === "canvas" && w !== void 0, Y = q !== void 0 || T !== void 0, oe = {};
|
|
1219
1261
|
if (O && typeof O == "object") {
|
|
1220
1262
|
let e = oe;
|
|
1221
1263
|
O.duration !== void 0 && (e["--cascivo-chart-anim-dur"] = `${O.duration}ms`), O.easing && (e["--cascivo-chart-anim-ease"] = O.easing), O.properties && (e["--cascivo-chart-anim-props"] = O.properties.join(", "));
|
|
1222
1264
|
}
|
|
1223
|
-
let X = Y || J ||
|
|
1265
|
+
let X = Y || J || H || Object.keys(oe).length > 0 ? {
|
|
1224
1266
|
...oe,
|
|
1225
|
-
...Y || J ||
|
|
1267
|
+
...Y || J || H ? { position: "relative" } : {}
|
|
1226
1268
|
} : void 0;
|
|
1227
1269
|
return /* @__PURE__ */ h("div", {
|
|
1228
|
-
ref:
|
|
1229
|
-
className: [
|
|
1270
|
+
ref: N,
|
|
1271
|
+
className: [Qe.frame, g].filter(Boolean).join(" "),
|
|
1230
1272
|
style: X,
|
|
1231
1273
|
..._ !== void 0 && { "data-state": _ },
|
|
1232
1274
|
...y === !0 && { "data-plain": "" },
|
|
1233
1275
|
...O === !1 && { "data-no-anim": "" },
|
|
1234
1276
|
children: [
|
|
1235
|
-
|
|
1277
|
+
H && /* @__PURE__ */ m("div", {
|
|
1236
1278
|
style: {
|
|
1237
1279
|
position: "absolute",
|
|
1238
1280
|
top: 4,
|
|
1239
1281
|
right: 4,
|
|
1240
1282
|
zIndex: 12
|
|
1241
1283
|
},
|
|
1242
|
-
children: /* @__PURE__ */ m(
|
|
1243
|
-
options:
|
|
1244
|
-
onPng:
|
|
1245
|
-
onSvg:
|
|
1284
|
+
children: /* @__PURE__ */ m(lt, {
|
|
1285
|
+
options: H,
|
|
1286
|
+
onPng: G,
|
|
1287
|
+
onSvg: W,
|
|
1246
1288
|
onToggleData: () => {
|
|
1247
1289
|
I.value = !I.value;
|
|
1248
1290
|
},
|
|
1249
|
-
onRestore:
|
|
1291
|
+
onRestore: K,
|
|
1250
1292
|
showData: I.value
|
|
1251
1293
|
})
|
|
1252
1294
|
}),
|
|
1253
|
-
J && /* @__PURE__ */ m(
|
|
1295
|
+
J && /* @__PURE__ */ m(nt, {
|
|
1254
1296
|
size: () => ({
|
|
1255
|
-
width: n ??
|
|
1297
|
+
width: n ?? te.value,
|
|
1256
1298
|
height: r ?? P.value
|
|
1257
1299
|
}),
|
|
1258
1300
|
paint: w
|
|
1259
1301
|
}),
|
|
1260
1302
|
/* @__PURE__ */ h("svg", {
|
|
1261
|
-
ref:
|
|
1303
|
+
ref: L,
|
|
1262
1304
|
role: "img",
|
|
1263
1305
|
"aria-label": e,
|
|
1264
|
-
"aria-describedby": t ?
|
|
1265
|
-
width:
|
|
1266
|
-
height:
|
|
1267
|
-
viewBox: `0 0 ${
|
|
1306
|
+
"aria-describedby": t ? M : void 0,
|
|
1307
|
+
width: B,
|
|
1308
|
+
height: V,
|
|
1309
|
+
viewBox: `0 0 ${B} ${V}`,
|
|
1268
1310
|
children: [
|
|
1269
1311
|
t && /* @__PURE__ */ m("desc", {
|
|
1270
|
-
id:
|
|
1312
|
+
id: M,
|
|
1271
1313
|
children: t
|
|
1272
1314
|
}),
|
|
1273
|
-
|
|
1274
|
-
width:
|
|
1275
|
-
height:
|
|
1315
|
+
k?.({
|
|
1316
|
+
width: B,
|
|
1317
|
+
height: V
|
|
1276
1318
|
}),
|
|
1277
1319
|
d({
|
|
1278
|
-
width:
|
|
1279
|
-
height:
|
|
1320
|
+
width: B,
|
|
1321
|
+
height: V
|
|
1280
1322
|
}),
|
|
1281
|
-
|
|
1282
|
-
width:
|
|
1283
|
-
height:
|
|
1323
|
+
A?.({
|
|
1324
|
+
width: B,
|
|
1325
|
+
height: V
|
|
1284
1326
|
}),
|
|
1285
1327
|
_ === "empty" && /* @__PURE__ */ m("text", {
|
|
1286
|
-
x:
|
|
1287
|
-
y:
|
|
1328
|
+
x: B / 2,
|
|
1329
|
+
y: V / 2,
|
|
1288
1330
|
textAnchor: "middle",
|
|
1289
1331
|
dominantBaseline: "central",
|
|
1290
1332
|
fill: "var(--cascivo-color-foreground-muted)",
|
|
@@ -1295,19 +1337,19 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1295
1337
|
]
|
|
1296
1338
|
}),
|
|
1297
1339
|
i && /* @__PURE__ */ m("div", {
|
|
1298
|
-
className:
|
|
1299
|
-
style:
|
|
1340
|
+
className: Qe.fallback,
|
|
1341
|
+
style: mt,
|
|
1300
1342
|
children: i
|
|
1301
1343
|
}),
|
|
1302
|
-
|
|
1344
|
+
H && I.value && i && /* @__PURE__ */ m("div", {
|
|
1303
1345
|
"data-data-view": "",
|
|
1304
1346
|
style: { overflowX: "auto" },
|
|
1305
1347
|
children: i
|
|
1306
1348
|
}),
|
|
1307
1349
|
Y && /* @__PURE__ */ h(p, { children: [
|
|
1308
|
-
|
|
1350
|
+
q !== void 0 && /* @__PURE__ */ h(p, { children: [
|
|
1309
1351
|
/* @__PURE__ */ m("span", {
|
|
1310
|
-
id:
|
|
1352
|
+
id: ee,
|
|
1311
1353
|
ref: ne,
|
|
1312
1354
|
"aria-live": "polite",
|
|
1313
1355
|
style: {
|
|
@@ -1322,21 +1364,21 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1322
1364
|
border: 0
|
|
1323
1365
|
}
|
|
1324
1366
|
}),
|
|
1325
|
-
|
|
1367
|
+
q.mode === "axis" && F.value !== null && q.points[F.value] !== void 0 && /* @__PURE__ */ m("div", {
|
|
1326
1368
|
"aria-hidden": "true",
|
|
1327
1369
|
style: {
|
|
1328
1370
|
position: "absolute",
|
|
1329
|
-
left:
|
|
1371
|
+
left: q.points[F.value].cx,
|
|
1330
1372
|
top: 0,
|
|
1331
1373
|
width: 1,
|
|
1332
|
-
height:
|
|
1374
|
+
height: V,
|
|
1333
1375
|
background: "var(--cascivo-chart-grid, currentColor)",
|
|
1334
1376
|
pointerEvents: "none",
|
|
1335
1377
|
zIndex: 9
|
|
1336
1378
|
}
|
|
1337
1379
|
}),
|
|
1338
|
-
F.value !== null &&
|
|
1339
|
-
let e =
|
|
1380
|
+
F.value !== null && q.points[F.value] !== void 0 && (() => {
|
|
1381
|
+
let e = q.points[F.value];
|
|
1340
1382
|
return /* @__PURE__ */ m("div", {
|
|
1341
1383
|
"aria-hidden": "true",
|
|
1342
1384
|
style: {
|
|
@@ -1353,14 +1395,14 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1353
1395
|
}
|
|
1354
1396
|
});
|
|
1355
1397
|
})(),
|
|
1356
|
-
F.value !== null &&
|
|
1357
|
-
point:
|
|
1358
|
-
model:
|
|
1398
|
+
F.value !== null && q.points[F.value] !== void 0 && /* @__PURE__ */ m(et, {
|
|
1399
|
+
point: q.points[F.value],
|
|
1400
|
+
model: q
|
|
1359
1401
|
})
|
|
1360
1402
|
] }),
|
|
1361
|
-
T && !
|
|
1403
|
+
T && !H && st(T.window.value, T.count) && /* @__PURE__ */ m("button", {
|
|
1362
1404
|
type: "button",
|
|
1363
|
-
onClick:
|
|
1405
|
+
onClick: z,
|
|
1364
1406
|
style: {
|
|
1365
1407
|
position: "absolute",
|
|
1366
1408
|
top: 4,
|
|
@@ -1378,71 +1420,71 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1378
1420
|
children: f(u.charts.resetZoom)
|
|
1379
1421
|
}),
|
|
1380
1422
|
/* @__PURE__ */ m("div", {
|
|
1381
|
-
ref:
|
|
1423
|
+
ref: ie,
|
|
1382
1424
|
role: "application",
|
|
1383
1425
|
"aria-label": T ? "Chart — arrow keys navigate points; + and - zoom, 0 resets, drag to pan" : "Chart data — use arrow keys to navigate points",
|
|
1384
1426
|
tabIndex: 0,
|
|
1385
|
-
style:
|
|
1427
|
+
style: ae,
|
|
1386
1428
|
onPointerDown: (e) => {
|
|
1387
|
-
T && (
|
|
1429
|
+
T && (R.current = {
|
|
1388
1430
|
x: e.clientX,
|
|
1389
1431
|
win: [...T.window.value]
|
|
1390
1432
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
1391
1433
|
},
|
|
1392
1434
|
onPointerMove: (e) => {
|
|
1393
|
-
if (T &&
|
|
1394
|
-
let t = e.currentTarget.getBoundingClientRect(), n =
|
|
1395
|
-
T.window.value =
|
|
1435
|
+
if (T && R.current && e.buttons === 1) {
|
|
1436
|
+
let t = e.currentTarget.getBoundingClientRect(), n = R.current.win[1] - R.current.win[0] + 1, r = e.clientX - R.current.x, i = t.width ? -(r / t.width) * n : 0;
|
|
1437
|
+
T.window.value = ot(R.current.win, T.count, i);
|
|
1396
1438
|
return;
|
|
1397
1439
|
}
|
|
1398
|
-
if (!
|
|
1440
|
+
if (!q || !q.points.length) return;
|
|
1399
1441
|
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
1400
|
-
F.value =
|
|
1442
|
+
F.value = q.mode === "axis" ? tt(q.points, n, r, "x") : S === "voronoi" ? re(q.points.map((e) => [e.cx, e.cy]), n, r) : tt(q.points, n, r, "xy");
|
|
1401
1443
|
},
|
|
1402
1444
|
onPointerUp: () => {
|
|
1403
|
-
|
|
1445
|
+
R.current = null;
|
|
1404
1446
|
},
|
|
1405
1447
|
onPointerLeave: () => {
|
|
1406
|
-
|
|
1448
|
+
R.current = null, q && (F.value = null);
|
|
1407
1449
|
},
|
|
1408
1450
|
onKeyDown: (e) => {
|
|
1409
1451
|
if (T) {
|
|
1410
1452
|
if (e.key === "+" || e.key === "=") {
|
|
1411
|
-
e.preventDefault(), T.window.value =
|
|
1453
|
+
e.preventDefault(), T.window.value = at(T.window.value, T.count, 1 / 1.25, .5);
|
|
1412
1454
|
return;
|
|
1413
1455
|
}
|
|
1414
1456
|
if (e.key === "-" || e.key === "_") {
|
|
1415
|
-
e.preventDefault(), T.window.value =
|
|
1457
|
+
e.preventDefault(), T.window.value = at(T.window.value, T.count, 1.25, .5);
|
|
1416
1458
|
return;
|
|
1417
1459
|
}
|
|
1418
1460
|
if (e.key === "0") {
|
|
1419
|
-
e.preventDefault(),
|
|
1461
|
+
e.preventDefault(), z();
|
|
1420
1462
|
return;
|
|
1421
1463
|
}
|
|
1422
1464
|
}
|
|
1423
|
-
if (!
|
|
1465
|
+
if (!q || !q.points.length) return;
|
|
1424
1466
|
let t = F.value;
|
|
1425
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), F.value = t === null ? 0 : Math.min(t + 1,
|
|
1426
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), F.value = t === null ?
|
|
1467
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") e.preventDefault(), F.value = t === null ? 0 : Math.min(t + 1, q.points.length - 1);
|
|
1468
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") e.preventDefault(), F.value = t === null ? q.points.length - 1 : Math.max(t - 1, 0);
|
|
1427
1469
|
else if (e.key === "Home") e.preventDefault(), F.value = 0;
|
|
1428
|
-
else if (e.key === "End") e.preventDefault(), F.value =
|
|
1470
|
+
else if (e.key === "End") e.preventDefault(), F.value = q.points.length - 1;
|
|
1429
1471
|
else if (e.key === "Escape") F.value = null;
|
|
1430
1472
|
else if (x && (e.key === "Enter" || e.key === " ")) {
|
|
1431
1473
|
e.preventDefault();
|
|
1432
|
-
let t = F.value, n = t === null ? void 0 :
|
|
1474
|
+
let t = F.value, n = t === null ? void 0 : q.points[t];
|
|
1433
1475
|
n && x(n);
|
|
1434
1476
|
}
|
|
1435
1477
|
},
|
|
1436
1478
|
onClick: () => {
|
|
1437
|
-
if (!
|
|
1438
|
-
let e = F.value, t = e === null ? void 0 :
|
|
1479
|
+
if (!q) return;
|
|
1480
|
+
let e = F.value, t = e === null ? void 0 : q.points[e];
|
|
1439
1481
|
x && t && x(t);
|
|
1440
1482
|
},
|
|
1441
1483
|
onFocus: () => {
|
|
1442
|
-
|
|
1484
|
+
q && q.points.length > 0 && F.value === null && (F.value = 0);
|
|
1443
1485
|
},
|
|
1444
1486
|
onBlur: () => {
|
|
1445
|
-
|
|
1487
|
+
q && (F.value = null);
|
|
1446
1488
|
}
|
|
1447
1489
|
})
|
|
1448
1490
|
] })
|
|
@@ -1451,57 +1493,63 @@ function Q({ title: e, description: t, width: n, height: r = 300, fallback: i, c
|
|
|
1451
1493
|
}
|
|
1452
1494
|
//#endregion
|
|
1453
1495
|
//#region src/core/sync.ts
|
|
1454
|
-
var
|
|
1455
|
-
function
|
|
1456
|
-
let t =
|
|
1496
|
+
var ht = /* @__PURE__ */ new Map();
|
|
1497
|
+
function gt(e) {
|
|
1498
|
+
let t = ht.get(e);
|
|
1457
1499
|
return t || (t = {
|
|
1458
1500
|
group: {
|
|
1459
1501
|
window: r(null),
|
|
1460
1502
|
hoverX: r(null)
|
|
1461
1503
|
},
|
|
1462
1504
|
refs: 0
|
|
1463
|
-
},
|
|
1505
|
+
}, ht.set(e, t)), t.refs++, t.group;
|
|
1464
1506
|
}
|
|
1465
|
-
function
|
|
1466
|
-
let t =
|
|
1467
|
-
t && (t.refs--, t.refs <= 0 &&
|
|
1507
|
+
function _t(e) {
|
|
1508
|
+
let t = ht.get(e);
|
|
1509
|
+
t && (t.refs--, t.refs <= 0 && ht.delete(e));
|
|
1468
1510
|
}
|
|
1469
|
-
function
|
|
1470
|
-
return
|
|
1511
|
+
function vt() {
|
|
1512
|
+
return ht.size;
|
|
1471
1513
|
}
|
|
1472
1514
|
//#endregion
|
|
1473
1515
|
//#region src/chrome/axis.tsx
|
|
1474
|
-
function
|
|
1516
|
+
function yt(e) {
|
|
1475
1517
|
return "bandwidth" in e;
|
|
1476
1518
|
}
|
|
1477
|
-
function
|
|
1519
|
+
function bt(e) {
|
|
1478
1520
|
return "tickInterval" in e;
|
|
1479
1521
|
}
|
|
1480
|
-
function
|
|
1522
|
+
function xt(e) {
|
|
1481
1523
|
return e instanceof Date ? e.toLocaleDateString() : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
1482
1524
|
}
|
|
1483
|
-
function
|
|
1525
|
+
function St(e, t) {
|
|
1526
|
+
let n = new Intl.DateTimeFormat(void 0, e.tickFormat(t));
|
|
1527
|
+
return (e) => n.format(e);
|
|
1528
|
+
}
|
|
1529
|
+
function $({ scale: e, orientation: t, length: n, format: r, tickCount: i = 5, labelEvery: a, title: o, titleOffset: s = 36, transform: c }) {
|
|
1484
1530
|
let l;
|
|
1485
|
-
if (
|
|
1486
|
-
let t = e.domain.length - 1,
|
|
1487
|
-
if (
|
|
1488
|
-
let
|
|
1489
|
-
|
|
1531
|
+
if (yt(e)) {
|
|
1532
|
+
let t = r ?? xt, n = e.domain.length - 1, i = a != null && a > 1, o = i ? Math.floor(n / a) * a : -1, s = !1;
|
|
1533
|
+
if (i && o !== n && o >= 0) {
|
|
1534
|
+
let r = (t) => (e.map(e.domain[t]) ?? 0) + e.bandwidth / 2, i = e.domain.reduce((e, n) => Math.max(e, t(n).length), 0) * qe;
|
|
1535
|
+
s = r(n) - r(o) < i;
|
|
1490
1536
|
}
|
|
1491
|
-
l = e.domain.map((
|
|
1492
|
-
position: (e.map(
|
|
1493
|
-
label:
|
|
1494
|
-
i:
|
|
1495
|
-
})).filter(({ i: e }) => !
|
|
1496
|
-
} else if (
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1537
|
+
l = e.domain.map((n, r) => ({
|
|
1538
|
+
position: (e.map(n) ?? 0) + e.bandwidth / 2,
|
|
1539
|
+
label: t(n),
|
|
1540
|
+
i: r
|
|
1541
|
+
})).filter(({ i: e }) => !i || e === n ? !0 : s && e === o ? !1 : e % a === 0);
|
|
1542
|
+
} else if (bt(e)) {
|
|
1543
|
+
let t = r ?? St(e, i);
|
|
1544
|
+
l = e.ticks(i).map((n) => ({
|
|
1545
|
+
position: e.map(n),
|
|
1546
|
+
label: t(n)
|
|
1547
|
+
}));
|
|
1548
|
+
} else {
|
|
1501
1549
|
let t = e;
|
|
1502
1550
|
l = t.ticks(i).map((e) => ({
|
|
1503
1551
|
position: t.map(e),
|
|
1504
|
-
label: r(e)
|
|
1552
|
+
label: (r ?? xt)(e)
|
|
1505
1553
|
}));
|
|
1506
1554
|
}
|
|
1507
1555
|
let u = t === "x", d = t === "y-right", f = u ? 0 : d ? 4 : -4, p = u ? 0 : d ? 8 : -8, g = u ? "middle" : d ? "start" : "end";
|
|
@@ -1548,7 +1596,7 @@ function $({ scale: e, orientation: t, length: n, format: r = yt, tickCount: i =
|
|
|
1548
1596
|
}
|
|
1549
1597
|
//#endregion
|
|
1550
1598
|
//#region src/chrome/grid-lines.tsx
|
|
1551
|
-
function
|
|
1599
|
+
function Ct({ scale: e, orientation: t, length: n, tickCount: r = 5, transform: i }) {
|
|
1552
1600
|
let a = e.ticks(r), o = t === "x";
|
|
1553
1601
|
return /* @__PURE__ */ m("g", {
|
|
1554
1602
|
transform: i,
|
|
@@ -1569,17 +1617,17 @@ function bt({ scale: e, orientation: t, length: n, tickCount: r = 5, transform:
|
|
|
1569
1617
|
}
|
|
1570
1618
|
//#endregion
|
|
1571
1619
|
//#region src/chrome/reference.tsx
|
|
1572
|
-
var
|
|
1573
|
-
function
|
|
1620
|
+
var wt = "var(--cascivo-color-foreground-muted)", Tt = "var(--cascivo-color-accent)";
|
|
1621
|
+
function Et(e, t) {
|
|
1574
1622
|
let n = e.map(t);
|
|
1575
1623
|
if (!(n == null || Number.isNaN(n))) return e.bandwidth ? n + e.bandwidth / 2 : n;
|
|
1576
1624
|
}
|
|
1577
|
-
function
|
|
1625
|
+
function Dt(e, t, n) {
|
|
1578
1626
|
let { xScale: r, yScale: i, innerW: a, innerH: o } = t;
|
|
1579
1627
|
if (e.kind === "line") {
|
|
1580
|
-
let t =
|
|
1628
|
+
let t = Et(e.axis === "x" ? r : i, e.value);
|
|
1581
1629
|
if (t == null) return null;
|
|
1582
|
-
let s = e.color ??
|
|
1630
|
+
let s = e.color ?? wt, c = e.dash !== !1, l = e.axis === "x";
|
|
1583
1631
|
return /* @__PURE__ */ h("g", {
|
|
1584
1632
|
"data-annotation": "line",
|
|
1585
1633
|
"aria-hidden": "true",
|
|
@@ -1610,9 +1658,9 @@ function wt(e, t, n) {
|
|
|
1610
1658
|
}, n);
|
|
1611
1659
|
}
|
|
1612
1660
|
if (e.kind === "area") {
|
|
1613
|
-
let t = e.axis === "x" ? r : i, s =
|
|
1661
|
+
let t = e.axis === "x" ? r : i, s = Et(t, e.from), c = Et(t, e.to);
|
|
1614
1662
|
if (s == null || c == null) return null;
|
|
1615
|
-
let l = e.color ??
|
|
1663
|
+
let l = e.color ?? Tt, u = e.axis === "x", d = Math.min(s, c), f = Math.abs(c - s);
|
|
1616
1664
|
return /* @__PURE__ */ m("g", {
|
|
1617
1665
|
"data-annotation": "area",
|
|
1618
1666
|
"aria-hidden": "true",
|
|
@@ -1628,9 +1676,9 @@ function wt(e, t, n) {
|
|
|
1628
1676
|
}, n);
|
|
1629
1677
|
}
|
|
1630
1678
|
if (e.kind === "note") {
|
|
1631
|
-
let t =
|
|
1679
|
+
let t = Et(r, e.x), s = Et(i, e.y);
|
|
1632
1680
|
if (t == null || s == null) return null;
|
|
1633
|
-
let c = e.color ??
|
|
1681
|
+
let c = e.color ?? Tt, l = e.dx ?? 24, u = e.dy ?? -24, d = Math.max(2, Math.min(a - 2, t + l)), f = Math.max(8, Math.min(o - 2, s + u));
|
|
1634
1682
|
return /* @__PURE__ */ h("g", {
|
|
1635
1683
|
"data-annotation": "note",
|
|
1636
1684
|
children: [
|
|
@@ -1666,7 +1714,7 @@ function wt(e, t, n) {
|
|
|
1666
1714
|
if (e.kind === "threshold") {
|
|
1667
1715
|
let t = i.map(e.value);
|
|
1668
1716
|
if (t == null || Number.isNaN(t)) return null;
|
|
1669
|
-
let r = e.color ??
|
|
1717
|
+
let r = e.color ?? Tt, s = e.side === "above" ? 0 : t, c = e.side === "above" ? t : o - t;
|
|
1670
1718
|
return /* @__PURE__ */ m("g", {
|
|
1671
1719
|
"data-annotation": "threshold",
|
|
1672
1720
|
"aria-hidden": "true",
|
|
@@ -1681,9 +1729,9 @@ function wt(e, t, n) {
|
|
|
1681
1729
|
})
|
|
1682
1730
|
}, n);
|
|
1683
1731
|
}
|
|
1684
|
-
let s =
|
|
1732
|
+
let s = Et(r, e.x), c = Et(i, e.y);
|
|
1685
1733
|
if (s == null || c == null) return null;
|
|
1686
|
-
let l = e.color ??
|
|
1734
|
+
let l = e.color ?? Tt;
|
|
1687
1735
|
return /* @__PURE__ */ h("g", {
|
|
1688
1736
|
"data-annotation": "dot",
|
|
1689
1737
|
"aria-hidden": "true",
|
|
@@ -1705,28 +1753,28 @@ function wt(e, t, n) {
|
|
|
1705
1753
|
})]
|
|
1706
1754
|
}, n);
|
|
1707
1755
|
}
|
|
1708
|
-
function
|
|
1756
|
+
function Ot(e, t) {
|
|
1709
1757
|
return !e || e.length === 0 ? null : /* @__PURE__ */ m("g", {
|
|
1710
1758
|
"data-annotations": "",
|
|
1711
|
-
children: e.map((e, n) =>
|
|
1759
|
+
children: e.map((e, n) => Dt(e, t, n))
|
|
1712
1760
|
});
|
|
1713
1761
|
}
|
|
1714
|
-
function
|
|
1762
|
+
function kt(e) {
|
|
1715
1763
|
return e.kind === "line" ? e.label ?? `${e.axis}=${String(e.value)}` : e.kind === "area" ? e.label ?? `${e.axis} ${String(e.from)}–${String(e.to)}` : e.kind === "threshold" ? e.label ?? `${e.side} ${e.value}` : e.kind === "note" ? e.label : e.label ?? `(${String(e.x)}, ${e.y})`;
|
|
1716
1764
|
}
|
|
1717
1765
|
//#endregion
|
|
1718
1766
|
//#region src/chrome/data-label.tsx
|
|
1719
|
-
var
|
|
1720
|
-
function
|
|
1767
|
+
var At = (e) => e.toLocaleString();
|
|
1768
|
+
function jt(e) {
|
|
1721
1769
|
return e ? e === !0 ? {
|
|
1722
|
-
format:
|
|
1770
|
+
format: At,
|
|
1723
1771
|
position: "auto"
|
|
1724
1772
|
} : {
|
|
1725
|
-
format: e.format ??
|
|
1773
|
+
format: e.format ?? At,
|
|
1726
1774
|
position: e.position ?? "auto"
|
|
1727
1775
|
} : null;
|
|
1728
1776
|
}
|
|
1729
|
-
function
|
|
1777
|
+
function Mt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" }) {
|
|
1730
1778
|
return /* @__PURE__ */ m("text", {
|
|
1731
1779
|
x: e,
|
|
1732
1780
|
y: t,
|
|
@@ -1742,21 +1790,21 @@ function kt({ x: e, y: t, text: n, tone: r = "default", anchor: i = "middle" })
|
|
|
1742
1790
|
}
|
|
1743
1791
|
//#endregion
|
|
1744
1792
|
//#region src/chrome/defs.tsx
|
|
1745
|
-
function
|
|
1793
|
+
function Nt(e) {
|
|
1746
1794
|
return e.replace(/[^a-zA-Z0-9_-]/g, "");
|
|
1747
1795
|
}
|
|
1748
|
-
function
|
|
1749
|
-
return `${
|
|
1796
|
+
function Pt(e, t) {
|
|
1797
|
+
return `${Nt(e)}-grad-${Nt(t)}`;
|
|
1750
1798
|
}
|
|
1751
|
-
function
|
|
1752
|
-
return `${
|
|
1799
|
+
function Ft(e, t) {
|
|
1800
|
+
return `${Nt(e)}-pat-${Nt(t)}`;
|
|
1753
1801
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return n === "gradient" ? `url(#${
|
|
1802
|
+
function It(e, t, n, r) {
|
|
1803
|
+
return n === "gradient" ? `url(#${Pt(e, t)})` : n === "pattern" ? `url(#${Ft(e, t)})` : r;
|
|
1756
1804
|
}
|
|
1757
|
-
function
|
|
1805
|
+
function Lt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
1758
1806
|
return n === "solid" ? null : /* @__PURE__ */ m("defs", { children: t.map((t) => n === "gradient" ? /* @__PURE__ */ h("linearGradient", {
|
|
1759
|
-
id:
|
|
1807
|
+
id: Pt(e, t.id),
|
|
1760
1808
|
x1: "0",
|
|
1761
1809
|
y1: "0",
|
|
1762
1810
|
x2: "0",
|
|
@@ -1771,7 +1819,7 @@ function Pt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1771
1819
|
stopOpacity: .1
|
|
1772
1820
|
})]
|
|
1773
1821
|
}, t.id) : /* @__PURE__ */ h("pattern", {
|
|
1774
|
-
id:
|
|
1822
|
+
id: Ft(e, t.id),
|
|
1775
1823
|
patternUnits: "userSpaceOnUse",
|
|
1776
1824
|
width: 6,
|
|
1777
1825
|
height: 6,
|
|
@@ -1817,7 +1865,7 @@ function Pt({ prefix: e, series: t, fill: n, patternKind: r = "dots" }) {
|
|
|
1817
1865
|
}
|
|
1818
1866
|
//#endregion
|
|
1819
1867
|
//#region src/chrome/glyph.tsx
|
|
1820
|
-
function
|
|
1868
|
+
function Rt(e, t) {
|
|
1821
1869
|
let n = t / 2;
|
|
1822
1870
|
switch (e) {
|
|
1823
1871
|
case "square": return `M${-n},${-n}h${t}v${t}h${-t}Z`;
|
|
@@ -1838,7 +1886,7 @@ function Ft(e, t) {
|
|
|
1838
1886
|
default: return "";
|
|
1839
1887
|
}
|
|
1840
1888
|
}
|
|
1841
|
-
function
|
|
1889
|
+
function zt({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke: o, strokeWidth: s }) {
|
|
1842
1890
|
let c = {
|
|
1843
1891
|
fill: i,
|
|
1844
1892
|
fillOpacity: a,
|
|
@@ -1853,33 +1901,33 @@ function It({ shape: e, x: t, y: n, size: r, color: i, opacity: a = .85, stroke:
|
|
|
1853
1901
|
r: r / 2,
|
|
1854
1902
|
...c
|
|
1855
1903
|
}) : /* @__PURE__ */ m("path", {
|
|
1856
|
-
d:
|
|
1904
|
+
d: Rt(e, r),
|
|
1857
1905
|
transform: `translate(${t},${n})`,
|
|
1858
1906
|
...c
|
|
1859
1907
|
});
|
|
1860
1908
|
}
|
|
1861
1909
|
//#endregion
|
|
1862
1910
|
//#region src/chrome/text.tsx
|
|
1863
|
-
var
|
|
1864
|
-
function
|
|
1865
|
-
if (
|
|
1866
|
-
|
|
1867
|
-
let n =
|
|
1911
|
+
var Bt;
|
|
1912
|
+
function Vt(e, t) {
|
|
1913
|
+
if (Bt === void 0 && (Bt = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), Bt) {
|
|
1914
|
+
Bt.font = `${t}px sans-serif`;
|
|
1915
|
+
let n = Bt.measureText(e).width;
|
|
1868
1916
|
if (n > 0) return n;
|
|
1869
1917
|
}
|
|
1870
1918
|
return e.length * t * .55;
|
|
1871
1919
|
}
|
|
1872
|
-
function
|
|
1920
|
+
function Ht(e, t, n) {
|
|
1873
1921
|
if (!t || t <= 0) return [e];
|
|
1874
1922
|
let r = e.split(/\s+/).filter(Boolean), i = [], a = "";
|
|
1875
1923
|
for (let e of r) {
|
|
1876
1924
|
let r = a ? `${a} ${e}` : e;
|
|
1877
|
-
a &&
|
|
1925
|
+
a && Vt(r, n) > t ? (i.push(a), a = e) : a = r;
|
|
1878
1926
|
}
|
|
1879
1927
|
return a && i.push(a), i.length ? i : [e];
|
|
1880
1928
|
}
|
|
1881
|
-
function
|
|
1882
|
-
let l = r ?
|
|
1929
|
+
function Ut({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "start", fill: o, lineHeight: s = 1.2, className: c }) {
|
|
1930
|
+
let l = r ? Ht(n, r, i) : [n];
|
|
1883
1931
|
return /* @__PURE__ */ m("text", {
|
|
1884
1932
|
x: e,
|
|
1885
1933
|
y: t,
|
|
@@ -1896,7 +1944,7 @@ function Bt({ x: e, y: t, children: n, width: r, fontSize: i = 12, anchor: a = "
|
|
|
1896
1944
|
}
|
|
1897
1945
|
//#endregion
|
|
1898
1946
|
//#region src/chrome/brush.tsx
|
|
1899
|
-
function
|
|
1947
|
+
function Wt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1900
1948
|
s();
|
|
1901
1949
|
let i = Math.max(1, e - 1), a = (e) => e / i * 100, [o, c] = n.value, l = t - 8, u = (t, r) => {
|
|
1902
1950
|
let i = Math.max(0, Math.min(e - 1, r)), [a, o] = n.value;
|
|
@@ -1967,7 +2015,7 @@ function Vt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
1967
2015
|
}
|
|
1968
2016
|
//#endregion
|
|
1969
2017
|
//#region src/chrome/data-zoom.tsx
|
|
1970
|
-
function
|
|
2018
|
+
function Gt({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
1971
2019
|
s();
|
|
1972
2020
|
let i = Math.max(1, e - 1), o = (e) => e / i * 100, [c, l] = n.value, u = t - 8, d = a(0), f = (e, t) => {
|
|
1973
2021
|
let n = t.getBoundingClientRect();
|
|
@@ -2062,27 +2110,27 @@ function Ht({ count: e, height: t = 28, window: n, label: r = "Range" }) {
|
|
|
2062
2110
|
}
|
|
2063
2111
|
//#endregion
|
|
2064
2112
|
//#region src/chrome/visual-map.tsx
|
|
2065
|
-
var
|
|
2066
|
-
function
|
|
2067
|
-
let n = t.pieces ??
|
|
2068
|
-
return Math.min(n - 1, Math.max(0, Math.floor(
|
|
2069
|
-
}
|
|
2070
|
-
function
|
|
2071
|
-
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i =
|
|
2072
|
-
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ?
|
|
2073
|
-
let [e, n] = t.sizeRange ??
|
|
2074
|
-
a.size =
|
|
2113
|
+
var Kt = 5, qt = [3, 14], Jt = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Yt = (e, t, n) => e + (t - e) * n, Xt = (e, t) => Jt((e - t.min) / (t.max - t.min || 1));
|
|
2114
|
+
function Zt(e, t) {
|
|
2115
|
+
let n = t.pieces ?? Kt;
|
|
2116
|
+
return Math.min(n - 1, Math.max(0, Math.floor(Xt(e, t) * n)));
|
|
2117
|
+
}
|
|
2118
|
+
function Qt(e, t) {
|
|
2119
|
+
let n = t.channel ?? "color", r = t.ramp ?? "sequential", i = Xt(e, t), a = {};
|
|
2120
|
+
if ((n === "color" || n === "both") && (a.color = (t.mode ?? "continuous") === "piecewise" ? xe(t.pieces ?? Kt, r)[Zt(e, t)] : be(r)(i)), n === "size" || n === "both") {
|
|
2121
|
+
let [e, n] = t.sizeRange ?? qt;
|
|
2122
|
+
a.size = Yt(e, n, i);
|
|
2075
2123
|
}
|
|
2076
2124
|
return a;
|
|
2077
2125
|
}
|
|
2078
|
-
function
|
|
2079
|
-
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(
|
|
2126
|
+
function $t(e, t, n, r) {
|
|
2127
|
+
return (t.mode ?? "continuous") === "piecewise" ? !r?.has(Zt(e, t)) : n ? e >= n[0] && e <= n[1] : !0;
|
|
2080
2128
|
}
|
|
2081
|
-
function
|
|
2129
|
+
function en({ options: e, range: t, hidden: n, label: r = "Value", format: i }) {
|
|
2082
2130
|
s();
|
|
2083
2131
|
let a = i ?? ((e) => String(Math.round(e)));
|
|
2084
2132
|
if ((e.mode ?? "continuous") === "piecewise") {
|
|
2085
|
-
let t = e.pieces ??
|
|
2133
|
+
let t = e.pieces ?? Kt, i = xe(t, e.ramp ?? "sequential"), o = (e.max - e.min) / t, s = n?.value ?? /* @__PURE__ */ new Set(), c = (e) => {
|
|
2086
2134
|
if (!n) return;
|
|
2087
2135
|
let t = new Set(n.value);
|
|
2088
2136
|
t.has(e) ? t.delete(e) : t.add(e), n.value = t;
|
|
@@ -2130,9 +2178,9 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2130
2178
|
})
|
|
2131
2179
|
});
|
|
2132
2180
|
}
|
|
2133
|
-
let { min: o, max: c } = e, l = c - o || 1, u =
|
|
2181
|
+
let { min: o, max: c } = e, l = c - o || 1, u = xe(8, e.ramp ?? "sequential"), d = (e) => (e - o) / l * 100, f = t?.value[0] ?? o, g = t?.value[1] ?? c, _ = `vm-grad-${u.length}`, v = (e, t) => {
|
|
2134
2182
|
let n = t.getBoundingClientRect();
|
|
2135
|
-
return n.width === 0 ? o : o +
|
|
2183
|
+
return n.width === 0 ? o : o + Jt((e - n.left) / n.width) * l;
|
|
2136
2184
|
}, y = (e, n) => {
|
|
2137
2185
|
if (!t) return;
|
|
2138
2186
|
let r = Math.max(o, Math.min(c, n)), [i, a] = t.value;
|
|
@@ -2217,23 +2265,23 @@ function Zt({ options: e, range: t, hidden: n, label: r = "Value", format: i })
|
|
|
2217
2265
|
]
|
|
2218
2266
|
});
|
|
2219
2267
|
}
|
|
2220
|
-
var
|
|
2268
|
+
var tn = {
|
|
2221
2269
|
legend: "_legend_1pign_2",
|
|
2222
2270
|
item: "_item_1pign_9",
|
|
2223
2271
|
swatch: "_swatch_1pign_27"
|
|
2224
2272
|
};
|
|
2225
2273
|
//#endregion
|
|
2226
2274
|
//#region src/chrome/legend.tsx
|
|
2227
|
-
function
|
|
2275
|
+
function nn({ series: e, hidden: t }) {
|
|
2228
2276
|
return s(), /* @__PURE__ */ m("div", {
|
|
2229
|
-
className:
|
|
2277
|
+
className: tn.legend,
|
|
2230
2278
|
role: "group",
|
|
2231
2279
|
"aria-label": "Chart legend",
|
|
2232
2280
|
children: e.map((e, n) => {
|
|
2233
2281
|
let r = t.value.has(e.id);
|
|
2234
2282
|
return /* @__PURE__ */ h("button", {
|
|
2235
2283
|
type: "button",
|
|
2236
|
-
className:
|
|
2284
|
+
className: tn.item,
|
|
2237
2285
|
"data-state": r ? "off" : "on",
|
|
2238
2286
|
"aria-pressed": !r,
|
|
2239
2287
|
"aria-label": f(u.charts.legendToggle, { name: e.label }),
|
|
@@ -2242,7 +2290,7 @@ function $t({ series: e, hidden: t }) {
|
|
|
2242
2290
|
r ? n.delete(e.id) : n.add(e.id), t.value = n;
|
|
2243
2291
|
},
|
|
2244
2292
|
children: [/* @__PURE__ */ m("span", {
|
|
2245
|
-
className:
|
|
2293
|
+
className: tn.swatch,
|
|
2246
2294
|
style: { background: e.color || `var(--cascivo-chart-${n + 1})` },
|
|
2247
2295
|
"aria-hidden": "true"
|
|
2248
2296
|
}), e.label]
|
|
@@ -2252,63 +2300,63 @@ function $t({ series: e, hidden: t }) {
|
|
|
2252
2300
|
}
|
|
2253
2301
|
//#endregion
|
|
2254
2302
|
//#region src/core/dev-warn.ts
|
|
2255
|
-
function
|
|
2303
|
+
function rn() {
|
|
2256
2304
|
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
2257
2305
|
}
|
|
2258
|
-
var
|
|
2259
|
-
function
|
|
2260
|
-
if (
|
|
2306
|
+
var an = /* @__PURE__ */ new Set();
|
|
2307
|
+
function on(e, t) {
|
|
2308
|
+
if (rn() || an.has(e)) return;
|
|
2261
2309
|
let n = 0;
|
|
2262
2310
|
for (let e of t()) Number.isFinite(e) || n++;
|
|
2263
|
-
n !== 0 && (
|
|
2311
|
+
n !== 0 && (an.add(e), console.warn(`[cascivo charts] ${e}: ${n} non-finite value(s) (NaN/Infinity/null) in series data. These are dropped from the chart, which can make it look wrong — check your data source.`));
|
|
2264
2312
|
}
|
|
2265
|
-
function
|
|
2266
|
-
|
|
2313
|
+
function sn(e, t) {
|
|
2314
|
+
rn() || an.has(e) || (an.add(e), console.warn(`[cascivo charts] ${t}`));
|
|
2267
2315
|
}
|
|
2268
|
-
function
|
|
2269
|
-
if (
|
|
2316
|
+
function cn(e, t) {
|
|
2317
|
+
if (rn()) return;
|
|
2270
2318
|
let n = t.filter((e) => Number.isFinite(e.max) && e.max > 0);
|
|
2271
2319
|
if (n.length < 2) return;
|
|
2272
2320
|
let r = [...n].sort((e, t) => t.max - e.max), i = r[0], a = r[r.length - 1];
|
|
2273
|
-
i.max / a.max < 20 ||
|
|
2321
|
+
i.max / a.max < 20 || sn(`${e}:scale-mismatch`, `${e}: "${a.label}" (max ${a.max.toLocaleString()}) is more than 20× smaller than "${i.label}" (max ${i.max.toLocaleString()}) on the same axis, so it renders as a flat line at the baseline while the legend still names both. Put the smaller series on its own scale with \`axis: 'right'\` + \`secondAxis\`, or split it into a second chart.`);
|
|
2274
2322
|
}
|
|
2275
2323
|
//#endregion
|
|
2276
2324
|
//#region src/charts/line-chart/line-chart.tsx
|
|
2277
|
-
var
|
|
2278
|
-
function
|
|
2325
|
+
var ln = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2326
|
+
function un(e) {
|
|
2279
2327
|
return [Math.min(0, ...e), Math.max(...e)];
|
|
2280
2328
|
}
|
|
2281
|
-
function
|
|
2329
|
+
function dn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monotone", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, format: v, legend: y, tooltip: b, formatTooltip: x, className: S, plain: C, annotations: w, labels: T, connectNulls: D, onSelect: A, brush: j, dataZoom: M, zoom: ee, syncId: N, tooltipMode: te, secondAxis: P, decimate: F, toolbox: I, transition: ne, onBeforeDraw: L, onAfterDraw: R }) {
|
|
2282
2330
|
s();
|
|
2283
|
-
let
|
|
2331
|
+
let re = a(/* @__PURE__ */ new Set()), ie = C ? null : jt(T), z = F === !0 ? {
|
|
2284
2332
|
method: "lttb",
|
|
2285
2333
|
threshold: 1e3
|
|
2286
2334
|
} : F ? {
|
|
2287
2335
|
method: F.method ?? "lttb",
|
|
2288
2336
|
threshold: F.threshold ?? 1e3
|
|
2289
|
-
} : null,
|
|
2290
|
-
|
|
2291
|
-
|
|
2337
|
+
} : null, B = e.reduce((e, t) => Math.max(e, t.data.length), 0), V = (j || M || ee || N !== void 0) && B > 0, H = a([0, Math.max(0, B - 1)]), U = l(null);
|
|
2338
|
+
N && !U.current && (U.current = gt(N)), o(() => () => {
|
|
2339
|
+
N && _t(N);
|
|
2292
2340
|
}), o(() => {
|
|
2293
|
-
let e =
|
|
2341
|
+
let e = U.current;
|
|
2294
2342
|
if (!e) return;
|
|
2295
|
-
let t = e.window.value, n =
|
|
2296
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2343
|
+
let t = e.window.value, n = H.peek();
|
|
2344
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (H.value = t);
|
|
2297
2345
|
}), o(() => {
|
|
2298
|
-
let e =
|
|
2346
|
+
let e = U.current;
|
|
2299
2347
|
if (!e) return;
|
|
2300
|
-
let t =
|
|
2348
|
+
let t = H.value, n = e.window.peek();
|
|
2301
2349
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2302
2350
|
});
|
|
2303
|
-
let
|
|
2351
|
+
let W = V ? e.map((e) => ({
|
|
2304
2352
|
...e,
|
|
2305
|
-
data: e.data.slice(
|
|
2306
|
-
})) : e,
|
|
2307
|
-
|
|
2308
|
-
let se = J.length > 0, ce = g(
|
|
2309
|
-
...
|
|
2310
|
-
left:
|
|
2311
|
-
right:
|
|
2353
|
+
data: e.data.slice(H.value[0], H.value[1] + 1)
|
|
2354
|
+
})) : e, G = !C && W.some((e) => e.axis === "right"), K = d ?? (C ? 48 : 300), q = C ? !1 : y ?? W.length > 1, ae = (e) => e.y ?? n, J = W.flatMap((e) => e.data.map((e) => t(e))), Y = (e) => e.flatMap((e) => e.data.map((t) => ae(e)(t))).filter((e) => Number.isFinite(e)), oe = Y(G ? W.filter((e) => e.axis !== "right") : W), X = G ? Y(W.filter((e) => e.axis === "right")) : [];
|
|
2355
|
+
on("LineChart", () => W.flatMap((e) => e.data.map((t) => ae(e)(t))));
|
|
2356
|
+
let se = J.length > 0, ce = g(un(oe), [0, 1]).ticks(_).map((e) => e.toLocaleString()), le = se && J[0] instanceof Date, ue = G ? g(un(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 ? E([new Date(Math.min(...fe.map((e) => e.getTime()))), new Date(Math.max(...fe.map((e) => e.getTime())))], [0, 1]).ticks(f).map((e) => e.toLocaleDateString()) : g([Math.min(...de), Math.max(...de)], [0, 1]).ticks(f).map((e) => e.toLocaleString()) : [], Z = C ? Ke : {
|
|
2357
|
+
...Ge,
|
|
2358
|
+
left: Je(ce, C),
|
|
2359
|
+
right: Ye({
|
|
2312
2360
|
rightAxisLabels: ue,
|
|
2313
2361
|
bottomAxisLabels: pe,
|
|
2314
2362
|
rightAxisTitle: P?.label !== void 0 && P.label !== "",
|
|
@@ -2326,33 +2374,33 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2326
2374
|
title: r,
|
|
2327
2375
|
description: i,
|
|
2328
2376
|
width: u,
|
|
2329
|
-
height:
|
|
2377
|
+
height: K,
|
|
2330
2378
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2331
2379
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2332
|
-
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }),
|
|
2333
|
-
/* @__PURE__ */ m("tbody", { children: (
|
|
2380
|
+
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), W.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2381
|
+
/* @__PURE__ */ m("tbody", { children: (W[0]?.data ?? []).map((e, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: String(W[0] ? t(W[0].data[n]) : "") }), W.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : ae(e)(e.data[n]) }, e.id))] }, n)) })
|
|
2334
2382
|
] }),
|
|
2335
2383
|
className: S,
|
|
2336
2384
|
"data-state": se ? void 0 : "empty",
|
|
2337
2385
|
plain: C,
|
|
2338
2386
|
tooltip: b !== !1 && se ? ({ width: e, height: n }) => {
|
|
2339
2387
|
if (b === !1 || !se) return;
|
|
2340
|
-
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 ?
|
|
2341
|
-
if (
|
|
2342
|
-
let 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 ? E([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), c = g(un(oe), [i, 0]), l = G ? g(un(X), [i, 0]) : c, u = (e) => e.axis === "right" ? l : c, d = (e) => s.map(e);
|
|
2389
|
+
if (te === "axis") {
|
|
2390
|
+
let e = W.reduce((e, t) => Math.max(e, t.data.length), 0), n = [];
|
|
2343
2391
|
for (let r = 0; r < e; r++) {
|
|
2344
2392
|
let e = [], i = 0, a = 0, o = Infinity, s = "";
|
|
2345
|
-
|
|
2346
|
-
if (
|
|
2393
|
+
W.forEach((n, c) => {
|
|
2394
|
+
if (re.value.has(n.id)) return;
|
|
2347
2395
|
let l = n.data[r];
|
|
2348
2396
|
if (l === void 0) return;
|
|
2349
|
-
let f =
|
|
2397
|
+
let f = ae(n)(l);
|
|
2350
2398
|
if (!Number.isFinite(f)) return;
|
|
2351
2399
|
let p = t(l);
|
|
2352
2400
|
i += d(p), a++, o = Math.min(o, u(n).map(f)), s = p instanceof Date ? p.toLocaleDateString() : String(p), e.push({
|
|
2353
2401
|
label: n.label,
|
|
2354
2402
|
value: f,
|
|
2355
|
-
color: n.color ??
|
|
2403
|
+
color: n.color ?? ln[c % ln.length]
|
|
2356
2404
|
});
|
|
2357
2405
|
}), a !== 0 && n.push({
|
|
2358
2406
|
id: `x-${r}`,
|
|
@@ -2369,8 +2417,8 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2369
2417
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2370
2418
|
};
|
|
2371
2419
|
}
|
|
2372
|
-
let f =
|
|
2373
|
-
let i =
|
|
2420
|
+
let f = W.flatMap((e) => re.value.has(e.id) ? [] : e.data.flatMap((n, r) => {
|
|
2421
|
+
let i = ae(e)(n);
|
|
2374
2422
|
if (!Number.isFinite(i)) return [];
|
|
2375
2423
|
let a = t(n), o = s.map(a), c = u(e).map(i), l = a instanceof Date ? a.toLocaleDateString() : String(a);
|
|
2376
2424
|
return {
|
|
@@ -2378,58 +2426,58 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2378
2426
|
cx: Z.left + o,
|
|
2379
2427
|
cy: Z.top + c,
|
|
2380
2428
|
label: l,
|
|
2381
|
-
value:
|
|
2429
|
+
value: ae(e)(n),
|
|
2382
2430
|
seriesId: e.id
|
|
2383
2431
|
};
|
|
2384
2432
|
}));
|
|
2385
2433
|
return x ? {
|
|
2386
2434
|
points: f,
|
|
2387
2435
|
format: (e) => {
|
|
2388
|
-
let t =
|
|
2436
|
+
let t = W.find((t) => t.id === e.seriesId), n = parseInt(e.id.split("-").pop() ?? "0", 10);
|
|
2389
2437
|
return t && t.data[n] !== void 0 ? x(t.data[n], t) : `${e.label}: ${e.value}`;
|
|
2390
2438
|
}
|
|
2391
2439
|
} : { points: f };
|
|
2392
2440
|
} : void 0,
|
|
2393
|
-
onSelect:
|
|
2394
|
-
zoom:
|
|
2395
|
-
window:
|
|
2396
|
-
count:
|
|
2441
|
+
onSelect: A,
|
|
2442
|
+
zoom: ee && B > 1 ? {
|
|
2443
|
+
window: H,
|
|
2444
|
+
count: B
|
|
2397
2445
|
} : void 0,
|
|
2398
2446
|
toolbox: I,
|
|
2399
|
-
onRestore:
|
|
2400
|
-
|
|
2447
|
+
onRestore: V ? () => {
|
|
2448
|
+
H.value = [0, Math.max(0, B - 1)];
|
|
2401
2449
|
} : void 0,
|
|
2402
2450
|
transition: ne,
|
|
2403
|
-
onBeforeDraw:
|
|
2404
|
-
onAfterDraw:
|
|
2451
|
+
onBeforeDraw: L,
|
|
2452
|
+
onAfterDraw: R,
|
|
2405
2453
|
children: ({ width: e, height: n }) => {
|
|
2406
|
-
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 ?
|
|
2454
|
+
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 ? E([new Date(a), new Date(o)], [0, r]) : g([a, o], [0, r]), l = g(un(oe), [i, 0]), u = G ? g(un(X), [i, 0]) : l;
|
|
2407
2455
|
return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
|
|
2408
2456
|
transform: `translate(${Z.left},${Z.top})`,
|
|
2409
2457
|
children: [
|
|
2410
|
-
!C && /* @__PURE__ */ m(
|
|
2458
|
+
!C && /* @__PURE__ */ m(Ct, {
|
|
2411
2459
|
scale: l,
|
|
2412
2460
|
orientation: "y",
|
|
2413
2461
|
length: r,
|
|
2414
2462
|
tickCount: _
|
|
2415
2463
|
}),
|
|
2416
|
-
!C &&
|
|
2464
|
+
!C && Ot(w, {
|
|
2417
2465
|
xScale: s,
|
|
2418
2466
|
yScale: l,
|
|
2419
2467
|
innerW: r,
|
|
2420
2468
|
innerH: i
|
|
2421
2469
|
}),
|
|
2422
|
-
|
|
2423
|
-
if (
|
|
2424
|
-
let r = e.color ??
|
|
2425
|
-
if (
|
|
2470
|
+
W.map((e, n) => {
|
|
2471
|
+
if (re.value.has(e.id)) return null;
|
|
2472
|
+
let r = e.color ?? ln[n % ln.length], i = e.axis === "right" ? u : l, a = (e) => s.map(e);
|
|
2473
|
+
if (z && e.data.length > z.threshold) {
|
|
2426
2474
|
let n = [];
|
|
2427
2475
|
for (let r of e.data) {
|
|
2428
|
-
let o =
|
|
2476
|
+
let o = ae(e)(r);
|
|
2429
2477
|
Number.isFinite(o) && n.push([a(t(r)), i.map(o)]);
|
|
2430
2478
|
}
|
|
2431
2479
|
return /* @__PURE__ */ m("path", {
|
|
2432
|
-
d:
|
|
2480
|
+
d: k(Be(n, z.threshold, z.method).map((e) => [e[0], e[1]]), c),
|
|
2433
2481
|
fill: "none",
|
|
2434
2482
|
stroke: r,
|
|
2435
2483
|
strokeWidth: 2,
|
|
@@ -2439,23 +2487,23 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2439
2487
|
}, e.id);
|
|
2440
2488
|
}
|
|
2441
2489
|
let o = e.data.map((n) => {
|
|
2442
|
-
let r =
|
|
2490
|
+
let r = ae(e)(n);
|
|
2443
2491
|
return Number.isFinite(r) ? [a(t(n)), i.map(r)] : null;
|
|
2444
2492
|
});
|
|
2445
|
-
return /* @__PURE__ */ h("g", { children: [
|
|
2446
|
-
d:
|
|
2493
|
+
return /* @__PURE__ */ h("g", { children: [O(o, D).map((t, n) => /* @__PURE__ */ m("path", {
|
|
2494
|
+
d: k(t, c),
|
|
2447
2495
|
fill: "none",
|
|
2448
2496
|
stroke: r,
|
|
2449
2497
|
strokeWidth: 2,
|
|
2450
2498
|
strokeLinecap: "round",
|
|
2451
2499
|
strokeLinejoin: "round",
|
|
2452
2500
|
"data-series": e.id
|
|
2453
|
-
}, n)),
|
|
2501
|
+
}, n)), ie && e.data.map((t, n) => {
|
|
2454
2502
|
let r = o[n];
|
|
2455
|
-
return r ? /* @__PURE__ */ m(
|
|
2503
|
+
return r ? /* @__PURE__ */ m(Mt, {
|
|
2456
2504
|
x: r[0],
|
|
2457
2505
|
y: r[1] - 8,
|
|
2458
|
-
text:
|
|
2506
|
+
text: ie.format(ae(e)(t))
|
|
2459
2507
|
}, n) : null;
|
|
2460
2508
|
})] }, e.id);
|
|
2461
2509
|
}),
|
|
@@ -2474,7 +2522,7 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2474
2522
|
length: i,
|
|
2475
2523
|
tickCount: _
|
|
2476
2524
|
}),
|
|
2477
|
-
|
|
2525
|
+
G && /* @__PURE__ */ m($, {
|
|
2478
2526
|
scale: u,
|
|
2479
2527
|
orientation: "y-right",
|
|
2480
2528
|
length: i,
|
|
@@ -2491,75 +2539,75 @@ function cn({ series: e, x: t, y: n, title: r, description: i, curve: c = "monot
|
|
|
2491
2539
|
}) });
|
|
2492
2540
|
}
|
|
2493
2541
|
}),
|
|
2494
|
-
|
|
2495
|
-
count:
|
|
2496
|
-
window:
|
|
2542
|
+
j && !M && B > 1 && /* @__PURE__ */ m(Wt, {
|
|
2543
|
+
count: B,
|
|
2544
|
+
window: H,
|
|
2497
2545
|
label: "Time range"
|
|
2498
2546
|
}),
|
|
2499
|
-
|
|
2500
|
-
count:
|
|
2501
|
-
window:
|
|
2547
|
+
M && B > 1 && /* @__PURE__ */ m(Gt, {
|
|
2548
|
+
count: B,
|
|
2549
|
+
window: H,
|
|
2502
2550
|
label: "Time range"
|
|
2503
2551
|
}),
|
|
2504
|
-
|
|
2505
|
-
series:
|
|
2552
|
+
q && /* @__PURE__ */ m(nn, {
|
|
2553
|
+
series: W.map((e, t) => ({
|
|
2506
2554
|
id: e.id,
|
|
2507
2555
|
label: e.label,
|
|
2508
|
-
color: e.color ??
|
|
2556
|
+
color: e.color ?? ln[t % ln.length]
|
|
2509
2557
|
})),
|
|
2510
|
-
hidden:
|
|
2558
|
+
hidden: re
|
|
2511
2559
|
})
|
|
2512
2560
|
]
|
|
2513
2561
|
});
|
|
2514
2562
|
}
|
|
2515
2563
|
//#endregion
|
|
2516
2564
|
//#region src/charts/area-chart/area-chart.tsx
|
|
2517
|
-
var
|
|
2518
|
-
function
|
|
2519
|
-
return t || e <= 1 ?
|
|
2565
|
+
var fn = { fillOpacity: "var(--cascivo-chart-fill-opacity, 0.25)" };
|
|
2566
|
+
function pn(e, t) {
|
|
2567
|
+
return t || e <= 1 ? fn : { fillOpacity: "var(--cascivo-chart-fill-opacity-overlap, 0.12)" };
|
|
2520
2568
|
}
|
|
2521
|
-
var
|
|
2522
|
-
function
|
|
2569
|
+
var mn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2570
|
+
function hn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1, curve: d = "monotone", fill: f = "solid", patternKind: _, width: v, height: y, xTicks: b = 5, yTicks: x = 5, legend: S, tooltip: C, className: w, plain: T, annotations: D, labels: O, onSelect: A, brush: j, dataZoom: M, zoom: ee, syncId: N, tooltipMode: te, secondAxis: P, decimate: I, toolbox: L, format: R }) {
|
|
2523
2571
|
s();
|
|
2524
|
-
let
|
|
2572
|
+
let re = c(), ie = a(/* @__PURE__ */ new Set()), z = T ? null : jt(O), B = I === !0 ? {
|
|
2525
2573
|
method: "lttb",
|
|
2526
2574
|
threshold: 1e3
|
|
2527
|
-
} :
|
|
2528
|
-
method:
|
|
2529
|
-
threshold:
|
|
2530
|
-
} : null,
|
|
2531
|
-
|
|
2532
|
-
|
|
2575
|
+
} : I ? {
|
|
2576
|
+
method: I.method ?? "lttb",
|
|
2577
|
+
threshold: I.threshold ?? 1e3
|
|
2578
|
+
} : null, V = e.reduce((e, t) => Math.max(e, t.data.length), 0), H = (j || M || ee || N !== void 0) && V > 0, U = a([0, Math.max(0, V - 1)]), W = l(null);
|
|
2579
|
+
N && !W.current && (W.current = gt(N)), o(() => () => {
|
|
2580
|
+
N && _t(N);
|
|
2533
2581
|
}), o(() => {
|
|
2534
|
-
let e =
|
|
2582
|
+
let e = W.current;
|
|
2535
2583
|
if (!e) return;
|
|
2536
|
-
let t = e.window.value, n =
|
|
2537
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
2584
|
+
let t = e.window.value, n = U.peek();
|
|
2585
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (U.value = t);
|
|
2538
2586
|
}), o(() => {
|
|
2539
|
-
let e =
|
|
2587
|
+
let e = W.current;
|
|
2540
2588
|
if (!e) return;
|
|
2541
|
-
let t =
|
|
2589
|
+
let t = U.value, n = e.window.peek();
|
|
2542
2590
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
2543
2591
|
});
|
|
2544
|
-
let
|
|
2592
|
+
let G = H ? e.map((e) => ({
|
|
2545
2593
|
...e,
|
|
2546
|
-
data: e.data.slice(
|
|
2547
|
-
})) : e,
|
|
2548
|
-
!
|
|
2594
|
+
data: e.data.slice(U.value[0], U.value[1] + 1)
|
|
2595
|
+
})) : e, K = !T && !u && G.some((e) => e.axis === "right"), q = y ?? (T ? 48 : 300), ae = T ? !1 : S ?? G.length > 1, J = pn(G.filter((e) => e.type !== "line").length, u), Y = (e) => e.y ?? n, oe = (G[0]?.data ?? []).map((e) => t(e)), X = (K ? G.filter((e) => e.axis !== "right") : G).flatMap((e) => e.data.map((t) => Y(e)(t))), se = K ? G.filter((e) => e.axis === "right").flatMap((e) => e.data.map((t) => Y(e)(t))) : [];
|
|
2596
|
+
!K && !u && G.length > 1 && cn("AreaChart", G.map((e) => ({
|
|
2549
2597
|
label: e.label,
|
|
2550
2598
|
max: Math.max(0, ...e.data.map((t) => Y(e)(t)).filter((e) => Number.isFinite(e)))
|
|
2551
|
-
}))),
|
|
2552
|
-
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 ?
|
|
2599
|
+
}))), on("AreaChart", () => [...X, ...se]);
|
|
2600
|
+
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 ? E([new Date(de), new Date(fe)], [0, e]) : g([de, fe], [0, e]), Z = (e, n) => e.map(t(n)), me = (e) => {
|
|
2553
2601
|
let n = t(e);
|
|
2554
2602
|
return n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
2555
|
-
}, he = u ? 0 : Math.min(0, ...X), ge = Math.max(...u ? (
|
|
2556
|
-
...
|
|
2557
|
-
left:
|
|
2558
|
-
right:
|
|
2603
|
+
}, he = u ? 0 : Math.min(0, ...X), ge = Math.max(...u ? (G[0]?.data ?? []).map((e, t) => G.reduce((e, n) => e + Y(n)(n.data[t]), 0)) : X), _e = K ? Math.min(0, ...se) : he, ve = K ? Math.max(...se) : ge, ye = g([he, ge], [0, 1]).ticks(x).map((e) => e.toLocaleString()), be = K ? g([_e, ve], [0, 1]).ticks(x).map((e) => P?.format ? P.format(e) : e.toLocaleString()) : [], xe = le ? E([new Date(de), new Date(fe)], [0, 1]).ticks(b).map((e) => e.toLocaleDateString()) : g([de, fe], [0, 1]).ticks(b).map((e) => e.toLocaleString()), Se = T ? Ke : {
|
|
2604
|
+
...Ge,
|
|
2605
|
+
left: Je(ye, T),
|
|
2606
|
+
right: Ye({
|
|
2559
2607
|
rightAxisLabels: be,
|
|
2560
2608
|
bottomAxisLabels: xe,
|
|
2561
|
-
rightAxisTitle:
|
|
2562
|
-
plain:
|
|
2609
|
+
rightAxisTitle: P?.label !== void 0 && P.label !== "",
|
|
2610
|
+
plain: T
|
|
2563
2611
|
})
|
|
2564
2612
|
};
|
|
2565
2613
|
return /* @__PURE__ */ h("div", {
|
|
@@ -2573,31 +2621,31 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2573
2621
|
title: r,
|
|
2574
2622
|
description: i,
|
|
2575
2623
|
width: v,
|
|
2576
|
-
height:
|
|
2624
|
+
height: q,
|
|
2577
2625
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2578
2626
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2579
|
-
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }),
|
|
2580
|
-
/* @__PURE__ */ m("tbody", { children: (
|
|
2627
|
+
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "X" }), G.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2628
|
+
/* @__PURE__ */ m("tbody", { children: (G[0]?.data ?? []).map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: G[0] ? me(G[0].data[t]) : "" }), G.map((e) => /* @__PURE__ */ m("td", { children: e.data[t] == null ? "" : Y(e)(e.data[t]) }, e.id))] }, t)) })
|
|
2581
2629
|
] }),
|
|
2582
|
-
className:
|
|
2630
|
+
className: w,
|
|
2583
2631
|
"data-state": ce ? void 0 : "empty",
|
|
2584
|
-
plain:
|
|
2632
|
+
plain: T,
|
|
2585
2633
|
tooltip: C !== !1 && ce ? ({ width: e, height: t }) => {
|
|
2586
2634
|
if (C === !1 || !ce) return;
|
|
2587
|
-
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o =
|
|
2588
|
-
if (
|
|
2589
|
-
let e =
|
|
2635
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o = K ? g([_e, ve], [r, 0]) : a, s = (e) => e.axis === "right" ? o : a;
|
|
2636
|
+
if (te === "axis") {
|
|
2637
|
+
let e = G.reduce((e, t) => Math.max(e, t.data.length), 0), t = [];
|
|
2590
2638
|
for (let n = 0; n < e; n++) {
|
|
2591
2639
|
let e = [], r = Infinity, a = "", o = Se.left;
|
|
2592
|
-
|
|
2593
|
-
if (
|
|
2640
|
+
G.forEach((t, c) => {
|
|
2641
|
+
if (ie.value.has(t.id)) return;
|
|
2594
2642
|
let l = t.data[n];
|
|
2595
2643
|
if (l === void 0) return;
|
|
2596
2644
|
let u = Y(t)(l);
|
|
2597
2645
|
Number.isFinite(u) && (o = Se.left + Z(i, l), r = Math.min(r, s(t).map(u)), a = me(l), e.push({
|
|
2598
2646
|
label: t.label,
|
|
2599
2647
|
value: u,
|
|
2600
|
-
color: t.color ??
|
|
2648
|
+
color: t.color ?? mn[c % mn.length]
|
|
2601
2649
|
}));
|
|
2602
2650
|
}), e.length !== 0 && t.push({
|
|
2603
2651
|
id: `x-${n}`,
|
|
@@ -2614,7 +2662,7 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2614
2662
|
format: (e) => `${e.label}: ${(e.segments ?? []).map((e) => `${e.label} ${e.value}`).join(", ")}`
|
|
2615
2663
|
};
|
|
2616
2664
|
}
|
|
2617
|
-
return { points:
|
|
2665
|
+
return { points: G.flatMap((e) => ie.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
2618
2666
|
id: `${e.id}-${n}`,
|
|
2619
2667
|
cx: Se.left + Z(i, t),
|
|
2620
2668
|
cy: Se.top + s(e).map(Y(e)(t)),
|
|
@@ -2623,84 +2671,84 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2623
2671
|
seriesId: e.id
|
|
2624
2672
|
}))) };
|
|
2625
2673
|
} : void 0,
|
|
2626
|
-
onSelect:
|
|
2627
|
-
zoom:
|
|
2628
|
-
window:
|
|
2629
|
-
count:
|
|
2674
|
+
onSelect: A,
|
|
2675
|
+
zoom: ee && V > 1 ? {
|
|
2676
|
+
window: U,
|
|
2677
|
+
count: V
|
|
2630
2678
|
} : void 0,
|
|
2631
|
-
toolbox:
|
|
2632
|
-
onRestore:
|
|
2633
|
-
|
|
2679
|
+
toolbox: L,
|
|
2680
|
+
onRestore: H ? () => {
|
|
2681
|
+
U.value = [0, Math.max(0, V - 1)];
|
|
2634
2682
|
} : void 0,
|
|
2635
2683
|
children: ({ width: e, height: t }) => {
|
|
2636
|
-
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o =
|
|
2637
|
-
return u && (s =
|
|
2638
|
-
prefix:
|
|
2684
|
+
let n = e - Se.left - Se.right, r = t - Se.top - Se.bottom, i = pe(n), a = g([he, ge], [r, 0]), o = K ? g([_e, ve], [r, 0]) : a, s = [];
|
|
2685
|
+
return u && (s = ne(G.map((e) => e.data.map((t) => Y(e)(t))))), /* @__PURE__ */ h("g", { children: [f !== "solid" && /* @__PURE__ */ m(Lt, {
|
|
2686
|
+
prefix: re,
|
|
2639
2687
|
fill: f,
|
|
2640
2688
|
patternKind: _,
|
|
2641
|
-
series:
|
|
2689
|
+
series: G.map((e, t) => ({
|
|
2642
2690
|
id: e.id,
|
|
2643
|
-
color: e.color ??
|
|
2691
|
+
color: e.color ?? mn[t % mn.length]
|
|
2644
2692
|
}))
|
|
2645
2693
|
}), /* @__PURE__ */ h("g", {
|
|
2646
2694
|
transform: `translate(${Se.left},${Se.top})`,
|
|
2647
2695
|
children: [
|
|
2648
|
-
!
|
|
2696
|
+
!T && /* @__PURE__ */ m(Ct, {
|
|
2649
2697
|
scale: a,
|
|
2650
2698
|
orientation: "y",
|
|
2651
2699
|
length: n,
|
|
2652
2700
|
tickCount: x
|
|
2653
2701
|
}),
|
|
2654
|
-
!
|
|
2702
|
+
!T && Ot(D, {
|
|
2655
2703
|
xScale: i,
|
|
2656
2704
|
yScale: a,
|
|
2657
2705
|
innerW: n,
|
|
2658
2706
|
innerH: r
|
|
2659
2707
|
}),
|
|
2660
|
-
|
|
2661
|
-
if (
|
|
2662
|
-
let n = e.color ??
|
|
2708
|
+
G.map((e, t) => {
|
|
2709
|
+
if (ie.value.has(e.id)) return null;
|
|
2710
|
+
let n = e.color ?? mn[t % mn.length], r, c;
|
|
2663
2711
|
if (u && s[t]) {
|
|
2664
2712
|
let o = s[t];
|
|
2665
2713
|
r = e.data.map((e, t) => [Z(i, e), a.map(o[t][1])]);
|
|
2666
2714
|
let l = e.data.map((e, t) => [Z(i, e), a.map(o[t][0])]);
|
|
2667
2715
|
c = a.map(0);
|
|
2668
|
-
let u =
|
|
2716
|
+
let u = k(r, d), p = l[l.length - 1], g = l[0], _ = [...l].reverse().map(([e, t]) => `L${e},${t}`).join(""), v = `${u}L${p[0]},${p[1]}${_}L${g[0]},${g[1]}Z`;
|
|
2669
2717
|
return /* @__PURE__ */ h("g", {
|
|
2670
2718
|
"data-series": e.id,
|
|
2671
2719
|
children: [
|
|
2672
2720
|
/* @__PURE__ */ m("path", {
|
|
2673
2721
|
d: v,
|
|
2674
|
-
fill:
|
|
2722
|
+
fill: It(re, e.id, f, n),
|
|
2675
2723
|
style: f === "solid" ? J : void 0,
|
|
2676
2724
|
stroke: "none"
|
|
2677
2725
|
}),
|
|
2678
2726
|
/* @__PURE__ */ m("path", {
|
|
2679
|
-
d:
|
|
2727
|
+
d: k(r, d),
|
|
2680
2728
|
fill: "none",
|
|
2681
2729
|
stroke: n,
|
|
2682
2730
|
strokeWidth: 2
|
|
2683
2731
|
}),
|
|
2684
|
-
|
|
2732
|
+
z && r.map((t, n) => /* @__PURE__ */ m(Mt, {
|
|
2685
2733
|
x: t[0],
|
|
2686
2734
|
y: t[1] - 8,
|
|
2687
|
-
text:
|
|
2735
|
+
text: z.format(Y(e)(e.data[n]))
|
|
2688
2736
|
}, n))
|
|
2689
2737
|
]
|
|
2690
2738
|
}, e.id);
|
|
2691
2739
|
} else {
|
|
2692
2740
|
let t = e.axis === "right" ? o : a;
|
|
2693
|
-
if (r = e.data.map((n) => [Z(i, n), t.map(Y(e)(n))]), c = t.map(0),
|
|
2694
|
-
let t =
|
|
2741
|
+
if (r = e.data.map((n) => [Z(i, n), t.map(Y(e)(n))]), c = t.map(0), B && r.length > B.threshold) {
|
|
2742
|
+
let t = Be(r, B.threshold, B.method).map((e) => [e[0], e[1]]);
|
|
2695
2743
|
return /* @__PURE__ */ h("g", {
|
|
2696
2744
|
"data-series": e.id,
|
|
2697
|
-
children: [/* @__PURE__ */ m("path", {
|
|
2698
|
-
d:
|
|
2699
|
-
fill:
|
|
2745
|
+
children: [e.type !== "line" && /* @__PURE__ */ m("path", {
|
|
2746
|
+
d: F(t, c, d),
|
|
2747
|
+
fill: It(re, e.id, f, n),
|
|
2700
2748
|
style: f === "solid" ? J : void 0,
|
|
2701
2749
|
stroke: "none"
|
|
2702
2750
|
}), /* @__PURE__ */ m("path", {
|
|
2703
|
-
d:
|
|
2751
|
+
d: k(t, d),
|
|
2704
2752
|
fill: "none",
|
|
2705
2753
|
stroke: n,
|
|
2706
2754
|
strokeWidth: 2
|
|
@@ -2710,35 +2758,35 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2710
2758
|
return /* @__PURE__ */ h("g", {
|
|
2711
2759
|
"data-series": e.id,
|
|
2712
2760
|
children: [
|
|
2713
|
-
/* @__PURE__ */ m("path", {
|
|
2714
|
-
d:
|
|
2715
|
-
fill:
|
|
2761
|
+
e.type !== "line" && /* @__PURE__ */ m("path", {
|
|
2762
|
+
d: F(r, c, d),
|
|
2763
|
+
fill: It(re, e.id, f, n),
|
|
2716
2764
|
style: f === "solid" ? J : void 0,
|
|
2717
2765
|
stroke: "none"
|
|
2718
2766
|
}),
|
|
2719
2767
|
/* @__PURE__ */ m("path", {
|
|
2720
|
-
d:
|
|
2768
|
+
d: k(r, d),
|
|
2721
2769
|
fill: "none",
|
|
2722
2770
|
stroke: n,
|
|
2723
2771
|
strokeWidth: 2
|
|
2724
2772
|
}),
|
|
2725
|
-
|
|
2773
|
+
z && r.map((t, n) => /* @__PURE__ */ m(Mt, {
|
|
2726
2774
|
x: t[0],
|
|
2727
2775
|
y: t[1] - 8,
|
|
2728
|
-
text:
|
|
2776
|
+
text: z.format(Y(e)(e.data[n]))
|
|
2729
2777
|
}, n))
|
|
2730
2778
|
]
|
|
2731
2779
|
}, e.id);
|
|
2732
2780
|
}
|
|
2733
2781
|
}),
|
|
2734
|
-
!
|
|
2782
|
+
!T && /* @__PURE__ */ h(p, { children: [
|
|
2735
2783
|
/* @__PURE__ */ m($, {
|
|
2736
2784
|
scale: i,
|
|
2737
2785
|
orientation: "x",
|
|
2738
2786
|
length: n,
|
|
2739
2787
|
tickCount: b,
|
|
2740
2788
|
transform: `translate(0,${r})`,
|
|
2741
|
-
...
|
|
2789
|
+
...R ? { format: R } : {}
|
|
2742
2790
|
}),
|
|
2743
2791
|
/* @__PURE__ */ m($, {
|
|
2744
2792
|
scale: a,
|
|
@@ -2746,15 +2794,15 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2746
2794
|
length: r,
|
|
2747
2795
|
tickCount: x
|
|
2748
2796
|
}),
|
|
2749
|
-
|
|
2797
|
+
K && /* @__PURE__ */ m($, {
|
|
2750
2798
|
scale: o,
|
|
2751
2799
|
orientation: "y-right",
|
|
2752
2800
|
length: r,
|
|
2753
2801
|
tickCount: x,
|
|
2754
2802
|
transform: `translate(${n},0)`,
|
|
2755
|
-
...
|
|
2756
|
-
...
|
|
2757
|
-
title:
|
|
2803
|
+
...P?.format ? { format: (e) => P.format(Number(e)) } : {},
|
|
2804
|
+
...P?.label !== void 0 && P.label !== "" ? {
|
|
2805
|
+
title: P.label,
|
|
2758
2806
|
titleOffset: 8 + Math.ceil(be.reduce((e, t) => Math.max(e, t.length), 0) * 6.5) + 10
|
|
2759
2807
|
} : {}
|
|
2760
2808
|
})
|
|
@@ -2763,49 +2811,49 @@ function fn({ series: e, x: t, y: n, title: r, description: i, stacked: u = !1,
|
|
|
2763
2811
|
})] });
|
|
2764
2812
|
}
|
|
2765
2813
|
}),
|
|
2766
|
-
|
|
2767
|
-
count:
|
|
2768
|
-
window:
|
|
2814
|
+
j && !M && V > 1 && /* @__PURE__ */ m(Wt, {
|
|
2815
|
+
count: V,
|
|
2816
|
+
window: U,
|
|
2769
2817
|
label: "Range"
|
|
2770
2818
|
}),
|
|
2771
|
-
|
|
2772
|
-
count:
|
|
2773
|
-
window:
|
|
2819
|
+
M && V > 1 && /* @__PURE__ */ m(Gt, {
|
|
2820
|
+
count: V,
|
|
2821
|
+
window: U,
|
|
2774
2822
|
label: "Range"
|
|
2775
2823
|
}),
|
|
2776
|
-
|
|
2777
|
-
series:
|
|
2824
|
+
ae && /* @__PURE__ */ m(nn, {
|
|
2825
|
+
series: G.map((e, t) => ({
|
|
2778
2826
|
id: e.id,
|
|
2779
2827
|
label: e.label,
|
|
2780
|
-
color: e.color ??
|
|
2828
|
+
color: e.color ?? mn[t % mn.length]
|
|
2781
2829
|
})),
|
|
2782
|
-
hidden:
|
|
2830
|
+
hidden: ie
|
|
2783
2831
|
})
|
|
2784
2832
|
]
|
|
2785
2833
|
});
|
|
2786
2834
|
}
|
|
2787
2835
|
//#endregion
|
|
2788
2836
|
//#region src/charts/bar-chart/bar-chart.tsx
|
|
2789
|
-
function
|
|
2837
|
+
function gn(e, t, n, r) {
|
|
2790
2838
|
return typeof e == "function" ? t === void 0 ? r : e(t, n) : e ?? r;
|
|
2791
2839
|
}
|
|
2792
|
-
var
|
|
2793
|
-
function
|
|
2840
|
+
var _n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
2841
|
+
function vn(e) {
|
|
2794
2842
|
let t = e.segments?.filter((e) => e.value !== 0) ?? [], n = `${e.label} · ${e.value}`;
|
|
2795
2843
|
return t.length > 0 ? `${n} — ${t.map((e) => `${e.label}: ${e.value}`).join(", ")}` : n;
|
|
2796
2844
|
}
|
|
2797
|
-
function
|
|
2845
|
+
function yn({ series: e, x: t, y: n, title: r, description: i, orientation: o = "vertical", mode: l = "grouped", width: u, height: d, xTicks: f = 5, yTicks: _ = 5, valueAxisTicks: y, categoryAxisTicks: b, xLabelEvery: x, categoryLabelEvery: S, legend: C, tooltip: w, tooltipFormat: T, className: E, plain: D, annotations: O, labels: k, onSelect: A, fill: j = "solid", patternKind: M, format: ee }) {
|
|
2798
2846
|
s();
|
|
2799
|
-
let
|
|
2800
|
-
let t =
|
|
2847
|
+
let N = c(), te = D ? null : jt(k), P = a(/* @__PURE__ */ new Set()), F = d ?? (D ? 48 : 300), I = D ? !1 : C ?? e.length > 1, L = (e) => e.y ?? n, R = (e[0]?.data ?? []).map((e) => t(e)), re = e.flatMap((e) => e.data.map((t) => L(e)(t))), ie = R.length > 0, z = l === "stacked" || l === "percent", B = R.map((t, n) => e.reduce((e, t) => e + L(t)(t.data[n]), 0)), V = () => {
|
|
2848
|
+
let t = ne(e.map((e) => e.data.map((t) => L(e)(t))));
|
|
2801
2849
|
return l === "percent" ? t.map((e) => e.map(([e, t], n) => {
|
|
2802
|
-
let r =
|
|
2850
|
+
let r = B[n] || 1;
|
|
2803
2851
|
return [e / r, t / r];
|
|
2804
2852
|
})) : t;
|
|
2805
|
-
},
|
|
2806
|
-
...
|
|
2807
|
-
left:
|
|
2808
|
-
right:
|
|
2853
|
+
}, H = z ? 0 : Math.min(0, ...re), U = ie ? Math.max(...B) : 1, W = l === "percent" ? 1 : l === "stacked" ? U : Math.max(1, ...re), G = l === "percent" ? (e) => `${Math.round(Number(e) * 100)}%` : void 0, K = o === "vertical", q = (K ? y : b) ?? _, ae = (K ? b : y) ?? f, J = S ?? x, Y = K ? g([H, W], [0, 1]).ticks(q).map((e) => G ? G(e) : e.toLocaleString()) : R.map((e) => String(e)), oe = K ? R.map((e) => String(e)) : g([H, W], [0, 1]).ticks(ae).map((e) => G ? G(e) : e.toLocaleString()), X = D ? Ke : {
|
|
2854
|
+
...Ge,
|
|
2855
|
+
left: Je(Y, D),
|
|
2856
|
+
right: Ye({
|
|
2809
2857
|
bottomAxisLabels: oe,
|
|
2810
2858
|
plain: D
|
|
2811
2859
|
})
|
|
@@ -2820,24 +2868,24 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2820
2868
|
title: r,
|
|
2821
2869
|
description: i,
|
|
2822
2870
|
width: u,
|
|
2823
|
-
height:
|
|
2871
|
+
height: F,
|
|
2824
2872
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
2825
2873
|
/* @__PURE__ */ m("caption", { children: r }),
|
|
2826
2874
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), e.map((e) => /* @__PURE__ */ m("th", { children: e.label }, e.id))] }) }),
|
|
2827
|
-
/* @__PURE__ */ m("tbody", { children:
|
|
2875
|
+
/* @__PURE__ */ m("tbody", { children: R.map((t, n) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: t }), e.map((e) => /* @__PURE__ */ m("td", { children: e.data[n] == null ? "" : L(e)(e.data[n]) }, e.id))] }, t)) })
|
|
2828
2876
|
] }),
|
|
2829
2877
|
className: E,
|
|
2830
|
-
"data-state":
|
|
2878
|
+
"data-state": ie ? void 0 : "empty",
|
|
2831
2879
|
plain: D,
|
|
2832
|
-
tooltip: w &&
|
|
2833
|
-
if (!w || !
|
|
2834
|
-
let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = v(
|
|
2835
|
-
|
|
2836
|
-
let p =
|
|
2880
|
+
tooltip: w && ie ? ({ width: n, height: r }) => {
|
|
2881
|
+
if (!w || !ie) return;
|
|
2882
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = v(R, s ? [0, i] : [0, a], .2), u = g([H, W], s ? [a, 0] : [0, i]), d = e.filter((e) => !P.value.has(e.id)), f = [];
|
|
2883
|
+
z && (f = V());
|
|
2884
|
+
let p = z && !T, m = R.map((t, n) => {
|
|
2837
2885
|
let r = d.map((t) => ({
|
|
2838
2886
|
label: t.label,
|
|
2839
|
-
value:
|
|
2840
|
-
color:
|
|
2887
|
+
value: L(t)(t.data[n]),
|
|
2888
|
+
color: gn(t.color, t.data[n], n, _n[e.indexOf(t) % _n.length])
|
|
2841
2889
|
}));
|
|
2842
2890
|
return {
|
|
2843
2891
|
segs: r,
|
|
@@ -2847,71 +2895,71 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2847
2895
|
let r = e.indexOf(n), i = l === "grouped" ? c.bandwidth / d.length : c.bandwidth;
|
|
2848
2896
|
return n.data.map((e, a) => {
|
|
2849
2897
|
let o = c.map(t(e)) ?? 0, h, g;
|
|
2850
|
-
if (
|
|
2898
|
+
if (z && f[r]) {
|
|
2851
2899
|
let e = f[r][a];
|
|
2852
2900
|
h = e[1], g = e[0];
|
|
2853
|
-
} else h =
|
|
2901
|
+
} else h = L(n)(e), g = H;
|
|
2854
2902
|
let _ = d.indexOf(n), v = o + (l === "grouped" ? _ * i : 0) + i / 2, y = (Math.min(u.map(h), u.map(g)) + Math.max(u.map(h), u.map(g))) / 2;
|
|
2855
2903
|
return {
|
|
2856
2904
|
id: `${n.id}-${a}`,
|
|
2857
2905
|
cx: X.left + (s ? v : y),
|
|
2858
2906
|
cy: X.top + (s ? y : v),
|
|
2859
2907
|
label: t(e),
|
|
2860
|
-
value: p ? m[a].total :
|
|
2908
|
+
value: p ? m[a].total : L(n)(e),
|
|
2861
2909
|
seriesId: n.id,
|
|
2862
2910
|
...p && { segments: m[a].segs }
|
|
2863
2911
|
};
|
|
2864
2912
|
});
|
|
2865
|
-
}), _ = T ?? (p ?
|
|
2913
|
+
}), _ = T ?? (p ? vn : void 0);
|
|
2866
2914
|
return _ ? {
|
|
2867
2915
|
points: h,
|
|
2868
2916
|
format: _
|
|
2869
2917
|
} : { points: h };
|
|
2870
2918
|
} : void 0,
|
|
2871
|
-
onSelect:
|
|
2919
|
+
onSelect: A,
|
|
2872
2920
|
children: ({ width: n, height: r }) => {
|
|
2873
|
-
let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = J ??
|
|
2874
|
-
return
|
|
2875
|
-
prefix:
|
|
2876
|
-
fill:
|
|
2877
|
-
patternKind:
|
|
2921
|
+
let i = n - X.left - X.right, a = r - X.top - X.bottom, s = o === "vertical", c = J ?? Ze(R, s ? i : a, s ? "horizontal" : "vertical"), u = v(R, s ? [0, i] : [0, a], .2), d = g([H, W], s ? [a, 0] : [0, i]), f = e.filter((e) => !P.value.has(e.id)), _ = [];
|
|
2922
|
+
return z && (_ = V()), /* @__PURE__ */ h("g", { children: [j !== "solid" && /* @__PURE__ */ m(Lt, {
|
|
2923
|
+
prefix: N,
|
|
2924
|
+
fill: j,
|
|
2925
|
+
patternKind: M,
|
|
2878
2926
|
series: e.map((e, t) => ({
|
|
2879
2927
|
id: e.id,
|
|
2880
|
-
color:
|
|
2928
|
+
color: gn(e.color, e.data[0], 0, _n[t % _n.length])
|
|
2881
2929
|
}))
|
|
2882
2930
|
}), /* @__PURE__ */ h("g", {
|
|
2883
2931
|
transform: `translate(${X.left},${X.top})`,
|
|
2884
2932
|
children: [
|
|
2885
|
-
!D && s && /* @__PURE__ */ m(
|
|
2933
|
+
!D && s && /* @__PURE__ */ m(Ct, {
|
|
2886
2934
|
scale: d,
|
|
2887
2935
|
orientation: "y",
|
|
2888
2936
|
length: i,
|
|
2889
|
-
tickCount:
|
|
2937
|
+
tickCount: q
|
|
2890
2938
|
}),
|
|
2891
|
-
!D && !s && /* @__PURE__ */ m(
|
|
2939
|
+
!D && !s && /* @__PURE__ */ m(Ct, {
|
|
2892
2940
|
scale: d,
|
|
2893
2941
|
orientation: "x",
|
|
2894
2942
|
length: a,
|
|
2895
|
-
tickCount:
|
|
2943
|
+
tickCount: ae
|
|
2896
2944
|
}),
|
|
2897
|
-
!D &&
|
|
2945
|
+
!D && Ot(O, {
|
|
2898
2946
|
xScale: s ? u : d,
|
|
2899
2947
|
yScale: s ? d : u,
|
|
2900
2948
|
innerW: i,
|
|
2901
2949
|
innerH: a
|
|
2902
2950
|
}),
|
|
2903
2951
|
f.map((n, r) => {
|
|
2904
|
-
let i =
|
|
2952
|
+
let i = _n[e.indexOf(n) % _n.length], a = e.indexOf(n), o = l === "grouped" ? u.bandwidth / f.length : u.bandwidth;
|
|
2905
2953
|
return n.data.map((e, c) => {
|
|
2906
2954
|
let f = u.map(t(e)) ?? 0, p, g;
|
|
2907
|
-
if (
|
|
2955
|
+
if (z && _[a]) {
|
|
2908
2956
|
let e = _[a][c];
|
|
2909
2957
|
p = e[1], g = e[0];
|
|
2910
|
-
} else p =
|
|
2958
|
+
} else p = L(n)(e), g = H;
|
|
2911
2959
|
let v = f + (l === "grouped" ? r * o : 0), y = Math.min(d.map(p), d.map(g)), b = Math.abs(d.map(p) - d.map(g)), x = null;
|
|
2912
|
-
if (
|
|
2913
|
-
let t =
|
|
2914
|
-
if (s) x = /* @__PURE__ */ m(
|
|
2960
|
+
if (te) {
|
|
2961
|
+
let t = te.format(L(n)(e)), r = v + o / 2, i = z || b < 18 || y < 14;
|
|
2962
|
+
if (s) x = /* @__PURE__ */ m(Mt, {
|
|
2915
2963
|
x: r,
|
|
2916
2964
|
y: i ? y + 13 : y - 4,
|
|
2917
2965
|
text: t,
|
|
@@ -2919,7 +2967,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2919
2967
|
});
|
|
2920
2968
|
else {
|
|
2921
2969
|
let e = y + b;
|
|
2922
|
-
x = /* @__PURE__ */ m(
|
|
2970
|
+
x = /* @__PURE__ */ m(Mt, {
|
|
2923
2971
|
x: i ? e - 4 : e + 4,
|
|
2924
2972
|
y: r + 4,
|
|
2925
2973
|
text: t,
|
|
@@ -2927,15 +2975,15 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2927
2975
|
tone: i ? "muted" : "default"
|
|
2928
2976
|
});
|
|
2929
2977
|
}
|
|
2930
|
-
|
|
2978
|
+
z && b < 14 && (x = null);
|
|
2931
2979
|
}
|
|
2932
|
-
let S =
|
|
2980
|
+
let S = gn(n.color, e, c, i);
|
|
2933
2981
|
return /* @__PURE__ */ h("g", { children: [s ? /* @__PURE__ */ m("rect", {
|
|
2934
2982
|
x: v,
|
|
2935
2983
|
y,
|
|
2936
2984
|
width: o,
|
|
2937
2985
|
height: b,
|
|
2938
|
-
fill:
|
|
2986
|
+
fill: It(N, n.id, j, S),
|
|
2939
2987
|
rx: 2,
|
|
2940
2988
|
"data-series": n.id,
|
|
2941
2989
|
"data-x": String(t(e))
|
|
@@ -2944,7 +2992,7 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2944
2992
|
y: v,
|
|
2945
2993
|
width: b,
|
|
2946
2994
|
height: o,
|
|
2947
|
-
fill:
|
|
2995
|
+
fill: It(N, n.id, j, S),
|
|
2948
2996
|
rx: 2,
|
|
2949
2997
|
"data-series": n.id,
|
|
2950
2998
|
"data-x": String(t(e))
|
|
@@ -2955,39 +3003,39 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2955
3003
|
scale: u,
|
|
2956
3004
|
orientation: "x",
|
|
2957
3005
|
length: i,
|
|
2958
|
-
tickCount:
|
|
3006
|
+
tickCount: ae,
|
|
2959
3007
|
labelEvery: c,
|
|
2960
3008
|
transform: `translate(0,${a})`,
|
|
2961
|
-
...
|
|
3009
|
+
...ee ? { format: ee } : {}
|
|
2962
3010
|
}), /* @__PURE__ */ m($, {
|
|
2963
3011
|
scale: d,
|
|
2964
3012
|
orientation: "y",
|
|
2965
3013
|
length: a,
|
|
2966
|
-
tickCount:
|
|
2967
|
-
...
|
|
3014
|
+
tickCount: q,
|
|
3015
|
+
...G && { format: G }
|
|
2968
3016
|
})] }),
|
|
2969
3017
|
!D && !s && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m($, {
|
|
2970
3018
|
scale: d,
|
|
2971
3019
|
orientation: "x",
|
|
2972
3020
|
length: i,
|
|
2973
|
-
tickCount:
|
|
2974
|
-
...
|
|
3021
|
+
tickCount: ae,
|
|
3022
|
+
...G && { format: G },
|
|
2975
3023
|
transform: `translate(0,${a})`
|
|
2976
3024
|
}), /* @__PURE__ */ m($, {
|
|
2977
3025
|
scale: u,
|
|
2978
3026
|
orientation: "y",
|
|
2979
3027
|
length: a,
|
|
2980
|
-
tickCount:
|
|
3028
|
+
tickCount: q,
|
|
2981
3029
|
labelEvery: c
|
|
2982
3030
|
})] })
|
|
2983
3031
|
]
|
|
2984
3032
|
})] });
|
|
2985
3033
|
}
|
|
2986
|
-
}),
|
|
3034
|
+
}), I && /* @__PURE__ */ m(nn, {
|
|
2987
3035
|
series: e.map((e, t) => ({
|
|
2988
3036
|
id: e.id,
|
|
2989
3037
|
label: e.label,
|
|
2990
|
-
color:
|
|
3038
|
+
color: gn(e.color, e.data[0], 0, _n[t % _n.length])
|
|
2991
3039
|
})),
|
|
2992
3040
|
hidden: P
|
|
2993
3041
|
})]
|
|
@@ -2995,15 +3043,15 @@ function gn({ series: e, x: t, y: n, title: r, description: i, orientation: o =
|
|
|
2995
3043
|
}
|
|
2996
3044
|
//#endregion
|
|
2997
3045
|
//#region src/charts/pie-chart/pie-chart.tsx
|
|
2998
|
-
function
|
|
3046
|
+
function bn(e) {
|
|
2999
3047
|
let t = e.percent == null ? 0 : Math.round(e.percent);
|
|
3000
3048
|
return `${e.value} (${t}%)`;
|
|
3001
3049
|
}
|
|
3002
|
-
var
|
|
3003
|
-
function
|
|
3004
|
-
let w = x ? null :
|
|
3050
|
+
var xn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3051
|
+
function Sn({ data: e, title: t, description: n, donut: r = !1, width: i, height: o, size: c, thickness: l, innerRadius: u, centerValue: d, centerLabel: f, centerSlot: p, emptyLabel: g, tooltip: _, tooltipFormat: v, legend: y, className: b, plain: x, labels: S, onSelect: C }) {
|
|
3052
|
+
let w = x ? null : jt(S), T = typeof S == "object" && !!S && S.format != null, E = i ?? c, O = o ?? c ?? (x ? 48 : 300), k = x ? !1 : y ?? !0;
|
|
3005
3053
|
s();
|
|
3006
|
-
let
|
|
3054
|
+
let A = a(/* @__PURE__ */ new Set()), j = e.length > 0;
|
|
3007
3055
|
return /* @__PURE__ */ h("div", {
|
|
3008
3056
|
style: {
|
|
3009
3057
|
display: "flex",
|
|
@@ -3013,7 +3061,7 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
|
|
|
3013
3061
|
children: [/* @__PURE__ */ m(Q, {
|
|
3014
3062
|
title: t,
|
|
3015
3063
|
description: n,
|
|
3016
|
-
width:
|
|
3064
|
+
width: E,
|
|
3017
3065
|
height: O,
|
|
3018
3066
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
3019
3067
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
@@ -3032,34 +3080,34 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
|
|
|
3032
3080
|
}) })
|
|
3033
3081
|
] }),
|
|
3034
3082
|
className: b,
|
|
3035
|
-
"data-state":
|
|
3083
|
+
"data-state": j ? void 0 : "empty",
|
|
3036
3084
|
emptyLabel: g,
|
|
3037
3085
|
plain: x,
|
|
3038
|
-
tooltip: _ !== !1 &&
|
|
3039
|
-
if (!
|
|
3040
|
-
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !
|
|
3086
|
+
tooltip: _ !== !1 && j ? ({ width: t, height: n }) => {
|
|
3087
|
+
if (!j) return;
|
|
3088
|
+
let r = t / 2, i = n / 2, a = Math.min(r, i) - 8, o = e.filter((e) => !A.value.has(e.id)), s = o.reduce((e, t) => e + t.value, 0), c = 0;
|
|
3041
3089
|
return {
|
|
3042
3090
|
points: o.map((e, t) => {
|
|
3043
3091
|
let n = s > 0 ? e.value / s * 2 * Math.PI : 0, o = c + n, l = (c + o) / 2;
|
|
3044
3092
|
return c = o, {
|
|
3045
3093
|
id: e.id,
|
|
3046
|
-
cx:
|
|
3047
|
-
cy:
|
|
3094
|
+
cx: D(r + Math.sin(l) * a * .65),
|
|
3095
|
+
cy: D(i - Math.cos(l) * a * .65),
|
|
3048
3096
|
label: e.label,
|
|
3049
3097
|
value: e.value,
|
|
3050
3098
|
seriesId: String(t),
|
|
3051
3099
|
percent: s > 0 ? e.value / s * 100 : 0,
|
|
3052
|
-
color: e.color ??
|
|
3100
|
+
color: e.color ?? xn[t % xn.length]
|
|
3053
3101
|
};
|
|
3054
3102
|
}),
|
|
3055
|
-
format: v ??
|
|
3103
|
+
format: v ?? bn
|
|
3056
3104
|
};
|
|
3057
3105
|
} : void 0,
|
|
3058
3106
|
onSelect: C,
|
|
3059
3107
|
children: ({ width: t, height: n }) => {
|
|
3060
|
-
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !
|
|
3108
|
+
let i = t / 2, a = n / 2, o = Math.min(i, a) - 8, s = u ?? (l == null ? o * .6 : o - l), c = r ? Math.max(0, Math.min(s, o)) : 0, g = e.filter((e) => !A.value.has(e.id)), _ = g.reduce((e, t) => e + t.value, 0), v = 0, y = r && (d != null || f != null || p != null);
|
|
3061
3109
|
return /* @__PURE__ */ h("g", { children: [g.map((e, t) => {
|
|
3062
|
-
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ??
|
|
3110
|
+
let n = _ > 0 ? e.value / _ * 2 * Math.PI : 0, r = v + n, s = (v + r) / 2, l = e.color ?? xn[t % xn.length], u = I(i, a, o, c, v, r);
|
|
3063
3111
|
v = r;
|
|
3064
3112
|
let d = _ > 0 ? e.value / _ * 100 : 0, f = w && d >= 4, p = c > 0 ? (c + o) / 2 : o * .6;
|
|
3065
3113
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("path", {
|
|
@@ -3068,10 +3116,10 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
|
|
|
3068
3116
|
stroke: "var(--cascivo-color-surface)",
|
|
3069
3117
|
strokeWidth: 1,
|
|
3070
3118
|
"data-series": e.id
|
|
3071
|
-
}), f && /* @__PURE__ */ m(
|
|
3072
|
-
x:
|
|
3073
|
-
y:
|
|
3074
|
-
text:
|
|
3119
|
+
}), f && /* @__PURE__ */ m(Mt, {
|
|
3120
|
+
x: D(i + Math.sin(s) * p),
|
|
3121
|
+
y: D(a - Math.cos(s) * p + 4),
|
|
3122
|
+
text: T ? w.format(e.value) : `${Math.round(d)}%`,
|
|
3075
3123
|
tone: "muted"
|
|
3076
3124
|
})] }, e.id);
|
|
3077
3125
|
}), y && (p == null ? /* @__PURE__ */ h("g", {
|
|
@@ -3114,35 +3162,35 @@ function yn({ data: e, title: t, description: n, donut: r = !1, width: i, height
|
|
|
3114
3162
|
})
|
|
3115
3163
|
}))] });
|
|
3116
3164
|
}
|
|
3117
|
-
}),
|
|
3165
|
+
}), k && /* @__PURE__ */ m(nn, {
|
|
3118
3166
|
series: e.map((e, t) => ({
|
|
3119
3167
|
id: e.id,
|
|
3120
3168
|
label: e.label,
|
|
3121
|
-
color: e.color ??
|
|
3169
|
+
color: e.color ?? xn[t % xn.length]
|
|
3122
3170
|
})),
|
|
3123
|
-
hidden:
|
|
3171
|
+
hidden: A
|
|
3124
3172
|
})]
|
|
3125
3173
|
});
|
|
3126
3174
|
}
|
|
3127
3175
|
//#endregion
|
|
3128
3176
|
//#region src/charts/scatter-chart/scatter-chart.tsx
|
|
3129
|
-
var
|
|
3130
|
-
function
|
|
3177
|
+
var Cn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3178
|
+
function wn({ series: e, title: t, description: n, r = 4, width: i, height: o, xTicks: c = 5, yTicks: l = 5, legend: u, tooltip: d, className: f, plain: _, annotations: v, onSelect: y, glyph: b, renderer: x = "svg", visualMap: S, toolbox: C, format: w }) {
|
|
3131
3179
|
s();
|
|
3132
|
-
let T = a(/* @__PURE__ */ new Set()), E = _ ?
|
|
3180
|
+
let T = a(/* @__PURE__ */ new Set()), E = _ ? Ke : Ge, D = o ?? (_ ? 48 : 300), O = _ ? !1 : u ?? e.length > 1, k = e.reduce((e, t) => e + t.data.length, 0), A = !S && (x === "canvas" || x === "auto" && k > 2e3), j = a([S?.min ?? 0, S?.max ?? 1]), M = a(/* @__PURE__ */ new Set()), ee = (t, { width: n, height: i }) => {
|
|
3133
3181
|
let a = n - E.left - E.right, o = i - E.top - E.bottom;
|
|
3134
3182
|
if (a <= 0 || o <= 0) return;
|
|
3135
|
-
let s = g([F, I], [0, a]), c = g([ne,
|
|
3183
|
+
let s = g([F, I], [0, a]), c = g([ne, L], [o, 0]);
|
|
3136
3184
|
e.forEach((e, n) => {
|
|
3137
3185
|
if (!T.value.has(e.id)) {
|
|
3138
|
-
t.fillStyle =
|
|
3186
|
+
t.fillStyle = rt(t, e.color ?? Cn[n % Cn.length]), t.globalAlpha = .7;
|
|
3139
3187
|
for (let n of e.data) {
|
|
3140
3188
|
let e = typeof r == "function" ? r(n) : n.r ?? r;
|
|
3141
3189
|
t.beginPath(), t.arc(E.left + s.map(n.x), E.top + c.map(n.y), e, 0, Math.PI * 2), t.fill();
|
|
3142
3190
|
}
|
|
3143
3191
|
}
|
|
3144
3192
|
}), t.globalAlpha = 1;
|
|
3145
|
-
},
|
|
3193
|
+
}, N = e.flatMap((e) => e.data.map((e) => e.x)), te = e.flatMap((e) => e.data.map((e) => e.y)), P = N.length > 0, F = P ? Math.min(...N) : 0, I = P ? Math.max(...N) : 1, ne = P ? Math.min(0, ...te) : 0, L = P ? Math.max(...te) : 1;
|
|
3146
3194
|
return /* @__PURE__ */ h("div", {
|
|
3147
3195
|
style: {
|
|
3148
3196
|
display: "flex",
|
|
@@ -3173,7 +3221,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3173
3221
|
plain: _,
|
|
3174
3222
|
tooltip: d !== !1 && P ? ({ width: t, height: n }) => {
|
|
3175
3223
|
if (d === !1 || !P) return;
|
|
3176
|
-
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([F, I], [0, r]), o = g([ne,
|
|
3224
|
+
let r = t - E.left - E.right, i = n - E.top - E.bottom, a = g([F, I], [0, r]), o = g([ne, L], [i, 0]);
|
|
3177
3225
|
return { points: e.flatMap((e) => T.value.has(e.id) ? [] : e.data.map((t, n) => ({
|
|
3178
3226
|
id: `${e.id}-${n}`,
|
|
3179
3227
|
cx: E.left + a.map(t.x),
|
|
@@ -3185,37 +3233,37 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3185
3233
|
} : void 0,
|
|
3186
3234
|
onSelect: y,
|
|
3187
3235
|
hover: "voronoi",
|
|
3188
|
-
renderer:
|
|
3189
|
-
paint:
|
|
3236
|
+
renderer: A ? "canvas" : "svg",
|
|
3237
|
+
paint: A ? ee : void 0,
|
|
3190
3238
|
toolbox: C,
|
|
3191
3239
|
onRestore: S ? () => {
|
|
3192
|
-
|
|
3240
|
+
j.value = [S.min, S.max], M.value = /* @__PURE__ */ new Set();
|
|
3193
3241
|
} : void 0,
|
|
3194
3242
|
children: ({ width: t, height: n }) => {
|
|
3195
|
-
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([F, I], [0, i]), s = g([ne,
|
|
3243
|
+
let i = t - E.left - E.right, a = n - E.top - E.bottom, o = g([F, I], [0, i]), s = g([ne, L], [a, 0]);
|
|
3196
3244
|
return /* @__PURE__ */ m("g", { children: /* @__PURE__ */ h("g", {
|
|
3197
3245
|
transform: `translate(${E.left},${E.top})`,
|
|
3198
3246
|
children: [
|
|
3199
|
-
!_ && /* @__PURE__ */ m(
|
|
3247
|
+
!_ && /* @__PURE__ */ m(Ct, {
|
|
3200
3248
|
scale: s,
|
|
3201
3249
|
orientation: "y",
|
|
3202
3250
|
length: i,
|
|
3203
3251
|
tickCount: l
|
|
3204
3252
|
}),
|
|
3205
|
-
!_ &&
|
|
3253
|
+
!_ && Ot(v, {
|
|
3206
3254
|
xScale: o,
|
|
3207
3255
|
yScale: s,
|
|
3208
3256
|
innerW: i,
|
|
3209
3257
|
innerH: a
|
|
3210
3258
|
}),
|
|
3211
|
-
!
|
|
3259
|
+
!A && e.map((e, t) => {
|
|
3212
3260
|
if (T.value.has(e.id)) return null;
|
|
3213
|
-
let n = e.color ??
|
|
3261
|
+
let n = e.color ?? Cn[t % Cn.length];
|
|
3214
3262
|
return /* @__PURE__ */ m("g", {
|
|
3215
3263
|
"data-series": e.id,
|
|
3216
3264
|
children: e.data.map((t, i) => {
|
|
3217
|
-
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ?
|
|
3218
|
-
return p && p !== "circle" ? /* @__PURE__ */ m(
|
|
3265
|
+
let a = typeof r == "function" ? r(t) : t.r ?? r, c = S ? Qt(t.y, S) : void 0, l = c?.size ?? a, u = c?.color ?? n, d = S ? $t(t.y, S, j.value, M.value) : !0, f = d ? .7 : .1, p = typeof b == "function" ? b(t, e.id) : b;
|
|
3266
|
+
return p && p !== "circle" ? /* @__PURE__ */ m(zt, {
|
|
3219
3267
|
shape: p,
|
|
3220
3268
|
x: o.map(t.x),
|
|
3221
3269
|
y: s.map(t.y),
|
|
@@ -3253,17 +3301,17 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3253
3301
|
}) });
|
|
3254
3302
|
}
|
|
3255
3303
|
}),
|
|
3256
|
-
S && P && /* @__PURE__ */ m(
|
|
3304
|
+
S && P && /* @__PURE__ */ m(en, {
|
|
3257
3305
|
options: S,
|
|
3258
|
-
range:
|
|
3259
|
-
hidden:
|
|
3306
|
+
range: j,
|
|
3307
|
+
hidden: M,
|
|
3260
3308
|
label: t
|
|
3261
3309
|
}),
|
|
3262
|
-
O && /* @__PURE__ */ m(
|
|
3310
|
+
O && /* @__PURE__ */ m(nn, {
|
|
3263
3311
|
series: e.map((e, t) => ({
|
|
3264
3312
|
id: e.id,
|
|
3265
3313
|
label: e.label,
|
|
3266
|
-
color: e.color ??
|
|
3314
|
+
color: e.color ?? Cn[t % Cn.length]
|
|
3267
3315
|
})),
|
|
3268
3316
|
hidden: T
|
|
3269
3317
|
})
|
|
@@ -3272,7 +3320,7 @@ function xn({ series: e, title: t, description: n, r = 4, width: i, height: o, x
|
|
|
3272
3320
|
}
|
|
3273
3321
|
//#endregion
|
|
3274
3322
|
//#region src/charts/sparkline/sparkline.tsx
|
|
3275
|
-
function
|
|
3323
|
+
function Tn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, color: a = "var(--cascivo-chart-1)", endDot: o = !0 }) {
|
|
3276
3324
|
return /* @__PURE__ */ m(Q, {
|
|
3277
3325
|
title: r ?? i,
|
|
3278
3326
|
width: t,
|
|
@@ -3291,7 +3339,7 @@ function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3291
3339
|
})() : void 0,
|
|
3292
3340
|
children: () => {
|
|
3293
3341
|
if (e.length === 0) return null;
|
|
3294
|
-
let r = g([0, e.length - 1], [2, t - 2]), i = Math.min(...e), s = Math.max(...e), c = g([i === s ? i - 1 : i, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u =
|
|
3342
|
+
let r = g([0, e.length - 1], [2, t - 2]), i = Math.min(...e), s = Math.max(...e), c = g([i === s ? i - 1 : i, s], [n - 2, 2]), l = e.map((e, t) => [r.map(t), c.map(e)]), u = k(l, "monotone"), d = l[l.length - 1];
|
|
3295
3343
|
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("path", {
|
|
3296
3344
|
d: u,
|
|
3297
3345
|
fill: "none",
|
|
@@ -3308,40 +3356,47 @@ function Sn({ data: e, width: t = 120, height: n = 32, label: r, ariaLabel: i, c
|
|
|
3308
3356
|
}
|
|
3309
3357
|
});
|
|
3310
3358
|
}
|
|
3359
|
+
var En = {
|
|
3360
|
+
meter: "_meter_cns3q_2",
|
|
3361
|
+
svg: "_svg_cns3q_9",
|
|
3362
|
+
label: "_label_cns3q_16",
|
|
3363
|
+
gaugeLabel: "_gaugeLabel_cns3q_22",
|
|
3364
|
+
fill: "_fill_cns3q_28"
|
|
3365
|
+
};
|
|
3311
3366
|
//#endregion
|
|
3312
3367
|
//#region src/charts/meter/meter.tsx
|
|
3313
|
-
function
|
|
3314
|
-
if (!
|
|
3315
|
-
let { warning:
|
|
3316
|
-
return
|
|
3368
|
+
function Dn(e, t) {
|
|
3369
|
+
if (!t) return "var(--cascivo-chart-1)";
|
|
3370
|
+
let { warning: n, critical: r } = t;
|
|
3371
|
+
return r != null && e >= r ? "var(--cascivo-color-destructive)" : n != null && e >= n ? "var(--cascivo-color-warning)" : "var(--cascivo-color-success)";
|
|
3317
3372
|
}
|
|
3318
|
-
function
|
|
3319
|
-
let c = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0,
|
|
3373
|
+
function On({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar", thresholds: a, width: o, height: s }) {
|
|
3374
|
+
let { ref: c, width: l } = We(200, 100), u = o ?? l.value, d = n > t ? (Math.min(n, Math.max(t, e)) - t) / (n - t) : 0, f = Dn(e, a);
|
|
3320
3375
|
if (i === "gauge") {
|
|
3321
|
-
let i = s ?? 100, a =
|
|
3376
|
+
let i = s ?? 100, a = u, o = a / 2, l = i * .9, p = Math.min(o, l) - 4, g = p * .65, _ = Math.PI, v = I(o, l, p, g, _, 2 * Math.PI), y = _ + d * Math.PI, b = d > 0 ? I(o, l, p, g, _, y) : "";
|
|
3322
3377
|
return /* @__PURE__ */ h("div", {
|
|
3378
|
+
ref: c,
|
|
3379
|
+
className: En.meter,
|
|
3323
3380
|
"aria-label": r,
|
|
3324
3381
|
role: "meter",
|
|
3325
3382
|
"aria-valuenow": e,
|
|
3326
3383
|
"aria-valuemin": t,
|
|
3327
3384
|
"aria-valuemax": n,
|
|
3328
3385
|
children: [/* @__PURE__ */ h("svg", {
|
|
3386
|
+
className: En.svg,
|
|
3329
3387
|
width: a,
|
|
3330
3388
|
height: i,
|
|
3389
|
+
viewBox: `0 0 ${a} ${i}`,
|
|
3331
3390
|
"aria-hidden": "true",
|
|
3332
3391
|
children: [/* @__PURE__ */ m("path", {
|
|
3333
|
-
d:
|
|
3392
|
+
d: v,
|
|
3334
3393
|
fill: "var(--cascivo-color-border)"
|
|
3335
|
-
}),
|
|
3336
|
-
d:
|
|
3337
|
-
fill:
|
|
3394
|
+
}), b && /* @__PURE__ */ m("path", {
|
|
3395
|
+
d: b,
|
|
3396
|
+
fill: f
|
|
3338
3397
|
})]
|
|
3339
3398
|
}), /* @__PURE__ */ h("div", {
|
|
3340
|
-
|
|
3341
|
-
textAlign: "center",
|
|
3342
|
-
fontSize: "var(--cascivo-text-sm)",
|
|
3343
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3344
|
-
},
|
|
3399
|
+
className: En.gaugeLabel,
|
|
3345
3400
|
children: [
|
|
3346
3401
|
r,
|
|
3347
3402
|
": ",
|
|
@@ -3350,49 +3405,45 @@ function wn({ value: e, min: t = 0, max: n = 100, label: r, variant: i = "bar",
|
|
|
3350
3405
|
})]
|
|
3351
3406
|
});
|
|
3352
3407
|
}
|
|
3353
|
-
let
|
|
3408
|
+
let p = s ?? 12, g = u;
|
|
3354
3409
|
return /* @__PURE__ */ h("div", {
|
|
3410
|
+
ref: c,
|
|
3411
|
+
className: En.meter,
|
|
3355
3412
|
"aria-label": r,
|
|
3356
3413
|
role: "meter",
|
|
3357
3414
|
"aria-valuenow": e,
|
|
3358
3415
|
"aria-valuemin": t,
|
|
3359
3416
|
"aria-valuemax": n,
|
|
3360
3417
|
children: [/* @__PURE__ */ h("svg", {
|
|
3361
|
-
|
|
3362
|
-
|
|
3418
|
+
className: En.svg,
|
|
3419
|
+
width: g,
|
|
3420
|
+
height: p,
|
|
3421
|
+
viewBox: `0 0 ${g} ${p}`,
|
|
3363
3422
|
"aria-hidden": "true",
|
|
3364
|
-
style: { display: "block" },
|
|
3365
3423
|
children: [/* @__PURE__ */ m("rect", {
|
|
3366
3424
|
x: 0,
|
|
3367
3425
|
y: 0,
|
|
3368
|
-
width:
|
|
3369
|
-
height:
|
|
3370
|
-
rx:
|
|
3426
|
+
width: g,
|
|
3427
|
+
height: p,
|
|
3428
|
+
rx: p / 2,
|
|
3371
3429
|
fill: "var(--cascivo-color-border)"
|
|
3372
3430
|
}), /* @__PURE__ */ m("rect", {
|
|
3373
3431
|
x: 0,
|
|
3374
3432
|
y: 0,
|
|
3375
|
-
width:
|
|
3376
|
-
height:
|
|
3377
|
-
rx:
|
|
3378
|
-
fill:
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
transform: `scaleX(${c})`,
|
|
3382
|
-
transition: "transform 400ms ease"
|
|
3383
|
-
}
|
|
3433
|
+
width: g,
|
|
3434
|
+
height: p,
|
|
3435
|
+
rx: p / 2,
|
|
3436
|
+
fill: f,
|
|
3437
|
+
className: En.fill,
|
|
3438
|
+
style: { transform: `scaleX(${d})` }
|
|
3384
3439
|
})]
|
|
3385
3440
|
}), /* @__PURE__ */ m("div", {
|
|
3386
|
-
|
|
3387
|
-
marginTop: "var(--cascivo-space-1)",
|
|
3388
|
-
fontSize: "var(--cascivo-text-xs)",
|
|
3389
|
-
color: "var(--cascivo-color-foreground-muted)"
|
|
3390
|
-
},
|
|
3441
|
+
className: En.label,
|
|
3391
3442
|
children: r
|
|
3392
3443
|
})]
|
|
3393
3444
|
});
|
|
3394
3445
|
}
|
|
3395
|
-
var
|
|
3446
|
+
var kn = {
|
|
3396
3447
|
kpi: "_kpi_nrb8p_7",
|
|
3397
3448
|
head: "_head_nrb8p_19",
|
|
3398
3449
|
label: "_label_nrb8p_27",
|
|
@@ -3402,20 +3453,20 @@ var Tn = {
|
|
|
3402
3453
|
};
|
|
3403
3454
|
//#endregion
|
|
3404
3455
|
//#region src/charts/kpi/kpi.tsx
|
|
3405
|
-
function
|
|
3456
|
+
function An(e, t) {
|
|
3406
3457
|
if (typeof t == "function") return t(e);
|
|
3407
3458
|
let n = e >= 0 ? "+" : "", r = e.toLocaleString(d());
|
|
3408
3459
|
return t === "percent" ? `${n}${r}%` : `${n}${r}`;
|
|
3409
3460
|
}
|
|
3410
|
-
function
|
|
3461
|
+
function jn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirection: a = "up", deltaLabel: o, icon: s, sparkline: c, className: l }) {
|
|
3411
3462
|
let u = r != null && r >= 0, f = r != null && r < 0, p = u ? "up" : f ? "down" : "flat";
|
|
3412
3463
|
return /* @__PURE__ */ h("div", {
|
|
3413
|
-
className: [
|
|
3464
|
+
className: [kn.kpi, l].filter(Boolean).join(" "),
|
|
3414
3465
|
children: [
|
|
3415
3466
|
/* @__PURE__ */ h("div", {
|
|
3416
|
-
className:
|
|
3467
|
+
className: kn.head,
|
|
3417
3468
|
children: [/* @__PURE__ */ m("span", {
|
|
3418
|
-
className:
|
|
3469
|
+
className: kn.label,
|
|
3419
3470
|
children: t
|
|
3420
3471
|
}), s && /* @__PURE__ */ m("span", {
|
|
3421
3472
|
"aria-hidden": "true",
|
|
@@ -3423,25 +3474,25 @@ function Dn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
|
|
|
3423
3474
|
})]
|
|
3424
3475
|
}),
|
|
3425
3476
|
/* @__PURE__ */ h("div", {
|
|
3426
|
-
className:
|
|
3477
|
+
className: kn.valueRow,
|
|
3427
3478
|
children: [/* @__PURE__ */ m("span", {
|
|
3428
|
-
className:
|
|
3479
|
+
className: kn.value,
|
|
3429
3480
|
children: typeof e == "number" ? e.toLocaleString(d()) : e
|
|
3430
3481
|
}), r != null && /* @__PURE__ */ h("span", {
|
|
3431
3482
|
role: "img",
|
|
3432
|
-
className:
|
|
3483
|
+
className: kn.delta,
|
|
3433
3484
|
"data-trend": p,
|
|
3434
3485
|
"data-sentiment": n(p, a),
|
|
3435
|
-
"aria-label": `Trend: ${
|
|
3486
|
+
"aria-label": `Trend: ${An(r, i)}${o ? ` ${o}` : ""}`,
|
|
3436
3487
|
children: [
|
|
3437
3488
|
u ? "▲" : f ? "▼" : "–",
|
|
3438
3489
|
" ",
|
|
3439
|
-
|
|
3490
|
+
An(r, i),
|
|
3440
3491
|
o && ` ${o}`
|
|
3441
3492
|
]
|
|
3442
3493
|
})]
|
|
3443
3494
|
}),
|
|
3444
|
-
c && c.length > 0 && /* @__PURE__ */ m(
|
|
3495
|
+
c && c.length > 0 && /* @__PURE__ */ m(Tn, {
|
|
3445
3496
|
data: c,
|
|
3446
3497
|
label: `${t} trend`,
|
|
3447
3498
|
height: 32
|
|
@@ -3451,9 +3502,9 @@ function Dn({ value: e, label: t, delta: r, deltaFormat: i = "number", goodDirec
|
|
|
3451
3502
|
}
|
|
3452
3503
|
//#endregion
|
|
3453
3504
|
//#region src/charts/histogram/histogram.tsx
|
|
3454
|
-
function
|
|
3505
|
+
function Mn({ data: e, bins: t, title: n, label: r, description: i, width: a, height: o, className: c, plain: l, format: u }) {
|
|
3455
3506
|
s();
|
|
3456
|
-
let d = l ?
|
|
3507
|
+
let d = l ? Ke : Ge, f = o ?? (l ? 48 : 300), _ = H(e, t), v = _.reduce((e, t) => Math.max(e, t.count), 0);
|
|
3457
3508
|
return /* @__PURE__ */ m(Q, {
|
|
3458
3509
|
title: n,
|
|
3459
3510
|
description: i,
|
|
@@ -3494,7 +3545,7 @@ function On({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3494
3545
|
return /* @__PURE__ */ h("g", {
|
|
3495
3546
|
transform: `translate(${d.left},${d.top})`,
|
|
3496
3547
|
children: [
|
|
3497
|
-
!l && /* @__PURE__ */ m(
|
|
3548
|
+
!l && /* @__PURE__ */ m(Ct, {
|
|
3498
3549
|
scale: i,
|
|
3499
3550
|
orientation: "y",
|
|
3500
3551
|
length: n.width
|
|
@@ -3528,13 +3579,13 @@ function On({ data: e, bins: t, title: n, label: r, description: i, width: a, he
|
|
|
3528
3579
|
}
|
|
3529
3580
|
//#endregion
|
|
3530
3581
|
//#region src/charts/boxplot/boxplot.tsx
|
|
3531
|
-
var
|
|
3532
|
-
function
|
|
3582
|
+
var Nn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
3583
|
+
function Pn({ series: e, title: t, description: n, width: r, height: i, className: a, plain: o, format: c }) {
|
|
3533
3584
|
s();
|
|
3534
|
-
let l = o ?
|
|
3585
|
+
let l = o ? Ke : Ge, u = i ?? (o ? 48 : 320), d = e.map((e) => ({
|
|
3535
3586
|
...e,
|
|
3536
|
-
stats:
|
|
3537
|
-
})), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ?
|
|
3587
|
+
stats: U(e.values)
|
|
3588
|
+
})), f = e.flatMap((e) => e.values), [_, y] = f.length > 0 ? W(f) : [0, 1];
|
|
3538
3589
|
return /* @__PURE__ */ m(Q, {
|
|
3539
3590
|
title: t,
|
|
3540
3591
|
description: n,
|
|
@@ -3593,7 +3644,7 @@ function An({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3593
3644
|
return /* @__PURE__ */ h("g", {
|
|
3594
3645
|
transform: `translate(${l.left},${l.top})`,
|
|
3595
3646
|
children: [d.map((e, t) => {
|
|
3596
|
-
let n =
|
|
3647
|
+
let n = Nn[t % Nn.length] ?? "var(--cascivo-chart-1)", i = (r.map(e.id) ?? 0) + r.bandwidth / 2, o = r.bandwidth * .6, s = i - o / 2, c = a.map(e.stats.q1), l = a.map(e.stats.q3), u = a.map(e.stats.median), d = a.map(e.stats.min), f = a.map(e.stats.max);
|
|
3597
3648
|
return /* @__PURE__ */ h("g", { children: [
|
|
3598
3649
|
/* @__PURE__ */ m("line", {
|
|
3599
3650
|
x1: i,
|
|
@@ -3671,10 +3722,10 @@ function An({ series: e, title: t, description: n, width: r, height: i, classNam
|
|
|
3671
3722
|
}
|
|
3672
3723
|
//#endregion
|
|
3673
3724
|
//#region src/charts/bubble-chart/bubble-chart.tsx
|
|
3674
|
-
var
|
|
3675
|
-
function
|
|
3725
|
+
var Fn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), In = 3, Ln = 24;
|
|
3726
|
+
function Rn({ series: e, title: t, description: n, width: r, height: i, tooltip: o, className: c, plain: l, glyph: u, format: d }) {
|
|
3676
3727
|
s();
|
|
3677
|
-
let f = a(null), _ = l ?
|
|
3728
|
+
let f = a(null), _ = l ? Ke : Ge, v = i ?? (l ? 48 : 320), b = e.flatMap((e) => e.data), [x, S] = b.length > 0 ? W(b.map((e) => e.x)) : [0, 1], [C, w] = b.length > 0 ? W(b.map((e) => e.y)) : [0, 1], [T, E] = b.length > 0 ? W(b.map((e) => e.size)) : [0, 1], D = y([T, E], [In, Ln]), O = b.length > 0;
|
|
3678
3729
|
return /* @__PURE__ */ m(Q, {
|
|
3679
3730
|
title: t,
|
|
3680
3731
|
description: n,
|
|
@@ -3725,13 +3776,13 @@ function Pn({ series: e, title: t, description: n, width: r, height: i, tooltip:
|
|
|
3725
3776
|
return /* @__PURE__ */ h("g", {
|
|
3726
3777
|
transform: `translate(${_.left},${_.top})`,
|
|
3727
3778
|
children: [
|
|
3728
|
-
!l && /* @__PURE__ */ m(
|
|
3779
|
+
!l && /* @__PURE__ */ m(Ct, {
|
|
3729
3780
|
scale: s,
|
|
3730
3781
|
orientation: "y",
|
|
3731
3782
|
length: r.width
|
|
3732
3783
|
}),
|
|
3733
3784
|
e.map((e, t) => {
|
|
3734
|
-
let n =
|
|
3785
|
+
let n = Fn[t % Fn.length] ?? "var(--cascivo-chart-1)";
|
|
3735
3786
|
return /* @__PURE__ */ m("g", {
|
|
3736
3787
|
opacity: f.value !== null && f.value !== e.name ? .2 : 1,
|
|
3737
3788
|
onMouseEnter: () => {
|
|
@@ -3742,7 +3793,7 @@ function Pn({ series: e, title: t, description: n, width: r, height: i, tooltip:
|
|
|
3742
3793
|
},
|
|
3743
3794
|
children: e.data.map((t, r) => {
|
|
3744
3795
|
let i = typeof u == "function" ? u(t, e.name) : u;
|
|
3745
|
-
return i && i !== "circle" ? /* @__PURE__ */ m("g", { children: /* @__PURE__ */ m(
|
|
3796
|
+
return i && i !== "circle" ? /* @__PURE__ */ m("g", { children: /* @__PURE__ */ m(zt, {
|
|
3746
3797
|
shape: i,
|
|
3747
3798
|
x: o.map(t.x),
|
|
3748
3799
|
y: s.map(t.y),
|
|
@@ -3781,22 +3832,22 @@ function Pn({ series: e, title: t, description: n, width: r, height: i, tooltip:
|
|
|
3781
3832
|
}
|
|
3782
3833
|
//#endregion
|
|
3783
3834
|
//#region src/charts/combo-chart/combo-chart.tsx
|
|
3784
|
-
var
|
|
3785
|
-
function
|
|
3835
|
+
var zn = "var(--cascivo-chart-1)", Bn = "var(--cascivo-chart-2)";
|
|
3836
|
+
function Vn({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, barsLabel: o = "Bars", lineLabel: c = "Line", legend: l, xLabelEvery: u, width: d, height: f, tooltip: _, className: y, plain: b, annotations: x, format: S }) {
|
|
3786
3837
|
s();
|
|
3787
|
-
let C = a(/* @__PURE__ */ new Set()), w = f ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, E = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0,
|
|
3788
|
-
t.length > 0 && e.length > 0 && t.length !== e.length &&
|
|
3838
|
+
let C = a(/* @__PURE__ */ new Set()), w = f ?? (b ? 48 : 320), T = e.reduce((e, t) => Math.max(e, t.value), 0) || 1, E = t.length > 0 ? Math.min(...t.map((e) => e.y)) : 0, D = t.length > 0 ? Math.max(...t.map((e) => e.y)) : 1, O = e.length > 0, A = b ? !1 : l ?? (e.length > 0 && t.length > 0);
|
|
3839
|
+
t.length > 0 && e.length > 0 && t.length !== e.length && sn("ComboChart:length-mismatch", `ComboChart: \`line\` has ${t.length} point(s) but \`bars\` has ${e.length}. The two are correlated by array index, so the line is drawn against the wrong categories. Pass one line point per bar (use a null-valued point for a gap).`), !i && t.length > 0 && e.length > 0 && cn("ComboChart", [{
|
|
3789
3840
|
label: o,
|
|
3790
3841
|
max: T
|
|
3791
3842
|
}, {
|
|
3792
3843
|
label: c,
|
|
3793
|
-
max:
|
|
3844
|
+
max: D
|
|
3794
3845
|
}]);
|
|
3795
|
-
let
|
|
3796
|
-
...
|
|
3797
|
-
left:
|
|
3798
|
-
right:
|
|
3799
|
-
rightAxisLabels:
|
|
3846
|
+
let j = g([0, T], [0, 1]).ticks(5).map((e) => e.toLocaleString()), M = i ? g([E, D || E + 1], [0, 1]).ticks(5).map((e) => e.toLocaleString()) : [], ee = e.map((e) => e.label), N = b ? Ke : {
|
|
3847
|
+
...Ge,
|
|
3848
|
+
left: Je(j, b),
|
|
3849
|
+
right: Ye({
|
|
3850
|
+
rightAxisLabels: M,
|
|
3800
3851
|
plain: b
|
|
3801
3852
|
})
|
|
3802
3853
|
};
|
|
@@ -3826,17 +3877,17 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3826
3877
|
] }, e.label)) })
|
|
3827
3878
|
] }),
|
|
3828
3879
|
plain: b,
|
|
3829
|
-
tooltip: _ !== !1 &&
|
|
3830
|
-
if (_ === !1 || !
|
|
3880
|
+
tooltip: _ !== !1 && O ? ({ width: n, height: r }) => {
|
|
3881
|
+
if (_ === !1 || !O) return;
|
|
3831
3882
|
let a = {
|
|
3832
|
-
width: n -
|
|
3833
|
-
height: r -
|
|
3883
|
+
width: n - N.left - N.right,
|
|
3884
|
+
height: r - N.top - N.bottom
|
|
3834
3885
|
};
|
|
3835
3886
|
if (a.width <= 0) return;
|
|
3836
|
-
let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E,
|
|
3887
|
+
let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, D || E + 1], [a.height, 0]) : s, l = e.map((e, t) => ({
|
|
3837
3888
|
id: `bar-${t}`,
|
|
3838
|
-
cx:
|
|
3839
|
-
cy:
|
|
3889
|
+
cx: N.left + (o.map(e.label) ?? 0) + o.bandwidth / 2,
|
|
3890
|
+
cy: N.top + s.map(e.value),
|
|
3840
3891
|
label: e.label,
|
|
3841
3892
|
value: e.value,
|
|
3842
3893
|
seriesId: "bars"
|
|
@@ -3844,8 +3895,8 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3844
3895
|
let i = e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1);
|
|
3845
3896
|
return {
|
|
3846
3897
|
id: `line-${r}`,
|
|
3847
|
-
cx:
|
|
3848
|
-
cy:
|
|
3898
|
+
cx: N.left + i,
|
|
3899
|
+
cy: N.top + c.map(n.y),
|
|
3849
3900
|
label: e[r]?.label ?? String(n.x),
|
|
3850
3901
|
value: n.y,
|
|
3851
3902
|
seriesId: "line"
|
|
@@ -3855,20 +3906,20 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3855
3906
|
} : void 0,
|
|
3856
3907
|
children: ({ width: n, height: r }) => {
|
|
3857
3908
|
let a = {
|
|
3858
|
-
width: n -
|
|
3859
|
-
height: r -
|
|
3909
|
+
width: n - N.left - N.right,
|
|
3910
|
+
height: r - N.top - N.bottom
|
|
3860
3911
|
};
|
|
3861
3912
|
if (a.width <= 0 || e.length === 0) return null;
|
|
3862
|
-
let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E,
|
|
3913
|
+
let o = v(e.map((e) => e.label), [0, a.width], .2), s = g([0, T], [a.height, 0]), c = i ? g([E, D || E + 1], [a.height, 0]) : s, l = t.map((n, r) => [e[r] ? (o.map(e[r].label) ?? 0) + o.bandwidth / 2 : a.width * n.x / Math.max(1, t.length - 1), c.map(n.y)]), d = l.length > 1 ? k(l, "monotone") : "", f = u ?? Ze(ee, a.width), _ = C.value.has("bars"), y = C.value.has("line");
|
|
3863
3914
|
return /* @__PURE__ */ h("g", {
|
|
3864
|
-
transform: `translate(${
|
|
3915
|
+
transform: `translate(${N.left},${N.top})`,
|
|
3865
3916
|
children: [
|
|
3866
|
-
!b && /* @__PURE__ */ m(
|
|
3917
|
+
!b && /* @__PURE__ */ m(Ct, {
|
|
3867
3918
|
scale: s,
|
|
3868
3919
|
orientation: "y",
|
|
3869
3920
|
length: a.width
|
|
3870
3921
|
}),
|
|
3871
|
-
!b &&
|
|
3922
|
+
!b && Ot(x, {
|
|
3872
3923
|
xScale: o,
|
|
3873
3924
|
yScale: s,
|
|
3874
3925
|
innerW: a.width,
|
|
@@ -3881,14 +3932,14 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3881
3932
|
y: n,
|
|
3882
3933
|
width: o.bandwidth,
|
|
3883
3934
|
height: Math.max(0, a.height - n),
|
|
3884
|
-
fill:
|
|
3935
|
+
fill: zn,
|
|
3885
3936
|
opacity: .75
|
|
3886
3937
|
}, e.label);
|
|
3887
3938
|
}),
|
|
3888
3939
|
d && !y && /* @__PURE__ */ m("path", {
|
|
3889
3940
|
d,
|
|
3890
3941
|
fill: "none",
|
|
3891
|
-
stroke:
|
|
3942
|
+
stroke: Bn,
|
|
3892
3943
|
strokeWidth: 2.5,
|
|
3893
3944
|
strokeLinejoin: "round",
|
|
3894
3945
|
strokeLinecap: "round"
|
|
@@ -3917,15 +3968,15 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3917
3968
|
]
|
|
3918
3969
|
});
|
|
3919
3970
|
}
|
|
3920
|
-
}),
|
|
3971
|
+
}), A && /* @__PURE__ */ m(nn, {
|
|
3921
3972
|
series: [{
|
|
3922
3973
|
id: "bars",
|
|
3923
3974
|
label: o,
|
|
3924
|
-
color:
|
|
3975
|
+
color: zn
|
|
3925
3976
|
}, ...t.length > 0 ? [{
|
|
3926
3977
|
id: "line",
|
|
3927
3978
|
label: c,
|
|
3928
|
-
color:
|
|
3979
|
+
color: Bn
|
|
3929
3980
|
}] : []],
|
|
3930
3981
|
hidden: C
|
|
3931
3982
|
})]
|
|
@@ -3933,14 +3984,14 @@ function Ln({ bars: e, line: t, title: n, description: r, secondAxis: i = !1, ba
|
|
|
3933
3984
|
}
|
|
3934
3985
|
//#endregion
|
|
3935
3986
|
//#region src/charts/heatmap/heatmap.tsx
|
|
3936
|
-
function
|
|
3987
|
+
function Hn({ data: e, title: t, description: n, width: r, height: i, className: o, plain: c, visualMap: l, toolbox: u, format: d }) {
|
|
3937
3988
|
s();
|
|
3938
|
-
let f = i ?? (c ? 48 : 320), g = c ?
|
|
3989
|
+
let f = i ?? (c ? 48 : 320), g = c ? Ke : {
|
|
3939
3990
|
top: 20,
|
|
3940
3991
|
right: 20,
|
|
3941
3992
|
bottom: 60,
|
|
3942
3993
|
left: 60
|
|
3943
|
-
}, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ?
|
|
3994
|
+
}, _ = [...new Set(e.map((e) => e.x))], y = [...new Set(e.map((e) => e.y))], [b, x] = e.length > 0 ? W(e.map((e) => e.value)) : [0, 1], S = x - b || 1, C = (e) => Math.max(0, Math.min(1, (e - b) / S)), w = a([l?.min ?? b, l?.max ?? x]), T = a(/* @__PURE__ */ new Set()), E = /* @__PURE__ */ m(Q, {
|
|
3944
3995
|
title: t,
|
|
3945
3996
|
description: n,
|
|
3946
3997
|
width: r,
|
|
@@ -3990,7 +4041,7 @@ function Rn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
3990
4041
|
return /* @__PURE__ */ h("g", {
|
|
3991
4042
|
transform: `translate(${g.left},${g.top})`,
|
|
3992
4043
|
children: [e.map((e, t) => {
|
|
3993
|
-
let n = i.map(e.x) ?? 0, r = a.map(e.y) ?? 0, o = Math.round(C(e.value) * 100), s = l ?
|
|
4044
|
+
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-gray-100))`, c = l ? $t(e.value, l, w.value, T.value) : !0;
|
|
3994
4045
|
return /* @__PURE__ */ m("rect", {
|
|
3995
4046
|
x: n,
|
|
3996
4047
|
y: r,
|
|
@@ -4021,7 +4072,7 @@ function Rn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4021
4072
|
flexDirection: "column",
|
|
4022
4073
|
gap: "0.5rem"
|
|
4023
4074
|
},
|
|
4024
|
-
children: [E, /* @__PURE__ */ m(
|
|
4075
|
+
children: [E, /* @__PURE__ */ m(en, {
|
|
4025
4076
|
options: l,
|
|
4026
4077
|
range: w,
|
|
4027
4078
|
hidden: T,
|
|
@@ -4031,8 +4082,8 @@ function Rn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4031
4082
|
}
|
|
4032
4083
|
//#endregion
|
|
4033
4084
|
//#region src/charts/treemap/treemap.tsx
|
|
4034
|
-
var
|
|
4035
|
-
function
|
|
4085
|
+
var Un = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4086
|
+
function Wn({ data: e, title: t, description: n, width: r, height: i, className: a, plain: o }) {
|
|
4036
4087
|
s();
|
|
4037
4088
|
let l = c();
|
|
4038
4089
|
return /* @__PURE__ */ m(Q, {
|
|
@@ -4048,7 +4099,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4048
4099
|
className: a,
|
|
4049
4100
|
plain: o,
|
|
4050
4101
|
tooltip: e.length > 0 ? ({ width: t, height: n }) => {
|
|
4051
|
-
if (e.length !== 0) return { points:
|
|
4102
|
+
if (e.length !== 0) return { points: ae(e.map((e) => ({
|
|
4052
4103
|
id: e.id,
|
|
4053
4104
|
value: e.value
|
|
4054
4105
|
})), t, n).map((t) => {
|
|
@@ -4064,7 +4115,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4064
4115
|
} : void 0,
|
|
4065
4116
|
children: ({ width: t, height: n }) => {
|
|
4066
4117
|
if (e.length === 0) return null;
|
|
4067
|
-
let r =
|
|
4118
|
+
let r = ae(e.map((e) => ({
|
|
4068
4119
|
id: e.id,
|
|
4069
4120
|
value: e.value
|
|
4070
4121
|
})), t, n), i = new Map(e.map((e) => [e.id, e.label]));
|
|
@@ -4077,7 +4128,7 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4077
4128
|
height: Math.max(0, e.h - 4)
|
|
4078
4129
|
})
|
|
4079
4130
|
}, e.id)) }), r.map((e, t) => {
|
|
4080
|
-
let n =
|
|
4131
|
+
let n = Un[t % Un.length] ?? "var(--cascivo-chart-1)", r = i.get(e.id) ?? e.id;
|
|
4081
4132
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("rect", {
|
|
4082
4133
|
x: e.x,
|
|
4083
4134
|
y: e.y,
|
|
@@ -4101,18 +4152,18 @@ function Bn({ data: e, title: t, description: n, width: r, height: i, className:
|
|
|
4101
4152
|
}
|
|
4102
4153
|
//#endregion
|
|
4103
4154
|
//#region src/charts/radar/radar.tsx
|
|
4104
|
-
var
|
|
4105
|
-
function
|
|
4155
|
+
var Gn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`), Kn = 4;
|
|
4156
|
+
function qn(e, t, n, r, i) {
|
|
4106
4157
|
let a = e.length;
|
|
4107
4158
|
return e.map((e, o) => {
|
|
4108
4159
|
let s = o / a * 2 * Math.PI - Math.PI / 2, c = e / t * i;
|
|
4109
4160
|
return {
|
|
4110
|
-
x:
|
|
4111
|
-
y:
|
|
4161
|
+
x: D(n + Math.cos(s) * c),
|
|
4162
|
+
y: D(r + Math.sin(s) * c)
|
|
4112
4163
|
};
|
|
4113
4164
|
});
|
|
4114
4165
|
}
|
|
4115
|
-
function
|
|
4166
|
+
function Jn({ axes: e, series: t, max: n, title: r, description: i, width: a, height: o, className: c, plain: l }) {
|
|
4116
4167
|
let u = o ?? (l ? 48 : 320);
|
|
4117
4168
|
s();
|
|
4118
4169
|
let d = n ?? Math.max(1, ...t.flatMap((e) => e.values)), f = e.length;
|
|
@@ -4135,8 +4186,8 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4135
4186
|
let s = r / f * 2 * Math.PI - Math.PI / 2, c = n / d * o;
|
|
4136
4187
|
return {
|
|
4137
4188
|
id: `${t.id}-${r}`,
|
|
4138
|
-
cx:
|
|
4139
|
-
cy:
|
|
4189
|
+
cx: D(i + Math.cos(s) * c),
|
|
4190
|
+
cy: D(a + Math.sin(s) * c),
|
|
4140
4191
|
label: e[r] ?? String(r),
|
|
4141
4192
|
value: n,
|
|
4142
4193
|
seriesId: t.id
|
|
@@ -4144,15 +4195,15 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4144
4195
|
})) };
|
|
4145
4196
|
} : void 0,
|
|
4146
4197
|
children: ({ width: n, height: r }) => {
|
|
4147
|
-
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length:
|
|
4198
|
+
let i = n / 2, a = r / 2, o = Math.min(i, a) * .72, s = Array.from({ length: Kn }, (e, t) => (t + 1) / Kn * o), c = Array.from({ length: f }, (e, t) => {
|
|
4148
4199
|
let n = t / f * 2 * Math.PI - Math.PI / 2;
|
|
4149
4200
|
return {
|
|
4150
|
-
x:
|
|
4151
|
-
y:
|
|
4201
|
+
x: D(i + Math.cos(n) * o),
|
|
4202
|
+
y: D(a + Math.sin(n) * o)
|
|
4152
4203
|
};
|
|
4153
4204
|
}), u = s.map((e) => Array.from({ length: f }, (t, n) => {
|
|
4154
4205
|
let r = n / f * 2 * Math.PI - Math.PI / 2;
|
|
4155
|
-
return `${
|
|
4206
|
+
return `${D(i + Math.cos(r) * e)},${D(a + Math.sin(r) * e)}`;
|
|
4156
4207
|
}).join(" "));
|
|
4157
4208
|
return /* @__PURE__ */ h(p, { children: [
|
|
4158
4209
|
!l && u.map((e, t) => /* @__PURE__ */ m("polygon", {
|
|
@@ -4172,8 +4223,8 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4172
4223
|
!l && c.map((t, n) => {
|
|
4173
4224
|
let r = n / f * 2 * Math.PI - Math.PI / 2;
|
|
4174
4225
|
return /* @__PURE__ */ m("text", {
|
|
4175
|
-
x:
|
|
4176
|
-
y:
|
|
4226
|
+
x: D(i + Math.cos(r) * (o + 18)),
|
|
4227
|
+
y: D(a + Math.sin(r) * (o + 18)),
|
|
4177
4228
|
fontSize: 11,
|
|
4178
4229
|
textAnchor: "middle",
|
|
4179
4230
|
dominantBaseline: "middle",
|
|
@@ -4182,7 +4233,7 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4182
4233
|
}, n);
|
|
4183
4234
|
}),
|
|
4184
4235
|
t.map((e, t) => {
|
|
4185
|
-
let n =
|
|
4236
|
+
let n = qn(e.values, d, i, a, o).map((e) => `${e.x},${e.y}`).join(" "), r = Gn[t % Gn.length] ?? "var(--cascivo-chart-1)";
|
|
4186
4237
|
return /* @__PURE__ */ m("polygon", {
|
|
4187
4238
|
points: n,
|
|
4188
4239
|
fill: r,
|
|
@@ -4197,12 +4248,12 @@ function Wn({ axes: e, series: t, max: n, title: r, description: i, width: a, he
|
|
|
4197
4248
|
}
|
|
4198
4249
|
//#endregion
|
|
4199
4250
|
//#region src/charts/bullet/bullet.tsx
|
|
4200
|
-
var
|
|
4251
|
+
var Yn = [
|
|
4201
4252
|
"var(--cascivo-gray-200)",
|
|
4202
4253
|
"var(--cascivo-gray-300)",
|
|
4203
4254
|
"var(--cascivo-gray-400)"
|
|
4204
4255
|
];
|
|
4205
|
-
function
|
|
4256
|
+
function Xn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, width: o = 300, height: c = 40, className: l }) {
|
|
4206
4257
|
s();
|
|
4207
4258
|
let u = [...n].sort((e, t) => e - t), d = g([i, a ?? u[u.length - 1] ?? (Math.max(e, t) * 1.2 || 1)], [0, o]), f = c * .35, _ = (c - f) / 2, v = c * .7, y = (c - v) / 2;
|
|
4208
4259
|
return /* @__PURE__ */ h("figure", {
|
|
@@ -4229,7 +4280,7 @@ function Kn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4229
4280
|
y: 0,
|
|
4230
4281
|
width: Math.max(0, r),
|
|
4231
4282
|
height: c,
|
|
4232
|
-
fill:
|
|
4283
|
+
fill: Yn[t % Yn.length] ?? "var(--cascivo-gray-200)"
|
|
4233
4284
|
}, t);
|
|
4234
4285
|
}),
|
|
4235
4286
|
/* @__PURE__ */ m("rect", {
|
|
@@ -4256,10 +4307,10 @@ function Kn({ value: e, target: t, ranges: n, label: r, min: i = 0, max: a, widt
|
|
|
4256
4307
|
}
|
|
4257
4308
|
//#endregion
|
|
4258
4309
|
//#region src/charts/radial-bar/radial-bar.tsx
|
|
4259
|
-
var
|
|
4260
|
-
function
|
|
4310
|
+
var Zn = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4311
|
+
function Qn({ data: e, title: t, description: n, size: r, width: i, height: o, max: c, sweep: l = 270, centerValue: u, centerLabel: d, centerSlot: f, tooltip: p, legend: g, className: _, plain: v }) {
|
|
4261
4312
|
s();
|
|
4262
|
-
let y = a(/* @__PURE__ */ new Set()), b = i ?? r, x = o ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, w = c ?? Math.max(1, ...e.map((e) => e.value)),
|
|
4313
|
+
let y = a(/* @__PURE__ */ new Set()), b = i ?? r, x = o ?? r ?? (v ? 48 : 300), S = v ? !1 : g ?? e.length > 1, C = e.length > 0, w = c ?? Math.max(1, ...e.map((e) => e.value)), T = Math.min(360, Math.max(0, l)) * Math.PI / 180, E = -T / 2, O = (t, n) => {
|
|
4263
4314
|
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));
|
|
4264
4315
|
return {
|
|
4265
4316
|
cx: r,
|
|
@@ -4269,27 +4320,27 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4269
4320
|
span: s.length > 0 ? (a - o) / s.length : 0,
|
|
4270
4321
|
visible: s
|
|
4271
4322
|
};
|
|
4272
|
-
},
|
|
4323
|
+
}, k = ({ width: e, height: t }) => {
|
|
4273
4324
|
if (p === !1 || !C) return;
|
|
4274
4325
|
let { cx: n, cy: r, maxR: i, span: a, visible: o } = O(e, t);
|
|
4275
4326
|
return { points: o.map((e, t) => {
|
|
4276
|
-
let o = i - t * a, s = (o + (o - a * .7)) / 2, c =
|
|
4327
|
+
let o = i - t * a, s = (o + (o - a * .7)) / 2, c = E + T * Math.min(1, e.value / w);
|
|
4277
4328
|
return {
|
|
4278
4329
|
id: e.id,
|
|
4279
|
-
cx:
|
|
4280
|
-
cy:
|
|
4330
|
+
cx: D(n + Math.sin(c) * s),
|
|
4331
|
+
cy: D(r - Math.cos(c) * s),
|
|
4281
4332
|
label: e.label,
|
|
4282
4333
|
value: e.value,
|
|
4283
4334
|
seriesId: e.id,
|
|
4284
4335
|
percent: w > 0 ? e.value / w * 100 : 0,
|
|
4285
|
-
color: e.color ??
|
|
4336
|
+
color: e.color ?? Zn[t % Zn.length]
|
|
4286
4337
|
};
|
|
4287
4338
|
}) };
|
|
4288
|
-
},
|
|
4339
|
+
}, A = /* @__PURE__ */ h("table", { children: [
|
|
4289
4340
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4290
4341
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Label" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
|
|
4291
4342
|
/* @__PURE__ */ m("tbody", { children: e.map((e) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: e.label }), /* @__PURE__ */ m("td", { children: e.value })] }, e.id)) })
|
|
4292
|
-
] }),
|
|
4343
|
+
] }), j = u != null || d != null || f != null;
|
|
4293
4344
|
return /* @__PURE__ */ h("div", {
|
|
4294
4345
|
style: {
|
|
4295
4346
|
display: "flex",
|
|
@@ -4301,27 +4352,27 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4301
4352
|
description: n,
|
|
4302
4353
|
width: b,
|
|
4303
4354
|
height: x,
|
|
4304
|
-
fallback:
|
|
4355
|
+
fallback: A,
|
|
4305
4356
|
className: _,
|
|
4306
4357
|
"data-state": C ? void 0 : "empty",
|
|
4307
4358
|
plain: v,
|
|
4308
|
-
tooltip: p !== !1 && C ?
|
|
4359
|
+
tooltip: p !== !1 && C ? k : void 0,
|
|
4309
4360
|
children: ({ width: e, height: t }) => {
|
|
4310
4361
|
let { cx: n, cy: r, maxR: i, holeR: a, span: o, visible: s } = O(e, t);
|
|
4311
4362
|
return /* @__PURE__ */ h("g", { children: [s.map((e, t) => {
|
|
4312
|
-
let a = i - t * o, s = a - o * .7, c = e.color ??
|
|
4363
|
+
let a = i - t * o, s = a - o * .7, c = e.color ?? Zn[t % Zn.length], l = Math.max(0, Math.min(1, e.value / w)), u = E + T * l;
|
|
4313
4364
|
return /* @__PURE__ */ h("g", {
|
|
4314
4365
|
"data-series": e.id,
|
|
4315
4366
|
children: [/* @__PURE__ */ m("path", {
|
|
4316
|
-
d:
|
|
4367
|
+
d: I(n, r, a, s, E, E + T),
|
|
4317
4368
|
fill: "var(--cascivo-chart-grid)",
|
|
4318
4369
|
fillOpacity: .35
|
|
4319
4370
|
}), l > 0 && /* @__PURE__ */ m("path", {
|
|
4320
|
-
d:
|
|
4371
|
+
d: I(n, r, a, s, E, u),
|
|
4321
4372
|
fill: c
|
|
4322
4373
|
})]
|
|
4323
4374
|
}, e.id);
|
|
4324
|
-
}), !v &&
|
|
4375
|
+
}), !v && j && (f == null ? /* @__PURE__ */ h("g", {
|
|
4325
4376
|
"data-center": "",
|
|
4326
4377
|
children: [u != null && /* @__PURE__ */ m("text", {
|
|
4327
4378
|
x: n,
|
|
@@ -4361,11 +4412,11 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4361
4412
|
})
|
|
4362
4413
|
}))] });
|
|
4363
4414
|
}
|
|
4364
|
-
}), S && /* @__PURE__ */ m(
|
|
4415
|
+
}), S && /* @__PURE__ */ m(nn, {
|
|
4365
4416
|
series: e.map((e, t) => ({
|
|
4366
4417
|
id: e.id,
|
|
4367
4418
|
label: e.label,
|
|
4368
|
-
color: e.color ??
|
|
4419
|
+
color: e.color ?? Zn[t % Zn.length]
|
|
4369
4420
|
})),
|
|
4370
4421
|
hidden: y
|
|
4371
4422
|
})]
|
|
@@ -4373,10 +4424,10 @@ function Jn({ data: e, title: t, description: n, size: r, width: i, height: o, m
|
|
|
4373
4424
|
}
|
|
4374
4425
|
//#endregion
|
|
4375
4426
|
//#region src/charts/funnel/funnel.tsx
|
|
4376
|
-
var
|
|
4377
|
-
function
|
|
4427
|
+
var $n = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4428
|
+
function er({ data: e, title: t, description: n, width: r, height: i, showConversion: a = !1, tooltip: o, className: c, plain: l }) {
|
|
4378
4429
|
s();
|
|
4379
|
-
let u = l ?
|
|
4430
|
+
let u = l ? Ke : Ge, d = i ?? (l ? 48 : 320), f = e.length > 0, p = e[0]?.value ?? 0, _ = Math.max(1, ...e.map((e) => e.value));
|
|
4380
4431
|
return /* @__PURE__ */ m(Q, {
|
|
4381
4432
|
title: t,
|
|
4382
4433
|
description: n,
|
|
@@ -4410,7 +4461,7 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4410
4461
|
value: e.value,
|
|
4411
4462
|
seriesId: e.id,
|
|
4412
4463
|
percent: p > 0 ? e.value / p * 100 : 0,
|
|
4413
|
-
color: e.color ??
|
|
4464
|
+
color: e.color ?? $n[t % $n.length]
|
|
4414
4465
|
})),
|
|
4415
4466
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
4416
4467
|
};
|
|
@@ -4420,7 +4471,7 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4420
4471
|
if (r <= 0 || e.length === 0) return null;
|
|
4421
4472
|
let o = i / e.length, s = g([0, _], [0, r]), c = (e) => s.map(e) / 2, d = u.left + r / 2;
|
|
4422
4473
|
return /* @__PURE__ */ m("g", { children: e.map((t, n) => {
|
|
4423
|
-
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ??
|
|
4474
|
+
let r = e[n + 1], i = c(t.value), s = c(r ? r.value : t.value), f = u.top + n * o, g = f + o * (r ? 1 : .9), _ = t.color ?? $n[n % $n.length], v = [
|
|
4424
4475
|
[d - i, f],
|
|
4425
4476
|
[d + i, f],
|
|
4426
4477
|
[d + s, g],
|
|
@@ -4432,7 +4483,7 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4432
4483
|
points: v,
|
|
4433
4484
|
fill: _,
|
|
4434
4485
|
fillOpacity: .85
|
|
4435
|
-
}), !l && /* @__PURE__ */ m(
|
|
4486
|
+
}), !l && /* @__PURE__ */ m(Mt, {
|
|
4436
4487
|
x: d,
|
|
4437
4488
|
y: f + o / 2,
|
|
4438
4489
|
text: a ? `${t.label} · ${t.value} (${y}%)` : `${t.label} · ${t.value}`,
|
|
@@ -4445,10 +4496,10 @@ function Xn({ data: e, title: t, description: n, width: r, height: i, showConver
|
|
|
4445
4496
|
}
|
|
4446
4497
|
//#endregion
|
|
4447
4498
|
//#region src/charts/stream/stream.tsx
|
|
4448
|
-
var
|
|
4449
|
-
function
|
|
4499
|
+
var tr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4500
|
+
function nr({ series: e, categories: t, title: n, description: r, offset: i = "silhouette", curve: o = "basis", width: c, height: l, legend: u, tooltip: d, className: f, plain: p, format: _ }) {
|
|
4450
4501
|
s();
|
|
4451
|
-
let y = a(/* @__PURE__ */ new Set()), b = p ?
|
|
4502
|
+
let y = a(/* @__PURE__ */ new Set()), b = p ? Ke : Ge, x = l ?? (p ? 48 : 300), S = p ? !1 : u ?? e.length > 1, C = t.length > 0 && e.length > 0, w = J(e.map((e) => e.values), i), [T, E] = Y(w);
|
|
4452
4503
|
return /* @__PURE__ */ h("div", {
|
|
4453
4504
|
style: {
|
|
4454
4505
|
display: "flex",
|
|
@@ -4483,7 +4534,7 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4483
4534
|
label: `${e.label} · ${String(t)}`,
|
|
4484
4535
|
value: e.values[i] ?? 0,
|
|
4485
4536
|
seriesId: e.id,
|
|
4486
|
-
color: e.color ??
|
|
4537
|
+
color: e.color ?? tr[n % tr.length]
|
|
4487
4538
|
};
|
|
4488
4539
|
});
|
|
4489
4540
|
}) };
|
|
@@ -4496,9 +4547,9 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4496
4547
|
transform: `translate(${b.left},${b.top})`,
|
|
4497
4548
|
children: [e.map((e, n) => {
|
|
4498
4549
|
if (y.value.has(e.id)) return null;
|
|
4499
|
-
let r = w[n], i = e.color ??
|
|
4550
|
+
let r = w[n], i = e.color ?? tr[n % tr.length], a = t.map((e, t) => [l(t), c.map(r[t][1])]), s = t.map((e, t) => [l(t), c.map(r[t][0])]);
|
|
4500
4551
|
return /* @__PURE__ */ m("path", {
|
|
4501
|
-
d: `${
|
|
4552
|
+
d: `${k(a, o)}${k([...s].reverse(), o).replace(/^M/, "L")}Z`,
|
|
4502
4553
|
fill: i,
|
|
4503
4554
|
fillOpacity: .85,
|
|
4504
4555
|
"data-series": e.id
|
|
@@ -4512,11 +4563,11 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4512
4563
|
})]
|
|
4513
4564
|
});
|
|
4514
4565
|
}
|
|
4515
|
-
}), S && /* @__PURE__ */ m(
|
|
4566
|
+
}), S && /* @__PURE__ */ m(nn, {
|
|
4516
4567
|
series: e.map((e, t) => ({
|
|
4517
4568
|
id: e.id,
|
|
4518
4569
|
label: e.label,
|
|
4519
|
-
color: e.color ??
|
|
4570
|
+
color: e.color ?? tr[t % tr.length]
|
|
4520
4571
|
})),
|
|
4521
4572
|
hidden: y
|
|
4522
4573
|
})]
|
|
@@ -4524,10 +4575,10 @@ function Qn({ series: e, categories: t, title: n, description: r, offset: i = "s
|
|
|
4524
4575
|
}
|
|
4525
4576
|
//#endregion
|
|
4526
4577
|
//#region src/charts/sunburst/sunburst.tsx
|
|
4527
|
-
var
|
|
4528
|
-
function
|
|
4578
|
+
var rr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4579
|
+
function ir({ data: e, title: t, description: n, size: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
|
|
4529
4580
|
s();
|
|
4530
|
-
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f =
|
|
4581
|
+
let u = i ?? r, d = a ?? r ?? (l ? 48 : 300), f = oe(e), p = f > 0, g = X(e), _ = Math.max(1, se(g));
|
|
4531
4582
|
return /* @__PURE__ */ m(Q, {
|
|
4532
4583
|
title: t,
|
|
4533
4584
|
description: n,
|
|
@@ -4549,12 +4600,12 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4549
4600
|
let a = (e.a0 + e.a1) / 2, o = (e.depth - .5) * i;
|
|
4550
4601
|
return {
|
|
4551
4602
|
id: `${e.node.label}-${t}`,
|
|
4552
|
-
cx:
|
|
4553
|
-
cy:
|
|
4603
|
+
cx: D(n + Math.sin(a) * o),
|
|
4604
|
+
cy: D(r - Math.cos(a) * o),
|
|
4554
4605
|
label: e.node.label,
|
|
4555
4606
|
value: e.value,
|
|
4556
4607
|
percent: f > 0 ? e.value / f * 100 : 0,
|
|
4557
|
-
color: e.node.color ??
|
|
4608
|
+
color: e.node.color ?? rr[t % rr.length]
|
|
4558
4609
|
};
|
|
4559
4610
|
}),
|
|
4560
4611
|
format: (e) => `${e.label}: ${e.value} (${Math.round(e.percent ?? 0)}%)`
|
|
@@ -4563,9 +4614,9 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4563
4614
|
children: ({ width: e, height: t }) => {
|
|
4564
4615
|
let n = e / 2, r = t / 2, i = (Math.min(n, r) - 8) / _;
|
|
4565
4616
|
return /* @__PURE__ */ m("g", { children: g.filter((e) => e.depth > 0).map((e, t) => {
|
|
4566
|
-
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ??
|
|
4617
|
+
let a = (e.depth - 1) * i, o = e.depth * i, s = e.node.color ?? rr[t % rr.length];
|
|
4567
4618
|
return /* @__PURE__ */ m("path", {
|
|
4568
|
-
d:
|
|
4619
|
+
d: I(n, r, o, a, e.a0, e.a1),
|
|
4569
4620
|
fill: s,
|
|
4570
4621
|
fillOpacity: 1 - (e.depth - 1) * .18,
|
|
4571
4622
|
stroke: "var(--cascivo-color-surface)",
|
|
@@ -4578,10 +4629,10 @@ function er({ data: e, title: t, description: n, size: r, width: i, height: a, t
|
|
|
4578
4629
|
}
|
|
4579
4630
|
//#endregion
|
|
4580
4631
|
//#region src/charts/sankey/sankey.tsx
|
|
4581
|
-
var
|
|
4582
|
-
function
|
|
4632
|
+
var ar = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4633
|
+
function or({ nodes: e, links: t, title: n, description: r, width: i, height: a, tooltip: o, className: c, plain: l }) {
|
|
4583
4634
|
s();
|
|
4584
|
-
let u = l ?
|
|
4635
|
+
let u = l ? Ke : Ge, d = a ?? (l ? 48 : 320), f = e.length > 0 && t.length > 0, p = (t, n) => e.find((e) => e.id === t)?.color ?? ar[n % ar.length];
|
|
4585
4636
|
return /* @__PURE__ */ m(Q, {
|
|
4586
4637
|
title: n,
|
|
4587
4638
|
description: r,
|
|
@@ -4605,7 +4656,7 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4605
4656
|
plain: l,
|
|
4606
4657
|
tooltip: o && f ? ({ width: n, height: r }) => {
|
|
4607
4658
|
if (!o || !f) return;
|
|
4608
|
-
let { nodes: i } =
|
|
4659
|
+
let { nodes: i } = ce(e, t, {
|
|
4609
4660
|
width: n - u.left - u.right,
|
|
4610
4661
|
height: r - u.top - u.bottom
|
|
4611
4662
|
});
|
|
@@ -4621,14 +4672,14 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4621
4672
|
children: ({ width: n, height: r }) => {
|
|
4622
4673
|
let i = n - u.left - u.right, a = r - u.top - u.bottom;
|
|
4623
4674
|
if (i <= 0 || !f) return null;
|
|
4624
|
-
let { nodes: o, links: s } =
|
|
4675
|
+
let { nodes: o, links: s } = ce(e, t, {
|
|
4625
4676
|
width: i,
|
|
4626
4677
|
height: a
|
|
4627
4678
|
});
|
|
4628
4679
|
return /* @__PURE__ */ h("g", {
|
|
4629
4680
|
transform: `translate(${u.left},${u.top})`,
|
|
4630
4681
|
children: [s.map((e, t) => /* @__PURE__ */ m("path", {
|
|
4631
|
-
d:
|
|
4682
|
+
d: le(e),
|
|
4632
4683
|
fill: p(e.source.id, o.indexOf(e.source)),
|
|
4633
4684
|
fillOpacity: .32,
|
|
4634
4685
|
"data-link": ""
|
|
@@ -4657,23 +4708,23 @@ function nr({ nodes: e, links: t, title: n, description: r, width: i, height: a,
|
|
|
4657
4708
|
}
|
|
4658
4709
|
//#endregion
|
|
4659
4710
|
//#region src/charts/calendar/calendar.tsx
|
|
4660
|
-
var
|
|
4661
|
-
function
|
|
4711
|
+
var sr = 864e5, cr = (e) => e instanceof Date ? e : new Date(e), lr = (e) => e.toISOString().slice(0, 10);
|
|
4712
|
+
function ur(e) {
|
|
4662
4713
|
let t = new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()));
|
|
4663
4714
|
return t.setUTCDate(t.getUTCDate() - t.getUTCDay()), t;
|
|
4664
4715
|
}
|
|
4665
|
-
function
|
|
4716
|
+
function dr({ data: e, title: t, description: n, from: r, to: i, width: o, height: c, tooltip: l, className: u, plain: d, visualMap: f }) {
|
|
4666
4717
|
s();
|
|
4667
4718
|
let p = e.length > 0, g = a([f?.min ?? 0, f?.max ?? 1]), _ = a(/* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Map();
|
|
4668
|
-
for (let t of e) v.set(
|
|
4669
|
-
let y = e.map((e) =>
|
|
4719
|
+
for (let t of e) v.set(lr(cr(t.day)), t.value);
|
|
4720
|
+
let y = e.map((e) => cr(e.day)), b = ur(r ? cr(r) : y.reduce((e, t) => t < e ? t : e, y[0] ?? /* @__PURE__ */ new Date())), x = i ? cr(i) : y.reduce((e, t) => t > e ? t : e, y[0] ?? /* @__PURE__ */ new Date()), S = p ? Math.max(1, Math.ceil((x.getTime() - b.getTime()) / sr / 7)) : 1, C = Math.max(1, ...e.map((e) => e.value)), w = c ?? (d ? 48 : 160), T = [];
|
|
4670
4721
|
for (let e = 0; e < S; e++) for (let t = 0; t < 7; t++) {
|
|
4671
|
-
let n = new Date(b.getTime() + (e * 7 + t) *
|
|
4722
|
+
let n = new Date(b.getTime() + (e * 7 + t) * sr);
|
|
4672
4723
|
n > x || T.push({
|
|
4673
4724
|
col: e,
|
|
4674
4725
|
row: t,
|
|
4675
4726
|
date: n,
|
|
4676
|
-
value: v.get(
|
|
4727
|
+
value: v.get(lr(n)) ?? 0
|
|
4677
4728
|
});
|
|
4678
4729
|
}
|
|
4679
4730
|
let E = /* @__PURE__ */ m(Q, {
|
|
@@ -4684,7 +4735,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4684
4735
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
4685
4736
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4686
4737
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Day" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
|
|
4687
|
-
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children:
|
|
4738
|
+
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: lr(cr(e.day)) }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
|
|
4688
4739
|
] }),
|
|
4689
4740
|
className: u,
|
|
4690
4741
|
"data-state": p ? void 0 : "empty",
|
|
@@ -4694,10 +4745,10 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4694
4745
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4695
4746
|
return {
|
|
4696
4747
|
points: T.map((e, n) => ({
|
|
4697
|
-
id: `${
|
|
4748
|
+
id: `${lr(e.date)}-${n}`,
|
|
4698
4749
|
cx: e.col * (t + 2) + t / 2,
|
|
4699
4750
|
cy: e.row * (t + 2) + t / 2,
|
|
4700
|
-
label:
|
|
4751
|
+
label: lr(e.date),
|
|
4701
4752
|
value: e.value
|
|
4702
4753
|
})),
|
|
4703
4754
|
format: (e) => `${e.label}: ${e.value}`
|
|
@@ -4706,7 +4757,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4706
4757
|
children: ({ width: e }) => {
|
|
4707
4758
|
let t = Math.max(2, (e - (S - 1) * 2) / S);
|
|
4708
4759
|
return /* @__PURE__ */ m("g", { children: T.map((e, n) => {
|
|
4709
|
-
let r = f ?
|
|
4760
|
+
let r = f ? Qt(e.value, f).color : void 0, i = f ? $t(e.value, f, g.value, _.value) : !0;
|
|
4710
4761
|
return /* @__PURE__ */ m("rect", {
|
|
4711
4762
|
x: e.col * (t + 2),
|
|
4712
4763
|
y: e.row * (t + 2),
|
|
@@ -4715,7 +4766,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4715
4766
|
rx: 1.5,
|
|
4716
4767
|
fill: r ?? "var(--cascivo-chart-2)",
|
|
4717
4768
|
fillOpacity: f ? e.value > 0 && i ? 1 : .08 : e.value > 0 ? .15 + .85 * (e.value / C) : .06,
|
|
4718
|
-
"data-day":
|
|
4769
|
+
"data-day": lr(e.date)
|
|
4719
4770
|
}, n);
|
|
4720
4771
|
}) });
|
|
4721
4772
|
}
|
|
@@ -4726,7 +4777,7 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4726
4777
|
flexDirection: "column",
|
|
4727
4778
|
gap: "0.5rem"
|
|
4728
4779
|
},
|
|
4729
|
-
children: [E, /* @__PURE__ */ m(
|
|
4780
|
+
children: [E, /* @__PURE__ */ m(en, {
|
|
4730
4781
|
options: f,
|
|
4731
4782
|
range: g,
|
|
4732
4783
|
hidden: _,
|
|
@@ -4736,23 +4787,23 @@ function sr({ data: e, title: t, description: n, from: r, to: i, width: o, heigh
|
|
|
4736
4787
|
}
|
|
4737
4788
|
//#endregion
|
|
4738
4789
|
//#region src/charts/candlestick/candlestick.tsx
|
|
4739
|
-
function
|
|
4790
|
+
function fr({ data: e, title: t, description: n, width: r, height: i, yTicks: c = 5, upColor: u = "var(--cascivo-chart-2)", downColor: d = "var(--cascivo-chart-4)", volume: f, tooltip: _, className: y, plain: b, annotations: x, brush: S, dataZoom: C, zoom: w, syncId: T, tooltipMode: E, format: D }) {
|
|
4740
4791
|
s();
|
|
4741
|
-
let O = b ?
|
|
4742
|
-
T && !
|
|
4743
|
-
T &&
|
|
4792
|
+
let O = b ? Ke : Ge, k = i ?? (b ? 64 : 320), A = e.length, j = (S || C || w || T !== void 0) && A > 0, M = a([0, Math.max(0, A - 1)]), ee = l(null);
|
|
4793
|
+
T && !ee.current && (ee.current = gt(T)), o(() => () => {
|
|
4794
|
+
T && _t(T);
|
|
4744
4795
|
}), o(() => {
|
|
4745
|
-
let e =
|
|
4796
|
+
let e = ee.current;
|
|
4746
4797
|
if (!e) return;
|
|
4747
|
-
let t = e.window.value, n =
|
|
4748
|
-
t && (t[0] !== n[0] || t[1] !== n[1]) && (
|
|
4798
|
+
let t = e.window.value, n = M.peek();
|
|
4799
|
+
t && (t[0] !== n[0] || t[1] !== n[1]) && (M.value = t);
|
|
4749
4800
|
}), o(() => {
|
|
4750
|
-
let e =
|
|
4801
|
+
let e = ee.current;
|
|
4751
4802
|
if (!e) return;
|
|
4752
|
-
let t =
|
|
4803
|
+
let t = M.value, n = e.window.peek();
|
|
4753
4804
|
(!n || n[0] !== t[0] || n[1] !== t[1]) && (e.window.value = t);
|
|
4754
4805
|
});
|
|
4755
|
-
let
|
|
4806
|
+
let N = j ? e.slice(M.value[0], M.value[1] + 1) : e, te = N.length > 0, P = te ? Math.min(...N.map((e) => e.low)) : 0, F = te ? Math.max(...N.map((e) => e.high)) : 1, I = te ? Math.max(1, ...N.map((e) => e.volume ?? 0)) : 1, ne = N.map((e) => e.t);
|
|
4756
4807
|
return /* @__PURE__ */ h("div", {
|
|
4757
4808
|
style: {
|
|
4758
4809
|
display: "flex",
|
|
@@ -4764,7 +4815,7 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4764
4815
|
title: t,
|
|
4765
4816
|
description: n,
|
|
4766
4817
|
width: r,
|
|
4767
|
-
height:
|
|
4818
|
+
height: k,
|
|
4768
4819
|
fallback: /* @__PURE__ */ h("table", { children: [
|
|
4769
4820
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4770
4821
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
@@ -4774,7 +4825,7 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4774
4825
|
/* @__PURE__ */ m("th", { children: "Low" }),
|
|
4775
4826
|
/* @__PURE__ */ m("th", { children: "Close" })
|
|
4776
4827
|
] }) }),
|
|
4777
|
-
/* @__PURE__ */ m("tbody", { children:
|
|
4828
|
+
/* @__PURE__ */ m("tbody", { children: N.map((e, t) => /* @__PURE__ */ h("tr", { children: [
|
|
4778
4829
|
/* @__PURE__ */ m("td", { children: e.t }),
|
|
4779
4830
|
/* @__PURE__ */ m("td", { children: e.open }),
|
|
4780
4831
|
/* @__PURE__ */ m("td", { children: e.high }),
|
|
@@ -4783,15 +4834,15 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4783
4834
|
] }, t)) })
|
|
4784
4835
|
] }),
|
|
4785
4836
|
className: y,
|
|
4786
|
-
"data-state":
|
|
4837
|
+
"data-state": te ? void 0 : "empty",
|
|
4787
4838
|
plain: b,
|
|
4788
|
-
tooltip: _ !== !1 &&
|
|
4789
|
-
if (_ === !1 || !
|
|
4839
|
+
tooltip: _ !== !1 && te ? ({ width: e, height: t }) => {
|
|
4840
|
+
if (_ === !1 || !te) return;
|
|
4790
4841
|
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4791
4842
|
if (n <= 0) return;
|
|
4792
4843
|
let i = v(ne, [0, n], .3), a = r - (f ? Math.min(r * .2, 60) : 0), o = g([P, F], [a, 0]);
|
|
4793
4844
|
if (E === "axis") return {
|
|
4794
|
-
points:
|
|
4845
|
+
points: N.map((e, t) => ({
|
|
4795
4846
|
id: `c-${t}`,
|
|
4796
4847
|
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4797
4848
|
cy: O.top + o.map(e.high),
|
|
@@ -4818,13 +4869,13 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4818
4869
|
})),
|
|
4819
4870
|
mode: "axis",
|
|
4820
4871
|
format: (e) => {
|
|
4821
|
-
let t =
|
|
4872
|
+
let t = N[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4822
4873
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4823
4874
|
}
|
|
4824
4875
|
};
|
|
4825
4876
|
let s = g([P, F], [r, 0]);
|
|
4826
4877
|
return {
|
|
4827
|
-
points:
|
|
4878
|
+
points: N.map((e, t) => ({
|
|
4828
4879
|
id: `c-${t}`,
|
|
4829
4880
|
cx: O.left + (i.map(e.t) ?? 0) + i.bandwidth / 2,
|
|
4830
4881
|
cy: O.top + s.map(e.high),
|
|
@@ -4832,32 +4883,32 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4832
4883
|
value: e.close
|
|
4833
4884
|
})),
|
|
4834
4885
|
format: (e) => {
|
|
4835
|
-
let t =
|
|
4886
|
+
let t = N[parseInt(e.id.split("-")[1] ?? "0", 10)];
|
|
4836
4887
|
return t ? `${t.t} — O ${t.open} H ${t.high} L ${t.low} C ${t.close}` : `${e.label}: ${e.value}`;
|
|
4837
4888
|
}
|
|
4838
4889
|
};
|
|
4839
4890
|
} : void 0,
|
|
4840
|
-
zoom: w &&
|
|
4841
|
-
window:
|
|
4842
|
-
count:
|
|
4891
|
+
zoom: w && A > 1 ? {
|
|
4892
|
+
window: M,
|
|
4893
|
+
count: A
|
|
4843
4894
|
} : void 0,
|
|
4844
|
-
onRestore:
|
|
4845
|
-
|
|
4895
|
+
onRestore: j ? () => {
|
|
4896
|
+
M.value = [0, Math.max(0, A - 1)];
|
|
4846
4897
|
} : void 0,
|
|
4847
4898
|
children: ({ width: e, height: t }) => {
|
|
4848
4899
|
let n = e - O.left - O.right, r = t - O.top - O.bottom;
|
|
4849
|
-
if (n <= 0 || !
|
|
4900
|
+
if (n <= 0 || !te) return null;
|
|
4850
4901
|
let i = v(ne, [0, n], .3), a = g([P, F], [r, 0]), o = f ? Math.min(r * .2, 60) : 0, s = r - o, l = g([P, F], [s, 0]), _ = i.bandwidth;
|
|
4851
4902
|
return /* @__PURE__ */ h("g", {
|
|
4852
4903
|
transform: `translate(${O.left},${O.top})`,
|
|
4853
4904
|
children: [
|
|
4854
|
-
!b && /* @__PURE__ */ m(
|
|
4905
|
+
!b && /* @__PURE__ */ m(Ct, {
|
|
4855
4906
|
scale: a,
|
|
4856
4907
|
orientation: "y",
|
|
4857
4908
|
length: n,
|
|
4858
4909
|
tickCount: c
|
|
4859
4910
|
}),
|
|
4860
|
-
|
|
4911
|
+
N.map((e, t) => {
|
|
4861
4912
|
let n = (i.map(e.t) ?? 0) + _ / 2, r = e.close >= e.open, a = r ? u : d, c = l.map(e.open), p = l.map(e.close), g = Math.min(c, p), v = Math.max(1, Math.abs(p - c));
|
|
4862
4913
|
return /* @__PURE__ */ h("g", {
|
|
4863
4914
|
"data-candle": r ? "up" : "down",
|
|
@@ -4891,7 +4942,7 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4891
4942
|
]
|
|
4892
4943
|
}, t);
|
|
4893
4944
|
}),
|
|
4894
|
-
!b &&
|
|
4945
|
+
!b && Ot(x, {
|
|
4895
4946
|
xScale: i,
|
|
4896
4947
|
yScale: l,
|
|
4897
4948
|
innerW: n,
|
|
@@ -4913,14 +4964,14 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4913
4964
|
});
|
|
4914
4965
|
}
|
|
4915
4966
|
}),
|
|
4916
|
-
S && !C &&
|
|
4917
|
-
count:
|
|
4918
|
-
window:
|
|
4967
|
+
S && !C && A > 1 && /* @__PURE__ */ m(Wt, {
|
|
4968
|
+
count: A,
|
|
4969
|
+
window: M,
|
|
4919
4970
|
label: "Time range"
|
|
4920
4971
|
}),
|
|
4921
|
-
C &&
|
|
4922
|
-
count:
|
|
4923
|
-
window:
|
|
4972
|
+
C && A > 1 && /* @__PURE__ */ m(Gt, {
|
|
4973
|
+
count: A,
|
|
4974
|
+
window: M,
|
|
4924
4975
|
label: "Time range"
|
|
4925
4976
|
})
|
|
4926
4977
|
]
|
|
@@ -4928,10 +4979,10 @@ function cr({ data: e, title: t, description: n, width: r, height: i, yTicks: c
|
|
|
4928
4979
|
}
|
|
4929
4980
|
//#endregion
|
|
4930
4981
|
//#region src/charts/polar/polar.tsx
|
|
4931
|
-
var
|
|
4932
|
-
function
|
|
4982
|
+
var pr = Array.from({ length: 8 }, (e, t) => `var(--cascivo-chart-${t + 1})`);
|
|
4983
|
+
function mr({ data: e, title: t, description: n, mode: r = "bar", width: i, height: a, rings: o = 4, max: c, tooltip: l, className: u, plain: d }) {
|
|
4933
4984
|
s();
|
|
4934
|
-
let f = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y =
|
|
4985
|
+
let f = a ?? 320, g = e.length > 0, _ = e.map((e) => e.label), v = c ?? (g ? Math.max(1, ...e.map((e) => e.value)) : 1), y = we(_), b = /* @__PURE__ */ h("table", { children: [
|
|
4935
4986
|
/* @__PURE__ */ m("caption", { children: t }),
|
|
4936
4987
|
/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("th", { children: "Category" }), /* @__PURE__ */ m("th", { children: "Value" })] }) }),
|
|
4937
4988
|
/* @__PURE__ */ m("tbody", { children: e.map((e, t) => /* @__PURE__ */ h("tr", { children: [/* @__PURE__ */ m("td", { children: e.label }), /* @__PURE__ */ m("td", { children: e.value })] }, t)) })
|
|
@@ -4941,7 +4992,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4941
4992
|
cx: n,
|
|
4942
4993
|
cy: r,
|
|
4943
4994
|
outerR: i,
|
|
4944
|
-
rScale:
|
|
4995
|
+
rScale: Te([0, v], [0, i])
|
|
4945
4996
|
};
|
|
4946
4997
|
};
|
|
4947
4998
|
return /* @__PURE__ */ m(Q, {
|
|
@@ -4958,7 +5009,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4958
5009
|
let { cx: r, cy: i, rScale: a } = x(t, n);
|
|
4959
5010
|
return {
|
|
4960
5011
|
points: e.map((e, t) => {
|
|
4961
|
-
let n = y.center(e.label) ?? 0, [o, s] =
|
|
5012
|
+
let n = y.center(e.label) ?? 0, [o, s] = Ce(r, i, a.map(e.value), n);
|
|
4962
5013
|
return {
|
|
4963
5014
|
id: `p-${t}`,
|
|
4964
5015
|
cx: o,
|
|
@@ -4974,7 +5025,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4974
5025
|
if (!g) return null;
|
|
4975
5026
|
let { cx: i, cy: a, outerR: s, rScale: c } = x(t, n), l = Array.from({ length: o }, (e, t) => s * (t + 1) / o), u = e.map((e) => {
|
|
4976
5027
|
let t = y.center(e.label) ?? 0;
|
|
4977
|
-
return
|
|
5028
|
+
return Ce(i, a, c.map(e.value), t);
|
|
4978
5029
|
});
|
|
4979
5030
|
return /* @__PURE__ */ h("g", { children: [
|
|
4980
5031
|
!d && l.map((e, t) => /* @__PURE__ */ m("circle", {
|
|
@@ -4989,21 +5040,21 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
4989
5040
|
r === "bar" ? e.map((e, t) => {
|
|
4990
5041
|
let n = y.map(e.label) ?? 0, r = y.bandwidth * .1;
|
|
4991
5042
|
return /* @__PURE__ */ m("path", {
|
|
4992
|
-
d:
|
|
4993
|
-
fill: e.color ??
|
|
5043
|
+
d: I(i, a, c.map(e.value), 0, n + r, n + y.bandwidth - r),
|
|
5044
|
+
fill: e.color ?? pr[t % pr.length],
|
|
4994
5045
|
fillOpacity: .85,
|
|
4995
5046
|
"data-wedge": ""
|
|
4996
5047
|
}, t);
|
|
4997
5048
|
}) : (() => {
|
|
4998
|
-
let t = [...u, u[0]], n = e[0]?.color ??
|
|
5049
|
+
let t = [...u, u[0]], n = e[0]?.color ?? pr[0];
|
|
4999
5050
|
return /* @__PURE__ */ h(p, { children: [r === "area" && /* @__PURE__ */ m("path", {
|
|
5000
|
-
d: `${
|
|
5051
|
+
d: `${k(t, "linear")}Z`,
|
|
5001
5052
|
fill: n,
|
|
5002
5053
|
fillOpacity: .25,
|
|
5003
5054
|
stroke: "none",
|
|
5004
5055
|
"data-area": ""
|
|
5005
5056
|
}), /* @__PURE__ */ m("path", {
|
|
5006
|
-
d:
|
|
5057
|
+
d: k(t, "linear"),
|
|
5007
5058
|
fill: "none",
|
|
5008
5059
|
stroke: n,
|
|
5009
5060
|
strokeWidth: 2,
|
|
@@ -5011,7 +5062,7 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
5011
5062
|
})] });
|
|
5012
5063
|
})(),
|
|
5013
5064
|
!d && e.map((e, t) => {
|
|
5014
|
-
let n = y.center(e.label) ?? 0, [r, o] =
|
|
5065
|
+
let n = y.center(e.label) ?? 0, [r, o] = Ce(i, a, s + 12, n);
|
|
5015
5066
|
return /* @__PURE__ */ m("text", {
|
|
5016
5067
|
x: r,
|
|
5017
5068
|
y: o,
|
|
@@ -5029,10 +5080,10 @@ function ur({ data: e, title: t, description: n, mode: r = "bar", width: i, heig
|
|
|
5029
5080
|
}
|
|
5030
5081
|
//#endregion
|
|
5031
5082
|
//#region src/charts/gauge/gauge.tsx
|
|
5032
|
-
var
|
|
5033
|
-
function
|
|
5083
|
+
var hr = Math.PI / 180;
|
|
5084
|
+
function gr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", sweep: a = 270, ticks: o = 5, title: c, description: l, width: u, height: d, className: f, plain: p }) {
|
|
5034
5085
|
s();
|
|
5035
|
-
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a *
|
|
5086
|
+
let g = d ?? 240, _ = n - t || 1, v = Math.max(t, Math.min(n, e)), y = (v - t) / _, b = a * hr, x = -b / 2, S = (e) => x + (e - t) / _ * b;
|
|
5036
5087
|
return /* @__PURE__ */ m(Q, {
|
|
5037
5088
|
title: c,
|
|
5038
5089
|
description: l,
|
|
@@ -5052,7 +5103,7 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5052
5103
|
}], w = t, T = Array.from({ length: o + 1 }, (e, n) => t + _ * n / o);
|
|
5053
5104
|
return /* @__PURE__ */ h("g", { children: [
|
|
5054
5105
|
/* @__PURE__ */ m("path", {
|
|
5055
|
-
d:
|
|
5106
|
+
d: I(c, l, u, f, x, x + b),
|
|
5056
5107
|
fill: "var(--cascivo-chart-grid)",
|
|
5057
5108
|
fillOpacity: .25,
|
|
5058
5109
|
"data-track": ""
|
|
@@ -5060,13 +5111,13 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5060
5111
|
C.map((e, t) => {
|
|
5061
5112
|
let r = S(w), i = S(Math.min(n, e.upTo));
|
|
5062
5113
|
return w = e.upTo, /* @__PURE__ */ m("path", {
|
|
5063
|
-
d:
|
|
5114
|
+
d: I(c, l, u, f, r, i),
|
|
5064
5115
|
fill: e.color,
|
|
5065
5116
|
"data-zone": ""
|
|
5066
5117
|
}, t);
|
|
5067
5118
|
}),
|
|
5068
5119
|
!p && T.map((e, t) => {
|
|
5069
|
-
let n = S(e), [r, i] =
|
|
5120
|
+
let n = S(e), [r, i] = Ce(c, l, f - 2, n), [a, o] = Ce(c, l, f - 8, n), [s, u] = Ce(c, l, f - 18, n);
|
|
5070
5121
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
5071
5122
|
x1: r,
|
|
5072
5123
|
y1: i,
|
|
@@ -5086,7 +5137,7 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5086
5137
|
})] }, t);
|
|
5087
5138
|
}),
|
|
5088
5139
|
(() => {
|
|
5089
|
-
let [e, t] =
|
|
5140
|
+
let [e, t] = Ce(c, l, g, S(v));
|
|
5090
5141
|
return /* @__PURE__ */ m("line", {
|
|
5091
5142
|
x1: c,
|
|
5092
5143
|
y1: l,
|
|
@@ -5120,4 +5171,4 @@ function fr({ value: e, min: t = 0, max: n = 100, thresholds: r, unit: i = "", s
|
|
|
5120
5171
|
});
|
|
5121
5172
|
}
|
|
5122
5173
|
//#endregion
|
|
5123
|
-
export {
|
|
5174
|
+
export { qe as AXIS_CHAR_PX, Xe as AXIS_LINE_PX, hn as AreaChart, $ as Axis, yn as BarChart, Pn as Boxplot, Wt as Brush, Rn as BubbleChart, Xn as Bullet, dr as CalendarHeatmap, fr as Candlestick, nt as CanvasLayer, Lt as ChartDefs, Q as ChartFrame, Vn as ComboChart, Ge as DEFAULT_MARGINS, Mt as DataLabel, Gt as DataZoom, er as Funnel, gr as Gauge, zt as Glyph, Ct as GridLines, Hn as Heatmap, Mn as Histogram, jn as Kpi, nn as Legend, dn as LineChart, On as Meter, Ke as PLAIN_MARGINS, Sn as PieChart, mr as Polar, Jn as Radar, Qn as RadialBar, or as Sankey, wn as ScatterChart, Tn as Sparkline, nr as Stream, ir as Sunburst, Ut as Text, lt as Toolbox, Wn as Treemap, en as VisualMap, vt as _syncGroupCount, Ae as aggregate, we as angleBand, kt as annotationSummary, I as arcPath, F as areaPath, Ze as autoLabelStride, v as bandScale, je as bin, H as binValues, Ue as bindStream, U as boxStats, B as cellPath, Be as decimate, ye as divergingRamp, pt as download, Ie as encode, Le as encodeCategory, W as extent, It as fillFor, Ee as filter, gt as getSyncGroup, Rt as glyphPath, Pt as gradientId, st as isZoomed, Je as leftMarginForLabels, k as linePath, g as linearScale, le as linkPath, b as logScale, Re as lttb, Qt as mapVisual, se as maxDepth, ze as minmax, R as nearestIndex, _ as niceTicks, ot as panWindow, X as partition, Ft as patternId, Zt as pieceIndex, Ce as polarPoint, D as quantize, Te as radiusScale, Se as rampLightness, be as rampOf, xe as rampStops, Pe as regression, _t as releaseSyncGroup, Dt as renderAnnotation, Ot as renderAnnotations, rt as resolveColor, jt as resolveLabels, Ye as rightMarginForLabels, ce as sankeyLayout, ve as sequentialRamp, dt as serializeSvg, Oe as sort, O as splitDefined, y as sqrtScale, ae as squarify, ne as stackSeries, Y as streamExtent, J as streamLayout, oe as sumValue, ft as svgToPngBlob, E as timeScale, L as toStackedSeries, We as useChartSize, He as useStreamSeries, $t as visualVisible, z as voronoiCells, re as voronoiFind, Ht as wrapText, at as zoomWindow };
|