@canplot/react 0.1.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/LICENSE +21 -0
- package/README.md +239 -0
- package/dist/canplot.cjs +5 -0
- package/dist/canplot.cjs.map +1 -0
- package/dist/canplot.mjs +1361 -0
- package/dist/canplot.mjs.map +1 -0
- package/package.json +91 -0
package/dist/canplot.mjs
ADDED
|
@@ -0,0 +1,1361 @@
|
|
|
1
|
+
import { jsxs as at, jsx as D, Fragment as _t } from "react/jsx-runtime";
|
|
2
|
+
import G, { createContext as Rt, useContext as lt, useRef as U, useLayoutEffect as J, version as Ut, forwardRef as Lt, useMemo as vt, useState as N, useId as Dt, useEffect as Xt } from "react";
|
|
3
|
+
import { createStore as Kt, useStore as Ct } from "zustand";
|
|
4
|
+
const Tt = 5, bt = 10, kt = 60, It = 30, Et = "UTC", zt = "en-GB", q = (t, s, e) => Math.min(Math.max(t, s), e), Ft = (t, s, e, o) => {
|
|
5
|
+
const { min: i, max: n } = A(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, a = (V(t, e) ? r.width : r.height) / (n - i);
|
|
6
|
+
return s / a;
|
|
7
|
+
}, A = (t, s) => {
|
|
8
|
+
const e = t.scales.find((o) => o.id === s);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error(`Scale ${s} not found`);
|
|
11
|
+
return e;
|
|
12
|
+
}, V = (t, s) => t.scales.find((e) => e.id === s)?.origin === "x", me = (t, s) => t.scales.find((e) => e.id === s)?.origin === "y", X = (t, s) => {
|
|
13
|
+
const e = window.devicePixelRatio || 1;
|
|
14
|
+
t.lineCap = s?.lineCap ?? "butt", t.lineDashOffset = e * (s?.lineDashOffset ?? 0), t.lineJoin = s?.lineJoin ?? "miter", t.lineWidth = e * (s?.lineWidth ?? 1), t.miterLimit = e * (s?.miterLimit ?? 10), t.strokeStyle = s?.strokeStyle ?? "black", t.fillStyle = s?.fillStyle ?? t.strokeStyle, t.font = s?.font ?? `${10 * e}px sans-serif`, t.textAlign = s?.textAlign ?? "start", t.direction = s?.direction ?? "inherit", t.textBaseline = s?.textBaseline ?? "alphabetic", t.fontKerning = s?.fontKerning ?? "auto";
|
|
15
|
+
}, ut = (t, s, e, o) => {
|
|
16
|
+
const i = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: n, max: r } = A(t, e), a = (V(t, e) ? i.width : i.height) / (r - n);
|
|
17
|
+
return s * a;
|
|
18
|
+
}, K = (t, s, e, o) => {
|
|
19
|
+
const { min: i } = A(t, e), n = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, r = ut(t, s - i, e, o);
|
|
20
|
+
return V(t, e) ? q(
|
|
21
|
+
n.x + r,
|
|
22
|
+
n.x - 10 * n.width,
|
|
23
|
+
n.x + 11 * n.width
|
|
24
|
+
) : q(
|
|
25
|
+
n.y + n.height - r,
|
|
26
|
+
n.y - 10 * n.height,
|
|
27
|
+
n.y + 11 * n.height
|
|
28
|
+
);
|
|
29
|
+
}, O = (t, s, e) => {
|
|
30
|
+
const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
|
|
31
|
+
return q(s, o.x, o.x + o.width);
|
|
32
|
+
}, $ = (t, s, e) => {
|
|
33
|
+
const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
|
|
34
|
+
return q(s, o.y, o.y + o.height);
|
|
35
|
+
}, ct = (t, s, e) => {
|
|
36
|
+
const { min: o, max: i } = A(t, e);
|
|
37
|
+
return s >= o && s <= i;
|
|
38
|
+
}, L = (t, s, e, o) => {
|
|
39
|
+
const { min: i, max: n } = A(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, a = V(t, e) ? (s - r.x) / r.width : (r.height - s + r.y) / r.height;
|
|
40
|
+
return i + a * (n - i);
|
|
41
|
+
}, Yt = 1, Mt = 1e3 * Yt, dt = 60 * Mt, Q = 60 * dt, tt = 24 * Q, Ot = 30 * tt, $t = 365 * tt, Bt = [
|
|
42
|
+
// second divisors
|
|
43
|
+
[1, "milliseconds"],
|
|
44
|
+
[2, "milliseconds"],
|
|
45
|
+
[5, "milliseconds"],
|
|
46
|
+
[10, "milliseconds"],
|
|
47
|
+
[20, "milliseconds"],
|
|
48
|
+
[50, "milliseconds"],
|
|
49
|
+
[100, "milliseconds"],
|
|
50
|
+
[200, "milliseconds"],
|
|
51
|
+
[500, "milliseconds"],
|
|
52
|
+
// minute divisors
|
|
53
|
+
[1, "seconds"],
|
|
54
|
+
[5, "seconds"],
|
|
55
|
+
[10, "seconds"],
|
|
56
|
+
[15, "seconds"],
|
|
57
|
+
[30, "seconds"],
|
|
58
|
+
// hour divisors
|
|
59
|
+
[1, "minutes"],
|
|
60
|
+
[5, "minutes"],
|
|
61
|
+
[10, "minutes"],
|
|
62
|
+
[15, "minutes"],
|
|
63
|
+
[30, "minutes"],
|
|
64
|
+
// day divisors
|
|
65
|
+
[1, "hours"],
|
|
66
|
+
[2, "hours"],
|
|
67
|
+
[3, "hours"],
|
|
68
|
+
[4, "hours"],
|
|
69
|
+
[6, "hours"],
|
|
70
|
+
[8, "hours"],
|
|
71
|
+
[12, "hours"],
|
|
72
|
+
// month divisors
|
|
73
|
+
[1, "days"],
|
|
74
|
+
[3, "days"],
|
|
75
|
+
[5, "days"],
|
|
76
|
+
[7, "days"],
|
|
77
|
+
[10, "days"],
|
|
78
|
+
[15, "days"],
|
|
79
|
+
// year divisors
|
|
80
|
+
[1, "months"],
|
|
81
|
+
[2, "months"],
|
|
82
|
+
[3, "months"],
|
|
83
|
+
[4, "months"],
|
|
84
|
+
[6, "months"],
|
|
85
|
+
// century divisors
|
|
86
|
+
[1, "years"],
|
|
87
|
+
[2, "years"],
|
|
88
|
+
[5, "years"],
|
|
89
|
+
[10, "years"],
|
|
90
|
+
[25, "years"],
|
|
91
|
+
[50, "years"],
|
|
92
|
+
[100, "years"]
|
|
93
|
+
], H = (t) => {
|
|
94
|
+
const [s, e] = t;
|
|
95
|
+
switch (e) {
|
|
96
|
+
case "milliseconds":
|
|
97
|
+
return s;
|
|
98
|
+
case "seconds":
|
|
99
|
+
return s * Mt;
|
|
100
|
+
case "minutes":
|
|
101
|
+
return s * dt;
|
|
102
|
+
case "hours":
|
|
103
|
+
return s * Q;
|
|
104
|
+
case "days":
|
|
105
|
+
return s * tt;
|
|
106
|
+
case "months":
|
|
107
|
+
return s * Ot;
|
|
108
|
+
case "years":
|
|
109
|
+
return s * $t;
|
|
110
|
+
}
|
|
111
|
+
}, Nt = (t, s) => {
|
|
112
|
+
const e = new Date(t);
|
|
113
|
+
return e.setUTCMilliseconds(e.getUTCMilliseconds() + s), e.getTime();
|
|
114
|
+
}, Vt = (t, s) => {
|
|
115
|
+
const e = new Date(t);
|
|
116
|
+
return e.setUTCSeconds(e.getUTCSeconds() + s), e.getTime();
|
|
117
|
+
}, jt = (t, s) => {
|
|
118
|
+
const e = new Date(t);
|
|
119
|
+
return e.setUTCMinutes(e.getUTCMinutes() + s), e.getTime();
|
|
120
|
+
}, Ht = (t, s) => {
|
|
121
|
+
const e = new Date(t);
|
|
122
|
+
return e.setUTCHours(e.getUTCHours() + s), e.getTime();
|
|
123
|
+
}, Zt = (t, s) => {
|
|
124
|
+
const e = new Date(t);
|
|
125
|
+
return e.setUTCDate(e.getUTCDate() + s), e.getTime();
|
|
126
|
+
}, xt = (t, s) => {
|
|
127
|
+
const e = new Date(t);
|
|
128
|
+
return e.setUTCMonth(e.getUTCMonth() + s), e.getTime();
|
|
129
|
+
}, z = (t, s) => {
|
|
130
|
+
const [e, o] = s;
|
|
131
|
+
switch (o) {
|
|
132
|
+
case "milliseconds":
|
|
133
|
+
return Nt(t, e);
|
|
134
|
+
case "seconds":
|
|
135
|
+
return Vt(t, e);
|
|
136
|
+
case "minutes":
|
|
137
|
+
return jt(t, e);
|
|
138
|
+
case "hours":
|
|
139
|
+
return Ht(t, e);
|
|
140
|
+
case "days":
|
|
141
|
+
return Zt(t, e);
|
|
142
|
+
case "months":
|
|
143
|
+
return xt(t, e);
|
|
144
|
+
case "years":
|
|
145
|
+
return xt(t, e * 12);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function Z(t, s) {
|
|
149
|
+
const e = new Date(t), o = new Date(e.toLocaleString("en-US", { timeZone: s })), i = new Date(e.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
150
|
+
return (o.getTime() - i.getTime()) / (3600 * 1e3);
|
|
151
|
+
}
|
|
152
|
+
const Wt = (t, s, e = "UTC") => {
|
|
153
|
+
const [o, i] = s;
|
|
154
|
+
let n = new Date(t);
|
|
155
|
+
const r = () => {
|
|
156
|
+
n.setUTCHours(-Z(n, e), 0, 0, 0);
|
|
157
|
+
};
|
|
158
|
+
switch (i) {
|
|
159
|
+
case "milliseconds":
|
|
160
|
+
n.setUTCMilliseconds(
|
|
161
|
+
Math.ceil(n.getUTCMilliseconds() / o) * o
|
|
162
|
+
);
|
|
163
|
+
break;
|
|
164
|
+
case "seconds":
|
|
165
|
+
n.setUTCSeconds(
|
|
166
|
+
Math.ceil(n.getUTCSeconds() / o) * o,
|
|
167
|
+
0
|
|
168
|
+
);
|
|
169
|
+
break;
|
|
170
|
+
case "minutes":
|
|
171
|
+
n.setUTCMinutes(
|
|
172
|
+
Math.ceil(n.getTime() % Q / dt / o) * o,
|
|
173
|
+
0,
|
|
174
|
+
0
|
|
175
|
+
);
|
|
176
|
+
break;
|
|
177
|
+
case "hours":
|
|
178
|
+
n.setUTCHours(
|
|
179
|
+
Math.ceil(n.getTime() % tt / Q / o) * o,
|
|
180
|
+
0,
|
|
181
|
+
0,
|
|
182
|
+
0
|
|
183
|
+
);
|
|
184
|
+
break;
|
|
185
|
+
case "days":
|
|
186
|
+
case "months":
|
|
187
|
+
case "years":
|
|
188
|
+
i === "months" ? n.setUTCDate(1) : i === "years" && n.setUTCMonth(0, 1), r(), n.getTime() < t && (n = new Date(z(n, [1, i])));
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
return n.getTime();
|
|
192
|
+
}, Gt = ({
|
|
193
|
+
timeZone: t = Et,
|
|
194
|
+
space: s = kt
|
|
195
|
+
}) => ({ frame: e, scaleId: o }) => {
|
|
196
|
+
const { min: i, max: n } = A(e, o), r = Math.floor(e.chartAreaCanvasPX.width / s) + 1, u = (n - i) / r, [l, d] = Bt.find(
|
|
197
|
+
(p) => H(p) >= u
|
|
198
|
+
) ?? [1, "milliseconds"], f = Wt(i, [l, d], t), m = Z(f, t), h = [f];
|
|
199
|
+
let c;
|
|
200
|
+
for (; ; ) {
|
|
201
|
+
switch (d) {
|
|
202
|
+
case "milliseconds":
|
|
203
|
+
case "seconds":
|
|
204
|
+
case "minutes":
|
|
205
|
+
case "hours": {
|
|
206
|
+
c = z(f, [h.length * l, d]);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case "days": {
|
|
210
|
+
const p = z(f, [
|
|
211
|
+
h.length * l,
|
|
212
|
+
d
|
|
213
|
+
]);
|
|
214
|
+
c = z(p, [
|
|
215
|
+
m - Z(p, t),
|
|
216
|
+
"hours"
|
|
217
|
+
]);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
case "months":
|
|
221
|
+
case "years": {
|
|
222
|
+
const p = z(
|
|
223
|
+
z(z(f, [m, "hours"]), [
|
|
224
|
+
h.length * l,
|
|
225
|
+
d
|
|
226
|
+
]),
|
|
227
|
+
[-m, "hours"]
|
|
228
|
+
);
|
|
229
|
+
c = z(p, [
|
|
230
|
+
m - Z(p, t),
|
|
231
|
+
"hours"
|
|
232
|
+
]);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (c > n)
|
|
237
|
+
break;
|
|
238
|
+
h.push(c);
|
|
239
|
+
}
|
|
240
|
+
return h;
|
|
241
|
+
}, I = (t, s, e) => t.find((o) => o.type === e)?.value !== s.find((o) => o.type === e)?.value, Jt = ({
|
|
242
|
+
timeZone: t = Et,
|
|
243
|
+
locale: s = zt,
|
|
244
|
+
showTimezone: e = !0
|
|
245
|
+
}) => {
|
|
246
|
+
const o = new Intl.DateTimeFormat(s, {
|
|
247
|
+
year: "numeric",
|
|
248
|
+
day: "numeric",
|
|
249
|
+
month: "short",
|
|
250
|
+
hour: "numeric",
|
|
251
|
+
hourCycle: "h23",
|
|
252
|
+
minute: "numeric",
|
|
253
|
+
second: "numeric",
|
|
254
|
+
fractionalSecondDigits: 3,
|
|
255
|
+
timeZoneName: "short",
|
|
256
|
+
timeZone: t
|
|
257
|
+
});
|
|
258
|
+
return ({ ticks: i }) => {
|
|
259
|
+
const n = i[1] - i[0], r = n < H([1, "days"]), a = n < H([1, "minutes"]), u = n < H([1, "seconds"]);
|
|
260
|
+
return i.map((l) => o.formatToParts(new Date(l))).map((l, d, f) => {
|
|
261
|
+
const m = f[d - 1], h = d === 0 || I(l, m, "year"), c = d === 0 || I(l, m, "day"), p = d === 0 || I(l, m, "month"), y = d === 0 || I(l, m, "hour"), x = d === 0 || I(l, m, "timeZoneName"), C = d === 0 || I(l, m, "minute"), S = d === 0 || I(l, m, "second"), g = d === 0 || I(l, m, "fractionalSecond"), k = [];
|
|
262
|
+
if (r && (y || C || x || S || g)) {
|
|
263
|
+
const v = l.find((P) => P.type === "hour")?.value, E = l.find((P) => P.type === "minute")?.value, M = l.find((P) => P.type === "timeZoneName")?.value;
|
|
264
|
+
let _ = "";
|
|
265
|
+
if (a) {
|
|
266
|
+
const P = l.find((F) => F.type === "second")?.value, B = l.find((F) => F.type === "fractionalSecond")?.value;
|
|
267
|
+
_ = `:${P}` + (u ? `.${B}` : "");
|
|
268
|
+
}
|
|
269
|
+
k.push(
|
|
270
|
+
`${v}:${E}${_}` + (e && x ? ` ${M}` : "")
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return (c || p) && k.push(
|
|
274
|
+
[
|
|
275
|
+
l.find((v) => v.type === "month")?.value,
|
|
276
|
+
c && l.find((v) => v.type === "day")?.value
|
|
277
|
+
].filter(Boolean).join(" ")
|
|
278
|
+
), h && k.push(l.find((v) => v.type === "year")?.value), k.filter((v) => v).join(`
|
|
279
|
+
`);
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
}, W = [];
|
|
283
|
+
for (let t = -12; t <= 12; t++)
|
|
284
|
+
W.push(1 * 10 ** t), W.push(2 * 10 ** t), W.push(5 * 10 ** t);
|
|
285
|
+
const qt = (t) => {
|
|
286
|
+
const { ctx: s, scales: e } = t;
|
|
287
|
+
s.save(), s.strokeStyle = "black", s.fillStyle = "black", s.lineWidth = 1, s.font = "12px Arial", s.textAlign = "center", s.textBaseline = "middle";
|
|
288
|
+
for (const o of e) {
|
|
289
|
+
if (!o.axis) continue;
|
|
290
|
+
const i = o.type === "time" ? Gt({
|
|
291
|
+
space: o.axis.tickSpace,
|
|
292
|
+
timeZone: o.timeZone
|
|
293
|
+
}) : Qt({ space: o.axis.tickSpace }), n = o.type === "time" ? Jt({
|
|
294
|
+
timeZone: o.timeZone,
|
|
295
|
+
showTimezone: o.axis.showTimezone,
|
|
296
|
+
locale: o.locale
|
|
297
|
+
}) : te, r = o.axis.canvasRect;
|
|
298
|
+
if (o.origin === "x") {
|
|
299
|
+
if (o.axis.position === "bottom")
|
|
300
|
+
s.beginPath(), s.moveTo(r.x, r.y), s.lineTo(r.x + r.width, r.y), s.stroke(), gt(t, o.id, r.y, i, n);
|
|
301
|
+
else if (o.axis.position === "top") {
|
|
302
|
+
const a = r.y + r.height;
|
|
303
|
+
s.beginPath(), s.moveTo(r.x, a), s.lineTo(r.x + r.width, a), s.stroke(), gt(t, o.id, a, i, n);
|
|
304
|
+
}
|
|
305
|
+
} else if (o.axis.position === "left") {
|
|
306
|
+
const a = r.x + r.width;
|
|
307
|
+
s.beginPath(), s.moveTo(a, r.y), s.lineTo(a, r.y + r.height), s.stroke(), St(t, o.id, a, i, n);
|
|
308
|
+
} else o.axis.position === "right" && (s.beginPath(), s.moveTo(r.x, r.y), s.lineTo(r.x, r.y + r.height), s.stroke(), St(t, o.id, r.x, i, n));
|
|
309
|
+
}
|
|
310
|
+
s.restore();
|
|
311
|
+
}, St = (t, s, e, o, i) => {
|
|
312
|
+
const { ctx: n } = t, r = t.scales.find((c) => c.id === s)?.axis;
|
|
313
|
+
if (!r) return;
|
|
314
|
+
const a = window.devicePixelRatio || 1, u = Tt, l = e, d = r.position === "left" ? e - u : e + u, f = bt * a, m = o({ frame: t, scaleId: s }) ?? [], h = i({
|
|
315
|
+
frame: t,
|
|
316
|
+
scaleId: s,
|
|
317
|
+
ticks: m
|
|
318
|
+
});
|
|
319
|
+
n.save(), n.fontKerning = "auto", X(n, {}), n.beginPath();
|
|
320
|
+
for (let c = 0; c < m.length; c++) {
|
|
321
|
+
const p = K(t, m[c], s, "canvas");
|
|
322
|
+
n.moveTo(l, p), n.lineTo(d, p);
|
|
323
|
+
}
|
|
324
|
+
n.stroke(), n.restore(), n.save(), X(n, {
|
|
325
|
+
textBaseline: "middle",
|
|
326
|
+
textAlign: r.position === "left" ? "right" : "left"
|
|
327
|
+
// ...axis.axisStyle,
|
|
328
|
+
// ...axis.tickLabelStyle,
|
|
329
|
+
});
|
|
330
|
+
for (let c = 0; c < m.length; c++) {
|
|
331
|
+
const p = K(t, m[c], s, "canvas"), y = h[c].split(`
|
|
332
|
+
`);
|
|
333
|
+
for (let x = 0; x < y.length; x++)
|
|
334
|
+
n.fillText(` ${y[x]} `, d, p + x * f);
|
|
335
|
+
}
|
|
336
|
+
n.restore();
|
|
337
|
+
}, gt = (t, s, e, o, i) => {
|
|
338
|
+
const { ctx: n } = t, r = t.scales.find((c) => c.id === s)?.axis;
|
|
339
|
+
if (!r) return;
|
|
340
|
+
const a = window.devicePixelRatio || 1, u = Tt, l = e, d = r.position === "top" ? e - u : e + u, f = bt * a, m = o({ frame: t, scaleId: s }) ?? [], h = i({ frame: t, scaleId: s, ticks: m });
|
|
341
|
+
n.save(), n.fontKerning = "auto", X(n, {}), n.beginPath();
|
|
342
|
+
for (let c = 0; c < m.length; c++) {
|
|
343
|
+
const p = K(t, m[c], s, "canvas");
|
|
344
|
+
n.moveTo(p, l), n.lineTo(p, d);
|
|
345
|
+
}
|
|
346
|
+
n.stroke(), n.restore(), n.save(), X(n, {
|
|
347
|
+
textBaseline: r.position === "top" ? "bottom" : "top",
|
|
348
|
+
textAlign: "center"
|
|
349
|
+
// ...axis.axisStyle,
|
|
350
|
+
// ...axis.tickLabelStyle,
|
|
351
|
+
});
|
|
352
|
+
for (let c = 0; c < m.length; c++) {
|
|
353
|
+
const p = K(t, m[c], s, "canvas"), y = h[c].split(`
|
|
354
|
+
`);
|
|
355
|
+
for (let x = 0; x < y.length; x++)
|
|
356
|
+
n.fillText(y[x], p, d + a * 2 + x * f);
|
|
357
|
+
}
|
|
358
|
+
n.restore();
|
|
359
|
+
}, Qt = ({
|
|
360
|
+
space: t
|
|
361
|
+
} = {}) => ({ frame: s, scaleId: e }) => {
|
|
362
|
+
const { min: o, max: i } = A(s, e), n = [], r = window.devicePixelRatio || 1, a = (t ?? (V(s, e) ? kt : It)) * r, u = Ft(
|
|
363
|
+
s,
|
|
364
|
+
a,
|
|
365
|
+
e,
|
|
366
|
+
"canvas"
|
|
367
|
+
), l = W.find((f) => f > u) ?? 1;
|
|
368
|
+
let d = o % l < Number.EPSILON ? o : o + l - o % l;
|
|
369
|
+
for (; d <= i; )
|
|
370
|
+
n.push(d), d += l;
|
|
371
|
+
return n;
|
|
372
|
+
}, te = ({ ticks: t }) => {
|
|
373
|
+
const s = Math.max(0, Math.ceil(-Math.log10(t[1] - t[0])));
|
|
374
|
+
return t.map((e) => e.toFixed(s));
|
|
375
|
+
}, ee = () => Kt((t, s) => {
|
|
376
|
+
const e = () => {
|
|
377
|
+
const o = s()._frame;
|
|
378
|
+
if (!o) throw new Error("No frame set in frame store");
|
|
379
|
+
return o;
|
|
380
|
+
};
|
|
381
|
+
return {
|
|
382
|
+
_frame: null,
|
|
383
|
+
getFrame: e,
|
|
384
|
+
getCtx: () => e().ctx,
|
|
385
|
+
clampXPosToChartArea: (o, i) => O(e(), o, i ?? "canvas"),
|
|
386
|
+
clampYPosToChartArea: (o, i) => $(e(), o, i ?? "canvas"),
|
|
387
|
+
valToPos: (o, i, n) => K(e(), o, i, n ?? "canvas"),
|
|
388
|
+
valToPxDistance: (o, i, n) => ut(
|
|
389
|
+
e(),
|
|
390
|
+
o,
|
|
391
|
+
i,
|
|
392
|
+
n ?? "canvas"
|
|
393
|
+
),
|
|
394
|
+
valFits: (o, i) => ct(e(), o, i),
|
|
395
|
+
getScale: (o) => A(e(), o)
|
|
396
|
+
};
|
|
397
|
+
}), ht = Rt(null), j = (t, s) => {
|
|
398
|
+
const e = lt(ht);
|
|
399
|
+
if (!e)
|
|
400
|
+
throw new Error("useFrame must be used within a CanPlot component");
|
|
401
|
+
const o = U(t);
|
|
402
|
+
o.current = t, J(() => {
|
|
403
|
+
o.current(e.getState()), e.subscribe((i) => {
|
|
404
|
+
i._frame && o.current(i);
|
|
405
|
+
});
|
|
406
|
+
}, [e, ...s]);
|
|
407
|
+
}, pt = (t) => {
|
|
408
|
+
const s = lt(ht);
|
|
409
|
+
if (!s)
|
|
410
|
+
throw new Error("useFrame must be used within a CanPlot component");
|
|
411
|
+
return Ct(
|
|
412
|
+
s,
|
|
413
|
+
t ?? ((e) => e.getFrame())
|
|
414
|
+
);
|
|
415
|
+
};
|
|
416
|
+
function se(t) {
|
|
417
|
+
return (s) => {
|
|
418
|
+
for (const e of t) rt(e, s);
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function ne(t) {
|
|
422
|
+
return (s) => {
|
|
423
|
+
const e = [];
|
|
424
|
+
for (const o of t) {
|
|
425
|
+
const i = rt(o, s), n = typeof i == "function";
|
|
426
|
+
e.push(n ? i : () => rt(o, null));
|
|
427
|
+
}
|
|
428
|
+
return () => {
|
|
429
|
+
for (const o of e) o();
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function rt(t, s) {
|
|
434
|
+
if (typeof t == "function")
|
|
435
|
+
return t(s);
|
|
436
|
+
t && (t.current = s);
|
|
437
|
+
}
|
|
438
|
+
var oe = parseInt(Ut.split(".")[0], 10) >= 19 ? ne : se;
|
|
439
|
+
const fe = Lt(({ configuration: t, children: s, style: e, className: o }, i) => {
|
|
440
|
+
const n = U(null), r = U(null), a = ce(r), u = vt(ee, []);
|
|
441
|
+
J(() => {
|
|
442
|
+
u.setState({
|
|
443
|
+
_frame: re(t, a, n.current)
|
|
444
|
+
});
|
|
445
|
+
}, [t, a, n, u]), J(() => u.subscribe((d) => {
|
|
446
|
+
d._frame && ae(d._frame);
|
|
447
|
+
}), [u]);
|
|
448
|
+
const l = window.devicePixelRatio || 1;
|
|
449
|
+
return /* @__PURE__ */ at(
|
|
450
|
+
"div",
|
|
451
|
+
{
|
|
452
|
+
ref: oe([i, r]),
|
|
453
|
+
className: o,
|
|
454
|
+
style: {
|
|
455
|
+
position: "relative",
|
|
456
|
+
overflow: "hidden",
|
|
457
|
+
...e
|
|
458
|
+
},
|
|
459
|
+
"data-canplotroot": !0,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ D(
|
|
462
|
+
"canvas",
|
|
463
|
+
{
|
|
464
|
+
ref: n,
|
|
465
|
+
width: a.width * l,
|
|
466
|
+
height: a.height * l,
|
|
467
|
+
style: {
|
|
468
|
+
inset: 0,
|
|
469
|
+
position: "absolute",
|
|
470
|
+
width: `${a.width}px`,
|
|
471
|
+
height: `${a.height}px`
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
/* @__PURE__ */ D(ie, { frameStore: u, children: s })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}), ie = ({ frameStore: t, children: s }) => Ct(t, (o) => !!o._frame) ? /* @__PURE__ */ D(ht.Provider, { value: t, children: s }) : null, ce = (t) => {
|
|
480
|
+
const [s, e] = N({
|
|
481
|
+
width: 0,
|
|
482
|
+
height: 0
|
|
483
|
+
}), [o] = N(() => new ResizeObserver((i) => {
|
|
484
|
+
for (const n of i) {
|
|
485
|
+
const r = Math.round(n.contentRect.width), a = Math.round(n.contentRect.height);
|
|
486
|
+
e(
|
|
487
|
+
(u) => u.width !== r || u.height !== a ? { ...u, width: r, height: a } : u
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
}));
|
|
491
|
+
return J(() => {
|
|
492
|
+
if (!t.current) return;
|
|
493
|
+
const i = t.current.clientWidth, n = t.current.clientHeight;
|
|
494
|
+
return e(
|
|
495
|
+
(r) => r.width !== i || r.height !== n ? { ...r, width: i, height: n } : r
|
|
496
|
+
), o.observe(t.current, { box: "border-box" }), () => o.disconnect();
|
|
497
|
+
}, [o, t]), s;
|
|
498
|
+
}, re = (t, s, e) => {
|
|
499
|
+
const o = e?.getContext("2d");
|
|
500
|
+
if (!o) return null;
|
|
501
|
+
const i = window.devicePixelRatio || 1;
|
|
502
|
+
if (s.width === 0 || s.height === 0)
|
|
503
|
+
return null;
|
|
504
|
+
const n = {
|
|
505
|
+
x: t.padding.left,
|
|
506
|
+
y: t.padding.top,
|
|
507
|
+
width: s.width - t.padding.left - t.padding.right,
|
|
508
|
+
height: s.height - t.padding.top - t.padding.bottom
|
|
509
|
+
};
|
|
510
|
+
for (const h of t.scales)
|
|
511
|
+
h.axis && (h.origin === "x" ? (h.axis.position === "bottom" || h.axis.position === "top") && (n.height = Math.max(
|
|
512
|
+
0,
|
|
513
|
+
n.height - h.axis.size
|
|
514
|
+
), h.axis.position === "top" && (n.y += h.axis.size)) : (h.axis.position === "left" || h.axis.position === "right") && (n.width = Math.max(0, n.width - h.axis.size), h.axis.position === "left" && (n.x += h.axis.size)));
|
|
515
|
+
const r = {
|
|
516
|
+
x: n.x * i,
|
|
517
|
+
y: n.y * i,
|
|
518
|
+
width: n.width * i,
|
|
519
|
+
height: n.height * i
|
|
520
|
+
}, a = [];
|
|
521
|
+
let u = t.padding.left * i, l = o.canvas.width - t.padding.right * i, d = o.canvas.height - t.padding.bottom * i, f = t.padding.top * i;
|
|
522
|
+
for (const h of t.scales) {
|
|
523
|
+
if (!h.axis) {
|
|
524
|
+
a.push({ ...h, axis: null });
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
let c;
|
|
528
|
+
if (h.origin === "x")
|
|
529
|
+
switch (h.axis.position) {
|
|
530
|
+
case "bottom":
|
|
531
|
+
d -= h.axis.size * i, c = {
|
|
532
|
+
x: n.x,
|
|
533
|
+
y: d / i,
|
|
534
|
+
width: n.width,
|
|
535
|
+
height: h.axis.size
|
|
536
|
+
};
|
|
537
|
+
break;
|
|
538
|
+
case "top":
|
|
539
|
+
f += h.axis.size * i, c = {
|
|
540
|
+
x: n.x,
|
|
541
|
+
y: f / i - h.axis.size,
|
|
542
|
+
width: n.width,
|
|
543
|
+
height: h.axis.size
|
|
544
|
+
};
|
|
545
|
+
break;
|
|
546
|
+
case "left":
|
|
547
|
+
case "right":
|
|
548
|
+
throw new Error("Invalid axis position for x origin");
|
|
549
|
+
}
|
|
550
|
+
else
|
|
551
|
+
switch (h.axis.position) {
|
|
552
|
+
case "left":
|
|
553
|
+
u += h.axis.size * i, c = {
|
|
554
|
+
x: u / i - h.axis.size,
|
|
555
|
+
y: n.y,
|
|
556
|
+
width: h.axis.size,
|
|
557
|
+
height: n.height
|
|
558
|
+
};
|
|
559
|
+
break;
|
|
560
|
+
case "right":
|
|
561
|
+
l -= h.axis.size * i, c = {
|
|
562
|
+
x: l / i,
|
|
563
|
+
y: n.y,
|
|
564
|
+
width: h.axis.size,
|
|
565
|
+
height: n.height
|
|
566
|
+
};
|
|
567
|
+
break;
|
|
568
|
+
case "top":
|
|
569
|
+
case "bottom":
|
|
570
|
+
throw new Error("Invalid axis position for y origin");
|
|
571
|
+
}
|
|
572
|
+
const p = {
|
|
573
|
+
x: c.x * i,
|
|
574
|
+
y: c.y * i,
|
|
575
|
+
width: c.width * i,
|
|
576
|
+
height: c.height * i
|
|
577
|
+
};
|
|
578
|
+
a.push({
|
|
579
|
+
...h,
|
|
580
|
+
axis: {
|
|
581
|
+
...h.axis,
|
|
582
|
+
cssRect: c,
|
|
583
|
+
canvasRect: p
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
ctx: o,
|
|
589
|
+
dpr: i,
|
|
590
|
+
padding: t.padding,
|
|
591
|
+
scales: a,
|
|
592
|
+
chartAreaCSS: n,
|
|
593
|
+
chartAreaCanvasPX: r
|
|
594
|
+
};
|
|
595
|
+
}, ae = (t) => {
|
|
596
|
+
t.ctx.clearRect(0, 0, t.ctx.canvas.width, t.ctx.canvas.height), qt(t);
|
|
597
|
+
}, ye = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (j(
|
|
598
|
+
({ getCtx: i, clampXPosToChartArea: n, clampYPosToChartArea: r, valToPos: a }) => {
|
|
599
|
+
const u = i();
|
|
600
|
+
u.save(), u.beginPath(), X(u, o);
|
|
601
|
+
for (const l of t) {
|
|
602
|
+
const d = n(a(l.x, s)), f = r(a(l.y, e));
|
|
603
|
+
u.lineTo(d, f);
|
|
604
|
+
}
|
|
605
|
+
u.stroke(), u.restore();
|
|
606
|
+
},
|
|
607
|
+
[t, s, e, o]
|
|
608
|
+
), null), xe = ({ data: t, xScaleId: s, yScaleId: e, radius: o = 5, style: i }) => (j(({ getCtx: n, valToPos: r, valFits: a }) => {
|
|
609
|
+
const u = n();
|
|
610
|
+
u.save(), u.beginPath(), X(u, i);
|
|
611
|
+
for (const l of t) {
|
|
612
|
+
if (!a(l.x, s) || !a(l.y, e))
|
|
613
|
+
continue;
|
|
614
|
+
const d = r(l.x, s), f = r(l.y, e);
|
|
615
|
+
u.moveTo(d + o, f), u.arc(d, f, o, 0, Math.PI * 2);
|
|
616
|
+
}
|
|
617
|
+
u.stroke(), u.fill(), u.restore();
|
|
618
|
+
}, [t, s, e, o, i]), null), Se = ({
|
|
619
|
+
data: t,
|
|
620
|
+
xScaleId: s,
|
|
621
|
+
yScaleId: e,
|
|
622
|
+
style: o,
|
|
623
|
+
barWidth: i,
|
|
624
|
+
xPositionOffset: n,
|
|
625
|
+
radius: r
|
|
626
|
+
}) => (j(
|
|
627
|
+
({
|
|
628
|
+
getCtx: a,
|
|
629
|
+
valToPxDistance: u,
|
|
630
|
+
valToPos: l,
|
|
631
|
+
clampXPosToChartArea: d,
|
|
632
|
+
clampYPosToChartArea: f
|
|
633
|
+
}) => {
|
|
634
|
+
if (t.length === 0) return;
|
|
635
|
+
const m = a();
|
|
636
|
+
m.save(), X(m, o);
|
|
637
|
+
const h = u(i, s);
|
|
638
|
+
m.beginPath();
|
|
639
|
+
for (const c of t) {
|
|
640
|
+
const y = l(c.x, s) - h / 2 + n * h, x = f(l(0, e)), C = f(l(c.y, e)), S = x - C, g = d(y), k = d(y + h) - g;
|
|
641
|
+
r ? m.roundRect(
|
|
642
|
+
g,
|
|
643
|
+
C,
|
|
644
|
+
k,
|
|
645
|
+
S,
|
|
646
|
+
r
|
|
647
|
+
) : m.rect(g, C, k, S);
|
|
648
|
+
}
|
|
649
|
+
m.closePath(), m.fill(), o?.strokeStyle && m.stroke(), m.restore();
|
|
650
|
+
},
|
|
651
|
+
[t, s, e, o, i, n, r]
|
|
652
|
+
), null), ge = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (j(({ getCtx: i, clampXPosToChartArea: n, clampYPosToChartArea: r, valToPos: a }) => {
|
|
653
|
+
const u = [];
|
|
654
|
+
for (const d of t) {
|
|
655
|
+
const f = n(a(d.x, s)), m = r(a(d.y[0], e)), h = r(a(d.y[1], e));
|
|
656
|
+
u.push({ x: f, y: m }), u.unshift({ x: f, y: h });
|
|
657
|
+
}
|
|
658
|
+
const l = i();
|
|
659
|
+
if (u.length > 0) {
|
|
660
|
+
l.save(), l.beginPath(), X(l, o), l.moveTo(u[0].x, u[0].y);
|
|
661
|
+
for (const d of u)
|
|
662
|
+
l.lineTo(d.x, d.y);
|
|
663
|
+
l.closePath(), l.fill(), l.restore();
|
|
664
|
+
}
|
|
665
|
+
}, [t, s, e, o]), null), we = ({ data: t, stroked: s, xScaleId: e, yScaleId: o, style: i }) => (j(
|
|
666
|
+
({ getCtx: n, clampXPosToChartArea: r, clampYPosToChartArea: a, valToPos: u }) => {
|
|
667
|
+
const l = [], d = n();
|
|
668
|
+
for (const c of t) {
|
|
669
|
+
const p = r(u(c.x, e)), y = a(u(c.y, o));
|
|
670
|
+
l.push({ x: p, y });
|
|
671
|
+
}
|
|
672
|
+
const f = l.at(0), m = l.at(-1);
|
|
673
|
+
if (!f || !m)
|
|
674
|
+
return;
|
|
675
|
+
const h = a(u(0, o));
|
|
676
|
+
d.save(), d.beginPath(), X(d, i), d.moveTo(f.x, h);
|
|
677
|
+
for (const c of l)
|
|
678
|
+
d.lineTo(c.x, c.y);
|
|
679
|
+
if (d.lineTo(m.x, h), d.closePath(), d.fill(), s) {
|
|
680
|
+
d.beginPath(), d.moveTo(f.x, f.y);
|
|
681
|
+
for (const c of l)
|
|
682
|
+
d.lineTo(c.x, c.y);
|
|
683
|
+
d.stroke();
|
|
684
|
+
}
|
|
685
|
+
d.restore();
|
|
686
|
+
},
|
|
687
|
+
[t, s, e, o, i]
|
|
688
|
+
), null), ve = (t, s) => pt(
|
|
689
|
+
({
|
|
690
|
+
clampXPosToChartArea: e,
|
|
691
|
+
clampYPosToChartArea: o,
|
|
692
|
+
getScale: i,
|
|
693
|
+
valToPos: n,
|
|
694
|
+
valFits: r
|
|
695
|
+
}) => {
|
|
696
|
+
const a = {};
|
|
697
|
+
for (const u in t) {
|
|
698
|
+
const l = t[u];
|
|
699
|
+
switch (l.exceeding) {
|
|
700
|
+
case "discard": {
|
|
701
|
+
if (r(l.value, l.scaleId)) {
|
|
702
|
+
const d = n(l.value, l.scaleId, s);
|
|
703
|
+
a[u] = d;
|
|
704
|
+
}
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
case "clamp": {
|
|
708
|
+
const d = n(l.value, l.scaleId, s);
|
|
709
|
+
a[u] = i(l.scaleId)?.origin === "x" ? e(d, s) : o(d, s);
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return a;
|
|
715
|
+
}
|
|
716
|
+
), T = () => {
|
|
717
|
+
const t = [];
|
|
718
|
+
return {
|
|
719
|
+
addEventListener: (s, e) => (t.push({
|
|
720
|
+
syncKey: s,
|
|
721
|
+
callback: e
|
|
722
|
+
}), () => {
|
|
723
|
+
const o = t.findIndex((i) => i.callback === e);
|
|
724
|
+
o !== -1 && t.splice(o, 1);
|
|
725
|
+
}),
|
|
726
|
+
dispatchEvent: (s, e) => {
|
|
727
|
+
for (const o of t)
|
|
728
|
+
o.syncKey === s && o.callback(s, e);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
}, w = {
|
|
732
|
+
dblclick: T(),
|
|
733
|
+
click: T(),
|
|
734
|
+
move: T(),
|
|
735
|
+
mousedown: T(),
|
|
736
|
+
mouseup: T(),
|
|
737
|
+
spanselect: T(),
|
|
738
|
+
documentmouseup: T(),
|
|
739
|
+
pressandwheel: T(),
|
|
740
|
+
sync_dblclick: T(),
|
|
741
|
+
sync_click: T(),
|
|
742
|
+
sync_move: T(),
|
|
743
|
+
sync_mousedown: T(),
|
|
744
|
+
sync_mouseup: T(),
|
|
745
|
+
sync_spanselect: T(),
|
|
746
|
+
sync_pressandwheel: T()
|
|
747
|
+
}, b = (t, s, e) => {
|
|
748
|
+
const o = G.useRef(e);
|
|
749
|
+
o.current = e, G.useEffect(() => w[t].addEventListener(
|
|
750
|
+
s,
|
|
751
|
+
(n, r) => {
|
|
752
|
+
o.current(r, n);
|
|
753
|
+
}
|
|
754
|
+
), [s, t, o]);
|
|
755
|
+
}, mt = G.createContext(""), ft = (t, s) => {
|
|
756
|
+
const e = G.useContext(mt);
|
|
757
|
+
return b(t, e, s);
|
|
758
|
+
}, le = (t, s, e, o, i) => {
|
|
759
|
+
if (!s) return;
|
|
760
|
+
const n = o ?? e.scales.find((f) => f.origin === "x")?.id, r = i ?? e.scales.find((f) => f.origin === "y")?.id;
|
|
761
|
+
if (!n || !r)
|
|
762
|
+
return;
|
|
763
|
+
const a = t.clientX - s.left, u = {
|
|
764
|
+
scaleId: n,
|
|
765
|
+
value: L(e, a, n, "css")
|
|
766
|
+
}, l = t.clientY - s.top, d = {
|
|
767
|
+
scaleId: r,
|
|
768
|
+
value: L(e, l, r, "css")
|
|
769
|
+
};
|
|
770
|
+
return { pointerSyncPosition: { x: u, y: d }, cssX: a, cssY: l };
|
|
771
|
+
}, Y = (t, s) => {
|
|
772
|
+
const e = t.x ? K(
|
|
773
|
+
s,
|
|
774
|
+
t.x.value,
|
|
775
|
+
t.x.scaleId,
|
|
776
|
+
"css"
|
|
777
|
+
) : 0, o = t.y ? K(
|
|
778
|
+
s,
|
|
779
|
+
t.y.value,
|
|
780
|
+
t.y.scaleId,
|
|
781
|
+
"css"
|
|
782
|
+
) : 0;
|
|
783
|
+
return {
|
|
784
|
+
cssX: e,
|
|
785
|
+
cssY: o,
|
|
786
|
+
scaled: Object.fromEntries(
|
|
787
|
+
s.scales.map((i) => {
|
|
788
|
+
const n = i.origin === "y" ? o : e;
|
|
789
|
+
return [i.id, L(s, n, i.id, "css")];
|
|
790
|
+
})
|
|
791
|
+
)
|
|
792
|
+
};
|
|
793
|
+
}, wt = (t, s, e) => {
|
|
794
|
+
if (!s) {
|
|
795
|
+
const r = t === "x" ? e.chartAreaCSS.x : e.chartAreaCSS.y, a = t === "x" ? e.chartAreaCSS.x + e.chartAreaCSS.width : e.chartAreaCSS.y + e.chartAreaCSS.height;
|
|
796
|
+
return {
|
|
797
|
+
fromCSS: r,
|
|
798
|
+
toCSS: a,
|
|
799
|
+
scaled: e.scales.flatMap((u) => {
|
|
800
|
+
if (u.origin !== t)
|
|
801
|
+
return [];
|
|
802
|
+
const { min: l, max: d } = A(e, u.id);
|
|
803
|
+
return [{ scaleId: u.id, from: l, to: d }];
|
|
804
|
+
})
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
const o = K(
|
|
808
|
+
e,
|
|
809
|
+
s.from,
|
|
810
|
+
s.scaleId,
|
|
811
|
+
"css"
|
|
812
|
+
), i = K(
|
|
813
|
+
e,
|
|
814
|
+
s.to,
|
|
815
|
+
s.scaleId,
|
|
816
|
+
"css"
|
|
817
|
+
), n = e.scales.flatMap(
|
|
818
|
+
(r) => {
|
|
819
|
+
if (r.origin !== t)
|
|
820
|
+
return [];
|
|
821
|
+
const a = L(e, o, r.id, "css"), u = L(e, i, r.id, "css");
|
|
822
|
+
return [
|
|
823
|
+
{
|
|
824
|
+
scaleId: r.id,
|
|
825
|
+
from: a,
|
|
826
|
+
to: u
|
|
827
|
+
}
|
|
828
|
+
];
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
return {
|
|
832
|
+
fromCSS: o,
|
|
833
|
+
toCSS: i,
|
|
834
|
+
scaled: n
|
|
835
|
+
};
|
|
836
|
+
}, Ce = ({
|
|
837
|
+
id: t,
|
|
838
|
+
onClick: s,
|
|
839
|
+
onDblClick: e,
|
|
840
|
+
onMouseMove: o,
|
|
841
|
+
onMouseDown: i,
|
|
842
|
+
onMouseUp: n,
|
|
843
|
+
onDocumentMouseUp: r,
|
|
844
|
+
onSpanSelect: a,
|
|
845
|
+
className: u,
|
|
846
|
+
style: l,
|
|
847
|
+
sync: d,
|
|
848
|
+
children: f
|
|
849
|
+
}) => {
|
|
850
|
+
const m = Dt(), h = t || m;
|
|
851
|
+
return b("dblclick", h, (c) => {
|
|
852
|
+
e?.(c);
|
|
853
|
+
}), b("click", h, (c) => {
|
|
854
|
+
s?.(c);
|
|
855
|
+
}), b("move", h, (c) => {
|
|
856
|
+
o?.(c);
|
|
857
|
+
}), b("mousedown", h, (c) => {
|
|
858
|
+
i?.(c);
|
|
859
|
+
}), b("mouseup", h, (c) => {
|
|
860
|
+
n?.(c);
|
|
861
|
+
}), b("documentmouseup", h, (c) => {
|
|
862
|
+
r?.(c);
|
|
863
|
+
}), b("spanselect", h, (c) => {
|
|
864
|
+
a?.(c);
|
|
865
|
+
}), /* @__PURE__ */ at(mt, { value: h, children: [
|
|
866
|
+
/* @__PURE__ */ D(
|
|
867
|
+
ue,
|
|
868
|
+
{
|
|
869
|
+
className: u,
|
|
870
|
+
style: l,
|
|
871
|
+
sync: d
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
f
|
|
875
|
+
] });
|
|
876
|
+
}, ue = ({ className: t, style: s, sync: e }) => {
|
|
877
|
+
const o = U(null), i = pt(), n = U(i);
|
|
878
|
+
n.current = i;
|
|
879
|
+
const r = lt(mt), a = e?.key || r, u = U(null), l = U(null), d = U(null), f = () => {
|
|
880
|
+
const c = o.current?.parentElement;
|
|
881
|
+
if (c) {
|
|
882
|
+
if (c.dataset.canplotroot === void 0)
|
|
883
|
+
throw new Error(
|
|
884
|
+
"ChartAreaInteractions must be used within a CanPlot component"
|
|
885
|
+
);
|
|
886
|
+
return c.getBoundingClientRect();
|
|
887
|
+
}
|
|
888
|
+
}, m = (c, p) => {
|
|
889
|
+
const y = le(
|
|
890
|
+
c,
|
|
891
|
+
f(),
|
|
892
|
+
n.current,
|
|
893
|
+
e?.xViaScaleId,
|
|
894
|
+
e?.yViaScaleId
|
|
895
|
+
);
|
|
896
|
+
y && p(
|
|
897
|
+
y.pointerSyncPosition,
|
|
898
|
+
{ cssX: y.cssX, cssY: y.cssY },
|
|
899
|
+
{
|
|
900
|
+
ctrlKey: c.ctrlKey,
|
|
901
|
+
altKey: c.altKey,
|
|
902
|
+
shiftKey: c.shiftKey,
|
|
903
|
+
metaKey: c.metaKey
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
}, h = U(m);
|
|
907
|
+
return h.current = m, Xt(() => {
|
|
908
|
+
const c = (S) => {
|
|
909
|
+
const g = l.current;
|
|
910
|
+
g && w.sync_spanselect.dispatchEvent(a, {
|
|
911
|
+
...g,
|
|
912
|
+
completed: !0
|
|
913
|
+
}), w.documentmouseup.dispatchEvent(a, {
|
|
914
|
+
frame: n.current,
|
|
915
|
+
keys: {
|
|
916
|
+
ctrlKey: S.ctrlKey,
|
|
917
|
+
altKey: S.altKey,
|
|
918
|
+
shiftKey: S.shiftKey,
|
|
919
|
+
metaKey: S.metaKey
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
}, p = (S) => {
|
|
923
|
+
const g = {
|
|
924
|
+
ctrlKey: S.ctrlKey,
|
|
925
|
+
altKey: S.altKey,
|
|
926
|
+
shiftKey: S.shiftKey,
|
|
927
|
+
metaKey: S.metaKey
|
|
928
|
+
}, k = d.current;
|
|
929
|
+
if (k && Object.entries(g).some(
|
|
930
|
+
([E, M]) => k.keys[E] !== M
|
|
931
|
+
)) {
|
|
932
|
+
const E = { ...k, keys: g };
|
|
933
|
+
d.current = E, w.sync_move.dispatchEvent(a, E);
|
|
934
|
+
}
|
|
935
|
+
const v = l.current;
|
|
936
|
+
if (v && Object.entries(g).some(
|
|
937
|
+
([E, M]) => v.keys[E] !== M
|
|
938
|
+
)) {
|
|
939
|
+
S.stopPropagation(), S.preventDefault();
|
|
940
|
+
const E = { ...v, keys: g };
|
|
941
|
+
l.current = E, w.sync_spanselect.dispatchEvent(
|
|
942
|
+
a,
|
|
943
|
+
E
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
}, y = (S) => {
|
|
947
|
+
h.current(
|
|
948
|
+
S,
|
|
949
|
+
(g, { cssX: k, cssY: v }, E) => {
|
|
950
|
+
const M = u.current;
|
|
951
|
+
if (!M || !g.x || !g.y) return;
|
|
952
|
+
const _ = n.current, P = M.xRangeCss.start, B = k, F = M.yRangeCss.start, et = v, st = A(_, g.x.scaleId), nt = A(_, g.y.scaleId);
|
|
953
|
+
u.current = {
|
|
954
|
+
xRangeCss: { start: P, end: B },
|
|
955
|
+
yRangeCss: { start: F, end: et }
|
|
956
|
+
};
|
|
957
|
+
let R = "none";
|
|
958
|
+
const ot = Math.abs(F - et), it = Math.abs(P - B);
|
|
959
|
+
ot < 10 && it < 10 ? R = "none" : ot > 30 && it > 30 ? R = "box" : ot > it ? R = "y" : R = "x";
|
|
960
|
+
const Pt = R === "x" || R === "box" ? {
|
|
961
|
+
scaleId: st.id,
|
|
962
|
+
from: L(
|
|
963
|
+
_,
|
|
964
|
+
O(n.current, P, "css"),
|
|
965
|
+
st.id,
|
|
966
|
+
"css"
|
|
967
|
+
),
|
|
968
|
+
to: L(
|
|
969
|
+
_,
|
|
970
|
+
O(n.current, B, "css"),
|
|
971
|
+
st.id,
|
|
972
|
+
"css"
|
|
973
|
+
)
|
|
974
|
+
} : void 0, At = R === "y" || R === "box" ? {
|
|
975
|
+
scaleId: nt.id,
|
|
976
|
+
from: L(
|
|
977
|
+
_,
|
|
978
|
+
$(n.current, F, "css"),
|
|
979
|
+
nt.id,
|
|
980
|
+
"css"
|
|
981
|
+
),
|
|
982
|
+
to: L(
|
|
983
|
+
_,
|
|
984
|
+
$(n.current, et, "css"),
|
|
985
|
+
nt.id,
|
|
986
|
+
"css"
|
|
987
|
+
)
|
|
988
|
+
} : void 0, yt = {
|
|
989
|
+
mode: R,
|
|
990
|
+
xRange: Pt,
|
|
991
|
+
yRange: At,
|
|
992
|
+
completed: !1,
|
|
993
|
+
keys: E
|
|
994
|
+
};
|
|
995
|
+
l.current = yt, w.sync_spanselect.dispatchEvent(
|
|
996
|
+
a,
|
|
997
|
+
yt
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
);
|
|
1001
|
+
}, x = (S) => {
|
|
1002
|
+
h.current(S, (g, k, v) => {
|
|
1003
|
+
if (Object.values(v).some((M) => M)) {
|
|
1004
|
+
S.preventDefault();
|
|
1005
|
+
const M = Math.abs(S.deltaY) > Math.abs(S.deltaX) ? S.deltaY : S.deltaX;
|
|
1006
|
+
w.sync_pressandwheel.dispatchEvent(a, {
|
|
1007
|
+
positions: g,
|
|
1008
|
+
keys: v,
|
|
1009
|
+
deltaX: S.deltaX,
|
|
1010
|
+
deltaY: S.deltaY,
|
|
1011
|
+
deltaAbs: M
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
};
|
|
1016
|
+
document.addEventListener("mouseup", c), document.addEventListener("keydown", p), document.addEventListener("keyup", p), document.addEventListener("mousemove", y);
|
|
1017
|
+
const C = o.current;
|
|
1018
|
+
return C?.addEventListener("wheel", x, {
|
|
1019
|
+
passive: !1
|
|
1020
|
+
}), () => {
|
|
1021
|
+
document.removeEventListener("mouseup", c), document.removeEventListener("keydown", p), document.removeEventListener("keyup", p), document.removeEventListener("mousemove", y), C?.removeEventListener("wheel", x);
|
|
1022
|
+
};
|
|
1023
|
+
}, [n, a, h]), b("sync_dblclick", a, (c) => {
|
|
1024
|
+
const p = Y(
|
|
1025
|
+
c.positions,
|
|
1026
|
+
n.current
|
|
1027
|
+
);
|
|
1028
|
+
p && w.dblclick.dispatchEvent(r, {
|
|
1029
|
+
frame: n.current,
|
|
1030
|
+
pointer: p,
|
|
1031
|
+
keys: c.keys
|
|
1032
|
+
});
|
|
1033
|
+
}), b("sync_click", a, (c) => {
|
|
1034
|
+
const p = Y(
|
|
1035
|
+
c.positions,
|
|
1036
|
+
n.current
|
|
1037
|
+
);
|
|
1038
|
+
p && w.click.dispatchEvent(r, {
|
|
1039
|
+
frame: n.current,
|
|
1040
|
+
pointer: p,
|
|
1041
|
+
keys: c.keys
|
|
1042
|
+
});
|
|
1043
|
+
}), b("sync_move", a, (c) => {
|
|
1044
|
+
const p = c.positions ? Y(
|
|
1045
|
+
c.positions,
|
|
1046
|
+
n.current
|
|
1047
|
+
) : null;
|
|
1048
|
+
d.current = c, w.move.dispatchEvent(r, {
|
|
1049
|
+
frame: n.current,
|
|
1050
|
+
pointer: p ?? null,
|
|
1051
|
+
keys: c.keys
|
|
1052
|
+
});
|
|
1053
|
+
}), b("sync_mousedown", a, (c) => {
|
|
1054
|
+
const p = Y(
|
|
1055
|
+
c.positions,
|
|
1056
|
+
n.current
|
|
1057
|
+
);
|
|
1058
|
+
p && w.mousedown.dispatchEvent(r, {
|
|
1059
|
+
frame: n.current,
|
|
1060
|
+
pointer: p,
|
|
1061
|
+
keys: c.keys
|
|
1062
|
+
});
|
|
1063
|
+
}), b("sync_mouseup", a, (c) => {
|
|
1064
|
+
const p = Y(
|
|
1065
|
+
c.positions,
|
|
1066
|
+
n.current
|
|
1067
|
+
);
|
|
1068
|
+
p && w.mouseup.dispatchEvent(r, {
|
|
1069
|
+
frame: n.current,
|
|
1070
|
+
pointer: p,
|
|
1071
|
+
keys: c.keys
|
|
1072
|
+
});
|
|
1073
|
+
}), b(
|
|
1074
|
+
"sync_pressandwheel",
|
|
1075
|
+
a,
|
|
1076
|
+
(c) => {
|
|
1077
|
+
const p = Y(
|
|
1078
|
+
c.positions,
|
|
1079
|
+
n.current
|
|
1080
|
+
);
|
|
1081
|
+
p && w.pressandwheel.dispatchEvent(r, {
|
|
1082
|
+
frame: n.current,
|
|
1083
|
+
pointer: p,
|
|
1084
|
+
keys: c.keys,
|
|
1085
|
+
deltaX: c.deltaX,
|
|
1086
|
+
deltaY: c.deltaY,
|
|
1087
|
+
deltaAbs: c.deltaAbs
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
), b("sync_spanselect", a, (c) => {
|
|
1091
|
+
const p = wt(
|
|
1092
|
+
"x",
|
|
1093
|
+
c.xRange,
|
|
1094
|
+
n.current
|
|
1095
|
+
), y = wt(
|
|
1096
|
+
"y",
|
|
1097
|
+
c.yRange,
|
|
1098
|
+
n.current
|
|
1099
|
+
), x = p.scaled, C = y.scaled;
|
|
1100
|
+
c.completed && (u.current = null), w.spanselect.dispatchEvent(r, {
|
|
1101
|
+
mode: c.mode,
|
|
1102
|
+
frame: n.current,
|
|
1103
|
+
xRanges: x,
|
|
1104
|
+
yRanges: C,
|
|
1105
|
+
completed: c.completed,
|
|
1106
|
+
x: { fromCSS: p.fromCSS, toCSS: p.toCSS },
|
|
1107
|
+
y: { fromCSS: y.fromCSS, toCSS: y.toCSS },
|
|
1108
|
+
keys: c.keys
|
|
1109
|
+
});
|
|
1110
|
+
}), /* @__PURE__ */ D(
|
|
1111
|
+
"div",
|
|
1112
|
+
{
|
|
1113
|
+
ref: o,
|
|
1114
|
+
id: "interactions",
|
|
1115
|
+
className: t,
|
|
1116
|
+
style: {
|
|
1117
|
+
position: "absolute",
|
|
1118
|
+
left: i.chartAreaCSS.x,
|
|
1119
|
+
top: i.chartAreaCSS.y,
|
|
1120
|
+
width: i.chartAreaCSS.width,
|
|
1121
|
+
height: i.chartAreaCSS.height,
|
|
1122
|
+
zIndex: 25,
|
|
1123
|
+
...s
|
|
1124
|
+
},
|
|
1125
|
+
onClick: (c) => {
|
|
1126
|
+
m(c, (p, y, x) => {
|
|
1127
|
+
w.sync_click.dispatchEvent(a, {
|
|
1128
|
+
positions: p,
|
|
1129
|
+
keys: x
|
|
1130
|
+
});
|
|
1131
|
+
});
|
|
1132
|
+
},
|
|
1133
|
+
onMouseLeave: (c) => {
|
|
1134
|
+
m(c, (p, y, x) => {
|
|
1135
|
+
w.sync_move.dispatchEvent(a, {
|
|
1136
|
+
positions: null,
|
|
1137
|
+
keys: x
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
},
|
|
1141
|
+
onMouseMove: (c) => {
|
|
1142
|
+
m(c, (p, y, x) => {
|
|
1143
|
+
w.sync_move.dispatchEvent(a, {
|
|
1144
|
+
positions: p,
|
|
1145
|
+
keys: x
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
},
|
|
1149
|
+
onMouseDown: (c) => {
|
|
1150
|
+
m(c, (p, { cssX: y, cssY: x }, C) => {
|
|
1151
|
+
w.sync_mousedown.dispatchEvent(a, {
|
|
1152
|
+
positions: p,
|
|
1153
|
+
keys: C
|
|
1154
|
+
}), l.current = null, u.current = {
|
|
1155
|
+
xRangeCss: { start: y, end: y },
|
|
1156
|
+
yRangeCss: { start: x, end: x }
|
|
1157
|
+
};
|
|
1158
|
+
});
|
|
1159
|
+
},
|
|
1160
|
+
onMouseUp: (c) => {
|
|
1161
|
+
m(c, (p, y, x) => {
|
|
1162
|
+
w.sync_mouseup.dispatchEvent(a, {
|
|
1163
|
+
positions: p,
|
|
1164
|
+
keys: x
|
|
1165
|
+
});
|
|
1166
|
+
const C = l.current;
|
|
1167
|
+
l.current = null;
|
|
1168
|
+
const S = u.current;
|
|
1169
|
+
if (u.current = null, S && C) {
|
|
1170
|
+
const g = {
|
|
1171
|
+
...C,
|
|
1172
|
+
keys: x,
|
|
1173
|
+
completed: !0
|
|
1174
|
+
};
|
|
1175
|
+
w.sync_spanselect.dispatchEvent(
|
|
1176
|
+
a,
|
|
1177
|
+
g
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
},
|
|
1182
|
+
onDoubleClick: (c) => {
|
|
1183
|
+
m(c, (p, y, x) => {
|
|
1184
|
+
w.sync_dblclick.dispatchEvent(a, {
|
|
1185
|
+
positions: p,
|
|
1186
|
+
keys: x
|
|
1187
|
+
});
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
);
|
|
1192
|
+
}, Te = ({ data: t, renderTooltip: s, xScaleId: e }) => {
|
|
1193
|
+
const [o, i] = N(null);
|
|
1194
|
+
ft("move", (r) => {
|
|
1195
|
+
i(r);
|
|
1196
|
+
});
|
|
1197
|
+
const n = vt(() => {
|
|
1198
|
+
if (!o)
|
|
1199
|
+
return null;
|
|
1200
|
+
const { frame: r, pointer: a } = o, u = a?.scaled[e];
|
|
1201
|
+
if (u === void 0)
|
|
1202
|
+
return null;
|
|
1203
|
+
const l = [];
|
|
1204
|
+
let d = u;
|
|
1205
|
+
for (const f of t) {
|
|
1206
|
+
let m = null, h = 1 / 0;
|
|
1207
|
+
for (const [p, y] of f.points.entries()) {
|
|
1208
|
+
if (!ct(r, y.x, e) || !ct(r, y.y, f.yScaleId))
|
|
1209
|
+
continue;
|
|
1210
|
+
const x = Math.abs(y.x - u);
|
|
1211
|
+
x < h && (h = x, m = p);
|
|
1212
|
+
}
|
|
1213
|
+
const c = f.points[m ?? -1];
|
|
1214
|
+
if (!c || ut(r, h, e, "css") > 30) {
|
|
1215
|
+
l.push({ seriesId: f.seriesId, y: null });
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
d = c.x, l.push({
|
|
1219
|
+
seriesId: f.seriesId,
|
|
1220
|
+
y: c.y
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
return {
|
|
1224
|
+
frame: r,
|
|
1225
|
+
x: d,
|
|
1226
|
+
points: l
|
|
1227
|
+
};
|
|
1228
|
+
}, [t, o, e]);
|
|
1229
|
+
return s(n);
|
|
1230
|
+
}, be = ({ makeXStyle: t, makeXClassName: s, makeYStyle: e, makeYClassName: o }) => {
|
|
1231
|
+
const [i, n] = N(null);
|
|
1232
|
+
if (ft("move", (d) => {
|
|
1233
|
+
n(d);
|
|
1234
|
+
}), !i)
|
|
1235
|
+
return null;
|
|
1236
|
+
const { frame: r, pointer: a } = i, u = O(r, a?.cssX ?? 0, "css"), l = $(r, a?.cssY ?? 0, "css");
|
|
1237
|
+
return /* @__PURE__ */ at(_t, { children: [
|
|
1238
|
+
/* @__PURE__ */ D(
|
|
1239
|
+
"div",
|
|
1240
|
+
{
|
|
1241
|
+
"data-show": !!a,
|
|
1242
|
+
className: s?.(i),
|
|
1243
|
+
style: {
|
|
1244
|
+
position: "absolute",
|
|
1245
|
+
left: 0,
|
|
1246
|
+
top: r.chartAreaCSS.y,
|
|
1247
|
+
height: r.chartAreaCSS.height,
|
|
1248
|
+
borderColor: "red",
|
|
1249
|
+
borderLeftWidth: "1px",
|
|
1250
|
+
borderLeftStyle: "solid",
|
|
1251
|
+
pointerEvents: "none",
|
|
1252
|
+
opacity: a ? 1 : 0,
|
|
1253
|
+
transform: `translateX(${u}px)`,
|
|
1254
|
+
...t?.(i)
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
/* @__PURE__ */ D(
|
|
1259
|
+
"div",
|
|
1260
|
+
{
|
|
1261
|
+
className: o?.(i),
|
|
1262
|
+
"data-show": !!a,
|
|
1263
|
+
style: {
|
|
1264
|
+
position: "absolute",
|
|
1265
|
+
top: 0,
|
|
1266
|
+
height: 0,
|
|
1267
|
+
borderTop: "solid 1px red",
|
|
1268
|
+
left: r.chartAreaCSS.x,
|
|
1269
|
+
width: r.chartAreaCSS.width,
|
|
1270
|
+
pointerEvents: "none",
|
|
1271
|
+
opacity: a ? 1 : 0,
|
|
1272
|
+
transform: `translateY(${l}px)`,
|
|
1273
|
+
...e?.(i)
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
] });
|
|
1278
|
+
}, ke = ({ makeClassName: t, makeStyle: s }) => {
|
|
1279
|
+
const [e, o] = N(null);
|
|
1280
|
+
if (ft("spanselect", (m) => {
|
|
1281
|
+
o(m.mode === "none" || m.completed ? null : m);
|
|
1282
|
+
}), !e)
|
|
1283
|
+
return null;
|
|
1284
|
+
const i = O(
|
|
1285
|
+
e.frame,
|
|
1286
|
+
e.x.fromCSS,
|
|
1287
|
+
"css"
|
|
1288
|
+
), n = O(
|
|
1289
|
+
e.frame,
|
|
1290
|
+
e.x.toCSS,
|
|
1291
|
+
"css"
|
|
1292
|
+
), r = $(
|
|
1293
|
+
e.frame,
|
|
1294
|
+
e.y.fromCSS,
|
|
1295
|
+
"css"
|
|
1296
|
+
), a = $(
|
|
1297
|
+
e.frame,
|
|
1298
|
+
e.y.toCSS,
|
|
1299
|
+
"css"
|
|
1300
|
+
), u = Math.min(i, n), l = Math.min(r, a), d = Math.abs(n - i), f = Math.abs(a - r);
|
|
1301
|
+
return /* @__PURE__ */ D(
|
|
1302
|
+
"div",
|
|
1303
|
+
{
|
|
1304
|
+
className: t?.(e),
|
|
1305
|
+
style: {
|
|
1306
|
+
position: "absolute",
|
|
1307
|
+
backgroundColor: "#0000ff22",
|
|
1308
|
+
left: `${u}px`,
|
|
1309
|
+
top: `${l}px`,
|
|
1310
|
+
width: `${d}px`,
|
|
1311
|
+
height: `${f}px`,
|
|
1312
|
+
pointerEvents: "none",
|
|
1313
|
+
...s?.(e)
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
);
|
|
1317
|
+
}, Ee = ({ style: t, children: s, scaleId: e, ...o }) => {
|
|
1318
|
+
const i = pt((n) => n.getScale(e)?.axis);
|
|
1319
|
+
return i ? /* @__PURE__ */ D(
|
|
1320
|
+
"div",
|
|
1321
|
+
{
|
|
1322
|
+
style: {
|
|
1323
|
+
position: "absolute",
|
|
1324
|
+
backgroundColor: "#0000ff11",
|
|
1325
|
+
left: i.cssRect.x,
|
|
1326
|
+
top: i.cssRect.y,
|
|
1327
|
+
height: i.cssRect.height,
|
|
1328
|
+
width: i.cssRect.width,
|
|
1329
|
+
...t
|
|
1330
|
+
},
|
|
1331
|
+
...o,
|
|
1332
|
+
children: s
|
|
1333
|
+
}
|
|
1334
|
+
) : null;
|
|
1335
|
+
};
|
|
1336
|
+
export {
|
|
1337
|
+
ge as AreaPlot,
|
|
1338
|
+
Ee as AxisOverlay,
|
|
1339
|
+
Se as BarPlot,
|
|
1340
|
+
fe as CanPlot,
|
|
1341
|
+
Ce as ChartAreaInteractions,
|
|
1342
|
+
be as Crosshair,
|
|
1343
|
+
ye as LinePlot,
|
|
1344
|
+
xe as ScatterPlot,
|
|
1345
|
+
ke as SelectBox,
|
|
1346
|
+
we as SparklinePlot,
|
|
1347
|
+
Te as TooltipsX,
|
|
1348
|
+
X as applyStyles,
|
|
1349
|
+
O as clampXPosToChartArea,
|
|
1350
|
+
$ as clampYPosToChartArea,
|
|
1351
|
+
A as getScale,
|
|
1352
|
+
V as isXScale,
|
|
1353
|
+
me as isYScale,
|
|
1354
|
+
L as posToVal,
|
|
1355
|
+
Ft as pxToValDistance,
|
|
1356
|
+
ve as usePositioned,
|
|
1357
|
+
ct as valFits,
|
|
1358
|
+
K as valToPos,
|
|
1359
|
+
ut as valToPxDistance
|
|
1360
|
+
};
|
|
1361
|
+
//# sourceMappingURL=canplot.mjs.map
|