@canplot/react 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CanPlot.d.ts.map +1 -1
- package/dist/canplot.cjs +3 -3
- package/dist/canplot.cjs.map +1 -1
- package/dist/canplot.mjs +369 -366
- package/dist/canplot.mjs.map +1 -1
- package/package.json +1 -1
package/dist/canplot.mjs
CHANGED
|
@@ -2,14 +2,14 @@ var Oe = Object.defineProperty;
|
|
|
2
2
|
var Ke = (e, t, n) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var K = (e, t, n) => Ke(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsxs as pe, jsx as R, Fragment as Fe } from "react/jsx-runtime";
|
|
5
|
-
import D, { version as Ye, createContext as ye, forwardRef as
|
|
5
|
+
import D, { version as Ye, createContext as ye, forwardRef as Be, useRef as A, useState as B, useMemo as J, useLayoutEffect as $, useCallback as ze, useContext as q, useId as Ne, useEffect as $e } from "react";
|
|
6
6
|
const G = (e, t, n) => Math.min(Math.max(e, t), n), Mt = (e) => e.reduce((t, n) => t + (n ?? 0), 0), Et = (e, t) => {
|
|
7
7
|
let n = 0;
|
|
8
8
|
for (let s = 0; s < e.length; s++)
|
|
9
9
|
Math.abs(e[s] - t) < Math.abs(e[n] - t) && (n = s);
|
|
10
10
|
return n;
|
|
11
11
|
}, je = (e, t, n, s) => {
|
|
12
|
-
const { min: o, max:
|
|
12
|
+
const { min: o, max: c, origin: r } = X(e, n), i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, a = (r === "x" ? i.width : i.height) / (c - o);
|
|
13
13
|
return t / a;
|
|
14
14
|
}, X = (e, t) => {
|
|
15
15
|
const n = e.scales.find((s) => s.id === t);
|
|
@@ -20,18 +20,18 @@ const G = (e, t, n) => Math.min(Math.max(e, t), n), Mt = (e) => e.reduce((t, n)
|
|
|
20
20
|
const n = window.devicePixelRatio || 1;
|
|
21
21
|
e.lineCap = t?.lineCap ?? "butt", e.lineDashOffset = n * (t?.lineDashOffset ?? 0), e.lineJoin = t?.lineJoin ?? "miter", e.lineWidth = n * (t?.lineWidth ?? 1), e.miterLimit = n * (t?.miterLimit ?? 10), e.strokeStyle = t?.strokeStyle ?? "black", e.fillStyle = t?.fillStyle ?? e.strokeStyle, e.font = t?.font ?? `${10 * n}px sans-serif`, e.textAlign = t?.textAlign ?? "start", e.direction = t?.direction ?? "inherit", e.textBaseline = t?.textBaseline ?? "alphabetic", e.fontKerning = t?.fontKerning ?? "auto";
|
|
22
22
|
}, ge = (e, t, n, s) => {
|
|
23
|
-
const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, { min:
|
|
23
|
+
const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, { min: c, max: r, origin: i } = X(e, n), a = (i === "x" ? o.width : o.height) / (r - c);
|
|
24
24
|
return t * a;
|
|
25
25
|
}, Z = (e, t, n, s) => {
|
|
26
|
-
const { min: o, origin:
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const { min: o, origin: c } = X(e, n), r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = ge(e, t - o, n, s);
|
|
27
|
+
return c === "x" ? G(
|
|
28
|
+
r.x + i,
|
|
29
|
+
r.x - 10 * r.width,
|
|
30
|
+
r.x + 11 * r.width
|
|
31
31
|
) : G(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
r.y + r.height - i,
|
|
33
|
+
r.y - 10 * r.height,
|
|
34
|
+
r.y + 11 * r.height
|
|
35
35
|
);
|
|
36
36
|
}, kt = (e, t, n) => {
|
|
37
37
|
const { min: s, max: o } = X(e, n);
|
|
@@ -46,8 +46,8 @@ const G = (e, t, n) => Math.min(Math.max(e, t), n), Mt = (e) => e.reduce((t, n)
|
|
|
46
46
|
const { min: s, max: o } = X(e, n);
|
|
47
47
|
return t >= s && t <= o;
|
|
48
48
|
}, _ = (e, t, n, s) => {
|
|
49
|
-
const { min: o, max:
|
|
50
|
-
return o + a * (
|
|
49
|
+
const { min: o, max: c, origin: r } = X(e, n), i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, a = r === "x" ? (t - i.x) / i.width : (i.height - t + i.y) / i.height;
|
|
50
|
+
return o + a * (c - o);
|
|
51
51
|
}, O = (e, t) => {
|
|
52
52
|
if (e === t) return !0;
|
|
53
53
|
if (e == null || t == null || typeof e != typeof t || typeof e != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
@@ -77,12 +77,12 @@ const G = (e, t, n) => Math.min(Math.max(e, t), n), Mt = (e) => e.reduce((t, n)
|
|
|
77
77
|
if (s.axis.position === "bottom")
|
|
78
78
|
t.beginPath(), t.moveTo(o.x, o.y), t.lineTo(o.x + o.width, o.y), t.stroke();
|
|
79
79
|
else if (s.axis.position === "top") {
|
|
80
|
-
const
|
|
81
|
-
t.beginPath(), t.moveTo(o.x,
|
|
80
|
+
const c = o.y + o.height;
|
|
81
|
+
t.beginPath(), t.moveTo(o.x, c), t.lineTo(o.x + o.width, c), t.stroke();
|
|
82
82
|
}
|
|
83
83
|
} else if (s.axis.position === "left") {
|
|
84
|
-
const
|
|
85
|
-
t.beginPath(), t.moveTo(
|
|
84
|
+
const c = o.x + o.width;
|
|
85
|
+
t.beginPath(), t.moveTo(c, o.y), t.lineTo(c, o.y + o.height), t.stroke();
|
|
86
86
|
} else s.axis.position === "right" && (t.beginPath(), t.moveTo(o.x, o.y), t.lineTo(o.x, o.y + o.height), t.stroke());
|
|
87
87
|
t.restore();
|
|
88
88
|
}
|
|
@@ -96,8 +96,8 @@ function We(e) {
|
|
|
96
96
|
return (t) => {
|
|
97
97
|
const n = [];
|
|
98
98
|
for (const s of e) {
|
|
99
|
-
const o = me(s, t),
|
|
100
|
-
n.push(
|
|
99
|
+
const o = me(s, t), c = typeof o == "function";
|
|
100
|
+
n.push(c ? o : () => me(s, null));
|
|
101
101
|
}
|
|
102
102
|
return () => {
|
|
103
103
|
for (const s of n) s();
|
|
@@ -118,9 +118,9 @@ const Ee = ye({
|
|
|
118
118
|
}
|
|
119
119
|
}), Ge = () => {
|
|
120
120
|
const e = [];
|
|
121
|
-
return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((c, r) => c[0] - r[0]), () => {
|
|
122
|
+
const c = e.findIndex(([, r]) => r === s);
|
|
123
|
+
c !== -1 && e.splice(c, 1);
|
|
124
124
|
}), notifyListeners: () => {
|
|
125
125
|
for (const [, s] of e)
|
|
126
126
|
s();
|
|
@@ -154,16 +154,19 @@ class Re {
|
|
|
154
154
|
return this.frame.ctx;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
const At =
|
|
158
|
-
const
|
|
157
|
+
const At = Be(({ configuration: e, children: t, style: n, className: s }, o) => {
|
|
158
|
+
const c = A(null), r = A(null), i = Je(r), [a, u] = B(null), m = J(
|
|
159
|
+
() => Qe(e, i, a),
|
|
160
|
+
[e, i, a]
|
|
161
|
+
);
|
|
159
162
|
$(() => {
|
|
160
|
-
|
|
161
|
-
}, [
|
|
162
|
-
const
|
|
163
|
+
u(c.current?.getContext("2d") || null);
|
|
164
|
+
}, [c]);
|
|
165
|
+
const h = window.devicePixelRatio || 1;
|
|
163
166
|
return /* @__PURE__ */ pe(
|
|
164
167
|
"div",
|
|
165
168
|
{
|
|
166
|
-
ref: qe([o,
|
|
169
|
+
ref: qe([o, r]),
|
|
167
170
|
className: s,
|
|
168
171
|
style: {
|
|
169
172
|
position: "relative",
|
|
@@ -175,9 +178,9 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
175
178
|
/* @__PURE__ */ R(
|
|
176
179
|
"canvas",
|
|
177
180
|
{
|
|
178
|
-
ref:
|
|
179
|
-
width: i.width *
|
|
180
|
-
height: i.height *
|
|
181
|
+
ref: c,
|
|
182
|
+
width: i.width * h,
|
|
183
|
+
height: i.height * h,
|
|
181
184
|
style: {
|
|
182
185
|
inset: 0,
|
|
183
186
|
position: "absolute",
|
|
@@ -186,7 +189,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
),
|
|
189
|
-
|
|
192
|
+
m && /* @__PURE__ */ R(Ze, { frame: m, children: t })
|
|
190
193
|
]
|
|
191
194
|
}
|
|
192
195
|
);
|
|
@@ -194,14 +197,14 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
194
197
|
frame: e,
|
|
195
198
|
children: t
|
|
196
199
|
}) => {
|
|
197
|
-
const n =
|
|
200
|
+
const n = J(Ge, []), [s, o] = B(0);
|
|
198
201
|
$(() => {
|
|
199
202
|
e?.ctx.clearRect(0, 0, e.ctx.canvas.width, e.ctx.canvas.height);
|
|
200
203
|
}, [e, s]);
|
|
201
|
-
const
|
|
202
|
-
|
|
204
|
+
const c = A(null);
|
|
205
|
+
c.current = e, $(() => {
|
|
203
206
|
n.subscribe(() => {
|
|
204
|
-
|
|
207
|
+
c.current && Ve(c.current);
|
|
205
208
|
}, Ae.BOTTOM);
|
|
206
209
|
}, [n]), $(() => {
|
|
207
210
|
let i = null;
|
|
@@ -211,75 +214,75 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
211
214
|
i && cancelAnimationFrame(i);
|
|
212
215
|
};
|
|
213
216
|
}, [s, e, n]);
|
|
214
|
-
const
|
|
217
|
+
const r = ze(() => {
|
|
215
218
|
o((i) => i + 1);
|
|
216
219
|
}, [o]);
|
|
217
|
-
return /* @__PURE__ */ R(Ee.Provider, { value: n, children: /* @__PURE__ */ R(ke.Provider, { value:
|
|
220
|
+
return /* @__PURE__ */ R(Ee.Provider, { value: n, children: /* @__PURE__ */ R(ke.Provider, { value: r, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
|
|
218
221
|
}, Je = (e) => {
|
|
219
|
-
const [t, n] =
|
|
222
|
+
const [t, n] = B({
|
|
220
223
|
width: 0,
|
|
221
224
|
height: 0
|
|
222
|
-
}), [s] =
|
|
223
|
-
for (const
|
|
224
|
-
const
|
|
225
|
+
}), [s] = B(() => new ResizeObserver((o) => {
|
|
226
|
+
for (const c of o) {
|
|
227
|
+
const r = Math.round(c.contentRect.width), i = Math.round(c.contentRect.height);
|
|
225
228
|
n(
|
|
226
|
-
(a) => a.width !==
|
|
229
|
+
(a) => a.width !== r || a.height !== i ? { ...a, width: r, height: i } : a
|
|
227
230
|
);
|
|
228
231
|
}
|
|
229
232
|
}));
|
|
230
233
|
return $(() => {
|
|
231
234
|
if (!e.current) return;
|
|
232
|
-
const o = e.current.clientWidth,
|
|
235
|
+
const o = e.current.clientWidth, c = e.current.clientHeight;
|
|
233
236
|
return n(
|
|
234
|
-
(
|
|
237
|
+
(r) => r.width !== o || r.height !== c ? { ...r, width: o, height: c } : r
|
|
235
238
|
), s.observe(e.current, { box: "border-box" }), () => s.disconnect();
|
|
236
239
|
}, [s, e]), t;
|
|
237
240
|
}, Qe = (e, t, n) => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
+
if (!n)
|
|
242
|
+
return null;
|
|
243
|
+
const s = window.devicePixelRatio || 1;
|
|
241
244
|
if (t.width === 0 || t.height === 0)
|
|
242
245
|
return null;
|
|
243
|
-
const
|
|
246
|
+
const o = {
|
|
244
247
|
x: e.padding.left,
|
|
245
248
|
y: e.padding.top,
|
|
246
249
|
width: t.width - e.padding.left - e.padding.right,
|
|
247
250
|
height: t.height - e.padding.top - e.padding.bottom
|
|
248
251
|
};
|
|
249
|
-
for (const
|
|
250
|
-
|
|
252
|
+
for (const l of e.scales)
|
|
253
|
+
l.axis && (l.origin === "x" ? (l.axis.position === "bottom" || l.axis.position === "top") && (o.height = Math.max(
|
|
251
254
|
0,
|
|
252
|
-
|
|
253
|
-
),
|
|
255
|
+
o.height - l.axis.size
|
|
256
|
+
), l.axis.position === "top" && (o.y += l.axis.size)) : (l.axis.position === "left" || l.axis.position === "right") && (o.width = Math.max(0, o.width - l.axis.size), l.axis.position === "left" && (o.x += l.axis.size)));
|
|
254
257
|
const c = {
|
|
255
|
-
x:
|
|
256
|
-
y:
|
|
257
|
-
width:
|
|
258
|
-
height:
|
|
259
|
-
},
|
|
260
|
-
let
|
|
261
|
-
for (const
|
|
262
|
-
if (!
|
|
263
|
-
|
|
258
|
+
x: o.x * s,
|
|
259
|
+
y: o.y * s,
|
|
260
|
+
width: o.width * s,
|
|
261
|
+
height: o.height * s
|
|
262
|
+
}, r = [];
|
|
263
|
+
let i = e.padding.left * s, a = t.width * s - e.padding.right * s, u = t.height * s - e.padding.bottom * s, m = e.padding.top * s;
|
|
264
|
+
for (const l of e.scales) {
|
|
265
|
+
if (!l.axis) {
|
|
266
|
+
r.push({ ...l, axis: null });
|
|
264
267
|
continue;
|
|
265
268
|
}
|
|
266
|
-
let
|
|
267
|
-
if (
|
|
268
|
-
switch (
|
|
269
|
+
let p;
|
|
270
|
+
if (l.origin === "x")
|
|
271
|
+
switch (l.axis.position) {
|
|
269
272
|
case "bottom":
|
|
270
|
-
|
|
271
|
-
x:
|
|
272
|
-
y:
|
|
273
|
-
width:
|
|
274
|
-
height:
|
|
273
|
+
u -= l.axis.size * s, p = {
|
|
274
|
+
x: o.x,
|
|
275
|
+
y: u / s,
|
|
276
|
+
width: o.width,
|
|
277
|
+
height: l.axis.size
|
|
275
278
|
};
|
|
276
279
|
break;
|
|
277
280
|
case "top":
|
|
278
|
-
|
|
279
|
-
x:
|
|
280
|
-
y:
|
|
281
|
-
width:
|
|
282
|
-
height:
|
|
281
|
+
m += l.axis.size * s, p = {
|
|
282
|
+
x: o.x,
|
|
283
|
+
y: m / s - l.axis.size,
|
|
284
|
+
width: o.width,
|
|
285
|
+
height: l.axis.size
|
|
283
286
|
};
|
|
284
287
|
break;
|
|
285
288
|
case "left":
|
|
@@ -287,84 +290,84 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
287
290
|
throw new Error("Invalid axis position for x origin");
|
|
288
291
|
}
|
|
289
292
|
else
|
|
290
|
-
switch (
|
|
293
|
+
switch (l.axis.position) {
|
|
291
294
|
case "left":
|
|
292
|
-
|
|
293
|
-
x:
|
|
294
|
-
y:
|
|
295
|
-
width:
|
|
296
|
-
height:
|
|
295
|
+
i += l.axis.size * s, p = {
|
|
296
|
+
x: i / s - l.axis.size,
|
|
297
|
+
y: o.y,
|
|
298
|
+
width: l.axis.size,
|
|
299
|
+
height: o.height
|
|
297
300
|
};
|
|
298
301
|
break;
|
|
299
302
|
case "right":
|
|
300
|
-
|
|
301
|
-
x:
|
|
302
|
-
y:
|
|
303
|
-
width:
|
|
304
|
-
height:
|
|
303
|
+
a -= l.axis.size * s, p = {
|
|
304
|
+
x: a / s,
|
|
305
|
+
y: o.y,
|
|
306
|
+
width: l.axis.size,
|
|
307
|
+
height: o.height
|
|
305
308
|
};
|
|
306
309
|
break;
|
|
307
310
|
case "top":
|
|
308
311
|
case "bottom":
|
|
309
312
|
throw new Error("Invalid axis position for y origin");
|
|
310
313
|
}
|
|
311
|
-
const
|
|
312
|
-
x:
|
|
313
|
-
y:
|
|
314
|
-
width:
|
|
315
|
-
height:
|
|
314
|
+
const d = {
|
|
315
|
+
x: p.x * s,
|
|
316
|
+
y: p.y * s,
|
|
317
|
+
width: p.width * s,
|
|
318
|
+
height: p.height * s
|
|
316
319
|
};
|
|
317
|
-
|
|
318
|
-
...
|
|
320
|
+
r.push({
|
|
321
|
+
...l,
|
|
319
322
|
axis: {
|
|
320
|
-
...
|
|
321
|
-
cssRect:
|
|
322
|
-
canvasRect:
|
|
323
|
+
...l.axis,
|
|
324
|
+
cssRect: p,
|
|
325
|
+
canvasRect: d
|
|
323
326
|
}
|
|
324
327
|
});
|
|
325
328
|
}
|
|
326
329
|
return {
|
|
327
|
-
ctx:
|
|
328
|
-
dpr:
|
|
330
|
+
ctx: n,
|
|
331
|
+
dpr: s,
|
|
329
332
|
padding: e.padding,
|
|
330
|
-
scales:
|
|
331
|
-
chartAreaCSS:
|
|
333
|
+
scales: r,
|
|
334
|
+
chartAreaCSS: o,
|
|
332
335
|
chartAreaCanvasPX: c
|
|
333
336
|
};
|
|
334
337
|
}, j = (e, t, n) => {
|
|
335
|
-
const s = q(ve), o = q(ke),
|
|
338
|
+
const s = q(ve), o = q(ke), c = q(Ee);
|
|
336
339
|
if (!s || !o)
|
|
337
340
|
throw new Error("useFrame must be used within a CanPlot component");
|
|
338
|
-
const [
|
|
339
|
-
|
|
340
|
-
const i = A(
|
|
341
|
-
i.current =
|
|
341
|
+
const [r] = B(() => new Re());
|
|
342
|
+
r._updateFrame(s);
|
|
343
|
+
const i = A(r);
|
|
344
|
+
i.current = r;
|
|
342
345
|
const a = A(t);
|
|
343
|
-
a.current = t, $(() =>
|
|
346
|
+
a.current = t, $(() => c.subscribe(
|
|
344
347
|
() => {
|
|
345
|
-
a.current(
|
|
348
|
+
a.current(r);
|
|
346
349
|
},
|
|
347
350
|
typeof e == "number" ? e : Ae[e]
|
|
348
|
-
), [
|
|
351
|
+
), [c, e, r]), $(() => {
|
|
349
352
|
o();
|
|
350
353
|
}, [o, ...n]);
|
|
351
354
|
}, De = () => {
|
|
352
355
|
const e = q(ve);
|
|
353
356
|
if (!e)
|
|
354
357
|
throw new Error("useFrame must be used within a CanPlot component");
|
|
355
|
-
return
|
|
358
|
+
return J(() => {
|
|
356
359
|
const t = new Re();
|
|
357
360
|
return t._updateFrame(e), t;
|
|
358
361
|
}, [e]);
|
|
359
362
|
}, et = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
|
|
360
363
|
e,
|
|
361
|
-
({ ctx:
|
|
362
|
-
|
|
363
|
-
for (const
|
|
364
|
-
const m =
|
|
365
|
-
|
|
364
|
+
({ ctx: c, clampXPosToChartArea: r, clampYPosToChartArea: i, valToPos: a }) => {
|
|
365
|
+
c.save(), c.beginPath(), U(c, o);
|
|
366
|
+
for (const u of t) {
|
|
367
|
+
const m = r(a(u.x, n)), h = i(a(u.y, s));
|
|
368
|
+
c.lineTo(m, h);
|
|
366
369
|
}
|
|
367
|
-
|
|
370
|
+
c.stroke(), c.restore();
|
|
368
371
|
},
|
|
369
372
|
[t, n, s, o]
|
|
370
373
|
), null), Rt = D.memo(et, O), tt = ({
|
|
@@ -373,141 +376,141 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
373
376
|
xScaleId: n,
|
|
374
377
|
yScaleId: s,
|
|
375
378
|
xStrategy: o = "clip",
|
|
376
|
-
yStrategy:
|
|
377
|
-
radius:
|
|
379
|
+
yStrategy: c = "clip",
|
|
380
|
+
radius: r = 5,
|
|
378
381
|
style: i,
|
|
379
382
|
globalAlpha: a
|
|
380
383
|
}) => (j(
|
|
381
384
|
e,
|
|
382
385
|
({
|
|
383
|
-
ctx:
|
|
386
|
+
ctx: u,
|
|
384
387
|
valToPos: m,
|
|
385
|
-
valFits:
|
|
386
|
-
clampXPosToChartArea:
|
|
387
|
-
clampYPosToChartArea:
|
|
388
|
+
valFits: h,
|
|
389
|
+
clampXPosToChartArea: l,
|
|
390
|
+
clampYPosToChartArea: p
|
|
388
391
|
}) => {
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
U(
|
|
392
|
+
u.save(), u.beginPath();
|
|
393
|
+
const d = new Path2D();
|
|
394
|
+
U(u, i), a !== void 0 && (u.globalAlpha = a);
|
|
392
395
|
for (const y of t) {
|
|
393
396
|
let f, g;
|
|
394
397
|
switch (o) {
|
|
395
398
|
case "clip":
|
|
396
|
-
if (!
|
|
399
|
+
if (!h(y.x, n))
|
|
397
400
|
continue;
|
|
398
401
|
f = m(y.x, n);
|
|
399
402
|
break;
|
|
400
403
|
case "clamp":
|
|
401
|
-
f =
|
|
404
|
+
f = l(m(y.x, n), "canvas");
|
|
402
405
|
break;
|
|
403
406
|
}
|
|
404
|
-
switch (
|
|
407
|
+
switch (c) {
|
|
405
408
|
case "clip":
|
|
406
|
-
if (!
|
|
409
|
+
if (!h(y.y, s))
|
|
407
410
|
continue;
|
|
408
411
|
g = m(y.y, s);
|
|
409
412
|
break;
|
|
410
413
|
case "clamp":
|
|
411
|
-
g =
|
|
414
|
+
g = p(m(y.y, s), "canvas");
|
|
412
415
|
break;
|
|
413
416
|
}
|
|
414
|
-
|
|
417
|
+
d.moveTo(f + r, g), d.arc(f, g, r, 0, Math.PI * 2);
|
|
415
418
|
}
|
|
416
|
-
|
|
419
|
+
u.fill(d), u.stroke(d), u.restore();
|
|
417
420
|
},
|
|
418
|
-
[t, n, s,
|
|
421
|
+
[t, n, s, r, i, a]
|
|
419
422
|
), null), Dt = D.memo(tt, O), nt = ({
|
|
420
423
|
data: e,
|
|
421
424
|
xScaleId: t,
|
|
422
425
|
yScaleId: n,
|
|
423
426
|
style: s,
|
|
424
427
|
barWidth: o,
|
|
425
|
-
xPositionOffset:
|
|
426
|
-
radius:
|
|
428
|
+
xPositionOffset: c,
|
|
429
|
+
radius: r,
|
|
427
430
|
layer: i = "MIDDLE"
|
|
428
431
|
}) => (j(
|
|
429
432
|
i,
|
|
430
433
|
({
|
|
431
434
|
ctx: a,
|
|
432
|
-
valToPxDistance:
|
|
435
|
+
valToPxDistance: u,
|
|
433
436
|
valToPos: m,
|
|
434
|
-
clampXPosToChartArea:
|
|
435
|
-
clampYPosToChartArea:
|
|
437
|
+
clampXPosToChartArea: h,
|
|
438
|
+
clampYPosToChartArea: l
|
|
436
439
|
}) => {
|
|
437
440
|
if (e.length === 0) return;
|
|
438
441
|
a.save(), U(a, s);
|
|
439
|
-
const
|
|
442
|
+
const p = u(o, t);
|
|
440
443
|
a.beginPath();
|
|
441
|
-
for (const
|
|
442
|
-
const f = m(
|
|
443
|
-
|
|
444
|
+
for (const d of e) {
|
|
445
|
+
const f = m(d.x, t) - p / 2 + c * p, g = l(m(0, n)), w = l(m(d.y, n)), T = g - w, x = h(f), v = h(f + p) - x;
|
|
446
|
+
r ? a.roundRect(
|
|
444
447
|
x,
|
|
445
448
|
w,
|
|
446
449
|
v,
|
|
447
450
|
T,
|
|
448
|
-
|
|
451
|
+
r
|
|
449
452
|
) : a.rect(x, w, v, T);
|
|
450
453
|
}
|
|
451
454
|
a.closePath(), a.fill(), s?.strokeStyle && a.stroke(), a.restore();
|
|
452
455
|
},
|
|
453
|
-
[e, t, n, s, o,
|
|
456
|
+
[e, t, n, s, o, c, r]
|
|
454
457
|
), null), It = D.memo(nt, O), st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
|
|
455
458
|
e,
|
|
456
|
-
({ ctx:
|
|
457
|
-
const
|
|
458
|
-
for (const
|
|
459
|
-
const
|
|
460
|
-
|
|
459
|
+
({ ctx: c, clampXPosToChartArea: r, clampYPosToChartArea: i, valToPos: a }) => {
|
|
460
|
+
const u = [];
|
|
461
|
+
for (const h of t) {
|
|
462
|
+
const l = r(a(h.x, n)), p = i(a(h.y[0], s)), d = i(a(h.y[1], s));
|
|
463
|
+
u.push({ x: l, y: p }), u.unshift({ x: l, y: d });
|
|
461
464
|
}
|
|
462
|
-
const m =
|
|
465
|
+
const m = u[0];
|
|
463
466
|
if (m) {
|
|
464
|
-
|
|
465
|
-
for (const
|
|
466
|
-
|
|
467
|
-
|
|
467
|
+
c.save(), c.beginPath(), U(c, o), c.moveTo(m.x, m.y);
|
|
468
|
+
for (const h of u)
|
|
469
|
+
c.lineTo(h.x, h.y);
|
|
470
|
+
c.closePath(), c.fill(), c.restore();
|
|
468
471
|
}
|
|
469
472
|
},
|
|
470
473
|
[t, n, s, o]
|
|
471
|
-
), null), Lt = D.memo(st, O), ot = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style:
|
|
474
|
+
), null), Lt = D.memo(st, O), ot = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: c }) => (j(
|
|
472
475
|
e,
|
|
473
|
-
({ ctx:
|
|
476
|
+
({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: a, valToPos: u }) => {
|
|
474
477
|
const m = [];
|
|
475
|
-
for (const
|
|
476
|
-
const y = i(
|
|
478
|
+
for (const d of t) {
|
|
479
|
+
const y = i(u(d.x, s)), f = a(u(d.y, o));
|
|
477
480
|
m.push({ x: y, y: f });
|
|
478
481
|
}
|
|
479
|
-
const
|
|
480
|
-
if (!
|
|
482
|
+
const h = m.at(0), l = m.at(-1);
|
|
483
|
+
if (!h || !l)
|
|
481
484
|
return;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
for (const
|
|
485
|
-
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
for (const
|
|
489
|
-
|
|
490
|
-
|
|
485
|
+
const p = a(u(0, o));
|
|
486
|
+
r.save(), r.beginPath(), U(r, c), r.moveTo(h.x, p);
|
|
487
|
+
for (const d of m)
|
|
488
|
+
r.lineTo(d.x, d.y);
|
|
489
|
+
if (r.lineTo(l.x, p), r.closePath(), r.fill(), n) {
|
|
490
|
+
r.beginPath(), r.moveTo(h.x, h.y);
|
|
491
|
+
for (const d of m)
|
|
492
|
+
r.lineTo(d.x, d.y);
|
|
493
|
+
r.stroke();
|
|
491
494
|
}
|
|
492
|
-
|
|
495
|
+
r.restore();
|
|
493
496
|
},
|
|
494
|
-
[t, n, s, o,
|
|
495
|
-
), null), Ut = D.memo(ot, O), rt = ({ layer: e = "BOTTOM", scaleId: t, tickStyle: n, labelStyle: s, labelGap: o, tickSize:
|
|
497
|
+
[t, n, s, o, c]
|
|
498
|
+
), null), Ut = D.memo(ot, O), rt = ({ layer: e = "BOTTOM", scaleId: t, tickStyle: n, labelStyle: s, labelGap: o, tickSize: c, ticks: r }) => (j(
|
|
496
499
|
e,
|
|
497
|
-
({ ctx: i, valToPos: a, getScale:
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
500
|
-
const
|
|
500
|
+
({ ctx: i, valToPos: a, getScale: u, frame: m }) => {
|
|
501
|
+
const h = u(t);
|
|
502
|
+
if (!h || !h.axis || h.origin !== "x") return;
|
|
503
|
+
const l = h.axis, p = l.position === "top" ? l.canvasRect.y + l.canvasRect.height : l.canvasRect.y, d = window.devicePixelRatio || 1, y = p, f = (c ?? 6) * d, g = l.position === "top" ? p - f : p + f, w = (o ?? 12) * d;
|
|
501
504
|
i.save(), i.fontKerning = "auto", U(i, {
|
|
502
505
|
...n
|
|
503
506
|
}), i.beginPath();
|
|
504
|
-
const T = Array.isArray(
|
|
507
|
+
const T = Array.isArray(r) ? r : r({ ...h, axis: l }, m);
|
|
505
508
|
for (const { value: x } of T) {
|
|
506
509
|
const v = a(x, t, "canvas");
|
|
507
510
|
i.moveTo(v, y), i.lineTo(v, g);
|
|
508
511
|
}
|
|
509
512
|
i.stroke(), i.restore(), i.save(), U(i, {
|
|
510
|
-
textBaseline:
|
|
513
|
+
textBaseline: l.position === "top" ? "bottom" : "top",
|
|
511
514
|
textAlign: "center",
|
|
512
515
|
...n,
|
|
513
516
|
...s
|
|
@@ -516,25 +519,25 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
516
519
|
const b = a(x, t, "canvas"), S = v.split(`
|
|
517
520
|
`);
|
|
518
521
|
for (let E = 0; E < S.length; E++)
|
|
519
|
-
i.fillText(S[E], b, g +
|
|
522
|
+
i.fillText(S[E], b, g + d * 2 + E * w);
|
|
520
523
|
}
|
|
521
524
|
i.restore();
|
|
522
525
|
},
|
|
523
|
-
[
|
|
524
|
-
), null), _t = D.memo(rt, O), it = ({ layer: e = "BOTTOM", scaleId: t, tickStyle: n, labelStyle: s, labelGap: o, tickSize:
|
|
526
|
+
[r, t, n, s]
|
|
527
|
+
), null), _t = D.memo(rt, O), it = ({ layer: e = "BOTTOM", scaleId: t, tickStyle: n, labelStyle: s, labelGap: o, tickSize: c, ticks: r }) => (j(
|
|
525
528
|
e,
|
|
526
|
-
({ ctx: i, valToPos: a, getScale:
|
|
527
|
-
const
|
|
528
|
-
if (!
|
|
529
|
-
const
|
|
529
|
+
({ ctx: i, valToPos: a, getScale: u, frame: m }) => {
|
|
530
|
+
const h = u(t);
|
|
531
|
+
if (!h || !h.axis || h.origin !== "y") return;
|
|
532
|
+
const l = h.axis, p = l.position === "left" ? l.canvasRect.x + l.canvasRect.width : l.canvasRect.x, d = p, y = c ?? 6, f = l.position === "left" ? p - y : p + y, g = o ?? 12, w = Array.isArray(r) ? r : r({ ...h, axis: l }, m);
|
|
530
533
|
i.save(), i.fontKerning = "auto", U(i, { ...n }), i.beginPath();
|
|
531
534
|
for (const { value: T } of w) {
|
|
532
535
|
const x = a(T, t, "canvas");
|
|
533
|
-
i.moveTo(
|
|
536
|
+
i.moveTo(d, x), i.lineTo(f, x);
|
|
534
537
|
}
|
|
535
538
|
i.stroke(), i.restore(), i.save(), U(i, {
|
|
536
539
|
textBaseline: "middle",
|
|
537
|
-
textAlign:
|
|
540
|
+
textAlign: l.position === "left" ? "right" : "left",
|
|
538
541
|
...n,
|
|
539
542
|
...s
|
|
540
543
|
});
|
|
@@ -546,7 +549,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
546
549
|
}
|
|
547
550
|
i.restore();
|
|
548
551
|
},
|
|
549
|
-
[
|
|
552
|
+
[r, t, n, s]
|
|
550
553
|
), null), Xt = D.memo(it, O), I = () => {
|
|
551
554
|
const e = [];
|
|
552
555
|
return {
|
|
@@ -577,8 +580,8 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
577
580
|
const s = D.useRef(n);
|
|
578
581
|
s.current = n, D.useEffect(() => M[e].addEventListener(
|
|
579
582
|
t,
|
|
580
|
-
(
|
|
581
|
-
s.current(
|
|
583
|
+
(c, r) => {
|
|
584
|
+
s.current(r, c);
|
|
582
585
|
}
|
|
583
586
|
), [t, e, s]);
|
|
584
587
|
}, we = D.createContext(""), xe = (e, t) => {
|
|
@@ -586,23 +589,23 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
586
589
|
return L(e, n, t);
|
|
587
590
|
}, ct = (e, t, n, s, o) => {
|
|
588
591
|
if (!t) return;
|
|
589
|
-
const
|
|
590
|
-
scaleId: r,
|
|
591
|
-
value: _(n, i, r, "css")
|
|
592
|
-
} : null, l = e.clientY - t.top, m = c ? {
|
|
592
|
+
const c = s ?? n.scales.find((h) => h.origin === "x")?.id, r = o ?? n.scales.find((h) => h.origin === "y")?.id, i = e.clientX - t.left, a = c ? {
|
|
593
593
|
scaleId: c,
|
|
594
|
-
value: _(n,
|
|
594
|
+
value: _(n, i, c, "css")
|
|
595
|
+
} : null, u = e.clientY - t.top, m = r ? {
|
|
596
|
+
scaleId: r,
|
|
597
|
+
value: _(n, u, r, "css")
|
|
595
598
|
} : null;
|
|
596
|
-
return { pointerSyncPosition: { x: a, y: m }, cssX: i, cssY:
|
|
599
|
+
return { pointerSyncPosition: { x: a, y: m }, cssX: i, cssY: u };
|
|
597
600
|
}, N = (e, t) => {
|
|
598
|
-
const { x: n, y: s } = e, o = n && t.scales.some((
|
|
601
|
+
const { x: n, y: s } = e, o = n && t.scales.some((r) => r.id === n.scaleId) ? Z(t, n.value, n.scaleId, "css") : null, c = s && t.scales.some((r) => r.id === s.scaleId) ? Z(t, s.value, s.scaleId, "css") : null;
|
|
599
602
|
return {
|
|
600
603
|
cssX: o,
|
|
601
|
-
cssY:
|
|
604
|
+
cssY: c,
|
|
602
605
|
scaled: Object.fromEntries(
|
|
603
|
-
t.scales.flatMap((
|
|
604
|
-
const i =
|
|
605
|
-
return i === null ? [] : [[
|
|
606
|
+
t.scales.flatMap((r) => {
|
|
607
|
+
const i = r.origin === "y" ? c : o;
|
|
608
|
+
return i === null ? [] : [[r.id, _(t, i, r.id, "css")]];
|
|
606
609
|
})
|
|
607
610
|
)
|
|
608
611
|
};
|
|
@@ -617,14 +620,14 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
617
620
|
t.to,
|
|
618
621
|
t.scaleId,
|
|
619
622
|
"css"
|
|
620
|
-
),
|
|
621
|
-
(
|
|
622
|
-
if (
|
|
623
|
+
), c = n.scales.flatMap(
|
|
624
|
+
(r) => {
|
|
625
|
+
if (r.origin !== e)
|
|
623
626
|
return [];
|
|
624
|
-
const i = _(n, s,
|
|
627
|
+
const i = _(n, s, r.id, "css"), a = _(n, o, r.id, "css");
|
|
625
628
|
return [
|
|
626
629
|
{
|
|
627
|
-
scaleId:
|
|
630
|
+
scaleId: r.id,
|
|
628
631
|
from: i,
|
|
629
632
|
to: a
|
|
630
633
|
}
|
|
@@ -634,7 +637,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
634
637
|
return {
|
|
635
638
|
fromCSS: s,
|
|
636
639
|
toCSS: o,
|
|
637
|
-
scaled:
|
|
640
|
+
scaled: c
|
|
638
641
|
};
|
|
639
642
|
}, Ot = ({
|
|
640
643
|
id: e,
|
|
@@ -642,51 +645,51 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
642
645
|
onDblClick: n,
|
|
643
646
|
onMouseMove: s,
|
|
644
647
|
onMouseDown: o,
|
|
645
|
-
onMouseUp:
|
|
646
|
-
onDocumentMouseUp:
|
|
648
|
+
onMouseUp: c,
|
|
649
|
+
onDocumentMouseUp: r,
|
|
647
650
|
onSpanSelect: i,
|
|
648
651
|
onContextMenu: a,
|
|
649
|
-
className:
|
|
652
|
+
className: u,
|
|
650
653
|
style: m,
|
|
651
|
-
sync:
|
|
652
|
-
innerChildren:
|
|
653
|
-
children:
|
|
654
|
+
sync: h,
|
|
655
|
+
innerChildren: l,
|
|
656
|
+
children: p
|
|
654
657
|
}) => {
|
|
655
|
-
const
|
|
656
|
-
return L("dblclick",
|
|
658
|
+
const d = Ne();
|
|
659
|
+
return L("dblclick", d, (y) => {
|
|
657
660
|
n?.(y);
|
|
658
|
-
}), L("click",
|
|
661
|
+
}), L("click", d, (y) => {
|
|
659
662
|
t?.(y);
|
|
660
|
-
}), L("move",
|
|
663
|
+
}), L("move", d, (y) => {
|
|
661
664
|
s?.(y);
|
|
662
|
-
}), L("mousedown",
|
|
665
|
+
}), L("mousedown", d, (y) => {
|
|
663
666
|
o?.(y);
|
|
664
|
-
}), L("mouseup",
|
|
665
|
-
r?.(y);
|
|
666
|
-
}), L("documentmouseup", h, (y) => {
|
|
667
|
+
}), L("mouseup", d, (y) => {
|
|
667
668
|
c?.(y);
|
|
668
|
-
}), L("
|
|
669
|
+
}), L("documentmouseup", d, (y) => {
|
|
670
|
+
r?.(y);
|
|
671
|
+
}), L("spanselect", d, (y) => {
|
|
669
672
|
i?.(y);
|
|
670
|
-
}), L("contextmenu",
|
|
673
|
+
}), L("contextmenu", d, (y) => {
|
|
671
674
|
a?.(y);
|
|
672
|
-
}), /* @__PURE__ */ pe(we.Provider, { value:
|
|
675
|
+
}), /* @__PURE__ */ pe(we.Provider, { value: d, children: [
|
|
673
676
|
/* @__PURE__ */ R(
|
|
674
677
|
at,
|
|
675
678
|
{
|
|
676
679
|
id: e,
|
|
677
|
-
className:
|
|
680
|
+
className: u,
|
|
678
681
|
style: m,
|
|
679
|
-
sync:
|
|
680
|
-
children:
|
|
682
|
+
sync: h,
|
|
683
|
+
children: l
|
|
681
684
|
}
|
|
682
685
|
),
|
|
683
|
-
|
|
686
|
+
p
|
|
684
687
|
] });
|
|
685
688
|
}, at = ({ id: e, className: t, style: n, sync: s, children: o }) => {
|
|
686
|
-
const
|
|
687
|
-
i.current =
|
|
688
|
-
const a = q(we),
|
|
689
|
-
const f =
|
|
689
|
+
const c = A(null), r = De().frame, i = A(r);
|
|
690
|
+
i.current = r;
|
|
691
|
+
const a = q(we), u = s?.key || a, m = A(null), h = A(null), l = A(null), p = () => {
|
|
692
|
+
const f = c.current?.parentElement;
|
|
690
693
|
if (f) {
|
|
691
694
|
if (f.dataset.canplotroot === void 0)
|
|
692
695
|
throw new Error(
|
|
@@ -694,10 +697,10 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
694
697
|
);
|
|
695
698
|
return f.getBoundingClientRect();
|
|
696
699
|
}
|
|
697
|
-
},
|
|
700
|
+
}, d = (f, g) => {
|
|
698
701
|
const w = ct(
|
|
699
702
|
f,
|
|
700
|
-
|
|
703
|
+
p(),
|
|
701
704
|
i.current,
|
|
702
705
|
s?.xViaScaleId,
|
|
703
706
|
s?.yViaScaleId
|
|
@@ -712,10 +715,10 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
712
715
|
metaKey: f.metaKey
|
|
713
716
|
}
|
|
714
717
|
);
|
|
715
|
-
}, y = A(
|
|
716
|
-
return y.current =
|
|
718
|
+
}, y = A(d);
|
|
719
|
+
return y.current = d, $e(() => {
|
|
717
720
|
const f = (v) => {
|
|
718
|
-
const b =
|
|
721
|
+
const b = h.current;
|
|
719
722
|
b && M.spanselect.dispatchEvent(a, {
|
|
720
723
|
...b,
|
|
721
724
|
completed: !0
|
|
@@ -734,20 +737,20 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
734
737
|
altKey: v.altKey,
|
|
735
738
|
shiftKey: v.shiftKey,
|
|
736
739
|
metaKey: v.metaKey
|
|
737
|
-
}, S =
|
|
740
|
+
}, S = l.current;
|
|
738
741
|
if (S && Object.entries(b).some(
|
|
739
742
|
([C, P]) => S.keys[C] !== P
|
|
740
743
|
)) {
|
|
741
744
|
const C = { ...S, keys: b };
|
|
742
|
-
|
|
745
|
+
l.current = C, M.sync_move.dispatchEvent(u, C);
|
|
743
746
|
}
|
|
744
|
-
const E =
|
|
747
|
+
const E = h.current;
|
|
745
748
|
if (E && Object.entries(b).some(
|
|
746
749
|
([C, P]) => E.keys[C] !== P
|
|
747
750
|
)) {
|
|
748
751
|
v.stopPropagation(), v.preventDefault();
|
|
749
752
|
const C = { ...E, keys: b };
|
|
750
|
-
|
|
753
|
+
h.current = C, M.spanselect.dispatchEvent(a, C);
|
|
751
754
|
}
|
|
752
755
|
}, w = (v) => {
|
|
753
756
|
y.current(
|
|
@@ -755,19 +758,19 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
755
758
|
(b, { cssX: S, cssY: E }, C) => {
|
|
756
759
|
const P = m.current;
|
|
757
760
|
if (!P || !b.x || !b.y) return;
|
|
758
|
-
const k = i.current,
|
|
761
|
+
const k = i.current, z = P.xRangeCss.start, ie = S, ce = P.yRangeCss.start, ae = E, le = X(k, b.x.scaleId), ue = X(k, b.y.scaleId);
|
|
759
762
|
m.current = {
|
|
760
|
-
xRangeCss: { start:
|
|
763
|
+
xRangeCss: { start: z, end: ie },
|
|
761
764
|
yRangeCss: { start: ce, end: ae }
|
|
762
765
|
};
|
|
763
766
|
let W = "below_threshold";
|
|
764
|
-
const he = Math.abs(ce - ae), de = Math.abs(
|
|
767
|
+
const he = Math.abs(ce - ae), de = Math.abs(z - ie);
|
|
765
768
|
he < 10 && de < 10 ? W = "below_threshold" : he > 30 && de > 30 ? W = "box" : he > de ? W = "y" : W = "x";
|
|
766
769
|
const Te = {
|
|
767
770
|
scaleId: le.id,
|
|
768
771
|
from: _(
|
|
769
772
|
k,
|
|
770
|
-
V(i.current,
|
|
773
|
+
V(i.current, z, "css"),
|
|
771
774
|
le.id,
|
|
772
775
|
"css"
|
|
773
776
|
),
|
|
@@ -791,27 +794,27 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
791
794
|
ue.id,
|
|
792
795
|
"css"
|
|
793
796
|
)
|
|
794
|
-
},
|
|
797
|
+
}, Q = Te && Pe("x", Te, i.current), ee = Se && Pe("y", Se, i.current), _e = Q?.scaled, Xe = ee?.scaled, Ce = {
|
|
795
798
|
mode: W,
|
|
796
799
|
frame: i.current,
|
|
797
800
|
completed: !1,
|
|
798
801
|
x: {
|
|
799
|
-
css:
|
|
800
|
-
from:
|
|
801
|
-
to:
|
|
802
|
+
css: Q && {
|
|
803
|
+
from: Q.fromCSS,
|
|
804
|
+
to: Q.toCSS
|
|
802
805
|
},
|
|
803
806
|
scaled: _e ?? []
|
|
804
807
|
},
|
|
805
808
|
y: {
|
|
806
|
-
css:
|
|
807
|
-
from:
|
|
808
|
-
to:
|
|
809
|
+
css: ee && {
|
|
810
|
+
from: ee.fromCSS,
|
|
811
|
+
to: ee.toCSS
|
|
809
812
|
},
|
|
810
813
|
scaled: Xe ?? []
|
|
811
814
|
},
|
|
812
815
|
keys: C
|
|
813
816
|
};
|
|
814
|
-
|
|
817
|
+
h.current = Ce, M.spanselect.dispatchEvent(
|
|
815
818
|
a,
|
|
816
819
|
Ce
|
|
817
820
|
);
|
|
@@ -839,18 +842,18 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
839
842
|
});
|
|
840
843
|
};
|
|
841
844
|
document.addEventListener("mouseup", f), document.addEventListener("keydown", g), document.addEventListener("keyup", g), document.addEventListener("mousemove", w);
|
|
842
|
-
const x =
|
|
845
|
+
const x = c.current;
|
|
843
846
|
return x?.addEventListener("wheel", T, {
|
|
844
847
|
passive: !1
|
|
845
848
|
}), () => {
|
|
846
849
|
document.removeEventListener("mouseup", f), document.removeEventListener("keydown", g), document.removeEventListener("keyup", g), document.removeEventListener("mousemove", w), x?.removeEventListener("wheel", T);
|
|
847
850
|
};
|
|
848
|
-
}, [i, a,
|
|
851
|
+
}, [i, a, u, y]), L("sync_move", u, (f) => {
|
|
849
852
|
const g = f.positions ? N(
|
|
850
853
|
f.positions,
|
|
851
854
|
i.current
|
|
852
855
|
) : null;
|
|
853
|
-
|
|
856
|
+
l.current = f, M.move.dispatchEvent(a, {
|
|
854
857
|
frame: i.current,
|
|
855
858
|
pointer: g ?? null,
|
|
856
859
|
keys: f.keys,
|
|
@@ -859,15 +862,15 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
859
862
|
}), /* @__PURE__ */ R(
|
|
860
863
|
"div",
|
|
861
864
|
{
|
|
862
|
-
ref:
|
|
865
|
+
ref: c,
|
|
863
866
|
id: e,
|
|
864
867
|
className: t,
|
|
865
868
|
style: {
|
|
866
869
|
position: "absolute",
|
|
867
|
-
left:
|
|
868
|
-
top:
|
|
869
|
-
width:
|
|
870
|
-
height:
|
|
870
|
+
left: r.chartAreaCSS.x,
|
|
871
|
+
top: r.chartAreaCSS.y,
|
|
872
|
+
width: r.chartAreaCSS.width,
|
|
873
|
+
height: r.chartAreaCSS.height,
|
|
871
874
|
zIndex: 25,
|
|
872
875
|
...n
|
|
873
876
|
},
|
|
@@ -875,7 +878,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
875
878
|
f.preventDefault();
|
|
876
879
|
},
|
|
877
880
|
onClick: (f) => {
|
|
878
|
-
|
|
881
|
+
d(f, (g, w, T) => {
|
|
879
882
|
const x = N(
|
|
880
883
|
g,
|
|
881
884
|
i.current
|
|
@@ -888,8 +891,8 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
888
891
|
});
|
|
889
892
|
},
|
|
890
893
|
onMouseLeave: (f) => {
|
|
891
|
-
|
|
892
|
-
M.sync_move.dispatchEvent(
|
|
894
|
+
d(f, (g, w, T) => {
|
|
895
|
+
M.sync_move.dispatchEvent(u, {
|
|
893
896
|
positions: null,
|
|
894
897
|
keys: T,
|
|
895
898
|
originInteractionsId: a
|
|
@@ -897,8 +900,8 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
897
900
|
});
|
|
898
901
|
},
|
|
899
902
|
onMouseMove: (f) => {
|
|
900
|
-
|
|
901
|
-
M.sync_move.dispatchEvent(
|
|
903
|
+
d(f, (g, w, T) => {
|
|
904
|
+
M.sync_move.dispatchEvent(u, {
|
|
902
905
|
positions: g,
|
|
903
906
|
keys: T,
|
|
904
907
|
originInteractionsId: a
|
|
@@ -906,7 +909,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
906
909
|
});
|
|
907
910
|
},
|
|
908
911
|
onMouseDown: (f) => {
|
|
909
|
-
|
|
912
|
+
d(f, (g, { cssX: w, cssY: T }, x) => {
|
|
910
913
|
const v = N(
|
|
911
914
|
g,
|
|
912
915
|
i.current
|
|
@@ -922,7 +925,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
922
925
|
});
|
|
923
926
|
},
|
|
924
927
|
onMouseUp: (f) => {
|
|
925
|
-
|
|
928
|
+
d(f, (g, w, T) => {
|
|
926
929
|
const x = N(
|
|
927
930
|
g,
|
|
928
931
|
i.current
|
|
@@ -933,8 +936,8 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
933
936
|
pointer: x,
|
|
934
937
|
keys: T
|
|
935
938
|
});
|
|
936
|
-
const v =
|
|
937
|
-
|
|
939
|
+
const v = h.current;
|
|
940
|
+
h.current = null;
|
|
938
941
|
const b = m.current;
|
|
939
942
|
if (m.current = null, b && v) {
|
|
940
943
|
const S = {
|
|
@@ -942,7 +945,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
942
945
|
keys: T,
|
|
943
946
|
completed: !0
|
|
944
947
|
};
|
|
945
|
-
|
|
948
|
+
h.current = null, M.spanselect.dispatchEvent(
|
|
946
949
|
a,
|
|
947
950
|
S
|
|
948
951
|
);
|
|
@@ -950,7 +953,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
950
953
|
});
|
|
951
954
|
},
|
|
952
955
|
onContextMenu: (f) => {
|
|
953
|
-
f.preventDefault(),
|
|
956
|
+
f.preventDefault(), d(f, (g, w, T) => {
|
|
954
957
|
const x = N(
|
|
955
958
|
g,
|
|
956
959
|
i.current
|
|
@@ -963,7 +966,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
963
966
|
});
|
|
964
967
|
},
|
|
965
968
|
onDoubleClick: (f) => {
|
|
966
|
-
|
|
969
|
+
d(f, (g, w, T) => {
|
|
967
970
|
const x = N(
|
|
968
971
|
g,
|
|
969
972
|
i.current
|
|
@@ -979,50 +982,50 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
979
982
|
}
|
|
980
983
|
);
|
|
981
984
|
}, Kt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
|
|
982
|
-
const [s, o] =
|
|
983
|
-
xe("move", (
|
|
984
|
-
o(
|
|
985
|
+
const [s, o] = B(null);
|
|
986
|
+
xe("move", (r) => {
|
|
987
|
+
o(r);
|
|
985
988
|
});
|
|
986
|
-
const
|
|
989
|
+
const c = J(() => {
|
|
987
990
|
if (!s)
|
|
988
991
|
return null;
|
|
989
|
-
const { frame:
|
|
992
|
+
const { frame: r, pointer: i } = s, a = i?.scaled[n];
|
|
990
993
|
if (a === void 0)
|
|
991
994
|
return null;
|
|
992
|
-
const
|
|
995
|
+
const u = [];
|
|
993
996
|
let m = a;
|
|
994
|
-
for (const
|
|
995
|
-
let
|
|
996
|
-
for (const [y, f] of
|
|
997
|
-
if (!fe(
|
|
997
|
+
for (const h of e) {
|
|
998
|
+
let l = null, p = 1 / 0;
|
|
999
|
+
for (const [y, f] of h.points.entries()) {
|
|
1000
|
+
if (!fe(r, f.x, n) || !fe(r, f.y, h.yScaleId))
|
|
998
1001
|
continue;
|
|
999
1002
|
const g = Math.abs(f.x - a);
|
|
1000
|
-
g <
|
|
1003
|
+
g < p && (p = g, l = y);
|
|
1001
1004
|
}
|
|
1002
|
-
const
|
|
1003
|
-
if (!
|
|
1004
|
-
|
|
1005
|
+
const d = h.points[l ?? -1];
|
|
1006
|
+
if (!d || ge(r, p, n, "css") > 30) {
|
|
1007
|
+
u.push({ seriesId: h.seriesId, y: null });
|
|
1005
1008
|
continue;
|
|
1006
1009
|
}
|
|
1007
|
-
m =
|
|
1008
|
-
seriesId:
|
|
1009
|
-
y:
|
|
1010
|
+
m = d.x, u.push({
|
|
1011
|
+
seriesId: h.seriesId,
|
|
1012
|
+
y: d.y
|
|
1010
1013
|
});
|
|
1011
1014
|
}
|
|
1012
1015
|
return {
|
|
1013
|
-
frame:
|
|
1016
|
+
frame: r,
|
|
1014
1017
|
x: m,
|
|
1015
|
-
points:
|
|
1018
|
+
points: u
|
|
1016
1019
|
};
|
|
1017
1020
|
}, [e, s, n]);
|
|
1018
|
-
return t(
|
|
1021
|
+
return t(c);
|
|
1019
1022
|
}, Ft = ({ makeXStyle: e, makeXClassName: t, makeYStyle: n, makeYClassName: s }) => {
|
|
1020
|
-
const [o,
|
|
1021
|
-
if (xe("move", (
|
|
1022
|
-
|
|
1023
|
+
const [o, c] = B(null);
|
|
1024
|
+
if (xe("move", (l) => {
|
|
1025
|
+
c(l);
|
|
1023
1026
|
}), !o)
|
|
1024
1027
|
return null;
|
|
1025
|
-
const { frame:
|
|
1028
|
+
const { frame: r, pointer: i } = o, a = i?.cssX ?? null, u = i?.cssY ?? null, m = a ? V(r, a, "css") : 0, h = u ? H(r, u, "css") : 0;
|
|
1026
1029
|
return /* @__PURE__ */ pe(Fe, { children: [
|
|
1027
1030
|
/* @__PURE__ */ R(
|
|
1028
1031
|
"div",
|
|
@@ -1033,8 +1036,8 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1033
1036
|
position: "absolute",
|
|
1034
1037
|
left: 0,
|
|
1035
1038
|
visibility: a === null ? "hidden" : "visible",
|
|
1036
|
-
top:
|
|
1037
|
-
height:
|
|
1039
|
+
top: r.chartAreaCSS.y,
|
|
1040
|
+
height: r.chartAreaCSS.height,
|
|
1038
1041
|
borderColor: "red",
|
|
1039
1042
|
borderLeftWidth: "1px",
|
|
1040
1043
|
borderLeftStyle: "solid",
|
|
@@ -1052,32 +1055,32 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1052
1055
|
"data-show": !!i,
|
|
1053
1056
|
style: {
|
|
1054
1057
|
position: "absolute",
|
|
1055
|
-
visibility:
|
|
1058
|
+
visibility: u === null ? "hidden" : "visible",
|
|
1056
1059
|
top: 0,
|
|
1057
1060
|
height: 0,
|
|
1058
1061
|
borderTop: "solid 1px red",
|
|
1059
|
-
left:
|
|
1060
|
-
width:
|
|
1062
|
+
left: r.chartAreaCSS.x,
|
|
1063
|
+
width: r.chartAreaCSS.width,
|
|
1061
1064
|
pointerEvents: "none",
|
|
1062
1065
|
opacity: i ? 1 : 0,
|
|
1063
|
-
transform: `translateY(${
|
|
1066
|
+
transform: `translateY(${h}px)`,
|
|
1064
1067
|
...n?.(o)
|
|
1065
1068
|
}
|
|
1066
1069
|
}
|
|
1067
1070
|
)
|
|
1068
1071
|
] });
|
|
1069
1072
|
}, Yt = ({ makeClassName: e, makeStyle: t }) => {
|
|
1070
|
-
const [n, s] =
|
|
1071
|
-
xe("spanselect", (
|
|
1073
|
+
const [n, s] = B(null);
|
|
1074
|
+
xe("spanselect", (c) => {
|
|
1072
1075
|
s(
|
|
1073
|
-
|
|
1076
|
+
c.mode === "below_threshold" || c.completed ? null : c
|
|
1074
1077
|
);
|
|
1075
1078
|
});
|
|
1076
|
-
const o =
|
|
1079
|
+
const o = J(() => {
|
|
1077
1080
|
if (!n || n.mode === "below_threshold")
|
|
1078
1081
|
return null;
|
|
1079
|
-
const
|
|
1080
|
-
return { leftPx:
|
|
1082
|
+
const c = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, r = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, i = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, a = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, u = V(n.frame, c, "css"), m = V(n.frame, r, "css"), h = H(n.frame, i, "css"), l = H(n.frame, a, "css"), p = Math.min(u, m), d = Math.min(h, l), y = Math.abs(m - u), f = Math.abs(l - h);
|
|
1083
|
+
return { leftPx: p, topPx: d, widthPx: y, heightPx: f };
|
|
1081
1084
|
}, [n]);
|
|
1082
1085
|
return /* @__PURE__ */ R(
|
|
1083
1086
|
"div",
|
|
@@ -1095,7 +1098,7 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1095
1098
|
}
|
|
1096
1099
|
}
|
|
1097
1100
|
);
|
|
1098
|
-
},
|
|
1101
|
+
}, Bt = ({ style: e, children: t, scaleId: n, ...s }) => {
|
|
1099
1102
|
const o = De().getScale(n)?.axis;
|
|
1100
1103
|
return o ? /* @__PURE__ */ R(
|
|
1101
1104
|
"div",
|
|
@@ -1113,32 +1116,32 @@ const At = ze(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1113
1116
|
children: t
|
|
1114
1117
|
}
|
|
1115
1118
|
) : null;
|
|
1116
|
-
}, Ie = 60, lt = 30, Le = "UTC", ut = "en-GB",
|
|
1119
|
+
}, Ie = 60, lt = 30, Le = "UTC", ut = "en-GB", zt = ({
|
|
1117
1120
|
space: e,
|
|
1118
1121
|
formatter: t,
|
|
1119
1122
|
acceptableIncrements: n
|
|
1120
1123
|
} = {}) => (s, o) => {
|
|
1121
|
-
const { min:
|
|
1124
|
+
const { min: c, max: r } = s, i = [], a = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ? Ie : lt)) * a, m = je(
|
|
1122
1125
|
o,
|
|
1123
|
-
|
|
1126
|
+
u,
|
|
1124
1127
|
s.id,
|
|
1125
1128
|
"canvas"
|
|
1126
|
-
),
|
|
1127
|
-
let
|
|
1128
|
-
if (Math.abs(
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1129
|
+
), h = n ?? te, l = h.find((d) => d > m) ?? h.at(-1) ?? 1;
|
|
1130
|
+
let p = c;
|
|
1131
|
+
if (Math.abs(p % l) > Number.EPSILON) {
|
|
1132
|
+
const d = (l - p % l) % l;
|
|
1133
|
+
p += d;
|
|
1131
1134
|
}
|
|
1132
|
-
for (;
|
|
1133
|
-
i.push(
|
|
1135
|
+
for (; p <= r && i.length < 1e3; )
|
|
1136
|
+
i.push(p), p += l;
|
|
1134
1137
|
return (t ?? ht)(i);
|
|
1135
1138
|
}, ht = (e) => {
|
|
1136
1139
|
const t = Math.max(0, Math.ceil(-Math.log10(e[1] - e[0])));
|
|
1137
1140
|
return e.map((n) => ({ value: n, label: n.toFixed(t) }));
|
|
1138
|
-
},
|
|
1141
|
+
}, te = [];
|
|
1139
1142
|
for (let e = -12; e <= 12; e++)
|
|
1140
|
-
|
|
1141
|
-
const dt = 1, Ue = 1e3 * dt, be = 60 * Ue,
|
|
1143
|
+
te.push(1 * 10 ** e), te.push(2 * 10 ** e), te.push(5 * 10 ** e);
|
|
1144
|
+
const dt = 1, Ue = 1e3 * dt, be = 60 * Ue, oe = 60 * be, re = 24 * oe, ft = 30 * re, mt = 365 * re, pt = [
|
|
1142
1145
|
// second divisors
|
|
1143
1146
|
[1, "milliseconds"],
|
|
1144
1147
|
[2, "milliseconds"],
|
|
@@ -1190,7 +1193,7 @@ const dt = 1, Ue = 1e3 * dt, be = 60 * Ue, se = 60 * be, re = 24 * se, ft = 30 *
|
|
|
1190
1193
|
[25, "years"],
|
|
1191
1194
|
[50, "years"],
|
|
1192
1195
|
[100, "years"]
|
|
1193
|
-
],
|
|
1196
|
+
], ne = (e) => {
|
|
1194
1197
|
const [t, n] = e;
|
|
1195
1198
|
switch (n) {
|
|
1196
1199
|
case "milliseconds":
|
|
@@ -1200,7 +1203,7 @@ const dt = 1, Ue = 1e3 * dt, be = 60 * Ue, se = 60 * be, re = 24 * se, ft = 30 *
|
|
|
1200
1203
|
case "minutes":
|
|
1201
1204
|
return t * be;
|
|
1202
1205
|
case "hours":
|
|
1203
|
-
return t *
|
|
1206
|
+
return t * oe;
|
|
1204
1207
|
case "days":
|
|
1205
1208
|
return t * re;
|
|
1206
1209
|
case "months":
|
|
@@ -1245,38 +1248,38 @@ const dt = 1, Ue = 1e3 * dt, be = 60 * Ue, se = 60 * be, re = 24 * se, ft = 30 *
|
|
|
1245
1248
|
return Me(e, n * 12);
|
|
1246
1249
|
}
|
|
1247
1250
|
};
|
|
1248
|
-
function
|
|
1251
|
+
function se(e, t) {
|
|
1249
1252
|
const n = new Date(e), s = new Date(n.toLocaleString("en-US", { timeZone: t })), o = new Date(n.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
1250
1253
|
return (s.getTime() - o.getTime()) / (3600 * 1e3);
|
|
1251
1254
|
}
|
|
1252
1255
|
const bt = (e, t, n = "UTC") => {
|
|
1253
1256
|
const [s, o] = t;
|
|
1254
|
-
let
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
+
let c = new Date(e);
|
|
1258
|
+
const r = () => {
|
|
1259
|
+
c.setUTCHours(-se(c, n), 0, 0, 0);
|
|
1257
1260
|
};
|
|
1258
1261
|
switch (o) {
|
|
1259
1262
|
case "milliseconds":
|
|
1260
|
-
|
|
1261
|
-
Math.ceil(
|
|
1263
|
+
c.setUTCMilliseconds(
|
|
1264
|
+
Math.ceil(c.getUTCMilliseconds() / s) * s
|
|
1262
1265
|
);
|
|
1263
1266
|
break;
|
|
1264
1267
|
case "seconds":
|
|
1265
|
-
|
|
1266
|
-
Math.ceil(
|
|
1268
|
+
c.setUTCSeconds(
|
|
1269
|
+
Math.ceil(c.getUTCSeconds() / s) * s,
|
|
1267
1270
|
0
|
|
1268
1271
|
);
|
|
1269
1272
|
break;
|
|
1270
1273
|
case "minutes":
|
|
1271
|
-
|
|
1272
|
-
Math.ceil(
|
|
1274
|
+
c.setUTCMinutes(
|
|
1275
|
+
Math.ceil(c.getTime() % oe / be / s) * s,
|
|
1273
1276
|
0,
|
|
1274
1277
|
0
|
|
1275
1278
|
);
|
|
1276
1279
|
break;
|
|
1277
1280
|
case "hours":
|
|
1278
|
-
|
|
1279
|
-
Math.ceil(
|
|
1281
|
+
c.setUTCHours(
|
|
1282
|
+
Math.ceil(c.getTime() % re / oe / s) * s,
|
|
1280
1283
|
0,
|
|
1281
1284
|
0,
|
|
1282
1285
|
0
|
|
@@ -1285,37 +1288,37 @@ const bt = (e, t, n = "UTC") => {
|
|
|
1285
1288
|
case "days":
|
|
1286
1289
|
case "months":
|
|
1287
1290
|
case "years":
|
|
1288
|
-
o === "months" ?
|
|
1291
|
+
o === "months" ? c.setUTCDate(1) : o === "years" && c.setUTCMonth(0, 1), r(), c.getTime() < e && (c = new Date(Y(c, [1, o])));
|
|
1289
1292
|
break;
|
|
1290
1293
|
}
|
|
1291
|
-
return
|
|
1294
|
+
return c.getTime();
|
|
1292
1295
|
}, Nt = ({
|
|
1293
1296
|
timeZone: e = Le,
|
|
1294
1297
|
space: t = Ie,
|
|
1295
1298
|
formatter: n,
|
|
1296
1299
|
locale: s,
|
|
1297
1300
|
showTimezone: o
|
|
1298
|
-
} = {}) => (
|
|
1299
|
-
const { min: i, max: a } =
|
|
1300
|
-
(w) =>
|
|
1301
|
-
) ?? [1, "milliseconds"],
|
|
1301
|
+
} = {}) => (c, r) => {
|
|
1302
|
+
const { min: i, max: a } = c, u = Math.floor(r.chartAreaCanvasPX.width / t) + 1, h = (a - i) / u, [l, p] = pt.find(
|
|
1303
|
+
(w) => ne(w) >= h
|
|
1304
|
+
) ?? [1, "milliseconds"], d = bt(i, [l, p], e), y = se(d, e), f = [d];
|
|
1302
1305
|
let g;
|
|
1303
1306
|
for (; ; ) {
|
|
1304
|
-
switch (
|
|
1307
|
+
switch (p) {
|
|
1305
1308
|
case "milliseconds":
|
|
1306
1309
|
case "seconds":
|
|
1307
1310
|
case "minutes":
|
|
1308
1311
|
case "hours": {
|
|
1309
|
-
g = Y(
|
|
1312
|
+
g = Y(d, [f.length * l, p]);
|
|
1310
1313
|
break;
|
|
1311
1314
|
}
|
|
1312
1315
|
case "days": {
|
|
1313
|
-
const w = Y(
|
|
1314
|
-
f.length *
|
|
1315
|
-
|
|
1316
|
+
const w = Y(d, [
|
|
1317
|
+
f.length * l,
|
|
1318
|
+
p
|
|
1316
1319
|
]);
|
|
1317
1320
|
g = Y(w, [
|
|
1318
|
-
y -
|
|
1321
|
+
y - se(w, e),
|
|
1319
1322
|
"hours"
|
|
1320
1323
|
]);
|
|
1321
1324
|
break;
|
|
@@ -1323,14 +1326,14 @@ const bt = (e, t, n = "UTC") => {
|
|
|
1323
1326
|
case "months":
|
|
1324
1327
|
case "years": {
|
|
1325
1328
|
const w = Y(
|
|
1326
|
-
Y(Y(
|
|
1327
|
-
f.length *
|
|
1328
|
-
|
|
1329
|
+
Y(Y(d, [y, "hours"]), [
|
|
1330
|
+
f.length * l,
|
|
1331
|
+
p
|
|
1329
1332
|
]),
|
|
1330
1333
|
[-y, "hours"]
|
|
1331
1334
|
);
|
|
1332
1335
|
g = Y(w, [
|
|
1333
|
-
y -
|
|
1336
|
+
y - se(w, e),
|
|
1334
1337
|
"hours"
|
|
1335
1338
|
]);
|
|
1336
1339
|
break;
|
|
@@ -1363,15 +1366,15 @@ const bt = (e, t, n = "UTC") => {
|
|
|
1363
1366
|
timeZone: e
|
|
1364
1367
|
});
|
|
1365
1368
|
return (o) => {
|
|
1366
|
-
const
|
|
1367
|
-
return o.map((
|
|
1368
|
-
const
|
|
1369
|
-
if (
|
|
1370
|
-
const b =
|
|
1369
|
+
const c = o[1] - o[0], r = c < ne([1, "days"]), i = c < ne([1, "minutes"]), a = c < ne([1, "seconds"]);
|
|
1370
|
+
return o.map((u) => ({ value: u, label: s.formatToParts(new Date(u)) })).map((u, m, h) => {
|
|
1371
|
+
const l = h[m - 1], p = m === 0 || F(u.label, l.label, "year"), d = m === 0 || F(u.label, l.label, "day"), y = m === 0 || F(u.label, l.label, "month"), f = m === 0 || F(u.label, l.label, "hour"), g = m === 0 || F(u.label, l.label, "timeZoneName"), w = m === 0 || F(u.label, l.label, "minute"), T = m === 0 || F(u.label, l.label, "second"), x = m === 0 || F(u.label, l.label, "fractionalSecond"), v = [];
|
|
1372
|
+
if (r && (f || w || g || T || x)) {
|
|
1373
|
+
const b = u.label.find((P) => P.type === "hour")?.value, S = u.label.find((P) => P.type === "minute")?.value, E = u.label.find((P) => P.type === "timeZoneName")?.value;
|
|
1371
1374
|
let C = "";
|
|
1372
1375
|
if (i) {
|
|
1373
|
-
const P =
|
|
1374
|
-
(
|
|
1376
|
+
const P = u.label.find((z) => z.type === "second")?.value, k = u.label.find(
|
|
1377
|
+
(z) => z.type === "fractionalSecond"
|
|
1375
1378
|
)?.value;
|
|
1376
1379
|
C = `:${P}` + (a ? `.${k}` : "");
|
|
1377
1380
|
}
|
|
@@ -1379,13 +1382,13 @@ const bt = (e, t, n = "UTC") => {
|
|
|
1379
1382
|
`${b}:${S}${C}` + (n && g ? ` ${E}` : "")
|
|
1380
1383
|
);
|
|
1381
1384
|
}
|
|
1382
|
-
return (
|
|
1385
|
+
return (d || y) && v.push(
|
|
1383
1386
|
[
|
|
1384
|
-
|
|
1385
|
-
|
|
1387
|
+
u.label.find((b) => b.type === "month")?.value,
|
|
1388
|
+
d && u.label.find((b) => b.type === "day")?.value
|
|
1386
1389
|
].filter(Boolean).join(" ")
|
|
1387
|
-
),
|
|
1388
|
-
value:
|
|
1390
|
+
), p && v.push(u.label.find((b) => b.type === "year")?.value), {
|
|
1391
|
+
value: u.value,
|
|
1389
1392
|
label: v.filter((b) => b).join(`
|
|
1390
1393
|
`)
|
|
1391
1394
|
};
|
|
@@ -1394,7 +1397,7 @@ const bt = (e, t, n = "UTC") => {
|
|
|
1394
1397
|
};
|
|
1395
1398
|
export {
|
|
1396
1399
|
Lt as AreaPlot,
|
|
1397
|
-
|
|
1400
|
+
Bt as AxisOverlay,
|
|
1398
1401
|
It as BarPlot,
|
|
1399
1402
|
Ae as CANPLOT_LAYER,
|
|
1400
1403
|
At as CanPlot,
|
|
@@ -1417,7 +1420,7 @@ export {
|
|
|
1417
1420
|
ht as defaultNumericalTicksFormatter,
|
|
1418
1421
|
Et as findClosestIndex,
|
|
1419
1422
|
X as getScale,
|
|
1420
|
-
|
|
1423
|
+
zt as makeLinearTicks,
|
|
1421
1424
|
Tt as makeTimeTickFormat,
|
|
1422
1425
|
Nt as makeTimeTicks,
|
|
1423
1426
|
_ as posToVal,
|