@canplot/react 0.5.12 → 0.5.14
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.cjs +4 -4
- package/dist/canplot.cjs.map +1 -1
- package/dist/canplot.mjs +366 -353
- package/dist/canplot.mjs.map +1 -1
- package/dist/plot/LinePlot.d.ts +1 -0
- package/dist/plot/LinePlot.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/canplot.mjs
CHANGED
|
@@ -8,12 +8,12 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
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
|
+
}, qe = (e, t, n, s) => {
|
|
12
12
|
const o = F(e, n);
|
|
13
13
|
if (!o)
|
|
14
14
|
return null;
|
|
15
|
-
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS,
|
|
16
|
-
return t /
|
|
15
|
+
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, c = (o.origin === "x" ? i.width : i.height) / (o.max - o.min);
|
|
16
|
+
return t / c;
|
|
17
17
|
}, F = (e, t) => e.scales.find((n) => n.id === t) ?? null, _ = (e, t) => {
|
|
18
18
|
const n = window.devicePixelRatio || 1;
|
|
19
19
|
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";
|
|
@@ -21,24 +21,24 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
21
21
|
const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = F(e, n);
|
|
22
22
|
if (!i)
|
|
23
23
|
return null;
|
|
24
|
-
const
|
|
25
|
-
return t *
|
|
24
|
+
const c = (i.origin === "x" ? o.width : o.height) / (i.max - i.min);
|
|
25
|
+
return t * c;
|
|
26
26
|
}, Z = (e, t, n, s) => {
|
|
27
27
|
const o = F(e, n);
|
|
28
28
|
if (!o)
|
|
29
29
|
return null;
|
|
30
|
-
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS,
|
|
30
|
+
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, c = ge(
|
|
31
31
|
e,
|
|
32
32
|
t - o.min,
|
|
33
33
|
n,
|
|
34
34
|
s
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
i.x +
|
|
36
|
+
return c === null ? null : o.origin === "x" ? re(
|
|
37
|
+
i.x + c,
|
|
38
38
|
i.x - 10 * i.width,
|
|
39
39
|
i.x + 11 * i.width
|
|
40
40
|
) : re(
|
|
41
|
-
i.y + i.height -
|
|
41
|
+
i.y + i.height - c,
|
|
42
42
|
i.y - 10 * i.height,
|
|
43
43
|
i.y + 11 * i.height
|
|
44
44
|
);
|
|
@@ -47,7 +47,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
47
47
|
return null;
|
|
48
48
|
const s = n === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS;
|
|
49
49
|
return re(t, s.x, s.x + s.width);
|
|
50
|
-
},
|
|
50
|
+
}, q = (e, t, n) => {
|
|
51
51
|
if (t === null)
|
|
52
52
|
return null;
|
|
53
53
|
const s = n === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS;
|
|
@@ -61,8 +61,8 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
61
61
|
const o = F(e, n);
|
|
62
62
|
if (!o)
|
|
63
63
|
return null;
|
|
64
|
-
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS,
|
|
65
|
-
return o.min +
|
|
64
|
+
const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, c = o.origin === "x" ? (t - i.x) / i.width : (i.height - t + i.y) / i.height;
|
|
65
|
+
return o.min + c * (o.max - o.min);
|
|
66
66
|
}, O = (e, t) => {
|
|
67
67
|
if (e === t) return !0;
|
|
68
68
|
if (e == null || t == null || typeof e != typeof t || typeof e != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
@@ -77,7 +77,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
77
77
|
for (const o of n)
|
|
78
78
|
if (!Object.prototype.hasOwnProperty.call(t, o) || !O(e[o], t[o])) return !1;
|
|
79
79
|
return !0;
|
|
80
|
-
},
|
|
80
|
+
}, We = (e) => {
|
|
81
81
|
const { ctx: t, scales: n } = e;
|
|
82
82
|
for (const s of n) {
|
|
83
83
|
if (!s.axis) continue;
|
|
@@ -133,8 +133,8 @@ const Ae = ye({
|
|
|
133
133
|
}
|
|
134
134
|
}), Qe = () => {
|
|
135
135
|
const e = [];
|
|
136
|
-
return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((i,
|
|
137
|
-
const i = e.findIndex(([,
|
|
136
|
+
return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((i, c) => i[0] - c[0]), () => {
|
|
137
|
+
const i = e.findIndex(([, c]) => c === s);
|
|
138
138
|
i !== -1 && e.splice(i, 1);
|
|
139
139
|
}), notifyListeners: () => {
|
|
140
140
|
for (const [, s] of e)
|
|
@@ -151,7 +151,7 @@ class Le {
|
|
|
151
151
|
constructor() {
|
|
152
152
|
K(this, "_frame", null);
|
|
153
153
|
K(this, "clampXPosToChartArea", (t, n = "canvas") => V(this.frame, t, n));
|
|
154
|
-
K(this, "clampYPosToChartArea", (t, n = "canvas") =>
|
|
154
|
+
K(this, "clampYPosToChartArea", (t, n = "canvas") => q(this.frame, t, n));
|
|
155
155
|
K(this, "valToPos", (t, n, s = "canvas") => Z(this.frame, t, n, s));
|
|
156
156
|
K(this, "valToPxDistance", (t, n, s = "canvas") => ge(this.frame, t, n, s));
|
|
157
157
|
K(this, "valFits", (t, n) => de(this.frame, t, n));
|
|
@@ -170,18 +170,18 @@ class Le {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
173
|
-
const i = k(null),
|
|
174
|
-
() => nt(e,
|
|
175
|
-
[e,
|
|
173
|
+
const i = k(null), c = k(null), r = tt(c), [u, l] = B(null), y = Q(
|
|
174
|
+
() => nt(e, r, u),
|
|
175
|
+
[e, r, u]
|
|
176
176
|
);
|
|
177
177
|
$(() => {
|
|
178
178
|
l(i.current?.getContext("2d") || null);
|
|
179
179
|
}, [i]);
|
|
180
|
-
const
|
|
180
|
+
const d = window.devicePixelRatio || 1;
|
|
181
181
|
return /* @__PURE__ */ pe(
|
|
182
182
|
"div",
|
|
183
183
|
{
|
|
184
|
-
ref: Ze([o,
|
|
184
|
+
ref: Ze([o, c]),
|
|
185
185
|
style: {
|
|
186
186
|
position: "relative",
|
|
187
187
|
overflow: "hidden",
|
|
@@ -194,17 +194,17 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
194
194
|
"canvas",
|
|
195
195
|
{
|
|
196
196
|
ref: i,
|
|
197
|
-
width:
|
|
198
|
-
height:
|
|
197
|
+
width: r.width * d,
|
|
198
|
+
height: r.height * d,
|
|
199
199
|
style: {
|
|
200
200
|
inset: 0,
|
|
201
201
|
position: "absolute",
|
|
202
|
-
width: `${
|
|
203
|
-
height: `${
|
|
202
|
+
width: `${r.width}px`,
|
|
203
|
+
height: `${r.height}px`
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
),
|
|
207
|
-
|
|
207
|
+
y && /* @__PURE__ */ A(et, { frame: y, children: t })
|
|
208
208
|
]
|
|
209
209
|
}
|
|
210
210
|
);
|
|
@@ -219,29 +219,29 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
219
219
|
const i = k(null);
|
|
220
220
|
i.current = e, $(() => {
|
|
221
221
|
n.subscribe(() => {
|
|
222
|
-
i.current &&
|
|
222
|
+
i.current && We(i.current);
|
|
223
223
|
}, Ie.BOTTOM);
|
|
224
224
|
}, [n]), $(() => {
|
|
225
|
-
let
|
|
226
|
-
return
|
|
227
|
-
|
|
225
|
+
let r = null;
|
|
226
|
+
return r = window.requestAnimationFrame(() => {
|
|
227
|
+
r = null, n.notifyListeners();
|
|
228
228
|
}), () => {
|
|
229
|
-
|
|
229
|
+
r && cancelAnimationFrame(r);
|
|
230
230
|
};
|
|
231
231
|
}, [s, e, n]);
|
|
232
|
-
const
|
|
233
|
-
o((
|
|
232
|
+
const c = He(() => {
|
|
233
|
+
o((r) => r + 1);
|
|
234
234
|
}, [o]);
|
|
235
|
-
return /* @__PURE__ */ A(Ae.Provider, { value: n, children: /* @__PURE__ */ A(Re.Provider, { value:
|
|
235
|
+
return /* @__PURE__ */ A(Ae.Provider, { value: n, children: /* @__PURE__ */ A(Re.Provider, { value: c, children: /* @__PURE__ */ A(ve.Provider, { value: e, children: t }) }) });
|
|
236
236
|
}, tt = (e) => {
|
|
237
237
|
const [t, n] = B({
|
|
238
238
|
width: 0,
|
|
239
239
|
height: 0
|
|
240
240
|
}), [s] = B(() => new ResizeObserver((o) => {
|
|
241
241
|
for (const i of o) {
|
|
242
|
-
const
|
|
242
|
+
const c = Math.round(i.contentRect.width), r = Math.round(i.contentRect.height);
|
|
243
243
|
n(
|
|
244
|
-
(u) => u.width !==
|
|
244
|
+
(u) => u.width !== c || u.height !== r ? { ...u, width: c, height: r } : u
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
}));
|
|
@@ -249,7 +249,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
249
249
|
if (!e.current) return;
|
|
250
250
|
const o = e.current.clientWidth, i = e.current.clientHeight;
|
|
251
251
|
return n(
|
|
252
|
-
(
|
|
252
|
+
(c) => c.width !== o || c.height !== i ? { ...c, width: o, height: i } : c
|
|
253
253
|
), s.observe(e.current, { box: "border-box" }), () => s.disconnect();
|
|
254
254
|
}, [s, e]), t;
|
|
255
255
|
}, nt = (e, t, n) => {
|
|
@@ -274,11 +274,11 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
274
274
|
y: o.y * s,
|
|
275
275
|
width: o.width * s,
|
|
276
276
|
height: o.height * s
|
|
277
|
-
},
|
|
278
|
-
let
|
|
277
|
+
}, c = [];
|
|
278
|
+
let r = e.padding.left * s, u = t.width * s - e.padding.right * s, l = t.height * s - e.padding.bottom * s, y = e.padding.top * s;
|
|
279
279
|
for (const a of e.scales) {
|
|
280
280
|
if (!a.axis) {
|
|
281
|
-
|
|
281
|
+
c.push({ ...a, axis: null });
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
284
|
let g;
|
|
@@ -293,9 +293,9 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
293
293
|
};
|
|
294
294
|
break;
|
|
295
295
|
case "top":
|
|
296
|
-
|
|
296
|
+
y += a.axis.size * s, g = {
|
|
297
297
|
x: o.x,
|
|
298
|
-
y:
|
|
298
|
+
y: y / s - a.axis.size,
|
|
299
299
|
width: o.width,
|
|
300
300
|
height: a.axis.size
|
|
301
301
|
};
|
|
@@ -307,8 +307,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
307
307
|
else
|
|
308
308
|
switch (a.axis.position) {
|
|
309
309
|
case "left":
|
|
310
|
-
|
|
311
|
-
x:
|
|
310
|
+
r += a.axis.size * s, g = {
|
|
311
|
+
x: r / s - a.axis.size,
|
|
312
312
|
y: o.y,
|
|
313
313
|
width: a.axis.size,
|
|
314
314
|
height: o.height
|
|
@@ -326,18 +326,18 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
326
326
|
case "bottom":
|
|
327
327
|
throw new Error("Invalid axis position for y origin");
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const h = {
|
|
330
330
|
x: g.x * s,
|
|
331
331
|
y: g.y * s,
|
|
332
332
|
width: g.width * s,
|
|
333
333
|
height: g.height * s
|
|
334
334
|
};
|
|
335
|
-
|
|
335
|
+
c.push({
|
|
336
336
|
...a,
|
|
337
337
|
axis: {
|
|
338
338
|
...a.axis,
|
|
339
339
|
cssRect: g,
|
|
340
|
-
canvasRect:
|
|
340
|
+
canvasRect: h
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
343
|
}
|
|
@@ -345,7 +345,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
345
345
|
ctx: n,
|
|
346
346
|
dpr: s,
|
|
347
347
|
padding: e.padding,
|
|
348
|
-
scales:
|
|
348
|
+
scales: c,
|
|
349
349
|
chartAreaCSS: o,
|
|
350
350
|
chartAreaCanvasPX: i
|
|
351
351
|
};
|
|
@@ -353,22 +353,22 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
353
353
|
const s = G(ve), o = G(Re), i = G(Ae);
|
|
354
354
|
if (!s || !o)
|
|
355
355
|
throw new Error("useFrame must be used within a CanPlot component");
|
|
356
|
-
const [
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
356
|
+
const [c] = B(() => new Le());
|
|
357
|
+
c._updateFrame(s);
|
|
358
|
+
const r = k(c);
|
|
359
|
+
r.current = c;
|
|
360
360
|
const u = k(t);
|
|
361
361
|
u.current = t, $(() => {
|
|
362
362
|
const l = i.subscribe(
|
|
363
363
|
() => {
|
|
364
|
-
u.current(
|
|
364
|
+
u.current(c);
|
|
365
365
|
},
|
|
366
366
|
typeof e == "number" ? e : Ie[e]
|
|
367
367
|
);
|
|
368
368
|
return () => {
|
|
369
369
|
l();
|
|
370
370
|
};
|
|
371
|
-
}, [i, e,
|
|
371
|
+
}, [i, e, c]), $(() => {
|
|
372
372
|
o();
|
|
373
373
|
}, [o, ...n]), ke(() => () => {
|
|
374
374
|
o();
|
|
@@ -381,19 +381,32 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
381
381
|
const t = new Le();
|
|
382
382
|
return t._updateFrame(e), t;
|
|
383
383
|
}, [e]);
|
|
384
|
-
}, st = ({
|
|
384
|
+
}, st = ({
|
|
385
|
+
layer: e = "MIDDLE",
|
|
386
|
+
data: t,
|
|
387
|
+
xScaleId: n,
|
|
388
|
+
yScaleId: s,
|
|
389
|
+
style: o,
|
|
390
|
+
globalAlpha: i,
|
|
391
|
+
xGapWidth: c
|
|
392
|
+
}) => (j(
|
|
385
393
|
e,
|
|
386
|
-
({ ctx: r, clampXPosToChartArea:
|
|
394
|
+
({ ctx: r, clampXPosToChartArea: u, clampYPosToChartArea: l, valToPos: y }) => {
|
|
387
395
|
r.save(), r.beginPath(), _(r, o);
|
|
388
|
-
const
|
|
396
|
+
const d = r.getLineDash();
|
|
389
397
|
o?.lineDash && r.setLineDash(o.lineDash), i !== void 0 && (r.globalAlpha = i);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
398
|
+
let a = null;
|
|
399
|
+
for (const g of t) {
|
|
400
|
+
const h = u(
|
|
401
|
+
y(g.x, n, "canvas")
|
|
402
|
+
), p = l(
|
|
403
|
+
y(g.y, s, "canvas")
|
|
404
|
+
);
|
|
405
|
+
h === null || p === null || (a !== null && c !== void 0 && g.x - a > c ? r.moveTo(h, p) : r.lineTo(h, p), a = g.x);
|
|
393
406
|
}
|
|
394
|
-
r.stroke(),
|
|
407
|
+
r.stroke(), d && r.setLineDash(d), r.restore();
|
|
395
408
|
},
|
|
396
|
-
[t, n, s, o, i]
|
|
409
|
+
[t, n, s, o, i, c]
|
|
397
410
|
), null), It = R.memo(st, O), ot = ({
|
|
398
411
|
layer: e = "MIDDLE",
|
|
399
412
|
data: t,
|
|
@@ -401,51 +414,51 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
401
414
|
yScaleId: s,
|
|
402
415
|
xStrategy: o = "clip",
|
|
403
416
|
yStrategy: i = "clip",
|
|
404
|
-
radius:
|
|
405
|
-
style:
|
|
417
|
+
radius: c = 5,
|
|
418
|
+
style: r,
|
|
406
419
|
globalAlpha: u
|
|
407
420
|
}) => (j(
|
|
408
421
|
e,
|
|
409
422
|
({
|
|
410
423
|
ctx: l,
|
|
411
|
-
valToPos:
|
|
412
|
-
valFits:
|
|
424
|
+
valToPos: y,
|
|
425
|
+
valFits: d,
|
|
413
426
|
clampXPosToChartArea: a,
|
|
414
427
|
clampYPosToChartArea: g
|
|
415
428
|
}) => {
|
|
416
|
-
l.save(), _(l,
|
|
417
|
-
const
|
|
418
|
-
for (const
|
|
419
|
-
let
|
|
420
|
-
const v = p
|
|
429
|
+
l.save(), _(l, r), u !== void 0 && (l.globalAlpha = u);
|
|
430
|
+
const h = [];
|
|
431
|
+
for (const p of t) {
|
|
432
|
+
let f = null, m = null;
|
|
433
|
+
const v = y(p.x, n);
|
|
421
434
|
if (v === null) continue;
|
|
422
435
|
if (o === "clip") {
|
|
423
|
-
if (!
|
|
424
|
-
|
|
436
|
+
if (!d(p.x, n)) continue;
|
|
437
|
+
f = v;
|
|
425
438
|
} else
|
|
426
|
-
|
|
427
|
-
const x = p
|
|
439
|
+
f = a(v, "canvas");
|
|
440
|
+
const x = y(p.y, s);
|
|
428
441
|
if (x !== null) {
|
|
429
442
|
if (i === "clip") {
|
|
430
|
-
if (!
|
|
443
|
+
if (!d(p.y, s)) continue;
|
|
431
444
|
m = x;
|
|
432
445
|
} else
|
|
433
446
|
m = g(x, "canvas");
|
|
434
|
-
|
|
447
|
+
f === null || m === null || h.push({ x: f, y: m });
|
|
435
448
|
}
|
|
436
449
|
}
|
|
437
|
-
if (
|
|
438
|
-
for (const
|
|
439
|
-
l.beginPath(), l.arc(
|
|
440
|
-
if (
|
|
450
|
+
if (r?.fillStyle)
|
|
451
|
+
for (const p of h)
|
|
452
|
+
l.beginPath(), l.arc(p.x, p.y, c, 0, Math.PI * 2), l.fill();
|
|
453
|
+
if (r?.strokeStyle) {
|
|
441
454
|
l.beginPath();
|
|
442
|
-
for (const
|
|
443
|
-
l.moveTo(
|
|
455
|
+
for (const p of h)
|
|
456
|
+
l.moveTo(p.x + c, p.y), l.arc(p.x, p.y, c, 0, Math.PI * 2);
|
|
444
457
|
l.stroke();
|
|
445
458
|
}
|
|
446
459
|
l.restore();
|
|
447
460
|
},
|
|
448
|
-
[t, n, s,
|
|
461
|
+
[t, n, s, c, r, u]
|
|
449
462
|
), null), Lt = R.memo(ot, O), it = ({
|
|
450
463
|
data: e,
|
|
451
464
|
xScaleId: t,
|
|
@@ -453,102 +466,102 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
453
466
|
style: s,
|
|
454
467
|
barWidth: o,
|
|
455
468
|
xPositionOffset: i,
|
|
456
|
-
globalAlpha:
|
|
457
|
-
radius:
|
|
469
|
+
globalAlpha: c,
|
|
470
|
+
radius: r,
|
|
458
471
|
layer: u = "MIDDLE"
|
|
459
472
|
}) => (j(
|
|
460
473
|
u,
|
|
461
474
|
({
|
|
462
475
|
ctx: l,
|
|
463
|
-
valToPxDistance:
|
|
464
|
-
valToPos:
|
|
476
|
+
valToPxDistance: y,
|
|
477
|
+
valToPos: d,
|
|
465
478
|
clampXPosToChartArea: a,
|
|
466
479
|
clampYPosToChartArea: g
|
|
467
480
|
}) => {
|
|
468
481
|
if (e.length === 0) return;
|
|
469
|
-
const
|
|
470
|
-
|
|
482
|
+
const h = g(
|
|
483
|
+
d(0, n, "canvas"),
|
|
471
484
|
"canvas"
|
|
472
485
|
);
|
|
473
|
-
if (
|
|
486
|
+
if (h === null)
|
|
474
487
|
return;
|
|
475
|
-
const
|
|
488
|
+
const p = y(o, t, "canvas") ?? 0, f = [];
|
|
476
489
|
for (const m of e) {
|
|
477
|
-
const v =
|
|
490
|
+
const v = d(m.x, t, "canvas");
|
|
478
491
|
if (v === null)
|
|
479
492
|
continue;
|
|
480
|
-
const x = v -
|
|
481
|
-
|
|
493
|
+
const x = v - p / 2 + i * p, T = g(
|
|
494
|
+
d(m.y, n, "canvas"),
|
|
482
495
|
"canvas"
|
|
483
496
|
);
|
|
484
497
|
if (T === null)
|
|
485
498
|
continue;
|
|
486
|
-
const w =
|
|
487
|
-
|
|
499
|
+
const w = h - T, b = a(x, "canvas"), S = a(x + p, "canvas") - b;
|
|
500
|
+
f.push({
|
|
488
501
|
x: b,
|
|
489
502
|
y: T,
|
|
490
503
|
width: S,
|
|
491
504
|
height: w
|
|
492
505
|
});
|
|
493
506
|
}
|
|
494
|
-
if (l.save(), _(l, s),
|
|
495
|
-
for (const m of
|
|
496
|
-
l.beginPath(),
|
|
507
|
+
if (l.save(), _(l, s), c !== void 0 && (l.globalAlpha = c), s?.fillStyle)
|
|
508
|
+
for (const m of f)
|
|
509
|
+
l.beginPath(), r ? l.roundRect(m.x, m.y, m.width, m.height, r) : l.rect(m.x, m.y, m.width, m.height), l.fill();
|
|
497
510
|
if (s?.strokeStyle) {
|
|
498
511
|
l.beginPath();
|
|
499
|
-
for (const m of
|
|
500
|
-
|
|
512
|
+
for (const m of f)
|
|
513
|
+
r ? l.roundRect(m.x, m.y, m.width, m.height, r) : l.rect(m.x, m.y, m.width, m.height);
|
|
501
514
|
l.stroke();
|
|
502
515
|
}
|
|
503
516
|
l.restore();
|
|
504
517
|
},
|
|
505
|
-
[e, t, n, s, o, i,
|
|
518
|
+
[e, t, n, s, o, i, r, c]
|
|
506
519
|
), null), Ut = R.memo(it, O), rt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
|
|
507
520
|
e,
|
|
508
|
-
({ ctx: i, clampXPosToChartArea:
|
|
521
|
+
({ ctx: i, clampXPosToChartArea: c, clampYPosToChartArea: r, valToPos: u }) => {
|
|
509
522
|
const l = [];
|
|
510
|
-
for (const
|
|
511
|
-
const a =
|
|
523
|
+
for (const d of t) {
|
|
524
|
+
const a = c(u(d.x, n));
|
|
512
525
|
if (a === null)
|
|
513
526
|
continue;
|
|
514
|
-
const g =
|
|
527
|
+
const g = r(u(d.y[0], s));
|
|
515
528
|
if (g === null)
|
|
516
529
|
continue;
|
|
517
|
-
const
|
|
518
|
-
|
|
530
|
+
const h = r(u(d.y[1], s));
|
|
531
|
+
h !== null && (l.push({ x: a, y: g }), l.unshift({ x: a, y: h }));
|
|
519
532
|
}
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
i.save(), i.beginPath(), _(i, o), i.moveTo(
|
|
523
|
-
for (const
|
|
524
|
-
i.lineTo(
|
|
533
|
+
const y = l[0];
|
|
534
|
+
if (y) {
|
|
535
|
+
i.save(), i.beginPath(), _(i, o), i.moveTo(y.x, y.y);
|
|
536
|
+
for (const d of l)
|
|
537
|
+
i.lineTo(d.x, d.y);
|
|
525
538
|
i.closePath(), i.fill(), i.restore();
|
|
526
539
|
}
|
|
527
540
|
},
|
|
528
541
|
[t, n, s, o]
|
|
529
542
|
), null), _t = R.memo(rt, O), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: i }) => (j(
|
|
530
543
|
e,
|
|
531
|
-
({ ctx:
|
|
532
|
-
const
|
|
533
|
-
for (const
|
|
534
|
-
const
|
|
535
|
-
|
|
544
|
+
({ ctx: c, clampXPosToChartArea: r, clampYPosToChartArea: u, valToPos: l }) => {
|
|
545
|
+
const y = [];
|
|
546
|
+
for (const h of t) {
|
|
547
|
+
const p = r(l(h.x, s)), f = u(l(h.y, o));
|
|
548
|
+
p === null || f === null || y.push({ x: p, y: f });
|
|
536
549
|
}
|
|
537
|
-
const
|
|
538
|
-
if (!
|
|
550
|
+
const d = y.at(0), a = y.at(-1);
|
|
551
|
+
if (!d || !a)
|
|
539
552
|
return;
|
|
540
553
|
const g = u(l(0, o));
|
|
541
554
|
if (g !== null) {
|
|
542
|
-
|
|
543
|
-
for (const
|
|
544
|
-
|
|
545
|
-
if (
|
|
546
|
-
|
|
547
|
-
for (const
|
|
548
|
-
|
|
549
|
-
|
|
555
|
+
c.save(), c.beginPath(), _(c, i), c.moveTo(d.x, g);
|
|
556
|
+
for (const h of y)
|
|
557
|
+
c.lineTo(h.x, h.y);
|
|
558
|
+
if (c.lineTo(a.x, g), c.closePath(), c.fill(), n) {
|
|
559
|
+
c.beginPath(), c.moveTo(d.x, d.y);
|
|
560
|
+
for (const h of y)
|
|
561
|
+
c.lineTo(h.x, h.y);
|
|
562
|
+
c.stroke();
|
|
550
563
|
}
|
|
551
|
-
|
|
564
|
+
c.restore();
|
|
552
565
|
}
|
|
553
566
|
},
|
|
554
567
|
[t, n, s, o, i]
|
|
@@ -559,22 +572,22 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
559
572
|
labelStyle: s,
|
|
560
573
|
labelGap: o,
|
|
561
574
|
tickSize: i,
|
|
562
|
-
ticks:
|
|
575
|
+
ticks: c
|
|
563
576
|
}) => (j(
|
|
564
577
|
e,
|
|
565
|
-
({ ctx:
|
|
566
|
-
const
|
|
567
|
-
if (!
|
|
568
|
-
const a =
|
|
569
|
-
|
|
578
|
+
({ ctx: r, valToPos: u, getScale: l, frame: y }) => {
|
|
579
|
+
const d = l(t);
|
|
580
|
+
if (!d || !d.axis || d.origin !== "x") return;
|
|
581
|
+
const a = d.axis, g = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, h = window.devicePixelRatio || 1, p = g, f = (i ?? 6) * h, m = a.position === "top" ? g - f : g + f, v = (o ?? 12) * h;
|
|
582
|
+
r.save(), r.fontKerning = "auto", _(r, {
|
|
570
583
|
...n
|
|
571
|
-
}),
|
|
572
|
-
const x = Array.isArray(
|
|
584
|
+
}), r.beginPath();
|
|
585
|
+
const x = Array.isArray(c) ? c : c({ ...d, axis: a }, y);
|
|
573
586
|
for (const { value: T } of x) {
|
|
574
587
|
const w = u(T, t, "canvas");
|
|
575
|
-
w !== null && (
|
|
588
|
+
w !== null && (r.moveTo(w, p), r.lineTo(w, m));
|
|
576
589
|
}
|
|
577
|
-
|
|
590
|
+
r.stroke(), r.restore(), r.save(), _(r, {
|
|
578
591
|
textBaseline: a.position === "top" ? "bottom" : "top",
|
|
579
592
|
textAlign: "center",
|
|
580
593
|
...n,
|
|
@@ -589,11 +602,11 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
589
602
|
const S = w.split(`
|
|
590
603
|
`);
|
|
591
604
|
for (let E = 0; E < S.length; E++)
|
|
592
|
-
|
|
605
|
+
r.fillText(S[E], b, m + h * 2 + E * v);
|
|
593
606
|
}
|
|
594
|
-
|
|
607
|
+
r.restore();
|
|
595
608
|
},
|
|
596
|
-
[
|
|
609
|
+
[c, t, n, s]
|
|
597
610
|
), null), Ft = R.memo(at, O), lt = ({
|
|
598
611
|
layer: e = "BOTTOM",
|
|
599
612
|
scaleId: t,
|
|
@@ -601,19 +614,19 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
601
614
|
labelStyle: s,
|
|
602
615
|
labelGap: o,
|
|
603
616
|
tickSize: i,
|
|
604
|
-
ticks:
|
|
617
|
+
ticks: c
|
|
605
618
|
}) => (j(
|
|
606
619
|
e,
|
|
607
|
-
({ ctx:
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
610
|
-
const a =
|
|
611
|
-
|
|
620
|
+
({ ctx: r, valToPos: u, getScale: l, frame: y }) => {
|
|
621
|
+
const d = l(t);
|
|
622
|
+
if (!d || !d.axis || d.origin !== "y") return;
|
|
623
|
+
const a = d.axis, g = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, h = g, p = i ?? 6, f = a.position === "left" ? g - p : g + p, m = o ?? 12, v = Array.isArray(c) ? c : c({ ...d, axis: a }, y);
|
|
624
|
+
r.save(), r.fontKerning = "auto", _(r, { ...n }), r.beginPath();
|
|
612
625
|
for (const { value: x } of v) {
|
|
613
626
|
const T = u(x, t, "canvas");
|
|
614
|
-
T !== null && (
|
|
627
|
+
T !== null && (r.moveTo(h, T), r.lineTo(f, T));
|
|
615
628
|
}
|
|
616
|
-
|
|
629
|
+
r.stroke(), r.restore(), r.save(), _(r, {
|
|
617
630
|
textBaseline: "middle",
|
|
618
631
|
textAlign: a.position === "left" ? "right" : "left",
|
|
619
632
|
...n,
|
|
@@ -628,11 +641,11 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
628
641
|
const b = T.split(`
|
|
629
642
|
`);
|
|
630
643
|
for (let S = 0; S < b.length; S++)
|
|
631
|
-
|
|
644
|
+
r.fillText(` ${b[S]} `, f, w + S * m);
|
|
632
645
|
}
|
|
633
|
-
|
|
646
|
+
r.restore();
|
|
634
647
|
},
|
|
635
|
-
[
|
|
648
|
+
[c, t, n, s]
|
|
636
649
|
), null), Ot = R.memo(lt, O), _e = (e) => {
|
|
637
650
|
if (e)
|
|
638
651
|
try {
|
|
@@ -670,8 +683,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
670
683
|
const s = R.useRef(n);
|
|
671
684
|
s.current = n, R.useEffect(() => M[e].addEventListener(
|
|
672
685
|
t,
|
|
673
|
-
(i,
|
|
674
|
-
s.current(
|
|
686
|
+
(i, c) => {
|
|
687
|
+
s.current(c, i);
|
|
675
688
|
}
|
|
676
689
|
), [t, e, s]);
|
|
677
690
|
}, we = R.createContext(""), xe = (e, t) => {
|
|
@@ -679,23 +692,23 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
679
692
|
return L(e, n, t);
|
|
680
693
|
}, ut = (e, t, n, s, o) => {
|
|
681
694
|
if (!t) return;
|
|
682
|
-
const i = s ?? n.scales.find((
|
|
695
|
+
const i = s ?? n.scales.find((d) => d.origin === "x")?.id, c = o ?? n.scales.find((d) => d.origin === "y")?.id, r = e.clientX - t.left, u = i ? {
|
|
683
696
|
scaleId: i,
|
|
684
|
-
value: X(n,
|
|
685
|
-
} : null, l = e.clientY - t.top,
|
|
686
|
-
scaleId:
|
|
687
|
-
value: X(n, l,
|
|
697
|
+
value: X(n, r, i, "css")
|
|
698
|
+
} : null, l = e.clientY - t.top, y = c ? {
|
|
699
|
+
scaleId: c,
|
|
700
|
+
value: X(n, l, c, "css")
|
|
688
701
|
} : null;
|
|
689
|
-
return { pointerSyncPosition: { x: u, y
|
|
702
|
+
return { pointerSyncPosition: { x: u, y }, cssX: r, cssY: l };
|
|
690
703
|
}, N = (e, t) => {
|
|
691
|
-
const { x: n, y: s } = e, o = n && t.scales.some((
|
|
704
|
+
const { x: n, y: s } = e, o = n && t.scales.some((c) => c.id === n.scaleId) ? Z(t, n.value, n.scaleId, "css") : null, i = s && t.scales.some((c) => c.id === s.scaleId) ? Z(t, s.value, s.scaleId, "css") : null;
|
|
692
705
|
return {
|
|
693
706
|
cssX: o,
|
|
694
707
|
cssY: i,
|
|
695
708
|
scaled: Object.fromEntries(
|
|
696
|
-
t.scales.flatMap((
|
|
697
|
-
const
|
|
698
|
-
return
|
|
709
|
+
t.scales.flatMap((c) => {
|
|
710
|
+
const r = c.origin === "y" ? i : o;
|
|
711
|
+
return r === null ? [] : [[c.id, X(t, r, c.id, "css")]];
|
|
699
712
|
})
|
|
700
713
|
)
|
|
701
714
|
};
|
|
@@ -714,14 +727,14 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
714
727
|
if (s === null || o === null)
|
|
715
728
|
return null;
|
|
716
729
|
const i = n.scales.flatMap(
|
|
717
|
-
(
|
|
718
|
-
if (
|
|
730
|
+
(c) => {
|
|
731
|
+
if (c.origin !== e)
|
|
719
732
|
return [];
|
|
720
|
-
const
|
|
721
|
-
return
|
|
733
|
+
const r = X(n, s, c.id, "css"), u = X(n, o, c.id, "css");
|
|
734
|
+
return r === null || u === null ? [] : [
|
|
722
735
|
{
|
|
723
|
-
scaleId:
|
|
724
|
-
from:
|
|
736
|
+
scaleId: c.id,
|
|
737
|
+
from: r,
|
|
725
738
|
to: u
|
|
726
739
|
}
|
|
727
740
|
];
|
|
@@ -739,62 +752,62 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
739
752
|
onMouseMove: s,
|
|
740
753
|
onMouseDown: o,
|
|
741
754
|
onMouseUp: i,
|
|
742
|
-
onDocumentMouseUp:
|
|
743
|
-
onSpanSelect:
|
|
755
|
+
onDocumentMouseUp: c,
|
|
756
|
+
onSpanSelect: r,
|
|
744
757
|
onContextMenu: u,
|
|
745
758
|
className: l,
|
|
746
|
-
style:
|
|
747
|
-
sync:
|
|
759
|
+
style: y,
|
|
760
|
+
sync: d,
|
|
748
761
|
innerChildren: a,
|
|
749
762
|
children: g
|
|
750
763
|
}) => {
|
|
751
|
-
const
|
|
752
|
-
return L("dblclick",
|
|
753
|
-
n?.(
|
|
754
|
-
}), L("click",
|
|
755
|
-
t?.(
|
|
756
|
-
}), L("move",
|
|
757
|
-
s?.(
|
|
758
|
-
}), L("mousedown",
|
|
759
|
-
o?.(
|
|
760
|
-
}), L("mouseup",
|
|
761
|
-
i?.(
|
|
762
|
-
}), L("documentmouseup",
|
|
763
|
-
|
|
764
|
-
}), L("spanselect",
|
|
765
|
-
|
|
766
|
-
}), L("contextmenu",
|
|
767
|
-
u?.(
|
|
768
|
-
}), /* @__PURE__ */ pe(we.Provider, { value:
|
|
764
|
+
const h = Ve();
|
|
765
|
+
return L("dblclick", h, (p) => {
|
|
766
|
+
n?.(p);
|
|
767
|
+
}), L("click", h, (p) => {
|
|
768
|
+
t?.(p);
|
|
769
|
+
}), L("move", h, (p) => {
|
|
770
|
+
s?.(p);
|
|
771
|
+
}), L("mousedown", h, (p) => {
|
|
772
|
+
o?.(p);
|
|
773
|
+
}), L("mouseup", h, (p) => {
|
|
774
|
+
i?.(p);
|
|
775
|
+
}), L("documentmouseup", h, (p) => {
|
|
776
|
+
c?.(p);
|
|
777
|
+
}), L("spanselect", h, (p) => {
|
|
778
|
+
r?.(p);
|
|
779
|
+
}), L("contextmenu", h, (p) => {
|
|
780
|
+
u?.(p);
|
|
781
|
+
}), /* @__PURE__ */ pe(we.Provider, { value: h, children: [
|
|
769
782
|
/* @__PURE__ */ A(
|
|
770
783
|
ht,
|
|
771
784
|
{
|
|
772
785
|
id: e,
|
|
773
786
|
className: l,
|
|
774
|
-
style:
|
|
775
|
-
sync:
|
|
787
|
+
style: y,
|
|
788
|
+
sync: d,
|
|
776
789
|
children: a
|
|
777
790
|
}
|
|
778
791
|
),
|
|
779
792
|
g
|
|
780
793
|
] });
|
|
781
794
|
}, ht = ({ id: e, className: t, style: n, sync: s, children: o }) => {
|
|
782
|
-
const i = k(null),
|
|
783
|
-
|
|
784
|
-
const u = G(we), l = s?.key || u,
|
|
785
|
-
const
|
|
786
|
-
if (
|
|
787
|
-
if (
|
|
795
|
+
const i = k(null), c = Ue().frame, r = k(c);
|
|
796
|
+
r.current = c;
|
|
797
|
+
const u = G(we), l = s?.key || u, y = k(null), d = k(null), a = k(null), g = () => {
|
|
798
|
+
const f = i.current?.parentElement;
|
|
799
|
+
if (f) {
|
|
800
|
+
if (f.dataset.canplotroot === void 0)
|
|
788
801
|
throw new Error(
|
|
789
802
|
"ChartAreaInteractions must be used within a CanPlot component"
|
|
790
803
|
);
|
|
791
|
-
return
|
|
804
|
+
return f.getBoundingClientRect();
|
|
792
805
|
}
|
|
793
|
-
},
|
|
806
|
+
}, h = (f, m) => {
|
|
794
807
|
const v = ut(
|
|
795
|
-
|
|
808
|
+
f,
|
|
796
809
|
g(),
|
|
797
|
-
|
|
810
|
+
r.current,
|
|
798
811
|
s?.xViaScaleId,
|
|
799
812
|
s?.yViaScaleId
|
|
800
813
|
);
|
|
@@ -802,21 +815,21 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
802
815
|
v.pointerSyncPosition,
|
|
803
816
|
{ cssX: v.cssX, cssY: v.cssY },
|
|
804
817
|
{
|
|
805
|
-
ctrlKey:
|
|
806
|
-
altKey:
|
|
807
|
-
shiftKey:
|
|
808
|
-
metaKey:
|
|
818
|
+
ctrlKey: f.ctrlKey,
|
|
819
|
+
altKey: f.altKey,
|
|
820
|
+
shiftKey: f.shiftKey,
|
|
821
|
+
metaKey: f.metaKey
|
|
809
822
|
}
|
|
810
823
|
);
|
|
811
|
-
},
|
|
812
|
-
return
|
|
813
|
-
const
|
|
814
|
-
const b =
|
|
824
|
+
}, p = k(h);
|
|
825
|
+
return p.current = h, ke(() => {
|
|
826
|
+
const f = (w) => {
|
|
827
|
+
const b = d.current;
|
|
815
828
|
b && M.spanselect.dispatchEvent(u, {
|
|
816
829
|
...b,
|
|
817
830
|
completed: !0
|
|
818
831
|
}), M.documentmouseup.dispatchEvent(u, {
|
|
819
|
-
frame:
|
|
832
|
+
frame: r.current,
|
|
820
833
|
keys: {
|
|
821
834
|
ctrlKey: w.ctrlKey,
|
|
822
835
|
altKey: w.altKey,
|
|
@@ -837,55 +850,55 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
837
850
|
const C = { ...S, keys: b };
|
|
838
851
|
a.current = C, M.sync_move.dispatchEvent(l, C);
|
|
839
852
|
}
|
|
840
|
-
const E =
|
|
853
|
+
const E = d.current;
|
|
841
854
|
if (E && Object.entries(b).some(
|
|
842
855
|
([C, P]) => E.keys[C] !== P
|
|
843
856
|
)) {
|
|
844
857
|
w.stopPropagation(), w.preventDefault();
|
|
845
858
|
const C = { ...E, keys: b };
|
|
846
|
-
|
|
859
|
+
d.current = C, M.spanselect.dispatchEvent(u, C);
|
|
847
860
|
}
|
|
848
861
|
}, v = (w) => {
|
|
849
|
-
|
|
862
|
+
p.current(
|
|
850
863
|
w,
|
|
851
864
|
(b, { cssX: S, cssY: E }, C) => {
|
|
852
|
-
const P =
|
|
865
|
+
const P = y.current;
|
|
853
866
|
if (!P || !b.x || !b.y) return;
|
|
854
|
-
const D =
|
|
867
|
+
const D = r.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, ee = F(D, b.x.scaleId);
|
|
855
868
|
if (!ee) return;
|
|
856
869
|
const te = F(D, b.y.scaleId);
|
|
857
870
|
if (!te) return;
|
|
858
|
-
|
|
871
|
+
y.current = {
|
|
859
872
|
xRangeCss: { start: z, end: ae },
|
|
860
873
|
yRangeCss: { start: le, end: ue }
|
|
861
874
|
};
|
|
862
|
-
let
|
|
875
|
+
let W = "below_threshold";
|
|
863
876
|
const he = Math.abs(le - ue), fe = Math.abs(z - ae);
|
|
864
|
-
he < 10 && fe < 10 ?
|
|
877
|
+
he < 10 && fe < 10 ? W = "below_threshold" : he > 30 && fe > 30 ? W = "box" : he > fe ? W = "y" : W = "x";
|
|
865
878
|
const Te = X(
|
|
866
879
|
D,
|
|
867
|
-
V(
|
|
880
|
+
V(r.current, z, "css"),
|
|
868
881
|
ee.id,
|
|
869
882
|
"css"
|
|
870
883
|
);
|
|
871
884
|
if (Te === null) return;
|
|
872
885
|
const Se = X(
|
|
873
886
|
D,
|
|
874
|
-
V(
|
|
887
|
+
V(r.current, ae, "css"),
|
|
875
888
|
ee.id,
|
|
876
889
|
"css"
|
|
877
890
|
);
|
|
878
891
|
if (Se === null) return;
|
|
879
892
|
const Ce = X(
|
|
880
893
|
D,
|
|
881
|
-
|
|
894
|
+
q(r.current, le, "css"),
|
|
882
895
|
te.id,
|
|
883
896
|
"css"
|
|
884
897
|
);
|
|
885
898
|
if (Ce === null) return;
|
|
886
899
|
const Pe = X(
|
|
887
900
|
D,
|
|
888
|
-
|
|
901
|
+
q(r.current, ue, "css"),
|
|
889
902
|
te.id,
|
|
890
903
|
"css"
|
|
891
904
|
);
|
|
@@ -893,14 +906,14 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
893
906
|
const ne = Ee(
|
|
894
907
|
"x",
|
|
895
908
|
{ scaleId: ee.id, from: Te, to: Se },
|
|
896
|
-
|
|
909
|
+
r.current
|
|
897
910
|
), se = Ee(
|
|
898
911
|
"y",
|
|
899
912
|
{ scaleId: te.id, from: Ce, to: Pe },
|
|
900
|
-
|
|
913
|
+
r.current
|
|
901
914
|
), Ke = ne?.scaled, Ye = se?.scaled, Me = {
|
|
902
|
-
mode:
|
|
903
|
-
frame:
|
|
915
|
+
mode: W,
|
|
916
|
+
frame: r.current,
|
|
904
917
|
completed: !1,
|
|
905
918
|
x: {
|
|
906
919
|
css: ne ? {
|
|
@@ -918,17 +931,17 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
918
931
|
},
|
|
919
932
|
keys: C
|
|
920
933
|
};
|
|
921
|
-
|
|
934
|
+
d.current = Me, M.spanselect.dispatchEvent(
|
|
922
935
|
u,
|
|
923
936
|
Me
|
|
924
937
|
);
|
|
925
938
|
}
|
|
926
939
|
);
|
|
927
940
|
}, x = (w) => {
|
|
928
|
-
|
|
941
|
+
p.current(w, (b, S, E) => {
|
|
929
942
|
const C = N(
|
|
930
943
|
b,
|
|
931
|
-
|
|
944
|
+
r.current
|
|
932
945
|
);
|
|
933
946
|
if (!C) return;
|
|
934
947
|
if (Object.values(E).some((D) => D)) {
|
|
@@ -936,7 +949,7 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
936
949
|
const D = Math.abs(w.deltaY) > Math.abs(w.deltaX) ? w.deltaY : w.deltaX;
|
|
937
950
|
M.pressandwheel.dispatchEvent(u, {
|
|
938
951
|
pointer: C,
|
|
939
|
-
frame:
|
|
952
|
+
frame: r.current,
|
|
940
953
|
keys: E,
|
|
941
954
|
deltaX: w.deltaX,
|
|
942
955
|
deltaY: w.deltaY,
|
|
@@ -945,23 +958,23 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
945
958
|
}
|
|
946
959
|
});
|
|
947
960
|
};
|
|
948
|
-
document.addEventListener("mouseup",
|
|
961
|
+
document.addEventListener("mouseup", f), document.addEventListener("keydown", m), document.addEventListener("keyup", m), document.addEventListener("mousemove", v);
|
|
949
962
|
const T = i.current;
|
|
950
963
|
return T?.addEventListener("wheel", x, {
|
|
951
964
|
passive: !1
|
|
952
965
|
}), () => {
|
|
953
|
-
document.removeEventListener("mouseup",
|
|
966
|
+
document.removeEventListener("mouseup", f), document.removeEventListener("keydown", m), document.removeEventListener("keyup", m), document.removeEventListener("mousemove", v), T?.removeEventListener("wheel", x);
|
|
954
967
|
};
|
|
955
|
-
}, [
|
|
956
|
-
const m =
|
|
957
|
-
|
|
958
|
-
|
|
968
|
+
}, [r, u, l, p]), L("sync_move", l, (f) => {
|
|
969
|
+
const m = f.positions ? N(
|
|
970
|
+
f.positions,
|
|
971
|
+
r.current
|
|
959
972
|
) : null;
|
|
960
|
-
a.current =
|
|
961
|
-
frame:
|
|
973
|
+
a.current = f, M.move.dispatchEvent(u, {
|
|
974
|
+
frame: r.current,
|
|
962
975
|
pointer: m ?? null,
|
|
963
|
-
keys:
|
|
964
|
-
source:
|
|
976
|
+
keys: f.keys,
|
|
977
|
+
source: f.originInteractionsId === u ? "own" : "sync"
|
|
965
978
|
});
|
|
966
979
|
}), /* @__PURE__ */ A(
|
|
967
980
|
"div",
|
|
@@ -971,31 +984,31 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
971
984
|
className: t,
|
|
972
985
|
style: {
|
|
973
986
|
position: "absolute",
|
|
974
|
-
left:
|
|
975
|
-
top:
|
|
976
|
-
width:
|
|
977
|
-
height:
|
|
987
|
+
left: c.chartAreaCSS.x,
|
|
988
|
+
top: c.chartAreaCSS.y,
|
|
989
|
+
width: c.chartAreaCSS.width,
|
|
990
|
+
height: c.chartAreaCSS.height,
|
|
978
991
|
zIndex: 25,
|
|
979
992
|
...n
|
|
980
993
|
},
|
|
981
|
-
onDragStart: (
|
|
982
|
-
|
|
994
|
+
onDragStart: (f) => {
|
|
995
|
+
f.preventDefault();
|
|
983
996
|
},
|
|
984
|
-
onClick: (
|
|
985
|
-
|
|
997
|
+
onClick: (f) => {
|
|
998
|
+
h(f, (m, v, x) => {
|
|
986
999
|
const T = N(
|
|
987
1000
|
m,
|
|
988
|
-
|
|
1001
|
+
r.current
|
|
989
1002
|
);
|
|
990
1003
|
T && M.click.dispatchEvent(u, {
|
|
991
1004
|
pointer: T,
|
|
992
|
-
frame:
|
|
1005
|
+
frame: r.current,
|
|
993
1006
|
keys: x
|
|
994
1007
|
});
|
|
995
1008
|
});
|
|
996
1009
|
},
|
|
997
|
-
onMouseLeave: (
|
|
998
|
-
|
|
1010
|
+
onMouseLeave: (f) => {
|
|
1011
|
+
h(f, (m, v, x) => {
|
|
999
1012
|
M.sync_move.dispatchEvent(l, {
|
|
1000
1013
|
positions: null,
|
|
1001
1014
|
keys: x,
|
|
@@ -1003,8 +1016,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1003
1016
|
});
|
|
1004
1017
|
});
|
|
1005
1018
|
},
|
|
1006
|
-
onMouseMove: (
|
|
1007
|
-
|
|
1019
|
+
onMouseMove: (f) => {
|
|
1020
|
+
h(f, (m, v, x) => {
|
|
1008
1021
|
M.sync_move.dispatchEvent(l, {
|
|
1009
1022
|
positions: m,
|
|
1010
1023
|
keys: x,
|
|
@@ -1012,71 +1025,71 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1012
1025
|
});
|
|
1013
1026
|
});
|
|
1014
1027
|
},
|
|
1015
|
-
onMouseDown: (
|
|
1016
|
-
|
|
1028
|
+
onMouseDown: (f) => {
|
|
1029
|
+
h(f, (m, { cssX: v, cssY: x }, T) => {
|
|
1017
1030
|
const w = N(
|
|
1018
1031
|
m,
|
|
1019
|
-
|
|
1032
|
+
r.current
|
|
1020
1033
|
);
|
|
1021
1034
|
w && (M.mousedown.dispatchEvent(u, {
|
|
1022
1035
|
pointer: w,
|
|
1023
|
-
frame:
|
|
1036
|
+
frame: r.current,
|
|
1024
1037
|
keys: T
|
|
1025
|
-
}),
|
|
1038
|
+
}), y.current = {
|
|
1026
1039
|
xRangeCss: { start: v, end: v },
|
|
1027
1040
|
yRangeCss: { start: x, end: x }
|
|
1028
1041
|
});
|
|
1029
1042
|
});
|
|
1030
1043
|
},
|
|
1031
|
-
onMouseUp: (
|
|
1032
|
-
|
|
1044
|
+
onMouseUp: (f) => {
|
|
1045
|
+
h(f, (m, v, x) => {
|
|
1033
1046
|
const T = N(
|
|
1034
1047
|
m,
|
|
1035
|
-
|
|
1048
|
+
r.current
|
|
1036
1049
|
);
|
|
1037
1050
|
if (!T) return;
|
|
1038
1051
|
M.mouseup.dispatchEvent(u, {
|
|
1039
|
-
frame:
|
|
1052
|
+
frame: r.current,
|
|
1040
1053
|
pointer: T,
|
|
1041
1054
|
keys: x
|
|
1042
1055
|
});
|
|
1043
|
-
const w =
|
|
1044
|
-
|
|
1045
|
-
const b =
|
|
1046
|
-
if (
|
|
1056
|
+
const w = d.current;
|
|
1057
|
+
d.current = null;
|
|
1058
|
+
const b = y.current;
|
|
1059
|
+
if (y.current = null, b && w) {
|
|
1047
1060
|
const S = {
|
|
1048
1061
|
...w,
|
|
1049
1062
|
keys: x,
|
|
1050
1063
|
completed: !0
|
|
1051
1064
|
};
|
|
1052
|
-
|
|
1065
|
+
d.current = null, M.spanselect.dispatchEvent(
|
|
1053
1066
|
u,
|
|
1054
1067
|
S
|
|
1055
1068
|
);
|
|
1056
1069
|
}
|
|
1057
1070
|
});
|
|
1058
1071
|
},
|
|
1059
|
-
onContextMenu: (
|
|
1060
|
-
|
|
1072
|
+
onContextMenu: (f) => {
|
|
1073
|
+
f.preventDefault(), h(f, (m, v, x) => {
|
|
1061
1074
|
const T = N(
|
|
1062
1075
|
m,
|
|
1063
|
-
|
|
1076
|
+
r.current
|
|
1064
1077
|
);
|
|
1065
1078
|
T && M.contextmenu.dispatchEvent(u, {
|
|
1066
|
-
frame:
|
|
1079
|
+
frame: r.current,
|
|
1067
1080
|
pointer: T,
|
|
1068
1081
|
keys: x
|
|
1069
1082
|
});
|
|
1070
1083
|
});
|
|
1071
1084
|
},
|
|
1072
|
-
onDoubleClick: (
|
|
1073
|
-
|
|
1085
|
+
onDoubleClick: (f) => {
|
|
1086
|
+
h(f, (m, v, x) => {
|
|
1074
1087
|
const T = N(
|
|
1075
1088
|
m,
|
|
1076
|
-
|
|
1089
|
+
r.current
|
|
1077
1090
|
);
|
|
1078
1091
|
T && M.dblclick.dispatchEvent(u, {
|
|
1079
|
-
frame:
|
|
1092
|
+
frame: r.current,
|
|
1080
1093
|
pointer: T,
|
|
1081
1094
|
keys: x
|
|
1082
1095
|
});
|
|
@@ -1087,39 +1100,39 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1087
1100
|
);
|
|
1088
1101
|
}, Yt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
|
|
1089
1102
|
const [s, o] = B(null);
|
|
1090
|
-
xe("move", (
|
|
1091
|
-
o(
|
|
1103
|
+
xe("move", (c) => {
|
|
1104
|
+
o(c);
|
|
1092
1105
|
});
|
|
1093
1106
|
const i = Q(() => {
|
|
1094
1107
|
if (!s)
|
|
1095
1108
|
return null;
|
|
1096
|
-
const { frame:
|
|
1097
|
-
if (u === void 0 || !F(
|
|
1109
|
+
const { frame: c, pointer: r } = s, u = r?.scaled[n];
|
|
1110
|
+
if (u === void 0 || !F(c, n))
|
|
1098
1111
|
return null;
|
|
1099
|
-
const
|
|
1100
|
-
let
|
|
1112
|
+
const y = [];
|
|
1113
|
+
let d = u;
|
|
1101
1114
|
for (const a of e) {
|
|
1102
|
-
let g = null,
|
|
1115
|
+
let g = null, h = 1 / 0;
|
|
1103
1116
|
for (const [m, v] of a.points.entries()) {
|
|
1104
|
-
if (!de(
|
|
1117
|
+
if (!de(c, v.x, n) || !de(c, v.y, a.yScaleId))
|
|
1105
1118
|
continue;
|
|
1106
1119
|
const x = Math.abs(v.x - u);
|
|
1107
|
-
x <
|
|
1120
|
+
x < h && (h = x, g = m);
|
|
1108
1121
|
}
|
|
1109
|
-
const
|
|
1110
|
-
if (!
|
|
1111
|
-
|
|
1122
|
+
const p = a.points[g ?? -1], f = ge(c, h, n, "css");
|
|
1123
|
+
if (!p || f === null || f > 30) {
|
|
1124
|
+
y.push({ seriesId: a.seriesId, y: null });
|
|
1112
1125
|
continue;
|
|
1113
1126
|
}
|
|
1114
|
-
|
|
1127
|
+
d = p.x, y.push({
|
|
1115
1128
|
seriesId: a.seriesId,
|
|
1116
|
-
y:
|
|
1129
|
+
y: p.y
|
|
1117
1130
|
});
|
|
1118
1131
|
}
|
|
1119
1132
|
return {
|
|
1120
|
-
frame:
|
|
1121
|
-
x:
|
|
1122
|
-
points:
|
|
1133
|
+
frame: c,
|
|
1134
|
+
x: d,
|
|
1135
|
+
points: y
|
|
1123
1136
|
};
|
|
1124
1137
|
}, [e, s, n]);
|
|
1125
1138
|
return t(i);
|
|
@@ -1129,25 +1142,25 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1129
1142
|
i(a);
|
|
1130
1143
|
}), !o)
|
|
1131
1144
|
return null;
|
|
1132
|
-
const { frame:
|
|
1145
|
+
const { frame: c, pointer: r } = o, u = r?.cssX ?? null, l = r?.cssY ?? null, y = u ? V(c, u, "css") : 0, d = l ? q(c, l, "css") : 0;
|
|
1133
1146
|
return /* @__PURE__ */ pe(Ne, { children: [
|
|
1134
1147
|
/* @__PURE__ */ A(
|
|
1135
1148
|
"div",
|
|
1136
1149
|
{
|
|
1137
|
-
"data-show": !!
|
|
1150
|
+
"data-show": !!r,
|
|
1138
1151
|
className: t?.(o),
|
|
1139
1152
|
style: {
|
|
1140
1153
|
position: "absolute",
|
|
1141
1154
|
left: 0,
|
|
1142
1155
|
visibility: u === null ? "hidden" : "visible",
|
|
1143
|
-
top:
|
|
1144
|
-
height:
|
|
1156
|
+
top: c.chartAreaCSS.y,
|
|
1157
|
+
height: c.chartAreaCSS.height,
|
|
1145
1158
|
borderColor: "red",
|
|
1146
1159
|
borderLeftWidth: "1px",
|
|
1147
1160
|
borderLeftStyle: "solid",
|
|
1148
1161
|
pointerEvents: "none",
|
|
1149
|
-
opacity:
|
|
1150
|
-
transform: `translateX(${
|
|
1162
|
+
opacity: r ? 1 : 0,
|
|
1163
|
+
transform: `translateX(${y}px)`,
|
|
1151
1164
|
...e?.(o)
|
|
1152
1165
|
}
|
|
1153
1166
|
}
|
|
@@ -1156,18 +1169,18 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1156
1169
|
"div",
|
|
1157
1170
|
{
|
|
1158
1171
|
className: s?.(o),
|
|
1159
|
-
"data-show": !!
|
|
1172
|
+
"data-show": !!r,
|
|
1160
1173
|
style: {
|
|
1161
1174
|
position: "absolute",
|
|
1162
1175
|
visibility: l === null ? "hidden" : "visible",
|
|
1163
1176
|
top: 0,
|
|
1164
1177
|
height: 0,
|
|
1165
1178
|
borderTop: "solid 1px red",
|
|
1166
|
-
left:
|
|
1167
|
-
width:
|
|
1179
|
+
left: c.chartAreaCSS.x,
|
|
1180
|
+
width: c.chartAreaCSS.width,
|
|
1168
1181
|
pointerEvents: "none",
|
|
1169
|
-
opacity:
|
|
1170
|
-
transform: `translateY(${
|
|
1182
|
+
opacity: r ? 1 : 0,
|
|
1183
|
+
transform: `translateY(${d}px)`,
|
|
1171
1184
|
...n?.(o)
|
|
1172
1185
|
}
|
|
1173
1186
|
}
|
|
@@ -1183,8 +1196,8 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1183
1196
|
const o = Q(() => {
|
|
1184
1197
|
if (!n || n.mode === "below_threshold")
|
|
1185
1198
|
return null;
|
|
1186
|
-
const i = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0,
|
|
1187
|
-
return { leftPx: g, topPx:
|
|
1199
|
+
const i = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, c = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, r = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, u = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, l = V(n.frame, i, "css"), y = V(n.frame, c, "css"), d = q(n.frame, r, "css"), a = q(n.frame, u, "css"), g = Math.min(l, y), h = Math.min(d, a), p = Math.abs(y - l), f = Math.abs(a - d);
|
|
1200
|
+
return { leftPx: g, topPx: h, widthPx: p, heightPx: f };
|
|
1188
1201
|
}, [n]);
|
|
1189
1202
|
return /* @__PURE__ */ A(
|
|
1190
1203
|
"div",
|
|
@@ -1225,23 +1238,23 @@ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
|
|
|
1225
1238
|
formatter: t,
|
|
1226
1239
|
acceptableIncrements: n
|
|
1227
1240
|
} = {}) => (s, o) => {
|
|
1228
|
-
const { min: i, max:
|
|
1241
|
+
const { min: i, max: c } = s, r = [], u = window.devicePixelRatio || 1, l = (e ?? (s.origin === "x" ? Xe : ft)) * u, y = qe(
|
|
1229
1242
|
o,
|
|
1230
1243
|
l,
|
|
1231
1244
|
s.id,
|
|
1232
1245
|
"canvas"
|
|
1233
1246
|
);
|
|
1234
|
-
if (
|
|
1247
|
+
if (y === null)
|
|
1235
1248
|
return [];
|
|
1236
|
-
const
|
|
1249
|
+
const d = n ?? oe, a = d.find((h) => h > y) ?? d.at(-1) ?? 1;
|
|
1237
1250
|
let g = i;
|
|
1238
1251
|
if (Math.abs(g % a) > Number.EPSILON) {
|
|
1239
|
-
const
|
|
1240
|
-
g +=
|
|
1252
|
+
const h = (a - g % a) % a;
|
|
1253
|
+
g += h;
|
|
1241
1254
|
}
|
|
1242
|
-
for (; g <=
|
|
1243
|
-
|
|
1244
|
-
return (t ?? mt)(
|
|
1255
|
+
for (; g <= c && r.length < 1e3; )
|
|
1256
|
+
r.push(g), g += a;
|
|
1257
|
+
return (t ?? mt)(r);
|
|
1245
1258
|
}, mt = (e) => {
|
|
1246
1259
|
const t = Math.max(0, Math.ceil(-Math.log10(e[1] - e[0])));
|
|
1247
1260
|
return e.map((n) => ({ value: n, label: n.toFixed(t) }));
|
|
@@ -1362,7 +1375,7 @@ function H(e, t) {
|
|
|
1362
1375
|
const Ct = (e, t, n = "UTC") => {
|
|
1363
1376
|
const [s, o] = t;
|
|
1364
1377
|
let i = new Date(e);
|
|
1365
|
-
const
|
|
1378
|
+
const c = () => {
|
|
1366
1379
|
i.setUTCHours(-H(i, n), 0, 0, 0);
|
|
1367
1380
|
};
|
|
1368
1381
|
switch (o) {
|
|
@@ -1385,11 +1398,11 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1385
1398
|
);
|
|
1386
1399
|
break;
|
|
1387
1400
|
case "hours": {
|
|
1388
|
-
const
|
|
1401
|
+
const r = H(i, n);
|
|
1389
1402
|
i.setUTCHours(
|
|
1390
1403
|
Math.ceil(
|
|
1391
|
-
(i.getTime() +
|
|
1392
|
-
) * s -
|
|
1404
|
+
(i.getTime() + r * J) % ce / J / s
|
|
1405
|
+
) * s - r,
|
|
1393
1406
|
0,
|
|
1394
1407
|
0,
|
|
1395
1408
|
0
|
|
@@ -1397,7 +1410,7 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1397
1410
|
break;
|
|
1398
1411
|
}
|
|
1399
1412
|
case "days": {
|
|
1400
|
-
for (
|
|
1413
|
+
for (c(), i.setUTCDate(
|
|
1401
1414
|
1
|
|
1402
1415
|
); i.getTime() < e; )
|
|
1403
1416
|
i = new Date(U(i, [s, o]));
|
|
@@ -1405,7 +1418,7 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1405
1418
|
}
|
|
1406
1419
|
case "months":
|
|
1407
1420
|
case "years":
|
|
1408
|
-
o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1),
|
|
1421
|
+
o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1), c(), i.getTime() < e && (i = new Date(U(i, [1, o])));
|
|
1409
1422
|
break;
|
|
1410
1423
|
}
|
|
1411
1424
|
return i.getTime();
|
|
@@ -1415,42 +1428,42 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1415
1428
|
formatter: n,
|
|
1416
1429
|
locale: s,
|
|
1417
1430
|
showTimezone: o
|
|
1418
|
-
} = {}) => (i,
|
|
1419
|
-
const { min:
|
|
1420
|
-
if (!Number.isFinite(
|
|
1431
|
+
} = {}) => (i, c) => {
|
|
1432
|
+
const { min: r, max: u } = i;
|
|
1433
|
+
if (!Number.isFinite(r) || !Number.isFinite(u))
|
|
1421
1434
|
return [];
|
|
1422
|
-
const l = Math.floor(
|
|
1423
|
-
(v) => ie(v) >=
|
|
1435
|
+
const l = Math.floor(c.chartAreaCanvasPX.width / t) + 1, d = (u - r) / l, [a, g] = vt.find(
|
|
1436
|
+
(v) => ie(v) >= d
|
|
1424
1437
|
) ?? [1, "milliseconds"];
|
|
1425
1438
|
if (!a || !g)
|
|
1426
1439
|
return [];
|
|
1427
|
-
const
|
|
1440
|
+
const h = Ct(r, [a, g], e), p = H(h, e), f = [h];
|
|
1428
1441
|
let m;
|
|
1429
1442
|
for (; ; ) {
|
|
1430
|
-
if (
|
|
1443
|
+
if (f.length > 100)
|
|
1431
1444
|
return [];
|
|
1432
1445
|
switch (g) {
|
|
1433
1446
|
case "milliseconds":
|
|
1434
1447
|
case "seconds":
|
|
1435
1448
|
case "minutes":
|
|
1436
1449
|
case "hours": {
|
|
1437
|
-
const v = U(
|
|
1438
|
-
|
|
1450
|
+
const v = U(h, [
|
|
1451
|
+
f.length * a,
|
|
1439
1452
|
g
|
|
1440
1453
|
]);
|
|
1441
1454
|
m = U(v, [
|
|
1442
|
-
|
|
1455
|
+
p - H(v, e),
|
|
1443
1456
|
"hours"
|
|
1444
1457
|
]);
|
|
1445
1458
|
break;
|
|
1446
1459
|
}
|
|
1447
1460
|
case "days": {
|
|
1448
|
-
const v = U(
|
|
1449
|
-
|
|
1461
|
+
const v = U(h, [
|
|
1462
|
+
f.length * a,
|
|
1450
1463
|
g
|
|
1451
1464
|
]);
|
|
1452
1465
|
m = U(v, [
|
|
1453
|
-
|
|
1466
|
+
p - H(v, e),
|
|
1454
1467
|
"hours"
|
|
1455
1468
|
]);
|
|
1456
1469
|
break;
|
|
@@ -1458,14 +1471,14 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1458
1471
|
case "months":
|
|
1459
1472
|
case "years": {
|
|
1460
1473
|
const v = U(
|
|
1461
|
-
U(U(
|
|
1462
|
-
|
|
1474
|
+
U(U(h, [p, "hours"]), [
|
|
1475
|
+
f.length * a,
|
|
1463
1476
|
g
|
|
1464
1477
|
]),
|
|
1465
|
-
[-
|
|
1478
|
+
[-p, "hours"]
|
|
1466
1479
|
);
|
|
1467
1480
|
m = U(v, [
|
|
1468
|
-
|
|
1481
|
+
p - H(v, e),
|
|
1469
1482
|
"hours"
|
|
1470
1483
|
]);
|
|
1471
1484
|
break;
|
|
@@ -1473,13 +1486,13 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1473
1486
|
}
|
|
1474
1487
|
if (m > u)
|
|
1475
1488
|
break;
|
|
1476
|
-
|
|
1489
|
+
f[f.length - 1] !== m && f.push(m);
|
|
1477
1490
|
}
|
|
1478
1491
|
return (n ?? Pt({
|
|
1479
1492
|
locale: s,
|
|
1480
1493
|
showTimezone: o,
|
|
1481
1494
|
timeZone: e
|
|
1482
|
-
}))(
|
|
1495
|
+
}))(f);
|
|
1483
1496
|
}, Y = (e, t, n) => e.find((s) => s.type === n)?.value !== t.find((s) => s.type === n)?.value, Pt = ({
|
|
1484
1497
|
timeZone: e = Fe,
|
|
1485
1498
|
locale: t = dt,
|
|
@@ -1498,13 +1511,13 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1498
1511
|
timeZone: e
|
|
1499
1512
|
});
|
|
1500
1513
|
return (o) => {
|
|
1501
|
-
const i = o[1] - o[0],
|
|
1502
|
-
return o.map((l) => ({ value: l, label: s.formatToParts(new Date(l)) })).map((l,
|
|
1503
|
-
const a =
|
|
1504
|
-
if (
|
|
1514
|
+
const i = o[1] - o[0], c = i < ie([1, "days"]), r = i < ie([1, "minutes"]), u = i < ie([1, "seconds"]);
|
|
1515
|
+
return o.map((l) => ({ value: l, label: s.formatToParts(new Date(l)) })).map((l, y, d) => {
|
|
1516
|
+
const a = d[y - 1], g = y === 0 || Y(l.label, a.label, "year"), h = y === 0 || Y(l.label, a.label, "day"), p = y === 0 || Y(l.label, a.label, "month"), f = y === 0 || Y(l.label, a.label, "hour"), m = y === 0 || Y(l.label, a.label, "timeZoneName"), v = y === 0 || Y(l.label, a.label, "minute"), x = y === 0 || Y(l.label, a.label, "second"), T = y === 0 || Y(l.label, a.label, "fractionalSecond"), w = [];
|
|
1517
|
+
if (c && (f || v || m || x || T)) {
|
|
1505
1518
|
const b = l.label.find((P) => P.type === "hour")?.value, S = l.label.find((P) => P.type === "minute")?.value, E = l.label.find((P) => P.type === "timeZoneName")?.value;
|
|
1506
1519
|
let C = "";
|
|
1507
|
-
if (
|
|
1520
|
+
if (r) {
|
|
1508
1521
|
const P = l.label.find((z) => z.type === "second")?.value, D = l.label.find(
|
|
1509
1522
|
(z) => z.type === "fractionalSecond"
|
|
1510
1523
|
)?.value;
|
|
@@ -1514,10 +1527,10 @@ const Ct = (e, t, n = "UTC") => {
|
|
|
1514
1527
|
`${b}:${S}${C}` + (n && m ? ` ${E}` : "")
|
|
1515
1528
|
);
|
|
1516
1529
|
}
|
|
1517
|
-
return (
|
|
1530
|
+
return (h || p) && w.push(
|
|
1518
1531
|
[
|
|
1519
1532
|
l.label.find((b) => b.type === "month")?.value,
|
|
1520
|
-
|
|
1533
|
+
h && l.label.find((b) => b.type === "day")?.value
|
|
1521
1534
|
].filter(Boolean).join(" ")
|
|
1522
1535
|
), g && w.push(l.label.find((b) => b.type === "year")?.value), {
|
|
1523
1536
|
value: l.value,
|
|
@@ -1546,7 +1559,7 @@ export {
|
|
|
1546
1559
|
_ as applyStyles,
|
|
1547
1560
|
re as clamp,
|
|
1548
1561
|
V as clampXPosToChartArea,
|
|
1549
|
-
|
|
1562
|
+
q as clampYPosToChartArea,
|
|
1550
1563
|
O as deepEqual,
|
|
1551
1564
|
mt as defaultNumericalTicksFormatter,
|
|
1552
1565
|
At as findClosestIndex,
|
|
@@ -1555,7 +1568,7 @@ export {
|
|
|
1555
1568
|
Pt as makeTimeTickFormat,
|
|
1556
1569
|
jt as makeTimeTicks,
|
|
1557
1570
|
X as posToVal,
|
|
1558
|
-
|
|
1571
|
+
qe as pxToValDistance,
|
|
1559
1572
|
kt as sum,
|
|
1560
1573
|
j as useDrawEffect,
|
|
1561
1574
|
Ue as useFrameState,
|