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