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