uplot-plus 0.5.5 → 0.5.10
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/components/Chart.d.ts.map +1 -1
- package/dist/components/FloatingLegend.d.ts.map +1 -1
- package/dist/components/HoverLabel.d.ts.map +1 -1
- package/dist/components/Timeline.d.ts.map +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/ZoomRanger.d.ts.map +1 -1
- package/dist/core/CursorManager.d.ts +1 -1
- package/dist/core/CursorManager.d.ts.map +1 -1
- package/dist/hooks/useChartStore.d.ts +3 -1
- package/dist/hooks/useChartStore.d.ts.map +1 -1
- package/dist/hooks/useDrawHook.d.ts +3 -1
- package/dist/hooks/useDrawHook.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1272 -1214
- package/dist/types/axes.d.ts +2 -0
- package/dist/types/axes.d.ts.map +1 -1
- package/dist/types/tooltip.d.ts +2 -0
- package/dist/types/tooltip.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var xn = Object.defineProperty;
|
|
2
2
|
var Cn = (t, e, n) => e in t ? xn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var X = (t, e, n) => Cn(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useRef as
|
|
4
|
+
import { jsx as V, jsxs as dt, Fragment as kn } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as Y, useSyncExternalStore as Gt, useContext as Tn, createContext as An, useEffect as rt, useState as ut, useLayoutEffect as j, useCallback as Lt, forwardRef as In, useMemo as Pn } from "react";
|
|
6
6
|
function ai(t = 0.15) {
|
|
7
7
|
return (e) => {
|
|
8
8
|
e.focusAlpha = t;
|
|
@@ -17,24 +17,24 @@ const ue = [
|
|
|
17
17
|
["pinch", "zoomX"],
|
|
18
18
|
["touchDrag", "zoomX"]
|
|
19
19
|
];
|
|
20
|
-
var
|
|
21
|
-
function
|
|
20
|
+
var N = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(N || {}), W = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(W || {}), O = /* @__PURE__ */ ((t) => (t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward", t))(O || {}), q = /* @__PURE__ */ ((t) => (t[t.Linear = 1] = "Linear", t[t.Ordinal = 2] = "Ordinal", t[t.Log = 3] = "Log", t[t.Asinh = 4] = "Asinh", t))(q || {}), Ht = /* @__PURE__ */ ((t) => (t[t.Ascending = 1] = "Ascending", t[t.Descending = -1] = "Descending", t[t.Unsorted = 0] = "Unsorted", t))(Ht || {});
|
|
21
|
+
function Et(t) {
|
|
22
22
|
return t % 2;
|
|
23
23
|
}
|
|
24
24
|
var it = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Scales = 1] = "Scales", t[t.Axes = 2] = "Axes", t[t.Paths = 4] = "Paths", t[t.Cursor = 8] = "Cursor", t[t.Select = 16] = "Select", t[t.Size = 32] = "Size", t[t.Full = 63] = "Full", t))(it || {});
|
|
25
|
-
const nt = Math,
|
|
26
|
-
function
|
|
25
|
+
const nt = Math, te = nt.PI, lt = nt.abs, ft = nt.floor, R = nt.round, Wt = nt.ceil, fe = nt.min, _t = nt.max, xt = nt.pow, Te = nt.sign, ct = nt.log10, Ft = nt.log2, Ln = (t, e = 1) => nt.sinh(t) * e, de = (t, e = 1) => nt.asinh(t / e), Q = 1 / 0, qe = Number.isInteger;
|
|
26
|
+
function ee(t, e) {
|
|
27
27
|
return t[e] ?? 0;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function St(t, e, n = 0, o = e.length - 1) {
|
|
30
30
|
let s;
|
|
31
31
|
const r = o <= 2147483647;
|
|
32
32
|
for (; o - n > 1; )
|
|
33
|
-
s = r ? n + o >> 1 :
|
|
34
|
-
return t -
|
|
33
|
+
s = r ? n + o >> 1 : ft((n + o) / 2), ee(e, s) < t ? n = s : o = s;
|
|
34
|
+
return t - ee(e, n) <= ee(e, o) - t ? n : o;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
36
|
+
const Ze = (t) => t != null, Je = (t) => t != null && t > 0;
|
|
37
|
+
function Qe(t) {
|
|
38
38
|
return (e, n, o) => {
|
|
39
39
|
let s = -1, r = -1;
|
|
40
40
|
for (let i = n; i <= o; i++)
|
|
@@ -50,14 +50,14 @@ function tn(t) {
|
|
|
50
50
|
return [s, r];
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
function _n(t, e, n, o =
|
|
55
|
-
const r = s ?
|
|
53
|
+
const Ot = Qe(Ze), tn = Qe(Je);
|
|
54
|
+
function _n(t, e, n, o = Ht.Unsorted, s = !1) {
|
|
55
|
+
const r = s ? tn : Ot, i = s ? Je : Ze, [l, c] = r(t, e, n);
|
|
56
56
|
let f = t[l] ?? Q, a = t[l] ?? -Q;
|
|
57
57
|
if (l > -1)
|
|
58
|
-
if (o ===
|
|
58
|
+
if (o === Ht.Ascending)
|
|
59
59
|
f = t[l] ?? Q, a = t[c] ?? -Q;
|
|
60
|
-
else if (o ===
|
|
60
|
+
else if (o === Ht.Descending)
|
|
61
61
|
f = t[c] ?? Q, a = t[l] ?? -Q;
|
|
62
62
|
else
|
|
63
63
|
for (let d = l; d <= c; d++) {
|
|
@@ -66,19 +66,19 @@ function _n(t, e, n, o = Ft.Unsorted, s = !1) {
|
|
|
66
66
|
}
|
|
67
67
|
return [f, a];
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
if (
|
|
69
|
+
function ht(t, e = 0) {
|
|
70
|
+
if (qe(t))
|
|
71
71
|
return t;
|
|
72
72
|
const n = 10 ** e, o = t * n * (1 + Number.EPSILON);
|
|
73
73
|
return R(o) / n;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const Dt = /* @__PURE__ */ new Map();
|
|
76
76
|
function Dn(t) {
|
|
77
77
|
return (String(t).split(".")[1] ?? "").length;
|
|
78
78
|
}
|
|
79
79
|
const En = /\.\d*?(?=9{6,}|0{6,})/gm;
|
|
80
|
-
function
|
|
81
|
-
if (
|
|
80
|
+
function kt(t) {
|
|
81
|
+
if (qe(t) || Dt.has(t))
|
|
82
82
|
return t;
|
|
83
83
|
const e = `${t}`, n = e.match(En);
|
|
84
84
|
if (n == null)
|
|
@@ -86,38 +86,38 @@ function Ct(t) {
|
|
|
86
86
|
const o = n[0].length - 1;
|
|
87
87
|
if (e.indexOf("e-") !== -1) {
|
|
88
88
|
const s = e.split("e"), r = s[0] ?? "0", i = s[1] ?? "0";
|
|
89
|
-
return +`${
|
|
89
|
+
return +`${kt(+r)}e${i}`;
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return ht(t, o);
|
|
92
92
|
}
|
|
93
93
|
function Fn(t, e, n = !0) {
|
|
94
|
-
return n ?
|
|
94
|
+
return n ? kt(ht(kt(t / e)) * e) : ht(t / e) * e;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return n ?
|
|
96
|
+
function ge(t, e, n = !0) {
|
|
97
|
+
return n ? kt(Wt(kt(t / e)) * e) : Wt(t / e) * e;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return n ?
|
|
99
|
+
function en(t, e, n = !0) {
|
|
100
|
+
return n ? kt(ft(kt(t / e)) * e) : ft(t / e) * e;
|
|
101
101
|
}
|
|
102
102
|
function zn(t) {
|
|
103
103
|
return t === 0 ? (e) => e : t === 1 ? R : (e) => Fn(e, t);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function nn(t, e, n, o) {
|
|
106
106
|
const s = [], r = o.map(Dn);
|
|
107
107
|
for (let i = e; i < n; i++) {
|
|
108
|
-
const l =
|
|
108
|
+
const l = lt(i);
|
|
109
109
|
for (let c = 0; c < o.length; c++) {
|
|
110
110
|
const f = o[c] ?? 0, a = r[c] ?? 0, d = +`${f}e${i}`, u = (i >= 0 ? 0 : l) + (i >= a ? 0 : a), h = d;
|
|
111
|
-
s.push(h),
|
|
111
|
+
s.push(h), Dt.set(h, u);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
return s;
|
|
115
115
|
}
|
|
116
116
|
function tt(t, e, n) {
|
|
117
|
-
return fe(
|
|
117
|
+
return fe(_t(t, e), n);
|
|
118
118
|
}
|
|
119
|
-
const Hn = new Intl.NumberFormat(),
|
|
120
|
-
function
|
|
119
|
+
const Hn = new Intl.NumberFormat(), on = (t) => Hn.format(t);
|
|
120
|
+
function Ae(t, e, n) {
|
|
121
121
|
for (; e <= n; ) {
|
|
122
122
|
if (t[e] != null)
|
|
123
123
|
return !0;
|
|
@@ -125,52 +125,52 @@ function Ie(t, e, n) {
|
|
|
125
125
|
}
|
|
126
126
|
return !1;
|
|
127
127
|
}
|
|
128
|
-
const $n = 0.1,
|
|
128
|
+
const $n = 0.1, mt = {
|
|
129
129
|
mode: 3,
|
|
130
130
|
pad: $n,
|
|
131
131
|
soft: null
|
|
132
|
-
},
|
|
133
|
-
function
|
|
132
|
+
}, $t = { pad: 0, soft: null, mode: 0 }, Wn = { min: $t, max: $t };
|
|
133
|
+
function ne(t, e, n, o) {
|
|
134
134
|
let s;
|
|
135
|
-
typeof n == "number" ? (
|
|
136
|
-
const r = s.min, i = s.max, l = r.pad, c = i.pad, f = r.hard ?? -Q, a = i.hard ?? Q, d = r.soft ?? Q, u = i.soft ?? -Q, h = r.mode,
|
|
135
|
+
typeof n == "number" ? ($t.pad = n, $t.soft = null, $t.mode = 0, s = Wn) : s = n;
|
|
136
|
+
const r = s.min, i = s.max, l = r.pad, c = i.pad, f = r.hard ?? -Q, a = i.hard ?? Q, d = r.soft ?? Q, u = i.soft ?? -Q, h = r.mode, g = i.mode;
|
|
137
137
|
let w = e - t;
|
|
138
|
-
const
|
|
139
|
-
(w < 1e-24 ||
|
|
140
|
-
const
|
|
141
|
-
return
|
|
138
|
+
const S = ct(w), b = _t(lt(t), lt(e)), M = ct(b), p = lt(M - S);
|
|
139
|
+
(w < 1e-24 || p > 10) && (w = 0, (t === 0 || e === 0) && (w = 1e-24));
|
|
140
|
+
const m = w || b || 1e3, T = ct(m), A = xt(10, ft(T)), y = m * (w === 0 ? t === 0 ? 0.1 : 1 : l), x = ht(en(t - y, A / 10), 24), P = h === 1 || h === 3 && x <= d || h === 2 && x >= d, L = t >= d && P ? d : Q, F = _t(f, x < L && t >= L ? L : fe(L, x)), I = m * (w === 0 ? e === 0 ? 0.1 : 1 : c), C = ht(ge(e + I, A / 10), 24), E = g === 1 || g === 3 && C >= u || g === 2 && C <= u, H = e <= u && E ? u : -Q, v = fe(a, C > H && e <= H ? H : _t(H, C));
|
|
141
|
+
return F === v && F === 0 ? [-1, 1] : [F, v];
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function sn(t, e, n, o) {
|
|
144
144
|
n === 2 && (o = !0);
|
|
145
|
-
const s =
|
|
145
|
+
const s = Te(t), r = Te(e);
|
|
146
146
|
t === e && (s === -1 ? (t *= n, e /= n) : (t /= n, e *= n));
|
|
147
|
-
const i = n === 10 ?
|
|
148
|
-
let h =
|
|
149
|
-
return n === 10 && (d < 0 && (h =
|
|
147
|
+
const i = n === 10 ? ct : Ft, l = s === 1 ? ft : Wt, c = r === 1 ? Wt : ft, f = i(lt(t)), a = i(lt(e)), d = l(f), u = c(a);
|
|
148
|
+
let h = xt(n, d), g = xt(n, u);
|
|
149
|
+
return n === 10 && (d < 0 && (h = ht(h, -d)), u < 0 && (g = ht(g, -u))), o ? (t = h * s, e = g * r) : (t = en(t, xt(n, ft(f)), !1), e = ge(e, xt(n, ft(a)), !1)), [t, e];
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const s =
|
|
151
|
+
function Rn(t, e, n, o) {
|
|
152
|
+
const s = sn(t, e, n, o);
|
|
153
153
|
return t === 0 && (s[0] = 0), e === 0 && (s[1] = 0), s;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
return (
|
|
155
|
+
function Ie(t) {
|
|
156
|
+
return (ct((t ^ t >> 31) - (t >> 31)) | 0) + 1;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
const r =
|
|
160
|
-
let l =
|
|
158
|
+
function Gn(t, e, n, o, s) {
|
|
159
|
+
const r = _t(Ie(t), Ie(e)), i = e - t;
|
|
160
|
+
let l = _t(0, St(s / o * i, n) - 1);
|
|
161
161
|
do {
|
|
162
162
|
const c = n[l] ?? 0, f = o * c / i;
|
|
163
|
-
if (f >= s * 0.9 && r + (c < 5 ?
|
|
163
|
+
if (f >= s * 0.9 && r + (c < 5 ? Dt.get(c) ?? 0 : 0) <= 17)
|
|
164
164
|
return [c, f];
|
|
165
165
|
} while (++l < n.length);
|
|
166
166
|
return [0, 0];
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Bn(t) {
|
|
169
169
|
return {
|
|
170
170
|
id: t.id,
|
|
171
171
|
min: t.min ?? null,
|
|
172
172
|
max: t.max ?? null,
|
|
173
|
-
distr: t.distr ??
|
|
173
|
+
distr: t.distr ?? q.Linear,
|
|
174
174
|
log: t.log ?? 10,
|
|
175
175
|
asinh: t.asinh ?? 1,
|
|
176
176
|
ori: t.ori ?? (t.id === "x" ? W.Horizontal : W.Vertical),
|
|
@@ -188,55 +188,55 @@ function Vn(t) {
|
|
|
188
188
|
function K(t) {
|
|
189
189
|
return t.min != null && t.max != null;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function gt(t) {
|
|
192
192
|
t._min = null, t._max = null;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function rn(t) {
|
|
195
195
|
if (t._min != null) return t._min;
|
|
196
196
|
const { min: e, distr: n } = t;
|
|
197
197
|
if (e == null) return 0;
|
|
198
|
-
if (n ===
|
|
198
|
+
if (n === q.Log) {
|
|
199
199
|
e <= 0 && console.warn(`[uPlot+] Log scale "${t.id}": min value ${e} <= 0, clamping to 1e-10`);
|
|
200
200
|
const o = e > 0 ? e : 1e-10;
|
|
201
|
-
t._min = (t.log === 10 ?
|
|
202
|
-
} else n ===
|
|
201
|
+
t._min = (t.log === 10 ? ct : Ft)(o);
|
|
202
|
+
} else n === q.Asinh ? t._min = de(e, t.asinh) : t._min = e;
|
|
203
203
|
return t._min;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function ln(t) {
|
|
206
206
|
if (t._max != null) return t._max;
|
|
207
207
|
const { max: e, distr: n } = t;
|
|
208
208
|
if (e == null) return 0;
|
|
209
|
-
if (n ===
|
|
209
|
+
if (n === q.Log) {
|
|
210
210
|
e <= 0 && console.warn(`[uPlot+] Log scale "${t.id}": max value ${e} <= 0, clamping to 1e-10`);
|
|
211
211
|
const o = e > 0 ? e : 1e-10;
|
|
212
|
-
t._max = (t.log === 10 ?
|
|
213
|
-
} else n ===
|
|
212
|
+
t._max = (t.log === 10 ? ct : Ft)(o);
|
|
213
|
+
} else n === q.Asinh ? t._max = de(e, t.asinh) : t._max = e;
|
|
214
214
|
return t._max;
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Vn(t, e) {
|
|
217
217
|
if (e.min == null || e.max == null) return 0;
|
|
218
|
-
const n =
|
|
218
|
+
const n = rn(e), s = ln(e) - n;
|
|
219
219
|
if (s === 0) return 0;
|
|
220
220
|
const { distr: r } = e;
|
|
221
|
-
if (r ===
|
|
222
|
-
const i = e.log === 10 ?
|
|
221
|
+
if (r === q.Log) {
|
|
222
|
+
const i = e.log === 10 ? ct : Ft, l = t > 0 ? t : 1e-10;
|
|
223
223
|
return (i(l) - n) / s;
|
|
224
224
|
}
|
|
225
|
-
return r ===
|
|
225
|
+
return r === q.Asinh ? (de(t, e.asinh) - n) / s : (t - n) / s;
|
|
226
226
|
}
|
|
227
227
|
function Xn(t, e) {
|
|
228
228
|
if (e.min == null || e.max == null) return 0;
|
|
229
|
-
const n =
|
|
229
|
+
const n = rn(e), o = ln(e);
|
|
230
230
|
if (o === n) return e.min;
|
|
231
231
|
const { distr: s } = e;
|
|
232
|
-
return s ===
|
|
232
|
+
return s === q.Log ? Math.pow(e.log, n + t * (o - n)) : s === q.Asinh ? Ln(n + t * (o - n), e.asinh) : n + t * (o - n);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
const s =
|
|
234
|
+
function B(t, e, n, o) {
|
|
235
|
+
const s = Vn(t, e);
|
|
236
236
|
let r;
|
|
237
237
|
return e.ori === W.Horizontal ? r = e.dir === O.Forward ? s : 1 - s : r = e.dir === O.Forward ? 1 - s : s, o + r * n;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function bt(t, e, n, o) {
|
|
240
240
|
if (n === 0) return e.min ?? 0;
|
|
241
241
|
let s = (t - o) / n;
|
|
242
242
|
return e.ori === W.Horizontal ? e.dir === O.Backward && (s = 1 - s) : e.dir !== O.Backward && (s = 1 - s), Xn(s, e);
|
|
@@ -251,7 +251,7 @@ class Yn {
|
|
|
251
251
|
X(this, "groupXScales", /* @__PURE__ */ new Map());
|
|
252
252
|
}
|
|
253
253
|
addScale(e) {
|
|
254
|
-
this.scales.set(e.id,
|
|
254
|
+
this.scales.set(e.id, Bn(e));
|
|
255
255
|
}
|
|
256
256
|
removeScale(e) {
|
|
257
257
|
this.scales.delete(e);
|
|
@@ -276,7 +276,7 @@ class Yn {
|
|
|
276
276
|
*/
|
|
277
277
|
setRange(e, n, o) {
|
|
278
278
|
const s = this.scales.get(e);
|
|
279
|
-
s && (s.min = n, s.max = o,
|
|
279
|
+
s && (s.min = n, s.max = o, gt(s));
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
282
|
* Auto-range only x-scales from data (cheap: just reads first/last x values).
|
|
@@ -290,42 +290,42 @@ class Yn {
|
|
|
290
290
|
if (!d || !d.auto) continue;
|
|
291
291
|
const u = e[f];
|
|
292
292
|
if (!u || u.x.length === 0) continue;
|
|
293
|
-
const h = u.x[0],
|
|
294
|
-
if (h == null ||
|
|
293
|
+
const h = u.x[0], g = u.x[u.x.length - 1];
|
|
294
|
+
if (h == null || g == null) continue;
|
|
295
295
|
const w = n.get(a);
|
|
296
|
-
w ? (w.dataMin = Math.min(w.dataMin, h), w.dataMax = Math.max(w.dataMax,
|
|
296
|
+
w ? (w.dataMin = Math.min(w.dataMin, h), w.dataMax = Math.max(w.dataMax, g), w.groups.push(f)) : n.set(a, { dataMin: h, dataMax: g, groups: [f] });
|
|
297
297
|
}
|
|
298
298
|
for (const [f, { dataMin: a, dataMax: d, groups: u }] of n) {
|
|
299
299
|
const h = this.scales.get(f);
|
|
300
300
|
if (!h) continue;
|
|
301
|
-
let
|
|
302
|
-
for (const
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
for (let
|
|
306
|
-
if (Number.isInteger(
|
|
307
|
-
const
|
|
308
|
-
|
|
301
|
+
let g = !0, w = Q;
|
|
302
|
+
for (const S of u) {
|
|
303
|
+
const b = e[S];
|
|
304
|
+
if (b) {
|
|
305
|
+
for (let M = 0; M < b.x.length; M++)
|
|
306
|
+
if (Number.isInteger(b.x[M]) || (g = !1), M > 0) {
|
|
307
|
+
const p = b.x[M] - b.x[M - 1];
|
|
308
|
+
p > 0 && p < w && (w = p);
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
if (h._discrete =
|
|
313
|
-
const [
|
|
312
|
+
if (h._discrete = g, h.range) {
|
|
313
|
+
const [S, b] = ne(a, d, {
|
|
314
314
|
min: { pad: ((o = h.range.min) == null ? void 0 : o.pad) ?? 0, soft: ((s = h.range.min) == null ? void 0 : s.soft) ?? null, mode: ((r = h.range.min) == null ? void 0 : r.mode) ?? 0 },
|
|
315
315
|
max: { pad: ((i = h.range.max) == null ? void 0 : i.pad) ?? 0, soft: ((l = h.range.max) == null ? void 0 : l.soft) ?? null, mode: ((c = h.range.max) == null ? void 0 : c.mode) ?? 0 }
|
|
316
316
|
});
|
|
317
|
-
h.min =
|
|
317
|
+
h.min = S, h.max = b;
|
|
318
318
|
} else if (a === d)
|
|
319
|
-
[h.min, h.max] =
|
|
319
|
+
[h.min, h.max] = ne(a, d, {
|
|
320
320
|
min: { pad: 0.1, soft: null, mode: 0 },
|
|
321
321
|
max: { pad: 0.1, soft: null, mode: 0 }
|
|
322
322
|
});
|
|
323
323
|
else if (w < Q) {
|
|
324
|
-
const
|
|
325
|
-
h.min = a -
|
|
324
|
+
const S = w / 2;
|
|
325
|
+
h.min = a - S, h.max = d + S;
|
|
326
326
|
} else
|
|
327
327
|
h.min = a, h.max = d;
|
|
328
|
-
h._cfgMin != null && (h.min = h._cfgMin), h._cfgMax != null && (h.max = h._cfgMax),
|
|
328
|
+
h._cfgMin != null && (h.min = h._cfgMin), h._cfgMax != null && (h.max = h._cfgMax), gt(h);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
/**
|
|
@@ -336,32 +336,32 @@ class Yn {
|
|
|
336
336
|
autoRange(e, n, o) {
|
|
337
337
|
var i, l, c, f, a, d;
|
|
338
338
|
const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
339
|
-
for (const { group: u, index: h, yScale:
|
|
339
|
+
for (const { group: u, index: h, yScale: g } of n) {
|
|
340
340
|
const w = e[u];
|
|
341
341
|
if (!w) continue;
|
|
342
|
-
const
|
|
343
|
-
if (!
|
|
344
|
-
const
|
|
345
|
-
s.set(
|
|
342
|
+
const S = w.series[h];
|
|
343
|
+
if (!S || S.length === 0) continue;
|
|
344
|
+
const b = o.windows.get(u), M = b ? b[0] : 0, p = b ? b[1] : S.length - 1, m = this.scales.get(g), T = (m == null ? void 0 : m.distr) === q.Log, [A, y] = o.getCachedMinMax(u, h, M, p, 0, T), x = s.get(g), P = r.get(g);
|
|
345
|
+
s.set(g, x != null ? Math.min(x, A) : A), r.set(g, P != null ? Math.max(P, y) : y);
|
|
346
346
|
}
|
|
347
347
|
for (const [u, h] of s) {
|
|
348
|
-
const
|
|
349
|
-
if (!
|
|
348
|
+
const g = this.scales.get(u);
|
|
349
|
+
if (!g || !g.auto) continue;
|
|
350
350
|
const w = r.get(u) ?? -Q;
|
|
351
351
|
if (h === Q) continue;
|
|
352
|
-
let
|
|
353
|
-
if (
|
|
354
|
-
[
|
|
355
|
-
else if (
|
|
356
|
-
[
|
|
352
|
+
let S, b;
|
|
353
|
+
if (g.distr === q.Log)
|
|
354
|
+
[S, b] = sn(h, w, g.log, !1);
|
|
355
|
+
else if (g.distr === q.Asinh)
|
|
356
|
+
[S, b] = Rn(h, w, g.log, !1);
|
|
357
357
|
else {
|
|
358
|
-
const
|
|
359
|
-
[
|
|
360
|
-
min: { pad: ((i =
|
|
361
|
-
max: { pad: ((f =
|
|
358
|
+
const M = g.range ?? { min: mt, max: mt };
|
|
359
|
+
[S, b] = ne(h, w, {
|
|
360
|
+
min: { pad: ((i = M.min) == null ? void 0 : i.pad) ?? mt.pad, soft: ((l = M.min) == null ? void 0 : l.soft) ?? mt.soft, mode: ((c = M.min) == null ? void 0 : c.mode) ?? mt.mode },
|
|
361
|
+
max: { pad: ((f = M.max) == null ? void 0 : f.pad) ?? mt.pad, soft: ((a = M.max) == null ? void 0 : a.soft) ?? mt.soft, mode: ((d = M.max) == null ? void 0 : d.mode) ?? mt.mode }
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
|
|
364
|
+
g._cfgMin != null && (S = g._cfgMin), g._cfgMax != null && (b = g._cfgMax), g.min = S, g.max = b, gt(g);
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -414,8 +414,8 @@ class Un {
|
|
|
414
414
|
h != null && (h < i && (i = h), h > l && (l = h));
|
|
415
415
|
}
|
|
416
416
|
for (let u = c + 1; u < f; u++) {
|
|
417
|
-
const h = r[u * 2] ?? 1 / 0,
|
|
418
|
-
h < i && (i = h),
|
|
417
|
+
const h = r[u * 2] ?? 1 / 0, g = r[u * 2 + 1] ?? -1 / 0;
|
|
418
|
+
h < i && (i = h), g > l && (l = g);
|
|
419
419
|
}
|
|
420
420
|
const d = f * s;
|
|
421
421
|
for (let u = d; u <= n; u++) {
|
|
@@ -502,7 +502,7 @@ class Kn {
|
|
|
502
502
|
if (a.length === 0)
|
|
503
503
|
c = 0, f = 0;
|
|
504
504
|
else {
|
|
505
|
-
c =
|
|
505
|
+
c = St(i.min, a), f = St(i.max, a);
|
|
506
506
|
const d = a[c], u = a[f];
|
|
507
507
|
c > 0 && d != null && d > i.min && c--, f < a.length - 1 && u != null && u < i.max && f++;
|
|
508
508
|
}
|
|
@@ -540,7 +540,7 @@ class Kn {
|
|
|
540
540
|
const a = f.series[n];
|
|
541
541
|
if (!a || a.length === 0) return [1 / 0, -1 / 0];
|
|
542
542
|
let d;
|
|
543
|
-
const u = !i && r ===
|
|
543
|
+
const u = !i && r === Ht.Unsorted ? this.getOrBuildTree(e, n) : void 0;
|
|
544
544
|
return u ? d = u.rangeMinMax(o, s) : d = _n(a, o, s, r, i), l.set(c, d), d;
|
|
545
545
|
}
|
|
546
546
|
/** Get block tree for a series (exposed for incremental append) */
|
|
@@ -591,12 +591,12 @@ class Kn {
|
|
|
591
591
|
return e;
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
const
|
|
594
|
+
const Bt = -10;
|
|
595
595
|
class On {
|
|
596
596
|
constructor() {
|
|
597
597
|
X(this, "state", {
|
|
598
|
-
left:
|
|
599
|
-
top:
|
|
598
|
+
left: Bt,
|
|
599
|
+
top: Bt,
|
|
600
600
|
activeGroup: -1,
|
|
601
601
|
activeSeriesIdx: -1,
|
|
602
602
|
activeDataIdx: -1
|
|
@@ -623,7 +623,7 @@ class On {
|
|
|
623
623
|
}
|
|
624
624
|
/** Hide the cursor (move off-screen) */
|
|
625
625
|
hide() {
|
|
626
|
-
this.state.left =
|
|
626
|
+
this.state.left = Bt, this.state.top = Bt, this.state.activeGroup = -1, this.state.activeSeriesIdx = -1, this.state.activeDataIdx = -1;
|
|
627
627
|
}
|
|
628
628
|
/**
|
|
629
629
|
* Update cursor position and snap to nearest data point.
|
|
@@ -639,31 +639,31 @@ class On {
|
|
|
639
639
|
this.state.left = e, this.state.top = n;
|
|
640
640
|
let f = 1 / 0, a = -1, d = -1, u = -1;
|
|
641
641
|
const h = this.getGroupedConfigs(r);
|
|
642
|
-
for (let
|
|
643
|
-
const w = s[
|
|
642
|
+
for (let g = 0; g < s.length; g++) {
|
|
643
|
+
const w = s[g];
|
|
644
644
|
if (w == null) continue;
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
649
|
-
const
|
|
650
|
-
if (
|
|
651
|
-
const [
|
|
652
|
-
x >
|
|
645
|
+
const S = w.x;
|
|
646
|
+
if (S.length === 0) continue;
|
|
647
|
+
const b = c(g);
|
|
648
|
+
if (b == null) continue;
|
|
649
|
+
const M = i(b);
|
|
650
|
+
if (M == null || !K(M)) continue;
|
|
651
|
+
const [p, m] = l(g), T = o.width, A = o.left, y = bt(e + A, M, T, A), x = St(y, S, p, m), P = [x];
|
|
652
|
+
x > p && P.push(x - 1), x < m && P.push(x + 1);
|
|
653
653
|
const L = /* @__PURE__ */ new Map();
|
|
654
|
-
for (const
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
658
|
-
for (const
|
|
659
|
-
const
|
|
660
|
-
if (
|
|
661
|
-
const
|
|
662
|
-
if (
|
|
663
|
-
let
|
|
664
|
-
if (
|
|
665
|
-
const _ = o.height,
|
|
666
|
-
if (
|
|
654
|
+
for (const F of P) {
|
|
655
|
+
const I = S[F];
|
|
656
|
+
if (I == null) continue;
|
|
657
|
+
const C = B(I, M, T, A);
|
|
658
|
+
for (const E of h.get(g) ?? []) {
|
|
659
|
+
const H = w.series[E.index];
|
|
660
|
+
if (H == null) continue;
|
|
661
|
+
const v = H[F];
|
|
662
|
+
if (v == null) continue;
|
|
663
|
+
let k = L.get(E.yScale);
|
|
664
|
+
if (k == null && !L.has(E.yScale) && (k = i(E.yScale), L.set(E.yScale, k)), k == null || !K(k)) continue;
|
|
665
|
+
const _ = o.height, D = o.top, $ = B(v, k, _, D), z = e + A - C, G = n + D - $, U = z * z + G * G;
|
|
666
|
+
if (U < f && (f = U, a = g, d = E.index, u = F, U === 0))
|
|
667
667
|
break;
|
|
668
668
|
}
|
|
669
669
|
if (f === 0) break;
|
|
@@ -675,33 +675,33 @@ class On {
|
|
|
675
675
|
* Sync cursor to a specific x-value (from another chart in a sync group).
|
|
676
676
|
* Finds the closest data index and positions the cursor there.
|
|
677
677
|
*/
|
|
678
|
-
syncToValue(e, n) {
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
const s =
|
|
682
|
-
if (
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
const [
|
|
688
|
-
if (
|
|
689
|
-
const
|
|
690
|
-
this.state.left =
|
|
691
|
-
let
|
|
692
|
-
for (const
|
|
693
|
-
if (
|
|
694
|
-
const
|
|
695
|
-
if (w == null) continue;
|
|
696
|
-
const b = w[f];
|
|
678
|
+
syncToValue(e, n, o = 0) {
|
|
679
|
+
const s = n.dataStore.data;
|
|
680
|
+
if (s.length === 0) return;
|
|
681
|
+
const r = o < s.length ? o : 0, i = s[r];
|
|
682
|
+
if (i == null) return;
|
|
683
|
+
const l = n.scaleManager.getGroupXScaleKey(r);
|
|
684
|
+
if (l == null) return;
|
|
685
|
+
const c = n.scaleManager.getScale(l);
|
|
686
|
+
if (c == null || !K(c)) return;
|
|
687
|
+
const [f, a] = n.dataStore.getWindow(r), d = St(e, i.x, f, a), u = i.x[d];
|
|
688
|
+
if (u == null) return;
|
|
689
|
+
const h = B(u, c, n.plotBox.width, n.plotBox.left);
|
|
690
|
+
this.state.left = h - n.plotBox.left, this.state.activeGroup = r, this.state.activeDataIdx = d;
|
|
691
|
+
let g = 0, w = n.plotBox.height / 2;
|
|
692
|
+
for (const S of n.seriesConfigs) {
|
|
693
|
+
if (S.group !== r || S.show === !1) continue;
|
|
694
|
+
const b = i.series[S.index];
|
|
697
695
|
if (b == null) continue;
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
|
|
696
|
+
const M = b[d];
|
|
697
|
+
if (M == null) continue;
|
|
698
|
+
const p = n.scaleManager.getScale(S.yScale);
|
|
699
|
+
if (!(p == null || !K(p))) {
|
|
700
|
+
w = B(M, p, n.plotBox.height, n.plotBox.top) - n.plotBox.top, g = S.index;
|
|
701
701
|
break;
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
this.state.top =
|
|
704
|
+
this.state.top = w, this.state.activeSeriesIdx = g;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
class jn {
|
|
@@ -747,14 +747,14 @@ class jn {
|
|
|
747
747
|
this.cancel(), this.callback = null, this.flags = it.None;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
const
|
|
751
|
-
function
|
|
750
|
+
const jt = { width: 1 }, qn = { width: 0, fill: "auto", fillTo: 0, points: { show: !1 }, cursor: { show: !1 } }, Zn = { width: 0, cursor: { show: !1 } };
|
|
751
|
+
function qt(t, e, n) {
|
|
752
752
|
t.lineTo(e, n);
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Zt(t, e, n) {
|
|
755
755
|
t.lineTo(n, e);
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function pe(t, e, n, o, s, r) {
|
|
758
758
|
const i = [];
|
|
759
759
|
let l = -1;
|
|
760
760
|
const c = s === O.Forward ? n : o, f = s === O.Forward ? o : n, a = s;
|
|
@@ -768,7 +768,7 @@ function me(t, e, n, o, s, r) {
|
|
|
768
768
|
l !== -1 && (i.push([l, r(t[d])]), l = -1);
|
|
769
769
|
return l !== -1 && i.push([l, r(t[o])]), i;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function me(t, e, n, o, s, r) {
|
|
772
772
|
const i = new Path2D();
|
|
773
773
|
let l = e === W.Horizontal ? n : o;
|
|
774
774
|
const c = e === W.Horizontal ? n + s : o + r, f = e === W.Horizontal ? o : n, a = e === W.Horizontal ? r : s;
|
|
@@ -776,16 +776,16 @@ function we(t, e, n, o, s, r) {
|
|
|
776
776
|
d > l && (e === W.Horizontal ? i.rect(l, f, d - l, a) : i.rect(f, l, a, d - l)), l = u;
|
|
777
777
|
return l < c && (e === W.Horizontal ? i.rect(l, f, c - l, a) : i.rect(f, l, a, c - l)), i;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function cn(t) {
|
|
780
780
|
return (e, n, o, s, r, i) => {
|
|
781
781
|
o !== s && (r !== o && i !== o && t(e, n, o), r !== s && i !== s && t(e, n, s), t(e, n, i));
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
|
-
const Jn =
|
|
784
|
+
const Jn = cn(qt), Qn = cn(Zt);
|
|
785
785
|
function to() {
|
|
786
786
|
const t = (e, n, o, s, r, i, l, c, f, a, d, u, h) => {
|
|
787
|
-
const
|
|
788
|
-
if ([f, a] = (s.distr ===
|
|
787
|
+
const g = (h == null ? void 0 : h.spanGaps) ?? !1;
|
|
788
|
+
if ([f, a] = (s.distr === q.Log ? tn : Ot)(n, f, a), f === -1)
|
|
789
789
|
return {
|
|
790
790
|
stroke: new Path2D(),
|
|
791
791
|
fill: null,
|
|
@@ -793,52 +793,52 @@ function to() {
|
|
|
793
793
|
band: null,
|
|
794
794
|
gaps: null
|
|
795
795
|
};
|
|
796
|
-
const
|
|
797
|
-
let
|
|
798
|
-
o.ori === W.Horizontal ? (
|
|
799
|
-
const
|
|
796
|
+
const S = (x) => u(B(x, o, r, l)), b = (x) => u(B(x, s, i, c));
|
|
797
|
+
let M, p;
|
|
798
|
+
o.ori === W.Horizontal ? (M = qt, p = Jn) : (M = Zt, p = Qn);
|
|
799
|
+
const m = {
|
|
800
800
|
stroke: new Path2D(),
|
|
801
801
|
fill: null,
|
|
802
802
|
clip: null,
|
|
803
803
|
band: null,
|
|
804
804
|
gaps: null
|
|
805
|
-
},
|
|
806
|
-
let
|
|
805
|
+
}, T = m.stroke;
|
|
806
|
+
let A = !1;
|
|
807
807
|
if (a - f >= r * 4) {
|
|
808
|
-
const x = (
|
|
809
|
-
let
|
|
810
|
-
const
|
|
811
|
-
let
|
|
812
|
-
for (let
|
|
813
|
-
const _ = e[
|
|
814
|
-
|
|
808
|
+
const x = (k) => bt(k, o, r, l);
|
|
809
|
+
let P = null, L = 0, F = 0, I = 0, C = S(e[d === O.Forward ? f : a]);
|
|
810
|
+
const E = S(e[f]), H = S(e[a]);
|
|
811
|
+
let v = x(d === O.Forward ? E + 1 : H - 1);
|
|
812
|
+
for (let k = d === O.Forward ? f : a; k >= f && k <= a; k += d) {
|
|
813
|
+
const _ = e[k], $ = (d === O.Forward ? _ < v : _ > v) ? C : S(_), z = n[k];
|
|
814
|
+
$ === C ? z != null ? (I = z, P == null ? (M(T, $, b(I)), F = P = L = I) : I < P ? P = I : I > L && (L = I)) : z === null && !g && (A = !0) : (P != null && p(T, C, b(P), b(L), b(F), b(I)), z != null ? (I = z, M(T, $, b(I)), P = L = F = I) : (P = null, L = 0, z === null && !g && (A = !0)), C = $, v = x(C + d));
|
|
815
815
|
}
|
|
816
|
-
|
|
816
|
+
P != null && (P !== L ? p(T, C, b(P), b(L), b(F), b(I)) : M(T, C, b(I)));
|
|
817
817
|
} else
|
|
818
818
|
for (let x = d === O.Forward ? f : a; x >= f && x <= a; x += d) {
|
|
819
|
-
const
|
|
820
|
-
|
|
819
|
+
const P = n[x];
|
|
820
|
+
P === null && !g ? A = !0 : P != null && M(T, S(e[x]), b(P));
|
|
821
821
|
}
|
|
822
822
|
{
|
|
823
|
-
const x =
|
|
824
|
-
let
|
|
825
|
-
d === O.Backward && ([
|
|
823
|
+
const x = m.fill = new Path2D(T), P = (h == null ? void 0 : h.fillTo) ?? s.min ?? 0, L = b(P);
|
|
824
|
+
let F = S(e[f]), I = S(e[a]);
|
|
825
|
+
d === O.Backward && ([I, F] = [F, I]), M(x, I, L), M(x, F, L);
|
|
826
826
|
}
|
|
827
|
-
if (
|
|
828
|
-
const x =
|
|
829
|
-
|
|
827
|
+
if (A) {
|
|
828
|
+
const x = pe(e, n, f, a, d, S);
|
|
829
|
+
m.gaps = x, m.clip = me(x, o.ori, l, c, r, i);
|
|
830
830
|
}
|
|
831
|
-
return
|
|
831
|
+
return m;
|
|
832
832
|
};
|
|
833
|
-
return t.defaults =
|
|
833
|
+
return t.defaults = jt, t;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function an(t, e, n) {
|
|
836
836
|
const o = t.length;
|
|
837
837
|
if (n = Math.max(2, Math.round(n)), o <= n) {
|
|
838
|
-
const u = new Uint32Array(o), h = new Float64Array(o),
|
|
838
|
+
const u = new Uint32Array(o), h = new Float64Array(o), g = new Array(o);
|
|
839
839
|
for (let w = 0; w < o; w++)
|
|
840
|
-
u[w] = w, h[w] = t[w],
|
|
841
|
-
return { indices: u, x: h, y:
|
|
840
|
+
u[w] = w, h[w] = t[w], g[w] = e[w] ?? null;
|
|
841
|
+
return { indices: u, x: h, y: g };
|
|
842
842
|
}
|
|
843
843
|
const s = [];
|
|
844
844
|
let r = -1, i = 0;
|
|
@@ -851,17 +851,17 @@ function un(t, e, n) {
|
|
|
851
851
|
y: []
|
|
852
852
|
};
|
|
853
853
|
if (i <= n) {
|
|
854
|
-
const u = new Uint32Array(i), h = new Float64Array(i),
|
|
854
|
+
const u = new Uint32Array(i), h = new Float64Array(i), g = new Array(i);
|
|
855
855
|
let w = 0;
|
|
856
|
-
for (let
|
|
857
|
-
e[
|
|
858
|
-
return { indices: u, x: h, y:
|
|
856
|
+
for (let S = 0; S < o; S++)
|
|
857
|
+
e[S] != null && (u[w] = S, h[w] = t[S], g[w] = e[S], w++);
|
|
858
|
+
return { indices: u, x: h, y: g };
|
|
859
859
|
}
|
|
860
860
|
const l = [];
|
|
861
861
|
for (const [u, h] of s) {
|
|
862
|
-
const
|
|
863
|
-
for (const
|
|
864
|
-
l.push(
|
|
862
|
+
const g = h - u + 1, w = Math.max(2, Math.round(n * (g / i))), S = eo(t, e, u, h, w);
|
|
863
|
+
for (const b of S)
|
|
864
|
+
l.push(b);
|
|
865
865
|
}
|
|
866
866
|
const c = l.length, f = new Uint32Array(c), a = new Float64Array(c), d = new Array(c);
|
|
867
867
|
for (let u = 0; u < c; u++) {
|
|
@@ -883,23 +883,23 @@ function eo(t, e, n, o, s) {
|
|
|
883
883
|
let f = n;
|
|
884
884
|
for (let a = 0; a < l; a++) {
|
|
885
885
|
const d = n + 1 + Math.floor(a * c), u = Math.min(n + 1 + Math.floor((a + 1) * c) - 1, o - 1);
|
|
886
|
-
let h = 0,
|
|
886
|
+
let h = 0, g = 0, w = 0;
|
|
887
887
|
if (a < l - 1) {
|
|
888
|
-
const
|
|
889
|
-
for (let
|
|
890
|
-
h += t[
|
|
888
|
+
const m = n + 1 + Math.floor((a + 1) * c), T = Math.min(n + 1 + Math.floor((a + 2) * c) - 1, o - 1);
|
|
889
|
+
for (let A = m; A <= T; A++)
|
|
890
|
+
h += t[A], g += e[A], w++;
|
|
891
891
|
} else
|
|
892
|
-
h = t[o],
|
|
893
|
-
w > 0 && (h /= w,
|
|
894
|
-
const
|
|
895
|
-
let
|
|
896
|
-
for (let
|
|
897
|
-
const
|
|
898
|
-
|
|
892
|
+
h = t[o], g = e[o], w = 1;
|
|
893
|
+
w > 0 && (h /= w, g /= w);
|
|
894
|
+
const S = t[f], b = e[f];
|
|
895
|
+
let M = d, p = -1;
|
|
896
|
+
for (let m = d; m <= u; m++) {
|
|
897
|
+
const T = t[m], A = e[m], y = Math.abs(
|
|
898
|
+
S * (A - g) + T * (g - b) + h * (b - A)
|
|
899
899
|
);
|
|
900
|
-
y >
|
|
900
|
+
y > p && (p = y, M = m);
|
|
901
901
|
}
|
|
902
|
-
i.push(
|
|
902
|
+
i.push(M), f = M;
|
|
903
903
|
}
|
|
904
904
|
return i.push(o), i;
|
|
905
905
|
}
|
|
@@ -909,7 +909,7 @@ function ui(t, e) {
|
|
|
909
909
|
return t;
|
|
910
910
|
const o = /* @__PURE__ */ new Set();
|
|
911
911
|
for (const c of t.series) {
|
|
912
|
-
const f =
|
|
912
|
+
const f = an(t.x, c, e);
|
|
913
913
|
for (let a = 0; a < f.indices.length; a++)
|
|
914
914
|
o.add(f.indices[a]);
|
|
915
915
|
}
|
|
@@ -932,16 +932,16 @@ function ui(t, e) {
|
|
|
932
932
|
return { x: i, series: l };
|
|
933
933
|
}
|
|
934
934
|
function no(t) {
|
|
935
|
-
const n = to(), o = (s, r, i, l, c, f, a, d, u, h,
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
const
|
|
939
|
-
for (let y = 0; y <
|
|
940
|
-
|
|
941
|
-
const
|
|
935
|
+
const n = to(), o = (s, r, i, l, c, f, a, d, u, h, g, w, S) => {
|
|
936
|
+
const b = h - u + 1, M = Math.round(c * 1);
|
|
937
|
+
if (b > M * 2) {
|
|
938
|
+
const p = h - u + 1, m = new Float64Array(p), T = new Array(p);
|
|
939
|
+
for (let y = 0; y < p; y++)
|
|
940
|
+
m[y] = s[u + y], T[y] = r[u + y] ?? null;
|
|
941
|
+
const A = an(m, T, M);
|
|
942
942
|
return n(
|
|
943
|
-
|
|
944
|
-
|
|
943
|
+
A.x,
|
|
944
|
+
A.y,
|
|
945
945
|
i,
|
|
946
946
|
l,
|
|
947
947
|
c,
|
|
@@ -949,10 +949,10 @@ function no(t) {
|
|
|
949
949
|
a,
|
|
950
950
|
d,
|
|
951
951
|
0,
|
|
952
|
-
|
|
953
|
-
|
|
952
|
+
A.x.length - 1,
|
|
953
|
+
g,
|
|
954
954
|
w,
|
|
955
|
-
|
|
955
|
+
S
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
958
|
return n(
|
|
@@ -966,15 +966,15 @@ function no(t) {
|
|
|
966
966
|
d,
|
|
967
967
|
u,
|
|
968
968
|
h,
|
|
969
|
-
|
|
969
|
+
g,
|
|
970
970
|
w,
|
|
971
|
-
|
|
971
|
+
S
|
|
972
972
|
);
|
|
973
973
|
};
|
|
974
|
-
return o.defaults =
|
|
974
|
+
return o.defaults = jt, o;
|
|
975
975
|
}
|
|
976
976
|
const Pe = /* @__PURE__ */ new WeakMap();
|
|
977
|
-
function
|
|
977
|
+
function Le(t, e, n) {
|
|
978
978
|
return typeof e == "string" ? e : oo(t, e, n);
|
|
979
979
|
}
|
|
980
980
|
function oo(t, e, n) {
|
|
@@ -991,15 +991,15 @@ function so(t, e, n, o, s) {
|
|
|
991
991
|
const r = e.alpha ?? 1;
|
|
992
992
|
t.save(), r < 1 && (t.globalAlpha = r), n.clip && t.clip(n.clip);
|
|
993
993
|
const i = s ?? { left: 0, top: 0, width: t.canvas.width / o, height: t.canvas.height / o };
|
|
994
|
-
if (e.fill && n.fill && (t.fillStyle =
|
|
994
|
+
if (e.fill && n.fill && (t.fillStyle = Le(t, e.fill, i), t.fill(n.fill)), e.stroke) {
|
|
995
995
|
const l = (e.width ?? 1) * o;
|
|
996
|
-
t.strokeStyle =
|
|
996
|
+
t.strokeStyle = Le(t, e.stroke, i), t.lineWidth = l, t.lineJoin = e.join ?? "round", t.lineCap = e.cap ?? "butt", e.dash && t.setLineDash(e.dash.map((d) => d * o));
|
|
997
997
|
const c = e.pxAlign ?? 0, f = l % 2 / 2;
|
|
998
998
|
c === 1 && f > 0 && t.translate(f, f), t.stroke(n.stroke);
|
|
999
999
|
}
|
|
1000
1000
|
t.restore();
|
|
1001
1001
|
}
|
|
1002
|
-
const io = no(),
|
|
1002
|
+
const io = no(), _e = 64;
|
|
1003
1003
|
class ro {
|
|
1004
1004
|
constructor() {
|
|
1005
1005
|
X(this, "ctx", null);
|
|
@@ -1069,8 +1069,8 @@ class ro {
|
|
|
1069
1069
|
/** Store paths in cache, evicting oldest 25% when at capacity.
|
|
1070
1070
|
* Callers may pass padded i0/i1 (wider than the visible window) for "runway" during panning. */
|
|
1071
1071
|
setCachedPaths(e, n, o, s, r) {
|
|
1072
|
-
if (this.pathCache.size >=
|
|
1073
|
-
const l =
|
|
1072
|
+
if (this.pathCache.size >= _e) {
|
|
1073
|
+
const l = _e >> 2, c = this.pathCache.keys();
|
|
1074
1074
|
for (let f = 0; f < l; f++) {
|
|
1075
1075
|
const a = c.next().value;
|
|
1076
1076
|
a != null && this.pathCache.delete(a);
|
|
@@ -1118,9 +1118,9 @@ class ro {
|
|
|
1118
1118
|
const r = e.config.group, i = e.config.index, [l, c] = e.window;
|
|
1119
1119
|
let f = this.getCachedPaths(r, i, l, c);
|
|
1120
1120
|
if (f == null) {
|
|
1121
|
-
const a = e.config.paths ?? io, d = e.xScale.dir, u = zn(e.config.pxAlign ?? 0), h = c - l,
|
|
1122
|
-
let
|
|
1123
|
-
typeof
|
|
1121
|
+
const a = e.config.paths ?? io, d = e.xScale.dir, u = zn(e.config.pxAlign ?? 0), h = c - l, g = Math.max(1, Math.ceil(h * 0.1)), w = e.dataX.length, S = Math.max(0, l - g), b = Math.min(w - 1, c + g), M = e.config.fillTo;
|
|
1122
|
+
let p;
|
|
1123
|
+
typeof M == "function" ? p = M(e.yScale.min ?? 0, e.yScale.max ?? 0) : M === 0 && e.yScale.distr === q.Log ? p = 1 : p = M, f = a(
|
|
1124
1124
|
e.dataX,
|
|
1125
1125
|
e.dataY,
|
|
1126
1126
|
e.xScale,
|
|
@@ -1129,12 +1129,12 @@ class ro {
|
|
|
1129
1129
|
n.height,
|
|
1130
1130
|
n.left,
|
|
1131
1131
|
n.top,
|
|
1132
|
+
S,
|
|
1132
1133
|
b,
|
|
1133
|
-
g,
|
|
1134
1134
|
d,
|
|
1135
1135
|
u,
|
|
1136
|
-
{ fillTo:
|
|
1137
|
-
), this.setCachedPaths(r, i,
|
|
1136
|
+
{ fillTo: p, spanGaps: e.config.spanGaps }
|
|
1137
|
+
), this.setCachedPaths(r, i, S, b, f);
|
|
1138
1138
|
}
|
|
1139
1139
|
so(s, e.config, f, o, n);
|
|
1140
1140
|
}
|
|
@@ -1151,40 +1151,40 @@ class ro {
|
|
|
1151
1151
|
r.restore();
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
const
|
|
1154
|
+
const un = [1, 2, 2.5, 5], lo = nn(10, -32, 0, un), co = nn(10, 0, 32, un), Mt = lo.concat(co);
|
|
1155
1155
|
function ao(t, e, n, o, s) {
|
|
1156
1156
|
if (n <= 0 || e < t) return [];
|
|
1157
|
-
const r = [], i =
|
|
1158
|
-
for (let c = l; c <= e; c =
|
|
1157
|
+
const r = [], i = Dt.get(n) ?? 0, l = s ? Math.ceil(t / n) * n : ht(ge(t, n), i);
|
|
1158
|
+
for (let c = l; c <= e; c = ht(c + n, i))
|
|
1159
1159
|
r.push(Object.is(c, -0) ? 0 : c);
|
|
1160
1160
|
return r;
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1163
|
-
return t.map((e) =>
|
|
1162
|
+
function oe(t) {
|
|
1163
|
+
return t.map((e) => on(e));
|
|
1164
1164
|
}
|
|
1165
1165
|
function uo(t, e, n) {
|
|
1166
1166
|
if (t <= 0 || e <= 0 || t >= e) return [];
|
|
1167
|
-
const o = [], r =
|
|
1168
|
-
let i =
|
|
1169
|
-
n === 10 && (i = St
|
|
1167
|
+
const o = [], r = ft((n === 10 ? ct : Ft)(t));
|
|
1168
|
+
let i = xt(n, r);
|
|
1169
|
+
n === 10 && (i = Mt[St(i, Mt)] ?? i);
|
|
1170
1170
|
let l = i, c = i * n;
|
|
1171
|
-
n === 10 && (c = St
|
|
1171
|
+
n === 10 && (c = Mt[St(c, Mt)] ?? c);
|
|
1172
1172
|
let f = 0;
|
|
1173
1173
|
do {
|
|
1174
|
-
if (l >= t && o.push(l), l = l + i, n === 10 && !
|
|
1175
|
-
const a =
|
|
1176
|
-
l =
|
|
1174
|
+
if (l >= t && o.push(l), l = l + i, n === 10 && !Dt.has(l)) {
|
|
1175
|
+
const a = Dt.get(i) ?? 0;
|
|
1176
|
+
l = ht(l, a);
|
|
1177
1177
|
}
|
|
1178
|
-
l >= c * (1 - 1e-10) && (i = l, c = i * n, n === 10 && (c = St
|
|
1178
|
+
l >= c * (1 - 1e-10) && (i = l, c = i * n, n === 10 && (c = Mt[St(c, Mt)] ?? c));
|
|
1179
1179
|
} while (l <= e && ++f < 1e4);
|
|
1180
1180
|
return o;
|
|
1181
1181
|
}
|
|
1182
1182
|
function fo(t, e, n = 1) {
|
|
1183
1183
|
const o = [];
|
|
1184
|
-
if (Math.max(
|
|
1184
|
+
if (Math.max(lt(t), lt(e)) === 0) return [0];
|
|
1185
1185
|
if (t < 0) {
|
|
1186
|
-
const i =
|
|
1187
|
-
let l =
|
|
1186
|
+
const i = lt(t);
|
|
1187
|
+
let l = xt(10, ft(ct(Math.max(i, n))));
|
|
1188
1188
|
for (; l >= n; ) {
|
|
1189
1189
|
const c = -l;
|
|
1190
1190
|
c >= t && c <= e && o.push(c), l /= 10;
|
|
@@ -1200,29 +1200,29 @@ function fo(t, e, n = 1) {
|
|
|
1200
1200
|
const r = [];
|
|
1201
1201
|
for (const i of o) {
|
|
1202
1202
|
const l = r[r.length - 1];
|
|
1203
|
-
(r.length === 0 || l != null &&
|
|
1203
|
+
(r.length === 0 || l != null && lt(i - l) > 1e-10) && r.push(i);
|
|
1204
1204
|
}
|
|
1205
1205
|
return r;
|
|
1206
1206
|
}
|
|
1207
1207
|
function ho(t, e) {
|
|
1208
|
-
const n = e === 10 ?
|
|
1208
|
+
const n = e === 10 ? ct : Ft;
|
|
1209
1209
|
return t.map((o) => {
|
|
1210
1210
|
if (o === 0) return !0;
|
|
1211
1211
|
if (o < 0) return !1;
|
|
1212
1212
|
const s = n(o);
|
|
1213
|
-
return
|
|
1213
|
+
return lt(s - Math.round(s)) < 1e-10;
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
1216
|
const go = 7, po = 50, mo = 16;
|
|
1217
1217
|
function wo(t, e) {
|
|
1218
|
-
const o =
|
|
1218
|
+
const o = on(Math.max(Math.abs(t), Math.abs(e))).length * go;
|
|
1219
1219
|
return Math.max(po, o + mo);
|
|
1220
1220
|
}
|
|
1221
1221
|
function vo(t, e, n, o) {
|
|
1222
1222
|
if (o <= 0)
|
|
1223
1223
|
return [0, 0];
|
|
1224
|
-
const s =
|
|
1225
|
-
return
|
|
1224
|
+
const s = Et(t.side) === W.Vertical, r = t.space ?? (s ? 30 : wo(e, n)), i = t.incrs ?? Mt;
|
|
1225
|
+
return Gn(e, n, i, o, r);
|
|
1226
1226
|
}
|
|
1227
1227
|
const So = 50;
|
|
1228
1228
|
function bo(t, e, n) {
|
|
@@ -1230,7 +1230,7 @@ function bo(t, e, n) {
|
|
|
1230
1230
|
if (t.size != null)
|
|
1231
1231
|
return t.size;
|
|
1232
1232
|
const o = ((l = t.ticks) == null ? void 0 : l.show) !== !1 ? ((c = t.ticks) == null ? void 0 : c.size) ?? 10 : 0, s = t.gap ?? 5, r = 12;
|
|
1233
|
-
if (
|
|
1233
|
+
if (Et(t.side) === W.Vertical && e != null) {
|
|
1234
1234
|
let f = 0;
|
|
1235
1235
|
for (const d of e)
|
|
1236
1236
|
d.length > f && (f = d.length);
|
|
@@ -1253,7 +1253,7 @@ function Mo(t) {
|
|
|
1253
1253
|
_rotate: 0
|
|
1254
1254
|
};
|
|
1255
1255
|
}
|
|
1256
|
-
const yo = 1,
|
|
1256
|
+
const yo = 1, Pt = 60, yt = 3600, vt = 86400, xo = 604800, Ct = 2592e3, Rt = 31536e3, Co = [
|
|
1257
1257
|
// Seconds
|
|
1258
1258
|
yo,
|
|
1259
1259
|
5,
|
|
@@ -1261,46 +1261,46 @@ const yo = 1, It = 60, bt = 3600, mt = 86400, xo = 604800, xt = 2592e3, $t = 315
|
|
|
1261
1261
|
15,
|
|
1262
1262
|
30,
|
|
1263
1263
|
// Minutes
|
|
1264
|
-
|
|
1265
|
-
5 *
|
|
1266
|
-
10 *
|
|
1267
|
-
15 *
|
|
1268
|
-
30 *
|
|
1264
|
+
Pt,
|
|
1265
|
+
5 * Pt,
|
|
1266
|
+
10 * Pt,
|
|
1267
|
+
15 * Pt,
|
|
1268
|
+
30 * Pt,
|
|
1269
1269
|
// Hours
|
|
1270
|
-
|
|
1271
|
-
2 *
|
|
1272
|
-
3 *
|
|
1273
|
-
4 *
|
|
1274
|
-
6 *
|
|
1275
|
-
12 *
|
|
1270
|
+
yt,
|
|
1271
|
+
2 * yt,
|
|
1272
|
+
3 * yt,
|
|
1273
|
+
4 * yt,
|
|
1274
|
+
6 * yt,
|
|
1275
|
+
12 * yt,
|
|
1276
1276
|
// Days
|
|
1277
|
-
|
|
1278
|
-
2 *
|
|
1279
|
-
3 *
|
|
1280
|
-
7 *
|
|
1281
|
-
14 *
|
|
1277
|
+
vt,
|
|
1278
|
+
2 * vt,
|
|
1279
|
+
3 * vt,
|
|
1280
|
+
7 * vt,
|
|
1281
|
+
14 * vt,
|
|
1282
1282
|
// Months (approximate)
|
|
1283
|
-
|
|
1284
|
-
2 *
|
|
1285
|
-
3 *
|
|
1286
|
-
6 *
|
|
1283
|
+
Ct,
|
|
1284
|
+
2 * Ct,
|
|
1285
|
+
3 * Ct,
|
|
1286
|
+
6 * Ct,
|
|
1287
1287
|
// Years
|
|
1288
|
-
|
|
1288
|
+
Rt
|
|
1289
1289
|
];
|
|
1290
1290
|
function ko(t, e, n) {
|
|
1291
1291
|
const o = [];
|
|
1292
1292
|
if (n <= 0 || t >= e) return o;
|
|
1293
1293
|
let s;
|
|
1294
|
-
if (n >=
|
|
1294
|
+
if (n >= Rt) {
|
|
1295
1295
|
const r = new Date(t * 1e3);
|
|
1296
1296
|
for (r.setUTCMonth(0, 1), r.setUTCHours(0, 0, 0, 0), s = r.getTime() / 1e3, s < t && (r.setUTCFullYear(r.getUTCFullYear() + 1), s = r.getTime() / 1e3); s <= e; )
|
|
1297
|
-
o.push(s), r.setUTCFullYear(r.getUTCFullYear() + Math.round(n /
|
|
1297
|
+
o.push(s), r.setUTCFullYear(r.getUTCFullYear() + Math.round(n / Rt)), s = r.getTime() / 1e3;
|
|
1298
1298
|
return o;
|
|
1299
1299
|
}
|
|
1300
|
-
if (n >=
|
|
1300
|
+
if (n >= Ct) {
|
|
1301
1301
|
const r = new Date(t * 1e3);
|
|
1302
1302
|
r.setUTCDate(1), r.setUTCHours(0, 0, 0, 0), s = r.getTime() / 1e3;
|
|
1303
|
-
const i = Math.max(1, Math.round(n /
|
|
1303
|
+
const i = Math.max(1, Math.round(n / Ct));
|
|
1304
1304
|
if (s < t && (r.setUTCMonth(r.getUTCMonth() + 1), s = r.getTime() / 1e3), i > 1) {
|
|
1305
1305
|
const l = r.getUTCMonth(), c = Math.ceil((l + 1) / i) * i;
|
|
1306
1306
|
r.setUTCMonth(c - 1), s = r.getTime() / 1e3;
|
|
@@ -1309,9 +1309,9 @@ function ko(t, e, n) {
|
|
|
1309
1309
|
o.push(s), r.setUTCMonth(r.getUTCMonth() + i), s = r.getTime() / 1e3;
|
|
1310
1310
|
return o;
|
|
1311
1311
|
}
|
|
1312
|
-
if (n >=
|
|
1312
|
+
if (n >= vt) {
|
|
1313
1313
|
const r = new Date(t * 1e3);
|
|
1314
|
-
r.setUTCHours(0, 0, 0, 0), s = r.getTime() / 1e3, s < t && (s +=
|
|
1314
|
+
r.setUTCHours(0, 0, 0, 0), s = r.getTime() / 1e3, s < t && (s += vt);
|
|
1315
1315
|
} else
|
|
1316
1316
|
s = Math.ceil(t / n) * n;
|
|
1317
1317
|
for (let r = 0; ; r++) {
|
|
@@ -1321,40 +1321,40 @@ function ko(t, e, n) {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
return o;
|
|
1323
1323
|
}
|
|
1324
|
-
const
|
|
1324
|
+
const De = /* @__PURE__ */ new Map();
|
|
1325
1325
|
function To(t, e) {
|
|
1326
1326
|
const n = JSON.stringify(t) + (e ?? "");
|
|
1327
|
-
let o =
|
|
1328
|
-
return o == null && (o = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }),
|
|
1327
|
+
let o = De.get(n);
|
|
1328
|
+
return o == null && (o = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }), De.set(n, o)), o;
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function at(t, e, n) {
|
|
1331
1331
|
const o = new Date(t * 1e3);
|
|
1332
1332
|
return To(e, n).format(o);
|
|
1333
1333
|
}
|
|
1334
1334
|
function Ao(t, e) {
|
|
1335
|
-
return
|
|
1335
|
+
return at(t, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
|
|
1336
1336
|
}
|
|
1337
1337
|
function Io(t, e) {
|
|
1338
|
-
return
|
|
1339
|
-
}
|
|
1340
|
-
function Lo(t, e) {
|
|
1341
|
-
return ct(t, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
|
|
1338
|
+
return at(t, { year: "numeric", month: "2-digit", day: "2-digit" }, e);
|
|
1342
1339
|
}
|
|
1343
1340
|
function Po(t, e) {
|
|
1344
|
-
return
|
|
1341
|
+
return at(t, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
|
|
1342
|
+
}
|
|
1343
|
+
function Lo(t, e) {
|
|
1344
|
+
return at(t, { hour: "2-digit", minute: "2-digit", hour12: !1 }, e);
|
|
1345
1345
|
}
|
|
1346
1346
|
function _o(t, e) {
|
|
1347
|
-
return
|
|
1347
|
+
return at(t, { month: "short", day: "numeric" }, e);
|
|
1348
1348
|
}
|
|
1349
1349
|
function Do(t, e) {
|
|
1350
|
-
return
|
|
1350
|
+
return at(t, { year: "numeric" }, e);
|
|
1351
1351
|
}
|
|
1352
1352
|
function Eo(t, e) {
|
|
1353
|
-
return
|
|
1353
|
+
return at(t, { year: "numeric", month: "short" }, e);
|
|
1354
1354
|
}
|
|
1355
1355
|
function Fo(t, e, n) {
|
|
1356
1356
|
let o;
|
|
1357
|
-
return e >=
|
|
1357
|
+
return e >= Rt ? o = Do : e >= Ct ? o = Eo : e >= xo ? o = Io : e >= vt ? o = _o : e >= yt ? o = Lo : e >= Pt ? o = Po : o = Ao, t.map((s) => o(s, n));
|
|
1358
1358
|
}
|
|
1359
1359
|
function zo(t, e, n, o, s) {
|
|
1360
1360
|
const r = e - t;
|
|
@@ -1364,7 +1364,7 @@ function zo(t, e, n, o, s) {
|
|
|
1364
1364
|
if (f >= s)
|
|
1365
1365
|
return [l, f];
|
|
1366
1366
|
}
|
|
1367
|
-
const i = n[n.length - 1] ??
|
|
1367
|
+
const i = n[n.length - 1] ?? Rt;
|
|
1368
1368
|
return [i, o / (r / i)];
|
|
1369
1369
|
}
|
|
1370
1370
|
const Ho = 3;
|
|
@@ -1380,50 +1380,50 @@ function $o(t, e, n, o, s) {
|
|
|
1380
1380
|
continue;
|
|
1381
1381
|
} else
|
|
1382
1382
|
i._show || (r = !1, i._show = !0);
|
|
1383
|
-
const f = l.side, d =
|
|
1384
|
-
let
|
|
1383
|
+
const f = l.side, d = Et(f) === W.Horizontal ? n : o, u = c.min, h = c.max;
|
|
1384
|
+
let g, w;
|
|
1385
1385
|
if (c.time) {
|
|
1386
|
-
const
|
|
1387
|
-
[
|
|
1386
|
+
const b = l.space ?? 80;
|
|
1387
|
+
[g, w] = zo(u, h, Co, d, b);
|
|
1388
1388
|
} else
|
|
1389
|
-
[
|
|
1390
|
-
if (c._discrete &&
|
|
1389
|
+
[g, w] = vo(l, u, h, d);
|
|
1390
|
+
if (c._discrete && g > 0 && g < 1 && (g = 1), i._incr = g, i._space = w, w === 0)
|
|
1391
1391
|
continue;
|
|
1392
1392
|
if (l.splits)
|
|
1393
|
-
i._splits = l.splits(u, h,
|
|
1393
|
+
i._splits = l.splits(u, h, g, w);
|
|
1394
1394
|
else if (c.time)
|
|
1395
|
-
i._splits = ko(u, h,
|
|
1396
|
-
else if (c.distr ===
|
|
1395
|
+
i._splits = ko(u, h, g);
|
|
1396
|
+
else if (c.distr === q.Log)
|
|
1397
1397
|
i._splits = uo(u, h, c.log);
|
|
1398
|
-
else if (c.distr ===
|
|
1398
|
+
else if (c.distr === q.Asinh)
|
|
1399
1399
|
i._splits = fo(u, h, c.asinh);
|
|
1400
1400
|
else {
|
|
1401
|
-
const
|
|
1402
|
-
i._splits = ao(u, h,
|
|
1401
|
+
const b = c.distr === q.Ordinal || c._discrete;
|
|
1402
|
+
i._splits = ao(u, h, g, w, b);
|
|
1403
1403
|
}
|
|
1404
1404
|
if (l.values)
|
|
1405
|
-
i._values = l.values(i._splits, w,
|
|
1405
|
+
i._values = l.values(i._splits, w, g);
|
|
1406
1406
|
else if (c.time)
|
|
1407
|
-
i._values = Fo(i._splits,
|
|
1408
|
-
else if (c.distr ===
|
|
1409
|
-
const
|
|
1410
|
-
i._values =
|
|
1411
|
-
} else c.distr,
|
|
1412
|
-
i._rotate = f ===
|
|
1413
|
-
const
|
|
1414
|
-
i._size =
|
|
1407
|
+
i._values = Fo(i._splits, g);
|
|
1408
|
+
else if (c.distr === q.Log) {
|
|
1409
|
+
const b = ho(i._splits, c.log), M = oe(i._splits);
|
|
1410
|
+
i._values = M.map((p, m) => b[m] ? p : "");
|
|
1411
|
+
} else c.distr, q.Asinh, i._values = oe(i._splits);
|
|
1412
|
+
i._rotate = f === N.Bottom ? l.rotate ?? 0 : 0;
|
|
1413
|
+
const S = i._size;
|
|
1414
|
+
i._size = Wt(bo(l, i._values)), S !== i._size && (r = !1);
|
|
1415
1415
|
}
|
|
1416
1416
|
return r;
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function Ee(t, e, n, o = 0) {
|
|
1419
1419
|
let s = t, r = e - o, i = 0, l = o;
|
|
1420
1420
|
for (const f of n) {
|
|
1421
1421
|
if (!f._show)
|
|
1422
1422
|
continue;
|
|
1423
|
-
const a = f.config.side, d =
|
|
1424
|
-
h > 0 && (d ? (s -= h, a ===
|
|
1423
|
+
const a = f.config.side, d = Et(a) === W.Vertical, u = f.config.label != null ? f.config.labelSize ?? 20 : 0, h = f._size + u;
|
|
1424
|
+
h > 0 && (d ? (s -= h, a === N.Left && (i += h)) : (r -= h, a === N.Top && (l += h)));
|
|
1425
1425
|
}
|
|
1426
|
-
return !n.some((f) => f._show && f.config.side ===
|
|
1426
|
+
return !n.some((f) => f._show && f.config.side === N.Top) && l <= o && (l += 8, r -= 8), {
|
|
1427
1427
|
left: i,
|
|
1428
1428
|
top: l,
|
|
1429
1429
|
width: Math.max(s, 0),
|
|
@@ -1434,17 +1434,17 @@ function Wo(t, e) {
|
|
|
1434
1434
|
let n = e.top, o = e.left + e.width, s = e.top + e.height, r = e.left;
|
|
1435
1435
|
function i(l, c) {
|
|
1436
1436
|
switch (l) {
|
|
1437
|
-
case
|
|
1437
|
+
case N.Top:
|
|
1438
1438
|
return n -= c, n + c;
|
|
1439
|
-
case
|
|
1439
|
+
case N.Right: {
|
|
1440
1440
|
const f = o;
|
|
1441
1441
|
return o += c, f;
|
|
1442
1442
|
}
|
|
1443
|
-
case
|
|
1443
|
+
case N.Bottom: {
|
|
1444
1444
|
const f = s;
|
|
1445
1445
|
return s += c, f;
|
|
1446
1446
|
}
|
|
1447
|
-
case
|
|
1447
|
+
case N.Left:
|
|
1448
1448
|
return r -= c, r + c;
|
|
1449
1449
|
default:
|
|
1450
1450
|
return 0;
|
|
@@ -1460,7 +1460,7 @@ function Wo(t, e) {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1463
|
+
function Ro(t, e, n, o, s = 0) {
|
|
1464
1464
|
for (const c of n)
|
|
1465
1465
|
c._size = 0;
|
|
1466
1466
|
let r = !1, i = 0, l = { left: 0, top: 0, width: t, height: e };
|
|
@@ -1472,85 +1472,85 @@ function Go(t, e, n, o, s = 0) {
|
|
|
1472
1472
|
l.width,
|
|
1473
1473
|
l.height
|
|
1474
1474
|
);
|
|
1475
|
-
r = i === Ho || c, r || (l =
|
|
1475
|
+
r = i === Ho || c, r || (l = Ee(t, e, n, s));
|
|
1476
1476
|
}
|
|
1477
|
-
return l =
|
|
1477
|
+
return l = Ee(t, e, n, s), Wo(n, l), l;
|
|
1478
1478
|
}
|
|
1479
|
-
const
|
|
1480
|
-
function
|
|
1479
|
+
const Fe = "top", ze = "bottom", Go = "left", Bo = "right";
|
|
1480
|
+
function se(t, e) {
|
|
1481
1481
|
return e === 1 ? t : t.replace(/(\d+(?:\.\d+)?)px/, (n, o) => `${Math.round(Number(o) * e)}px`);
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1483
|
+
function He(t, e, n, o, s, r, i, l, c, f, a) {
|
|
1484
1484
|
const d = l % 2 / 2;
|
|
1485
1485
|
t.save(), t.translate(d, d), t.strokeStyle = c, t.lineWidth = l, f.length > 0 && t.setLineDash(f), t.beginPath();
|
|
1486
|
-
let u = 0, h = 0,
|
|
1487
|
-
const
|
|
1488
|
-
o === W.Horizontal ? (h = r, w =
|
|
1489
|
-
for (let
|
|
1490
|
-
n[
|
|
1486
|
+
let u = 0, h = 0, g = 0, w = 0;
|
|
1487
|
+
const S = r + (s === N.Top || s === N.Left ? -i : i);
|
|
1488
|
+
o === W.Horizontal ? (h = r, w = S) : (u = r, g = S);
|
|
1489
|
+
for (let b = 0; b < e.length; b++)
|
|
1490
|
+
n[b] != null && (o === W.Horizontal ? u = g = e[b] ?? 0 : h = w = e[b] ?? 0, t.moveTo(u, h), t.lineTo(g, w));
|
|
1491
1491
|
t.stroke(), t.restore();
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Vo(t, e, n, o, s, r) {
|
|
1494
1494
|
const i = R(o.left * s), l = R(o.top * s), c = R(o.width * s), f = R(o.height * s);
|
|
1495
1495
|
for (const a of e) {
|
|
1496
1496
|
if (!a._show)
|
|
1497
1497
|
continue;
|
|
1498
|
-
const d = a.config, u = d.side, h =
|
|
1499
|
-
if (!
|
|
1498
|
+
const d = a.config, u = d.side, h = Et(u), g = n(d.scale);
|
|
1499
|
+
if (!g || !K(g))
|
|
1500
1500
|
continue;
|
|
1501
|
-
const w = d.stroke ?? "#000",
|
|
1502
|
-
if (!
|
|
1501
|
+
const w = d.stroke ?? "#000", S = u === N.Top || u === N.Left ? -1 : 1, b = a._splits, M = a._values;
|
|
1502
|
+
if (!b || !M || a._space === 0)
|
|
1503
1503
|
continue;
|
|
1504
|
-
const
|
|
1504
|
+
const p = h === W.Horizontal ? o.width : o.height, m = h === W.Horizontal ? o.left : o.top, T = b.map((L) => R(B(L, g, p, m) * s)), A = M.map((L) => L === "" ? null : L), y = d.grid;
|
|
1505
1505
|
if ((y == null ? void 0 : y.show) !== !1) {
|
|
1506
|
-
const L = (y == null ? void 0 : y.stroke) ?? "rgba(0,0,0,0.12)",
|
|
1507
|
-
|
|
1506
|
+
const L = (y == null ? void 0 : y.stroke) ?? "rgba(0,0,0,0.12)", F = R(((y == null ? void 0 : y.width) ?? 2) * s), I = ((y == null ? void 0 : y.dash) ?? []).map((H) => H * s), C = h === W.Horizontal ? l : i, E = h === W.Horizontal ? f : c;
|
|
1507
|
+
He(t, T, A, h, 2, C, E, F, L, I);
|
|
1508
1508
|
}
|
|
1509
1509
|
const x = d.ticks;
|
|
1510
1510
|
if ((x == null ? void 0 : x.show) !== !1) {
|
|
1511
|
-
const L = (x == null ? void 0 : x.stroke) ?? w,
|
|
1512
|
-
|
|
1511
|
+
const L = (x == null ? void 0 : x.stroke) ?? w, F = R(((x == null ? void 0 : x.width) ?? 1) * s), I = R(((x == null ? void 0 : x.size) ?? 10) * s), C = ((x == null ? void 0 : x.dash) ?? []).map((H) => H * s), E = R(a._pos * s);
|
|
1512
|
+
He(t, T, A, h, u, E, I, F, L, C);
|
|
1513
1513
|
}
|
|
1514
1514
|
{
|
|
1515
|
-
const L = (x == null ? void 0 : x.show) !== !1 ? ((x == null ? void 0 : x.size) ?? 10) * s : 0,
|
|
1516
|
-
t.font =
|
|
1517
|
-
const _ = a._rotate * -
|
|
1515
|
+
const L = (x == null ? void 0 : x.show) !== !1 ? ((x == null ? void 0 : x.size) ?? 10) * s : 0, F = R((d.gap ?? 5) * s), I = R(a._pos * s), C = (L + F) * S, E = I + C, H = se(d.font ?? "12px system-ui, sans-serif", s), v = h === W.Horizontal ? "center" : u === N.Left ? Bo : Go, k = h === W.Horizontal ? u === N.Bottom ? Fe : ze : "middle";
|
|
1516
|
+
t.font = H, t.fillStyle = w, t.textAlign = v, t.textBaseline = k;
|
|
1517
|
+
const _ = a._rotate * -te / 180;
|
|
1518
1518
|
if (_ !== 0) {
|
|
1519
|
-
const
|
|
1520
|
-
for (let z = 0; z <
|
|
1521
|
-
const G =
|
|
1519
|
+
const D = Math.cos(_), $ = Math.sin(_);
|
|
1520
|
+
for (let z = 0; z < M.length; z++) {
|
|
1521
|
+
const G = M[z];
|
|
1522
1522
|
if (G == null || G === "")
|
|
1523
1523
|
continue;
|
|
1524
|
-
const
|
|
1525
|
-
t.setTransform(
|
|
1524
|
+
const U = T[z] ?? 0;
|
|
1525
|
+
t.setTransform(D, $, -$, D, U, E), t.fillText(G, 0, 0);
|
|
1526
1526
|
}
|
|
1527
1527
|
t.setTransform(1, 0, 0, 1, 0, 0);
|
|
1528
1528
|
} else
|
|
1529
|
-
for (let
|
|
1530
|
-
const
|
|
1531
|
-
if (
|
|
1529
|
+
for (let D = 0; D < M.length; D++) {
|
|
1530
|
+
const $ = M[D];
|
|
1531
|
+
if ($ == null || $ === "")
|
|
1532
1532
|
continue;
|
|
1533
|
-
const z = D
|
|
1534
|
-
t.fillText(
|
|
1533
|
+
const z = T[D] ?? 0, G = h === W.Horizontal ? z : E, U = h === W.Horizontal ? E : z;
|
|
1534
|
+
t.fillText($, G, U);
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
1537
|
if (d.label != null) {
|
|
1538
|
-
const L =
|
|
1539
|
-
t.font = L, t.fillStyle = w, t.textAlign = "center", t.textBaseline = u ===
|
|
1540
|
-
const
|
|
1538
|
+
const L = se(d.labelFont ?? "bold 12px system-ui, sans-serif", s);
|
|
1539
|
+
t.font = L, t.fillStyle = w, t.textAlign = "center", t.textBaseline = u === N.Bottom ? Fe : ze;
|
|
1540
|
+
const F = R((a._lpos + (d.labelGap ?? 0) * S) * s);
|
|
1541
1541
|
h === W.Vertical ? (t.save(), t.translate(
|
|
1542
|
-
|
|
1542
|
+
F,
|
|
1543
1543
|
R(l + f / 2)
|
|
1544
|
-
), t.rotate((u ===
|
|
1544
|
+
), t.rotate((u === N.Left ? -te : te) / 2), t.fillText(d.label, 0, 0), t.restore()) : t.fillText(d.label, R(i + c / 2), F);
|
|
1545
1545
|
}
|
|
1546
|
-
const
|
|
1547
|
-
if ((
|
|
1548
|
-
const L =
|
|
1549
|
-
t.strokeStyle = L, t.lineWidth =
|
|
1546
|
+
const P = d.border;
|
|
1547
|
+
if ((P == null ? void 0 : P.show) !== !1 && P != null) {
|
|
1548
|
+
const L = P.stroke ?? w, F = R((P.width ?? 1) * s), I = (P.dash ?? []).map((E) => E * s), C = R(a._pos * s);
|
|
1549
|
+
t.strokeStyle = L, t.lineWidth = F, I.length > 0 && t.setLineDash(I), t.beginPath(), h === W.Horizontal ? (t.moveTo(i, C), t.lineTo(i + c, C)) : (t.moveTo(C, l), t.lineTo(C, l + f)), t.stroke(), I.length > 0 && t.setLineDash([]);
|
|
1550
1550
|
}
|
|
1551
1551
|
}
|
|
1552
1552
|
if (r != null) {
|
|
1553
|
-
const a =
|
|
1553
|
+
const a = se("bold 14px system-ui, sans-serif", s);
|
|
1554
1554
|
t.font = a, t.fillStyle = "#000", t.textAlign = "center", t.textBaseline = "top", t.fillText(r, R(i + c / 2), R(4 * s));
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
@@ -1562,26 +1562,26 @@ const Xo = 2, Yo = "#fff", No = {
|
|
|
1562
1562
|
showX: !0,
|
|
1563
1563
|
showY: !0
|
|
1564
1564
|
};
|
|
1565
|
-
function
|
|
1566
|
-
var
|
|
1565
|
+
function $e(t, e, n, o, s, r, i, l, c, f) {
|
|
1566
|
+
var m;
|
|
1567
1567
|
if (e.left < 0 || e.top < 0) return;
|
|
1568
|
-
const a = { ...No, ...c }, d = o, u = R(n.left * d), h = R(n.top * d),
|
|
1569
|
-
if (t.save(), t.strokeStyle = a.stroke, t.lineWidth =
|
|
1570
|
-
const
|
|
1571
|
-
if (x != null &&
|
|
1572
|
-
const
|
|
1573
|
-
if (
|
|
1574
|
-
let
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1568
|
+
const a = { ...No, ...c }, d = o, u = R(n.left * d), h = R(n.top * d), g = R(n.width * d), w = R(n.height * d), S = R(a.width * d), b = S % 2 / 2, M = R((n.left + e.left) * d) + b, p = R((n.top + e.top) * d) + b;
|
|
1569
|
+
if (t.save(), t.strokeStyle = a.stroke, t.lineWidth = S, t.setLineDash(a.dash.map((T) => T * d)), a.showX && (t.beginPath(), t.moveTo(M, h), t.lineTo(M, h + w), t.stroke()), a.showY && (t.beginPath(), t.moveTo(u, p), t.lineTo(u + g, p), t.stroke()), t.setLineDash([]), e.activeGroup >= 0 && e.activeDataIdx >= 0) {
|
|
1570
|
+
const T = e.activeGroup, A = e.activeSeriesIdx, y = e.activeDataIdx, x = s[T];
|
|
1571
|
+
if (x != null && A >= 0 && A < x.series.length && y < x.x.length) {
|
|
1572
|
+
const P = x.x[y], L = x.series[A], F = L != null ? L[y] : null;
|
|
1573
|
+
if (P != null && F != null) {
|
|
1574
|
+
let I = a.stroke, C = !0;
|
|
1575
|
+
const E = f == null ? void 0 : f.get(`${T}:${A}`);
|
|
1576
|
+
if (E != null) {
|
|
1577
|
+
const H = E.stroke;
|
|
1578
|
+
I = (typeof H == "string" ? H : void 0) ?? a.stroke, C = ((m = E.cursor) == null ? void 0 : m.show) !== !1;
|
|
1579
1579
|
}
|
|
1580
|
-
if (
|
|
1581
|
-
const
|
|
1582
|
-
if (
|
|
1583
|
-
const
|
|
1584
|
-
t.beginPath(), t.arc(
|
|
1580
|
+
if (C) {
|
|
1581
|
+
const H = l(T), v = H != null ? i(H) : void 0, k = (E == null ? void 0 : E.yScale) ?? Uo(r, T, A), _ = k != null ? i(k) : void 0;
|
|
1582
|
+
if (v != null && _ != null && K(v) && K(_)) {
|
|
1583
|
+
const D = R(B(P, v, n.width, n.left) * d), $ = R(B(F, _, n.height, n.top) * d), z = a.pointRadius * d, G = R(Xo * d);
|
|
1584
|
+
t.beginPath(), t.arc(D, $, z, 0, Math.PI * 2), t.fillStyle = Yo, t.fill(), t.strokeStyle = I, t.lineWidth = G, t.stroke();
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
@@ -1599,21 +1599,21 @@ const Ko = {
|
|
|
1599
1599
|
stroke: "rgba(0,0,0,0.15)",
|
|
1600
1600
|
width: 1
|
|
1601
1601
|
};
|
|
1602
|
-
function
|
|
1602
|
+
function We(t, e, n, o, s) {
|
|
1603
1603
|
if (!e.show || e.width <= 0) return;
|
|
1604
1604
|
const r = { ...Ko, ...s }, i = o, l = R((n.left + e.left) * i), c = R((n.top + e.top) * i), f = R(e.width * i), a = R(e.height * i);
|
|
1605
1605
|
t.save(), t.fillStyle = r.fill, t.fillRect(l, c, f, a), r.width > 0 && (t.strokeStyle = r.stroke, t.lineWidth = R(r.width * i), t.strokeRect(l, c, f, a)), t.restore();
|
|
1606
1606
|
}
|
|
1607
1607
|
function Oo(t, e, n, o, s, r, i, l, c, f, a, d) {
|
|
1608
|
-
const u = a / 2 * i, h = Math.max(1, R(a * 0.2)) * i,
|
|
1609
|
-
t.save(), t.strokeStyle =
|
|
1610
|
-
for (let
|
|
1611
|
-
const
|
|
1612
|
-
if (
|
|
1613
|
-
const
|
|
1614
|
-
if (
|
|
1615
|
-
const
|
|
1616
|
-
t.beginPath(), t.arc(
|
|
1608
|
+
const u = a / 2 * i, h = Math.max(1, R(a * 0.2)) * i, g = (f == null ? void 0 : f.stroke) ?? d, w = (f == null ? void 0 : f.fill) ?? "#fff";
|
|
1609
|
+
t.save(), t.strokeStyle = g, t.fillStyle = w, t.lineWidth = h, (f == null ? void 0 : f.dash) != null && t.setLineDash(f.dash.map((S) => S * i));
|
|
1610
|
+
for (let S = l; S <= c; S++) {
|
|
1611
|
+
const b = n[S];
|
|
1612
|
+
if (b == null) continue;
|
|
1613
|
+
const M = e[S];
|
|
1614
|
+
if (M == null) continue;
|
|
1615
|
+
const p = R(B(M, o, r.width, r.left) * i), m = R(B(b, s, r.height, r.top) * i);
|
|
1616
|
+
t.beginPath(), t.arc(p, m, u, 0, Math.PI * 2), t.fill(), t.stroke();
|
|
1617
1617
|
}
|
|
1618
1618
|
t.restore();
|
|
1619
1619
|
}
|
|
@@ -1626,19 +1626,19 @@ function jo(t, e, n, o, s, r, i) {
|
|
|
1626
1626
|
return l > 0 && l <= r / i;
|
|
1627
1627
|
}
|
|
1628
1628
|
function qo(t, e, n, o, s, r, i, l, c) {
|
|
1629
|
-
if (l > c || l < 0 || !
|
|
1630
|
-
const f = (h) =>
|
|
1629
|
+
if (l > c || l < 0 || !Ae(e, l, c) && !Ae(n, l, c)) return null;
|
|
1630
|
+
const f = (h) => B(h, o, r.width, r.left) * i, a = (h) => B(h, s, r.height, r.top) * i, d = new Path2D();
|
|
1631
1631
|
let u = !1;
|
|
1632
1632
|
for (let h = l; h <= c; h++) {
|
|
1633
|
-
const
|
|
1634
|
-
if (
|
|
1635
|
-
const
|
|
1636
|
-
u ? d.lineTo(
|
|
1633
|
+
const g = e[h], w = t[h];
|
|
1634
|
+
if (g == null || w == null) continue;
|
|
1635
|
+
const S = f(w), b = a(g);
|
|
1636
|
+
u ? d.lineTo(S, b) : (d.moveTo(S, b), u = !0);
|
|
1637
1637
|
}
|
|
1638
1638
|
if (!u) return null;
|
|
1639
1639
|
for (let h = c; h >= l; h--) {
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1640
|
+
const g = n[h], w = t[h];
|
|
1641
|
+
g == null || w == null || d.lineTo(f(w), a(g));
|
|
1642
1642
|
}
|
|
1643
1643
|
return d.closePath(), d;
|
|
1644
1644
|
}
|
|
@@ -1663,28 +1663,40 @@ function Jo(t) {
|
|
|
1663
1663
|
const l = { id: i, auto: !0 };
|
|
1664
1664
|
t.scaleConfigs.push(l), t.scaleManager.addScale(l), n.add(i);
|
|
1665
1665
|
}
|
|
1666
|
-
t.axisConfigs.some((i) => i.scale === "x")
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1666
|
+
if (!t.axisConfigs.some((i) => i.scale === "x"))
|
|
1667
|
+
t.axisConfigs.push({
|
|
1668
|
+
scale: "x",
|
|
1669
|
+
side: N.Bottom,
|
|
1670
|
+
show: !0,
|
|
1671
|
+
label: t.xlabel ?? "X Axis",
|
|
1672
|
+
_default: !0
|
|
1673
|
+
});
|
|
1674
|
+
else {
|
|
1675
|
+
const i = t.axisConfigs.find((l) => l.scale === "x" && l._default === !0);
|
|
1676
|
+
i != null && (i.label = t.xlabel ?? "X Axis");
|
|
1677
|
+
}
|
|
1672
1678
|
const r = new Set(t.axisConfigs.map((i) => i.scale));
|
|
1673
1679
|
for (const i of o)
|
|
1674
|
-
r.has(i)
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
+
if (!r.has(i))
|
|
1681
|
+
t.axisConfigs.push({
|
|
1682
|
+
scale: i,
|
|
1683
|
+
side: N.Left,
|
|
1684
|
+
show: !0,
|
|
1685
|
+
label: t.ylabel ?? "Y Axis",
|
|
1686
|
+
_default: !0
|
|
1687
|
+
}), r.add(i);
|
|
1688
|
+
else {
|
|
1689
|
+
const l = t.axisConfigs.find((c) => c.scale === i && c._default === !0);
|
|
1690
|
+
l != null && (l.label = t.ylabel ?? "Y Axis");
|
|
1691
|
+
}
|
|
1680
1692
|
}
|
|
1681
|
-
function
|
|
1693
|
+
function Vt(t, e, n, o) {
|
|
1682
1694
|
return { ctx: t, plotBox: e, pxRatio: n, getScale: o, valToX: (i, l = "x") => {
|
|
1683
1695
|
const c = o(l);
|
|
1684
|
-
return c == null || !K(c) ? null :
|
|
1696
|
+
return c == null || !K(c) ? null : B(i, c, e.width, e.left);
|
|
1685
1697
|
}, valToY: (i, l) => {
|
|
1686
1698
|
const c = o(l);
|
|
1687
|
-
return c == null || !K(c) ? null :
|
|
1699
|
+
return c == null || !K(c) ? null : B(i, c, e.height, e.top);
|
|
1688
1700
|
} };
|
|
1689
1701
|
}
|
|
1690
1702
|
const Qo = {
|
|
@@ -1742,6 +1754,7 @@ function ts() {
|
|
|
1742
1754
|
cursorListeners: /* @__PURE__ */ new Set(),
|
|
1743
1755
|
scheduler: new jn(),
|
|
1744
1756
|
drawHooks: /* @__PURE__ */ new Set(),
|
|
1757
|
+
unclippedDrawHooks: /* @__PURE__ */ new Set(),
|
|
1745
1758
|
cursorDrawHooks: /* @__PURE__ */ new Set(),
|
|
1746
1759
|
focusedSeries: null,
|
|
1747
1760
|
focusAlpha: 1,
|
|
@@ -1753,6 +1766,7 @@ function ts() {
|
|
|
1753
1766
|
revision: 0,
|
|
1754
1767
|
eventCallbacks: {},
|
|
1755
1768
|
_prevScaleRanges: /* @__PURE__ */ new Map(),
|
|
1769
|
+
_prevPlotBox: null,
|
|
1756
1770
|
seriesConfigMap: /* @__PURE__ */ new Map(),
|
|
1757
1771
|
registerScale(e) {
|
|
1758
1772
|
t.scaleConfigs = t.scaleConfigs.filter((n) => n.id !== e.id), t.scaleConfigs.push(e), t.scaleManager.addScale(e);
|
|
@@ -1777,8 +1791,9 @@ function ts() {
|
|
|
1777
1791
|
setFocus(e) {
|
|
1778
1792
|
t.focusedSeries = e, t.scheduleRedraw();
|
|
1779
1793
|
},
|
|
1780
|
-
setSize(e, n) {
|
|
1781
|
-
|
|
1794
|
+
setSize(e, n, o) {
|
|
1795
|
+
const s = o ?? t.pxRatio;
|
|
1796
|
+
t.width === e && t.height === n && t.pxRatio === s || (t.pxRatio = s, t.width = e, t.height = n, t.canvas && (t.canvas.width = e * t.pxRatio, t.canvas.height = n * t.pxRatio, t.canvas.style.width = `${e}px`, t.canvas.style.height = `${n}px`), t.renderer.clearCache());
|
|
1782
1797
|
},
|
|
1783
1798
|
scheduleRedraw() {
|
|
1784
1799
|
t.scheduler.mark(it.Full);
|
|
@@ -1802,9 +1817,9 @@ function ts() {
|
|
|
1802
1817
|
const a = c.getContext("2d");
|
|
1803
1818
|
if (a == null) return;
|
|
1804
1819
|
o.setContext(a, l);
|
|
1805
|
-
const u = (f.dirty & ~(it.Cursor | it.Select)) === 0, h = (
|
|
1820
|
+
const u = (f.dirty & ~(it.Cursor | it.Select)) === 0, h = (p) => e.getScale(p);
|
|
1806
1821
|
if (u && o.restoreSnapshot(a)) {
|
|
1807
|
-
if (
|
|
1822
|
+
if ($e(
|
|
1808
1823
|
a,
|
|
1809
1824
|
t.cursorManager.state,
|
|
1810
1825
|
t.plotBox,
|
|
@@ -1812,36 +1827,36 @@ function ts() {
|
|
|
1812
1827
|
n.data,
|
|
1813
1828
|
s,
|
|
1814
1829
|
h,
|
|
1815
|
-
(
|
|
1830
|
+
(p) => e.getGroupXScaleKey(p),
|
|
1816
1831
|
void 0,
|
|
1817
1832
|
t.seriesConfigMap
|
|
1818
|
-
),
|
|
1833
|
+
), We(a, t.selectState, t.plotBox, l), t.cursorDrawHooks.size > 0) {
|
|
1819
1834
|
a.save(), a.scale(l, l);
|
|
1820
|
-
const
|
|
1835
|
+
const p = Vt(a, t.plotBox, l, h);
|
|
1821
1836
|
for (const m of t.cursorDrawHooks)
|
|
1822
1837
|
try {
|
|
1823
|
-
m(
|
|
1824
|
-
} catch (
|
|
1825
|
-
console.warn("[uPlot+] draw hook error:",
|
|
1838
|
+
m(p, t.cursorManager.state);
|
|
1839
|
+
} catch (T) {
|
|
1840
|
+
console.warn("[uPlot+] draw hook error:", T);
|
|
1826
1841
|
}
|
|
1827
1842
|
a.restore();
|
|
1828
1843
|
}
|
|
1829
1844
|
Re(t);
|
|
1830
|
-
for (const
|
|
1845
|
+
for (const p of t.cursorListeners) p();
|
|
1831
1846
|
return;
|
|
1832
1847
|
}
|
|
1833
|
-
Jo(t), e.autoRangeX(n.data), n.updateWindows((
|
|
1834
|
-
const m = e.getGroupXScaleKey(
|
|
1848
|
+
Jo(t), e.autoRangeX(n.data), n.updateWindows((p) => {
|
|
1849
|
+
const m = e.getGroupXScaleKey(p);
|
|
1835
1850
|
return m != null ? e.getScale(m) : void 0;
|
|
1836
1851
|
});
|
|
1837
|
-
const
|
|
1838
|
-
group:
|
|
1839
|
-
index:
|
|
1840
|
-
yScale:
|
|
1852
|
+
const g = s.map((p) => ({
|
|
1853
|
+
group: p.group,
|
|
1854
|
+
index: p.index,
|
|
1855
|
+
yScale: p.yScale
|
|
1841
1856
|
}));
|
|
1842
|
-
if (e.autoRange(n.data,
|
|
1843
|
-
const
|
|
1844
|
-
t.plotBox =
|
|
1857
|
+
if (e.autoRange(n.data, g, n), es(t), t.axisStates.length > 0) {
|
|
1858
|
+
const p = t.title != null ? 20 : 0;
|
|
1859
|
+
t.plotBox = Ro(r, i, t.axisStates, h, p);
|
|
1845
1860
|
} else
|
|
1846
1861
|
t.plotBox = {
|
|
1847
1862
|
left: 10,
|
|
@@ -1849,62 +1864,63 @@ function ts() {
|
|
|
1849
1864
|
width: r - 20,
|
|
1850
1865
|
height: i - 20
|
|
1851
1866
|
};
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1867
|
+
const w = t._prevPlotBox, S = t.plotBox;
|
|
1868
|
+
w != null && (w.left !== S.left || w.top !== S.top || w.width !== S.width || w.height !== S.height) && o.clearCache(), t._prevPlotBox = { ...S }, a.clearRect(0, 0, r * l, i * l), t.axisStates.length > 0 && Vo(a, t.axisStates, h, t.plotBox, l, t.title);
|
|
1869
|
+
const b = [];
|
|
1870
|
+
for (const p of s) {
|
|
1871
|
+
const m = e.getGroupXScaleKey(p.group), T = m != null ? e.getScale(m) : void 0, A = e.getScale(p.yScale);
|
|
1872
|
+
T == null || A == null || b.push({
|
|
1873
|
+
config: p,
|
|
1874
|
+
dataX: n.getXValues(p.group),
|
|
1875
|
+
dataY: n.getYValues(p.group, p.index),
|
|
1876
|
+
xScale: T,
|
|
1877
|
+
yScale: A,
|
|
1878
|
+
window: n.getWindow(p.group)
|
|
1863
1879
|
});
|
|
1864
1880
|
}
|
|
1865
|
-
o.checkScaleStamp(
|
|
1866
|
-
for (let
|
|
1867
|
-
const m =
|
|
1868
|
-
m != null && (t.focusedSeries != null &&
|
|
1881
|
+
o.checkScaleStamp(b), a.save(), a.scale(l, l), a.beginPath(), a.rect(t.plotBox.left, t.plotBox.top, t.plotBox.width, t.plotBox.height), a.clip();
|
|
1882
|
+
for (let p = 0; p < b.length; p++) {
|
|
1883
|
+
const m = b[p];
|
|
1884
|
+
m != null && (t.focusedSeries != null && p !== t.focusedSeries ? (a.globalAlpha = t.focusAlpha, o.drawSeries(m, t.plotBox, 1), a.globalAlpha = 1) : o.drawSeries(m, t.plotBox, 1));
|
|
1869
1885
|
}
|
|
1870
|
-
const
|
|
1871
|
-
for (const
|
|
1872
|
-
|
|
1873
|
-
for (const
|
|
1874
|
-
const m = e.getGroupXScaleKey(
|
|
1875
|
-
if (
|
|
1876
|
-
const
|
|
1877
|
-
if (
|
|
1878
|
-
const [
|
|
1879
|
-
let
|
|
1880
|
-
|
|
1881
|
-
n.getXValues(
|
|
1882
|
-
n.getYValues(
|
|
1883
|
-
n.getYValues(
|
|
1884
|
-
M,
|
|
1886
|
+
const M = /* @__PURE__ */ new Map();
|
|
1887
|
+
for (const p of s)
|
|
1888
|
+
M.set(`${p.group}-${p.index}`, p);
|
|
1889
|
+
for (const p of t.bandConfigs) {
|
|
1890
|
+
const m = e.getGroupXScaleKey(p.group), T = m != null ? e.getScale(m) : void 0, A = M.get(`${p.group}-${p.series[0]}`), y = M.get(`${p.group}-${p.series[1]}`);
|
|
1891
|
+
if (T == null || A == null || y == null) continue;
|
|
1892
|
+
const x = e.getScale(A.yScale);
|
|
1893
|
+
if (x == null) continue;
|
|
1894
|
+
const [P, L] = n.getWindow(p.group), F = p.series[0], I = p.series[1];
|
|
1895
|
+
let C = o.getCachedBandPath(p.group, F, I, P, L);
|
|
1896
|
+
C == null && (C = qo(
|
|
1897
|
+
n.getXValues(p.group),
|
|
1898
|
+
n.getYValues(p.group, F),
|
|
1899
|
+
n.getYValues(p.group, I),
|
|
1885
1900
|
T,
|
|
1901
|
+
x,
|
|
1886
1902
|
t.plotBox,
|
|
1887
1903
|
l,
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
) ?? void 0,
|
|
1904
|
+
P,
|
|
1905
|
+
L
|
|
1906
|
+
) ?? void 0, C != null && o.setCachedBandPath(p.group, F, I, P, L, C)), C != null && Zo(a, p, C);
|
|
1891
1907
|
}
|
|
1892
|
-
for (const
|
|
1893
|
-
const m =
|
|
1908
|
+
for (const p of b) {
|
|
1909
|
+
const m = p.config;
|
|
1894
1910
|
if (m.show === !1) continue;
|
|
1895
|
-
const
|
|
1896
|
-
jo(
|
|
1911
|
+
const T = m.points, A = m.width ?? 1, y = (T == null ? void 0 : T.size) ?? 3 + A * 2, x = (T == null ? void 0 : T.space) ?? y * 2, [P, L] = p.window;
|
|
1912
|
+
jo(T == null ? void 0 : T.show, m.group, m.index, P, L, t.plotBox.width, x) && Oo(
|
|
1897
1913
|
a,
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1914
|
+
p.dataX,
|
|
1915
|
+
p.dataY,
|
|
1916
|
+
p.xScale,
|
|
1917
|
+
p.yScale,
|
|
1902
1918
|
t.plotBox,
|
|
1903
1919
|
l,
|
|
1920
|
+
P,
|
|
1921
|
+
L,
|
|
1922
|
+
T,
|
|
1904
1923
|
y,
|
|
1905
|
-
x,
|
|
1906
|
-
M,
|
|
1907
|
-
D,
|
|
1908
1924
|
(typeof m.stroke == "string" ? m.stroke : null) ?? "#000"
|
|
1909
1925
|
);
|
|
1910
1926
|
}
|
|
@@ -1915,12 +1931,23 @@ function ts() {
|
|
|
1915
1931
|
t.plotBox.width * l,
|
|
1916
1932
|
t.plotBox.height * l
|
|
1917
1933
|
), a.clip(), a.scale(l, l);
|
|
1918
|
-
const
|
|
1934
|
+
const p = Vt(a, t.plotBox, l, h);
|
|
1919
1935
|
for (const m of t.drawHooks)
|
|
1920
1936
|
try {
|
|
1921
|
-
m(
|
|
1922
|
-
} catch (
|
|
1923
|
-
console.warn("[uPlot+] draw hook error:",
|
|
1937
|
+
m(p);
|
|
1938
|
+
} catch (T) {
|
|
1939
|
+
console.warn("[uPlot+] draw hook error:", T);
|
|
1940
|
+
}
|
|
1941
|
+
a.restore();
|
|
1942
|
+
}
|
|
1943
|
+
if (t.unclippedDrawHooks.size > 0) {
|
|
1944
|
+
a.save(), a.scale(l, l);
|
|
1945
|
+
const p = Vt(a, t.plotBox, l, h);
|
|
1946
|
+
for (const m of t.unclippedDrawHooks)
|
|
1947
|
+
try {
|
|
1948
|
+
m(p);
|
|
1949
|
+
} catch (T) {
|
|
1950
|
+
console.warn("[uPlot+] draw hook error:", T);
|
|
1924
1951
|
}
|
|
1925
1952
|
a.restore();
|
|
1926
1953
|
}
|
|
@@ -1931,9 +1958,9 @@ function ts() {
|
|
|
1931
1958
|
n.data,
|
|
1932
1959
|
s,
|
|
1933
1960
|
h,
|
|
1934
|
-
(
|
|
1935
|
-
(
|
|
1936
|
-
)),
|
|
1961
|
+
(p) => n.getWindow(p),
|
|
1962
|
+
(p) => e.getGroupXScaleKey(p)
|
|
1963
|
+
)), $e(
|
|
1937
1964
|
a,
|
|
1938
1965
|
t.cursorManager.state,
|
|
1939
1966
|
t.plotBox,
|
|
@@ -1941,37 +1968,37 @@ function ts() {
|
|
|
1941
1968
|
n.data,
|
|
1942
1969
|
s,
|
|
1943
1970
|
h,
|
|
1944
|
-
(
|
|
1971
|
+
(p) => e.getGroupXScaleKey(p),
|
|
1945
1972
|
void 0,
|
|
1946
1973
|
t.seriesConfigMap
|
|
1947
|
-
),
|
|
1974
|
+
), We(a, t.selectState, t.plotBox, l), t.cursorDrawHooks.size > 0) {
|
|
1948
1975
|
a.save(), a.scale(l, l);
|
|
1949
|
-
const
|
|
1976
|
+
const p = Vt(a, t.plotBox, l, h);
|
|
1950
1977
|
for (const m of t.cursorDrawHooks)
|
|
1951
1978
|
try {
|
|
1952
|
-
m(
|
|
1953
|
-
} catch (
|
|
1954
|
-
console.warn("[uPlot+] draw hook error:",
|
|
1979
|
+
m(p, t.cursorManager.state);
|
|
1980
|
+
} catch (T) {
|
|
1981
|
+
console.warn("[uPlot+] draw hook error:", T);
|
|
1955
1982
|
}
|
|
1956
1983
|
a.restore();
|
|
1957
1984
|
}
|
|
1958
1985
|
Re(t);
|
|
1959
|
-
for (const
|
|
1960
|
-
for (const
|
|
1986
|
+
for (const p of t.listeners) p();
|
|
1987
|
+
for (const p of t.cursorListeners) p();
|
|
1961
1988
|
if (t._prevScaleRanges.size > 0 && t.eventCallbacks.onScaleChange != null)
|
|
1962
|
-
for (const
|
|
1963
|
-
if (!K(
|
|
1964
|
-
const m = t._prevScaleRanges.get(
|
|
1965
|
-
if (m == null || m.min !==
|
|
1989
|
+
for (const p of e.getAllScales()) {
|
|
1990
|
+
if (!K(p)) continue;
|
|
1991
|
+
const m = t._prevScaleRanges.get(p.id);
|
|
1992
|
+
if (m == null || m.min !== p.min || m.max !== p.max)
|
|
1966
1993
|
try {
|
|
1967
|
-
t.eventCallbacks.onScaleChange(
|
|
1968
|
-
} catch (
|
|
1969
|
-
console.warn("[uPlot+] event callback error:",
|
|
1994
|
+
t.eventCallbacks.onScaleChange(p.id, p.min, p.max);
|
|
1995
|
+
} catch (T) {
|
|
1996
|
+
console.warn("[uPlot+] event callback error:", T);
|
|
1970
1997
|
}
|
|
1971
1998
|
}
|
|
1972
1999
|
t._prevScaleRanges.clear();
|
|
1973
|
-
for (const
|
|
1974
|
-
K(
|
|
2000
|
+
for (const p of e.getAllScales())
|
|
2001
|
+
K(p) && t._prevScaleRanges.set(p.id, { min: p.min, max: p.max });
|
|
1975
2002
|
},
|
|
1976
2003
|
getSnapshot: () => t.snapshot,
|
|
1977
2004
|
// --- Config facade methods ---
|
|
@@ -2007,7 +2034,7 @@ function ts() {
|
|
|
2007
2034
|
t.canvas = e;
|
|
2008
2035
|
},
|
|
2009
2036
|
setLabels(e, n, o) {
|
|
2010
|
-
t.title = e, t.xlabel = n, t.ylabel = o;
|
|
2037
|
+
t.title = e, t.xlabel = n, t.ylabel = o, t.scheduleRedraw();
|
|
2011
2038
|
},
|
|
2012
2039
|
redrawSync() {
|
|
2013
2040
|
t.scheduler.cancel(), t.scheduler.mark(it.Full), t.redraw(), t.scheduler.clear();
|
|
@@ -2025,18 +2052,18 @@ function es(t) {
|
|
|
2025
2052
|
});
|
|
2026
2053
|
}
|
|
2027
2054
|
function ns() {
|
|
2028
|
-
const t =
|
|
2055
|
+
const t = Y(null);
|
|
2029
2056
|
return t.current === null && (t.current = ts()), t.current;
|
|
2030
2057
|
}
|
|
2031
|
-
const
|
|
2058
|
+
const fn = An(null);
|
|
2032
2059
|
function st() {
|
|
2033
|
-
const t = Tn(
|
|
2060
|
+
const t = Tn(fn);
|
|
2034
2061
|
if (!t)
|
|
2035
2062
|
throw new Error("useChart must be used within a <Chart> component");
|
|
2036
2063
|
return t;
|
|
2037
2064
|
}
|
|
2038
2065
|
function fi(t = "cursor") {
|
|
2039
|
-
const e = st(), n = t === "full" ? e.subscribe : e.subscribeCursor, o =
|
|
2066
|
+
const e = st(), n = t === "full" ? e.subscribe : e.subscribeCursor, o = Gt(n, e.getSnapshot);
|
|
2040
2067
|
return {
|
|
2041
2068
|
// Reactive snapshot fields
|
|
2042
2069
|
left: o.left,
|
|
@@ -2061,19 +2088,19 @@ function fi(t = "cursor") {
|
|
|
2061
2088
|
setFocus: (s) => e.setFocus(s)
|
|
2062
2089
|
};
|
|
2063
2090
|
}
|
|
2064
|
-
const
|
|
2065
|
-
function
|
|
2091
|
+
const Ge = 5, hn = 1e-3, os = 0.1, ss = 10;
|
|
2092
|
+
function we(t, e) {
|
|
2066
2093
|
const n = t.shiftKey ? "shift" : t.altKey ? "alt" : t.ctrlKey ? "ctrl" : "", o = t.button === 1 ? "Middle" : t.button === 2 ? "Right" : "Left";
|
|
2067
2094
|
return n ? `${n}${o}${e}` : `${o.toLowerCase()}${e}`;
|
|
2068
2095
|
}
|
|
2069
2096
|
function is(t) {
|
|
2070
|
-
return
|
|
2097
|
+
return we(t, "Drag");
|
|
2071
2098
|
}
|
|
2072
2099
|
function rs(t) {
|
|
2073
|
-
return
|
|
2100
|
+
return we(t, "Click");
|
|
2074
2101
|
}
|
|
2075
2102
|
function ls(t) {
|
|
2076
|
-
return
|
|
2103
|
+
return we(t, "Dblclick");
|
|
2077
2104
|
}
|
|
2078
2105
|
function cs(t) {
|
|
2079
2106
|
const e = t.shiftKey ? "shift" : t.altKey ? "alt" : t.ctrlKey ? "ctrl" : "";
|
|
@@ -2094,10 +2121,10 @@ function us(t, e, n, o, s = !0) {
|
|
|
2094
2121
|
function fs(t, e) {
|
|
2095
2122
|
const n = [];
|
|
2096
2123
|
for (const o of t.scaleManager.getAllScales())
|
|
2097
|
-
K(o) && (e != null && !e(o.ori) || n.push({ id: o.id, ori: o.ori, startMin: o.min, startMax: o.max }));
|
|
2124
|
+
K(o) && (e != null && !e(o.ori) || n.push({ id: o.id, ori: o.ori, dir: o.dir, startMin: o.min, startMax: o.max }));
|
|
2098
2125
|
return n;
|
|
2099
2126
|
}
|
|
2100
|
-
function
|
|
2127
|
+
function zt(t) {
|
|
2101
2128
|
const e = t.eventCallbacks.onScaleChange;
|
|
2102
2129
|
if (e != null)
|
|
2103
2130
|
for (const n of t.scaleManager.getAllScales()) {
|
|
@@ -2108,13 +2135,13 @@ function Et(t) {
|
|
|
2108
2135
|
}
|
|
2109
2136
|
function re(t, e, n, o) {
|
|
2110
2137
|
if (!(e instanceof WheelEvent)) return;
|
|
2111
|
-
const s = tt(1 - e.deltaY *
|
|
2138
|
+
const s = tt(1 - e.deltaY * hn, os, ss), r = t.plotBox;
|
|
2112
2139
|
for (const i of t.scaleManager.getAllScales()) {
|
|
2113
2140
|
if (!K(i) || !o(i.ori)) continue;
|
|
2114
|
-
const l = i.ori === W.Horizontal, c = l ? r.width : r.height, f = l ? r.left : r.top, a = l ? n.cx + r.left : n.cy + r.top, d =
|
|
2115
|
-
i.min = Math.min(u, h), i.max = Math.max(u, h), i.auto = !1,
|
|
2141
|
+
const l = i.ori === W.Horizontal, c = l ? r.width : r.height, f = l ? r.left : r.top, a = l ? n.cx + r.left : n.cy + r.top, d = bt(a, i, c, f), u = d - (d - i.min) * s, h = d + (i.max - d) * s;
|
|
2142
|
+
i.min = Math.min(u, h), i.max = Math.max(u, h), i.auto = !1, gt(i);
|
|
2116
2143
|
}
|
|
2117
|
-
t.scheduleRedraw(),
|
|
2144
|
+
t.scheduleRedraw(), zt(t);
|
|
2118
2145
|
}
|
|
2119
2146
|
function le(t, e, n) {
|
|
2120
2147
|
const o = { show: !1, left: 0, top: 0, width: 0, height: 0 }, s = e.cx, r = e.cy;
|
|
@@ -2124,7 +2151,7 @@ function le(t, e, n) {
|
|
|
2124
2151
|
o.show = !0, o.left = Math.min(s, a), o.top = Math.min(r, d), o.width = Math.abs(a - s), o.height = Math.abs(d - r), n(W.Vertical) || (o.top = 0, o.height = f.height), n(W.Horizontal) || (o.left = 0, o.width = f.width), t.selectState = o, t.scheduler.mark(it.Cursor | it.Select);
|
|
2125
2152
|
},
|
|
2126
2153
|
onEnd(i, l, c) {
|
|
2127
|
-
const f = n(W.Horizontal) && o.width >
|
|
2154
|
+
const f = n(W.Horizontal) && o.width > Ge, a = n(W.Vertical) && o.height > Ge;
|
|
2128
2155
|
if (f || a) {
|
|
2129
2156
|
let d = !0;
|
|
2130
2157
|
if (t.eventCallbacks.onSelect != null) {
|
|
@@ -2132,12 +2159,12 @@ function le(t, e, n) {
|
|
|
2132
2159
|
let h;
|
|
2133
2160
|
try {
|
|
2134
2161
|
h = t.eventCallbacks.onSelect(u);
|
|
2135
|
-
} catch (
|
|
2136
|
-
console.warn("[uPlot+] event callback error:",
|
|
2162
|
+
} catch (g) {
|
|
2163
|
+
console.warn("[uPlot+] event callback error:", g);
|
|
2137
2164
|
}
|
|
2138
2165
|
h === !1 && (d = !1);
|
|
2139
2166
|
}
|
|
2140
|
-
d && (hs(t, o, n),
|
|
2167
|
+
d && (hs(t, o, n), zt(t));
|
|
2141
2168
|
}
|
|
2142
2169
|
o.show = !1, o.left = 0, o.width = 0, t.selectState = o, t.scheduleRedraw();
|
|
2143
2170
|
}
|
|
@@ -2147,8 +2174,8 @@ function hs(t, e, n) {
|
|
|
2147
2174
|
const o = t.plotBox;
|
|
2148
2175
|
for (const s of t.scaleManager.getAllScales()) {
|
|
2149
2176
|
if (!K(s) || !n(s.ori)) continue;
|
|
2150
|
-
const r = s.ori === W.Horizontal, i = r ? o.width : o.height, l = r ? o.left : o.top, c = r ? e.left : e.top, f = r ? e.width : e.height, a = c / i, d = (c + f) / i, u =
|
|
2151
|
-
s.min = Math.min(u, h), s.max = Math.max(u, h), s.auto = !1,
|
|
2177
|
+
const r = s.ori === W.Horizontal, i = r ? o.width : o.height, l = r ? o.left : o.top, c = r ? e.left : e.top, f = r ? e.width : e.height, a = c / i, d = (c + f) / i, u = bt(l + a * i, s, i, l), h = bt(l + d * i, s, i, l);
|
|
2178
|
+
s.min = Math.min(u, h), s.max = Math.max(u, h), s.auto = !1, gt(s);
|
|
2152
2179
|
}
|
|
2153
2180
|
}
|
|
2154
2181
|
function ce(t, e, n, o) {
|
|
@@ -2159,13 +2186,13 @@ function ce(t, e, n, o) {
|
|
|
2159
2186
|
for (const d of s) {
|
|
2160
2187
|
const u = t.scaleManager.getScale(d.id);
|
|
2161
2188
|
if (u == null) continue;
|
|
2162
|
-
const h = d.ori === W.Horizontal,
|
|
2163
|
-
u.min = d.startMin +
|
|
2189
|
+
const h = d.ori === W.Horizontal, g = h ? f.width : f.height, w = h ? a.clientX - r : a.clientY - i, S = (h ? -1 : 1) * d.dir, b = d.startMax - d.startMin;
|
|
2190
|
+
u.min = d.startMin + S * (w / g) * b, u.max = d.startMax + S * (w / g) * b, u.auto = !1, gt(u);
|
|
2164
2191
|
}
|
|
2165
2192
|
t.renderer.clearCache(), t.scheduleRedraw();
|
|
2166
2193
|
},
|
|
2167
2194
|
onEnd() {
|
|
2168
|
-
|
|
2195
|
+
zt(t);
|
|
2169
2196
|
}
|
|
2170
2197
|
};
|
|
2171
2198
|
}
|
|
@@ -2179,74 +2206,74 @@ function Be(t, e, n) {
|
|
|
2179
2206
|
const i = s ? e.clientY - r.top : e.clientX - r.left, l = o.min, c = o.max, f = n.scaleId;
|
|
2180
2207
|
return {
|
|
2181
2208
|
onMove(d, u) {
|
|
2182
|
-
const h = t.plotBox,
|
|
2183
|
-
|
|
2209
|
+
const h = t.plotBox, g = u, w = s ? h.height : h.width, b = ((s ? g.clientY - r.top : g.clientX - r.left) - i) / w, M = (s ? 1 : -1) * o.dir, p = c - l, m = t.scaleManager.getScale(f);
|
|
2210
|
+
m != null && (m.min = l + M * b * p, m.max = c + M * b * p, m.auto = !1, gt(m), t.renderer.clearCache(), t.scheduleRedraw());
|
|
2184
2211
|
},
|
|
2185
2212
|
onEnd() {
|
|
2186
|
-
|
|
2213
|
+
zt(t);
|
|
2187
2214
|
}
|
|
2188
2215
|
};
|
|
2189
2216
|
}
|
|
2190
2217
|
function ae(t, e, n) {
|
|
2191
2218
|
if (!(e instanceof WheelEvent)) return;
|
|
2192
|
-
const o = e.deltaY *
|
|
2219
|
+
const o = e.deltaY * hn * 10;
|
|
2193
2220
|
for (const s of t.scaleManager.getAllScales()) {
|
|
2194
2221
|
if (!K(s) || !n(s.ori)) continue;
|
|
2195
2222
|
const r = s.max - s.min;
|
|
2196
|
-
s.min += o * r, s.max += o * r, s.auto = !1,
|
|
2223
|
+
s.min += o * r, s.max += o * r, s.auto = !1, gt(s);
|
|
2197
2224
|
}
|
|
2198
|
-
t.renderer.clearCache(), t.scheduleRedraw(),
|
|
2225
|
+
t.renderer.clearCache(), t.scheduleRedraw(), zt(t);
|
|
2199
2226
|
}
|
|
2200
|
-
const
|
|
2227
|
+
const Xt = (t) => t === W.Horizontal, Yt = (t) => t === W.Vertical, Nt = () => !0;
|
|
2201
2228
|
function ds(t) {
|
|
2202
2229
|
switch (t) {
|
|
2203
2230
|
case "zoomX":
|
|
2204
2231
|
return (e, n, o) => {
|
|
2205
2232
|
if (n instanceof WheelEvent) {
|
|
2206
|
-
re(e, n, o,
|
|
2233
|
+
re(e, n, o, Xt);
|
|
2207
2234
|
return;
|
|
2208
2235
|
}
|
|
2209
|
-
return le(e, o,
|
|
2236
|
+
return le(e, o, Xt);
|
|
2210
2237
|
};
|
|
2211
2238
|
case "zoomY":
|
|
2212
2239
|
return (e, n, o) => {
|
|
2213
2240
|
if (n instanceof WheelEvent) {
|
|
2214
|
-
re(e, n, o,
|
|
2241
|
+
re(e, n, o, Yt);
|
|
2215
2242
|
return;
|
|
2216
2243
|
}
|
|
2217
|
-
return le(e, o,
|
|
2244
|
+
return le(e, o, Yt);
|
|
2218
2245
|
};
|
|
2219
2246
|
case "zoomXY":
|
|
2220
2247
|
return (e, n, o) => {
|
|
2221
2248
|
if (n instanceof WheelEvent) {
|
|
2222
|
-
re(e, n, o,
|
|
2249
|
+
re(e, n, o, Nt);
|
|
2223
2250
|
return;
|
|
2224
2251
|
}
|
|
2225
|
-
return le(e, o,
|
|
2252
|
+
return le(e, o, Nt);
|
|
2226
2253
|
};
|
|
2227
2254
|
case "panX":
|
|
2228
2255
|
return (e, n, o) => {
|
|
2229
2256
|
if (n instanceof WheelEvent) {
|
|
2230
|
-
ae(e, n,
|
|
2257
|
+
ae(e, n, Xt);
|
|
2231
2258
|
return;
|
|
2232
2259
|
}
|
|
2233
|
-
return o.scaleId != null ? Be(e, n, o) : ce(e, n,
|
|
2260
|
+
return o.scaleId != null ? Be(e, n, o) : ce(e, n, Xt);
|
|
2234
2261
|
};
|
|
2235
2262
|
case "panY":
|
|
2236
2263
|
return (e, n, o) => {
|
|
2237
2264
|
if (n instanceof WheelEvent) {
|
|
2238
|
-
ae(e, n,
|
|
2265
|
+
ae(e, n, Yt);
|
|
2239
2266
|
return;
|
|
2240
2267
|
}
|
|
2241
|
-
return o.scaleId != null ? Be(e, n, o) : ce(e, n,
|
|
2268
|
+
return o.scaleId != null ? Be(e, n, o) : ce(e, n, Yt);
|
|
2242
2269
|
};
|
|
2243
2270
|
case "panXY":
|
|
2244
2271
|
return (e, n, o) => {
|
|
2245
2272
|
if (n instanceof WheelEvent) {
|
|
2246
|
-
ae(e, n,
|
|
2273
|
+
ae(e, n, Nt);
|
|
2247
2274
|
return;
|
|
2248
2275
|
}
|
|
2249
|
-
return ce(e, n,
|
|
2276
|
+
return ce(e, n, Nt);
|
|
2250
2277
|
};
|
|
2251
2278
|
case "reset":
|
|
2252
2279
|
return (e) => {
|
|
@@ -2261,307 +2288,307 @@ function ds(t) {
|
|
|
2261
2288
|
return;
|
|
2262
2289
|
}
|
|
2263
2290
|
}
|
|
2264
|
-
function
|
|
2291
|
+
function Ve(t) {
|
|
2265
2292
|
return typeof t == "function" ? t : ds(t);
|
|
2266
2293
|
}
|
|
2267
2294
|
function gs(t, e) {
|
|
2268
2295
|
const n = t.plotBox, o = e.left / n.width, s = (e.left + e.width) / n.width, r = {};
|
|
2269
2296
|
for (const i of t.scaleManager.getAllScales()) {
|
|
2270
2297
|
if (i.ori !== W.Horizontal || !K(i)) continue;
|
|
2271
|
-
const l =
|
|
2298
|
+
const l = bt(n.left + o * n.width, i, n.width, n.left), c = bt(n.left + s * n.width, i, n.width, n.left);
|
|
2272
2299
|
r[i.id] = { min: Math.min(l, c), max: Math.max(l, c) };
|
|
2273
2300
|
}
|
|
2274
2301
|
return { left: o, right: s, ranges: r };
|
|
2275
2302
|
}
|
|
2276
2303
|
function ps(t, e) {
|
|
2277
|
-
|
|
2304
|
+
rt(() => {
|
|
2278
2305
|
if (e != null)
|
|
2279
2306
|
return ms(t, e);
|
|
2280
2307
|
}, [t, e]);
|
|
2281
2308
|
}
|
|
2282
2309
|
function ms(t, e) {
|
|
2283
2310
|
let n = null, o = !1, s = null, r = -1, i = -1;
|
|
2284
|
-
function l(
|
|
2285
|
-
const
|
|
2311
|
+
function l(v) {
|
|
2312
|
+
const k = e.getBoundingClientRect(), _ = t.plotBox;
|
|
2286
2313
|
return {
|
|
2287
|
-
cx:
|
|
2288
|
-
cy:
|
|
2314
|
+
cx: v.clientX - k.left - _.left,
|
|
2315
|
+
cy: v.clientY - k.top - _.top
|
|
2289
2316
|
};
|
|
2290
2317
|
}
|
|
2291
|
-
function c(
|
|
2318
|
+
function c(v, k) {
|
|
2292
2319
|
const _ = t.plotBox;
|
|
2293
|
-
return
|
|
2320
|
+
return v >= 0 && v <= _.width && k >= 0 && k <= _.height;
|
|
2294
2321
|
}
|
|
2295
|
-
function f(
|
|
2296
|
-
const _ = e.getBoundingClientRect(),
|
|
2322
|
+
function f(v, k) {
|
|
2323
|
+
const _ = e.getBoundingClientRect(), D = v - _.left, $ = k - _.top, z = t.plotBox;
|
|
2297
2324
|
for (const G of t.axisStates) {
|
|
2298
|
-
const
|
|
2325
|
+
const U = G.config, Z = U.side;
|
|
2299
2326
|
if (G._size <= 0) continue;
|
|
2300
|
-
const ot =
|
|
2301
|
-
if (
|
|
2302
|
-
return { scaleId:
|
|
2327
|
+
const ot = $ >= z.top && $ <= z.top + z.height, J = D >= z.left && D <= z.left + z.width;
|
|
2328
|
+
if (Z === N.Left && D < z.left && ot || Z === N.Right && D > z.left + z.width && ot || Z === N.Top && $ < z.top && J || Z === N.Bottom && $ > z.top + z.height && J)
|
|
2329
|
+
return { scaleId: U.scale, ori: Et(Z) };
|
|
2303
2330
|
}
|
|
2304
2331
|
return null;
|
|
2305
2332
|
}
|
|
2306
|
-
function a(
|
|
2307
|
-
const { cx:
|
|
2308
|
-
return { cx:
|
|
2333
|
+
function a(v) {
|
|
2334
|
+
const { cx: k, cy: _ } = l(v);
|
|
2335
|
+
return { cx: k, cy: _, inPlot: c(k, _) };
|
|
2309
2336
|
}
|
|
2310
|
-
function d(
|
|
2337
|
+
function d(v) {
|
|
2311
2338
|
if (n == null) {
|
|
2312
|
-
|
|
2339
|
+
g();
|
|
2313
2340
|
return;
|
|
2314
2341
|
}
|
|
2315
|
-
e.contains(
|
|
2342
|
+
e.contains(v.target) || (o = !0, n.onMove(t, v, a(v)), M(v, v));
|
|
2316
2343
|
}
|
|
2317
|
-
function u(
|
|
2318
|
-
|
|
2344
|
+
function u(v) {
|
|
2345
|
+
g(), n != null && (e.contains(v.target) || (n.onEnd(t, v, a(v)), n = null, r = -1, i = -1, t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw()));
|
|
2319
2346
|
}
|
|
2320
2347
|
function h() {
|
|
2321
2348
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2322
2349
|
}
|
|
2323
|
-
function
|
|
2350
|
+
function g() {
|
|
2324
2351
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2325
2352
|
}
|
|
2326
2353
|
function w() {
|
|
2327
|
-
n != null && (n = null,
|
|
2354
|
+
n != null && (n = null, g(), t.cursorManager.hide(), t.scheduleCursorRedraw());
|
|
2328
2355
|
}
|
|
2329
|
-
function
|
|
2330
|
-
const
|
|
2331
|
-
let
|
|
2332
|
-
if (
|
|
2333
|
-
const z = t.dataStore.data[
|
|
2356
|
+
function S(v, k, _) {
|
|
2357
|
+
const D = t.cursorManager.state;
|
|
2358
|
+
let $ = null;
|
|
2359
|
+
if (D.activeGroup >= 0 && D.activeDataIdx >= 0) {
|
|
2360
|
+
const z = t.dataStore.data[D.activeGroup];
|
|
2334
2361
|
if (z != null) {
|
|
2335
|
-
const G = z.x[
|
|
2336
|
-
if (G != null &&
|
|
2337
|
-
const et = t.plotBox, ot = t.scaleManager.getGroupXScaleKey(
|
|
2338
|
-
let
|
|
2339
|
-
J != null && K(J) && (
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
group:
|
|
2343
|
-
seriesIdx:
|
|
2344
|
-
dataIdx:
|
|
2362
|
+
const G = z.x[D.activeDataIdx], U = z.series[D.activeSeriesIdx], Z = U != null ? U[D.activeDataIdx] : void 0;
|
|
2363
|
+
if (G != null && Z != null) {
|
|
2364
|
+
const et = t.plotBox, ot = t.scaleManager.getGroupXScaleKey(D.activeGroup), J = ot != null ? t.scaleManager.getScale(ot) : void 0, pt = t.seriesConfigMap.get(`${D.activeGroup}:${D.activeSeriesIdx}`), At = pt != null ? t.scaleManager.getScale(pt.yScale) : void 0;
|
|
2365
|
+
let It = k, Qt = _;
|
|
2366
|
+
J != null && K(J) && (It = B(G, J, et.width, et.left) - et.left), At != null && K(At) && (Qt = B(Z, At, et.height, et.top) - et.top);
|
|
2367
|
+
const Ce = k - It, ke = _ - Qt;
|
|
2368
|
+
$ = {
|
|
2369
|
+
group: D.activeGroup,
|
|
2370
|
+
seriesIdx: D.activeSeriesIdx,
|
|
2371
|
+
dataIdx: D.activeDataIdx,
|
|
2345
2372
|
xVal: G,
|
|
2346
|
-
yVal:
|
|
2347
|
-
pxX:
|
|
2348
|
-
pxY:
|
|
2349
|
-
dist: Math.sqrt(
|
|
2373
|
+
yVal: Z,
|
|
2374
|
+
pxX: It,
|
|
2375
|
+
pxY: Qt,
|
|
2376
|
+
dist: Math.sqrt(Ce * Ce + ke * ke)
|
|
2350
2377
|
};
|
|
2351
2378
|
}
|
|
2352
2379
|
}
|
|
2353
2380
|
}
|
|
2354
|
-
return { plotX:
|
|
2381
|
+
return { plotX: k, plotY: _, point: $, srcEvent: v };
|
|
2355
2382
|
}
|
|
2356
|
-
function
|
|
2357
|
-
const
|
|
2358
|
-
if (!(
|
|
2359
|
-
return
|
|
2383
|
+
function b(v, k, _, D = !0) {
|
|
2384
|
+
const $ = us(t.actionMap, v, k, _, D);
|
|
2385
|
+
if (!($ == null || $ === "none"))
|
|
2386
|
+
return Ve($);
|
|
2360
2387
|
}
|
|
2361
|
-
function
|
|
2362
|
-
const { cx: _, cy:
|
|
2363
|
-
if (!c(_,
|
|
2388
|
+
function M(v, k) {
|
|
2389
|
+
const { cx: _, cy: D } = l(v);
|
|
2390
|
+
if (!c(_, D) && n == null) {
|
|
2364
2391
|
r = -1, i = -1, t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw();
|
|
2365
2392
|
return;
|
|
2366
2393
|
}
|
|
2367
|
-
const
|
|
2368
|
-
if (r = _, i =
|
|
2394
|
+
const $ = _ !== r || D !== i;
|
|
2395
|
+
if (r = _, i = D, t.cursorManager.update(
|
|
2369
2396
|
_,
|
|
2370
|
-
|
|
2397
|
+
D,
|
|
2371
2398
|
t.plotBox,
|
|
2372
2399
|
t.dataStore.data,
|
|
2373
2400
|
t.seriesConfigs,
|
|
2374
2401
|
(z) => t.scaleManager.getScale(z),
|
|
2375
2402
|
(z) => t.dataStore.getWindow(z),
|
|
2376
2403
|
(z) => t.scaleManager.getGroupXScaleKey(z)
|
|
2377
|
-
),
|
|
2378
|
-
const z = { cx: _, cy:
|
|
2404
|
+
), $) {
|
|
2405
|
+
const z = { cx: _, cy: D, inPlot: c(_, D) }, G = t.actionMap.get("hover");
|
|
2379
2406
|
if (G != null && G !== "none") {
|
|
2380
|
-
const
|
|
2381
|
-
if (
|
|
2382
|
-
const
|
|
2383
|
-
if (
|
|
2407
|
+
const U = Ve(G);
|
|
2408
|
+
if (U != null && U(t, k ?? v, z), t.focusAlpha < 1) {
|
|
2409
|
+
const Z = t.cursorManager.state;
|
|
2410
|
+
if (Z.activeGroup >= 0 && Z.activeSeriesIdx >= 0) {
|
|
2384
2411
|
const et = t.seriesConfigs.findIndex(
|
|
2385
|
-
(ot) => ot.group ===
|
|
2412
|
+
(ot) => ot.group === Z.activeGroup && ot.index === Z.activeSeriesIdx
|
|
2386
2413
|
);
|
|
2387
2414
|
et >= 0 && t.focusedSeries !== et && (t.focusedSeries = et, t.scheduleRedraw());
|
|
2388
2415
|
}
|
|
2389
2416
|
}
|
|
2390
2417
|
}
|
|
2391
2418
|
}
|
|
2392
|
-
if (
|
|
2419
|
+
if (k != null && t.eventCallbacks.onCursorMove != null && c(_, D))
|
|
2393
2420
|
try {
|
|
2394
|
-
t.eventCallbacks.onCursorMove(
|
|
2421
|
+
t.eventCallbacks.onCursorMove(S(k, _, D));
|
|
2395
2422
|
} catch (z) {
|
|
2396
2423
|
console.warn("[uPlot+] event callback error:", z);
|
|
2397
2424
|
}
|
|
2398
2425
|
t.scheduleCursorRedraw();
|
|
2399
2426
|
}
|
|
2400
|
-
function
|
|
2427
|
+
function p() {
|
|
2401
2428
|
document.activeElement !== e && e.focus();
|
|
2402
2429
|
}
|
|
2403
|
-
function v
|
|
2404
|
-
const
|
|
2405
|
-
let
|
|
2406
|
-
if (_ != null &&
|
|
2407
|
-
|
|
2408
|
-
else if (
|
|
2409
|
-
|
|
2410
|
-
const
|
|
2411
|
-
if (
|
|
2412
|
-
(
|
|
2413
|
-
const z =
|
|
2430
|
+
function m(v) {
|
|
2431
|
+
const k = a(v), _ = f(v.clientX, v.clientY);
|
|
2432
|
+
let D;
|
|
2433
|
+
if (_ != null && v.button === 0)
|
|
2434
|
+
D = _.ori === W.Horizontal ? "xGutterDrag" : "yGutterDrag", k.scaleId = _.scaleId, k.ori = _.ori;
|
|
2435
|
+
else if (D = is(v), !k.inPlot) return;
|
|
2436
|
+
k.action = D;
|
|
2437
|
+
const $ = b(D, v, k, !1);
|
|
2438
|
+
if ($ == null) return;
|
|
2439
|
+
(v.button !== 0 || _ != null) && v.preventDefault();
|
|
2440
|
+
const z = $(t, v, k);
|
|
2414
2441
|
z != null && (n = z, o = !1, h());
|
|
2415
2442
|
}
|
|
2416
|
-
function
|
|
2443
|
+
function T(v) {
|
|
2417
2444
|
if (n != null) {
|
|
2418
|
-
o = !0, n.onMove(t,
|
|
2445
|
+
o = !0, n.onMove(t, v, a(v)), M(v, v);
|
|
2419
2446
|
return;
|
|
2420
2447
|
}
|
|
2421
|
-
|
|
2448
|
+
M(v, v);
|
|
2422
2449
|
}
|
|
2423
|
-
function
|
|
2450
|
+
function A(v) {
|
|
2424
2451
|
if (n != null) {
|
|
2425
|
-
n.onEnd(t,
|
|
2452
|
+
n.onEnd(t, v, a(v)), n = null;
|
|
2426
2453
|
return;
|
|
2427
2454
|
}
|
|
2428
2455
|
}
|
|
2429
|
-
function y(
|
|
2456
|
+
function y(v) {
|
|
2430
2457
|
if (o) {
|
|
2431
2458
|
o = !1;
|
|
2432
2459
|
return;
|
|
2433
2460
|
}
|
|
2434
|
-
const
|
|
2435
|
-
if (!
|
|
2436
|
-
const _ = rs(
|
|
2437
|
-
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
const
|
|
2441
|
-
if (
|
|
2461
|
+
const k = a(v);
|
|
2462
|
+
if (!k.inPlot) return;
|
|
2463
|
+
const _ = rs(v);
|
|
2464
|
+
k.action = _;
|
|
2465
|
+
const D = b(_, v, k);
|
|
2466
|
+
D != null && D(t, v, k);
|
|
2467
|
+
const $ = t.eventCallbacks.onClick;
|
|
2468
|
+
if ($ != null)
|
|
2442
2469
|
try {
|
|
2443
|
-
|
|
2470
|
+
$(S(v, k.cx, k.cy));
|
|
2444
2471
|
} catch (z) {
|
|
2445
2472
|
console.warn("[uPlot+] event callback error:", z);
|
|
2446
2473
|
}
|
|
2447
2474
|
}
|
|
2448
|
-
function x(
|
|
2475
|
+
function x(v) {
|
|
2449
2476
|
if (n != null) {
|
|
2450
|
-
|
|
2477
|
+
v.preventDefault();
|
|
2451
2478
|
return;
|
|
2452
2479
|
}
|
|
2453
|
-
const
|
|
2454
|
-
if (!
|
|
2455
|
-
|
|
2456
|
-
const _ =
|
|
2457
|
-
_ != null && _(t,
|
|
2458
|
-
const
|
|
2459
|
-
if (
|
|
2480
|
+
const k = a(v);
|
|
2481
|
+
if (!k.inPlot) return;
|
|
2482
|
+
v.preventDefault(), k.action = "rightClick";
|
|
2483
|
+
const _ = b("rightClick", v, k);
|
|
2484
|
+
_ != null && _(t, v, k);
|
|
2485
|
+
const D = t.eventCallbacks.onContextMenu;
|
|
2486
|
+
if (D != null)
|
|
2460
2487
|
try {
|
|
2461
|
-
|
|
2462
|
-
} catch (
|
|
2463
|
-
console.warn("[uPlot+] event callback error:",
|
|
2488
|
+
D(S(v, k.cx, k.cy));
|
|
2489
|
+
} catch ($) {
|
|
2490
|
+
console.warn("[uPlot+] event callback error:", $);
|
|
2464
2491
|
}
|
|
2465
2492
|
}
|
|
2466
|
-
function
|
|
2467
|
-
var
|
|
2493
|
+
function P(v) {
|
|
2494
|
+
var k, _;
|
|
2468
2495
|
if (n == null) {
|
|
2469
2496
|
r = -1, i = -1, t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw();
|
|
2470
2497
|
try {
|
|
2471
|
-
(_ = (
|
|
2472
|
-
} catch (
|
|
2473
|
-
console.warn("[uPlot+] event callback error:",
|
|
2498
|
+
(_ = (k = t.eventCallbacks).onCursorLeave) == null || _.call(k);
|
|
2499
|
+
} catch (D) {
|
|
2500
|
+
console.warn("[uPlot+] event callback error:", D);
|
|
2474
2501
|
}
|
|
2475
2502
|
}
|
|
2476
2503
|
}
|
|
2477
|
-
function L(
|
|
2478
|
-
const
|
|
2479
|
-
if (!
|
|
2504
|
+
function L(v) {
|
|
2505
|
+
const k = a(v);
|
|
2506
|
+
if (!k.inPlot) return;
|
|
2480
2507
|
if (t.eventCallbacks.onDblClick != null) {
|
|
2481
|
-
let
|
|
2508
|
+
let $;
|
|
2482
2509
|
try {
|
|
2483
|
-
|
|
2510
|
+
$ = t.eventCallbacks.onDblClick(S(v, k.cx, k.cy));
|
|
2484
2511
|
} catch (z) {
|
|
2485
2512
|
console.warn("[uPlot+] event callback error:", z);
|
|
2486
2513
|
}
|
|
2487
|
-
if (
|
|
2514
|
+
if ($ === !1) return;
|
|
2488
2515
|
}
|
|
2489
|
-
const _ = ls(
|
|
2490
|
-
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2493
|
-
}
|
|
2494
|
-
function
|
|
2495
|
-
const
|
|
2496
|
-
if (!
|
|
2497
|
-
const _ = cs(
|
|
2498
|
-
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2501
|
-
}
|
|
2502
|
-
function
|
|
2503
|
-
if (
|
|
2504
|
-
const z =
|
|
2516
|
+
const _ = ls(v);
|
|
2517
|
+
k.action = _;
|
|
2518
|
+
const D = b(_, v, k, !1);
|
|
2519
|
+
D != null && D(t, v, k);
|
|
2520
|
+
}
|
|
2521
|
+
function F(v) {
|
|
2522
|
+
const k = a(v);
|
|
2523
|
+
if (!k.inPlot) return;
|
|
2524
|
+
const _ = cs(v);
|
|
2525
|
+
k.action = _;
|
|
2526
|
+
const D = b(_, v, k);
|
|
2527
|
+
D != null && (v.preventDefault(), D(t, v, k));
|
|
2528
|
+
}
|
|
2529
|
+
function I(v) {
|
|
2530
|
+
if (v.touches.length === 2) {
|
|
2531
|
+
const z = v.touches[0], G = v.touches[1], U = G.clientX - z.clientX, Z = G.clientY - z.clientY;
|
|
2505
2532
|
s = {
|
|
2506
|
-
dist: Math.sqrt(
|
|
2533
|
+
dist: Math.sqrt(U * U + Z * Z),
|
|
2507
2534
|
midX: (z.clientX + G.clientX) / 2,
|
|
2508
2535
|
midY: (z.clientY + G.clientY) / 2
|
|
2509
2536
|
}, n = null;
|
|
2510
2537
|
return;
|
|
2511
2538
|
}
|
|
2512
|
-
const
|
|
2513
|
-
if (
|
|
2514
|
-
const _ = a(
|
|
2539
|
+
const k = v.touches[0];
|
|
2540
|
+
if (k == null) return;
|
|
2541
|
+
const _ = a(k);
|
|
2515
2542
|
if (!_.inPlot) return;
|
|
2516
|
-
const
|
|
2517
|
-
if (
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2521
|
-
function
|
|
2522
|
-
if (
|
|
2523
|
-
|
|
2524
|
-
const _ =
|
|
2525
|
-
if (
|
|
2543
|
+
const D = b("touchDrag", v, _);
|
|
2544
|
+
if (D == null) return;
|
|
2545
|
+
const $ = D(t, v, _);
|
|
2546
|
+
$ != null && (n = $, o = !1);
|
|
2547
|
+
}
|
|
2548
|
+
function C(v) {
|
|
2549
|
+
if (v.touches.length === 2 && s != null) {
|
|
2550
|
+
v.preventDefault();
|
|
2551
|
+
const _ = v.touches[0], D = v.touches[1], $ = D.clientX - _.clientX, z = D.clientY - _.clientY, G = Math.sqrt($ * $ + z * z), U = a({ clientX: s.midX, clientY: s.midY });
|
|
2552
|
+
if (b("pinch", v, U) != null) {
|
|
2526
2553
|
const et = G / s.dist, ot = t.plotBox;
|
|
2527
2554
|
for (const J of t.scaleManager.getAllScales()) {
|
|
2528
2555
|
if (J.ori !== W.Horizontal || !K(J)) continue;
|
|
2529
|
-
const
|
|
2530
|
-
J.min = Math.min(
|
|
2556
|
+
const pt = bt(U.cx + ot.left, J, ot.width, ot.left), At = pt - (pt - J.min) / et, It = pt + (J.max - pt) / et;
|
|
2557
|
+
J.min = Math.min(At, It), J.max = Math.max(At, It), J.auto = !1, gt(J);
|
|
2531
2558
|
}
|
|
2532
|
-
s.dist = G, t.renderer.clearCache(), t.scheduleRedraw(),
|
|
2559
|
+
s.dist = G, t.renderer.clearCache(), t.scheduleRedraw(), zt(t);
|
|
2533
2560
|
}
|
|
2534
2561
|
return;
|
|
2535
2562
|
}
|
|
2536
|
-
const
|
|
2537
|
-
if (
|
|
2563
|
+
const k = v.touches[0];
|
|
2564
|
+
if (k != null) {
|
|
2538
2565
|
if (n != null) {
|
|
2539
|
-
o = !0, n.onMove(t,
|
|
2566
|
+
o = !0, n.onMove(t, v, a(k)), M(k, v), v.preventDefault();
|
|
2540
2567
|
return;
|
|
2541
2568
|
}
|
|
2542
|
-
|
|
2569
|
+
M(k, v);
|
|
2543
2570
|
}
|
|
2544
2571
|
}
|
|
2545
|
-
function
|
|
2572
|
+
function E(v) {
|
|
2546
2573
|
if (s != null) {
|
|
2547
2574
|
s = null;
|
|
2548
2575
|
return;
|
|
2549
2576
|
}
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2577
|
+
const k = v.changedTouches[0];
|
|
2578
|
+
k != null && n != null && (n.onEnd(t, v, a(k)), n = null);
|
|
2552
2579
|
}
|
|
2553
|
-
function
|
|
2554
|
-
const
|
|
2580
|
+
function H(v) {
|
|
2581
|
+
const k = {
|
|
2555
2582
|
cx: r,
|
|
2556
2583
|
cy: i,
|
|
2557
2584
|
inPlot: r >= 0 && i >= 0
|
|
2558
|
-
}, _ = as(
|
|
2559
|
-
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2585
|
+
}, _ = as(v);
|
|
2586
|
+
k.action = _;
|
|
2587
|
+
const D = b(_, v, k);
|
|
2588
|
+
D != null && (v.preventDefault(), D(t, v, k));
|
|
2562
2589
|
}
|
|
2563
|
-
return e.addEventListener("mouseenter",
|
|
2564
|
-
|
|
2590
|
+
return e.addEventListener("mouseenter", p), e.addEventListener("mousemove", T), e.addEventListener("mousedown", m), e.addEventListener("mouseup", A), e.addEventListener("click", y), e.addEventListener("contextmenu", x), e.addEventListener("mouseleave", P), e.addEventListener("dblclick", L), e.addEventListener("wheel", F, { passive: !1 }), e.addEventListener("touchstart", I, { passive: !0 }), e.addEventListener("touchmove", C, { passive: !1 }), e.addEventListener("touchend", E), e.addEventListener("keydown", H), window.addEventListener("blur", w), () => {
|
|
2591
|
+
g(), e.removeEventListener("mouseenter", p), e.removeEventListener("mousemove", T), e.removeEventListener("mousedown", m), e.removeEventListener("mouseup", A), e.removeEventListener("click", y), e.removeEventListener("contextmenu", x), e.removeEventListener("mouseleave", P), e.removeEventListener("dblclick", L), e.removeEventListener("wheel", F), e.removeEventListener("touchstart", I), e.removeEventListener("touchmove", C), e.removeEventListener("touchend", E), e.removeEventListener("keydown", H), window.removeEventListener("blur", w);
|
|
2565
2592
|
};
|
|
2566
2593
|
}
|
|
2567
2594
|
const he = /* @__PURE__ */ new Map();
|
|
@@ -2609,12 +2636,12 @@ class vs {
|
|
|
2609
2636
|
return;
|
|
2610
2637
|
}
|
|
2611
2638
|
for (const l of this.members)
|
|
2612
|
-
l !== e && (this.syncedStores.add(l), l.cursorManager.syncToValue(i, l), l.scheduleCursorRedraw());
|
|
2639
|
+
l !== e && (this.syncedStores.add(l), l.cursorManager.syncToValue(i, l, o), l.scheduleCursorRedraw());
|
|
2613
2640
|
this.publishing = !1;
|
|
2614
2641
|
}
|
|
2615
2642
|
}
|
|
2616
2643
|
function Ss(t, e) {
|
|
2617
|
-
|
|
2644
|
+
rt(() => {
|
|
2618
2645
|
if (e == null) return;
|
|
2619
2646
|
const n = ws(e);
|
|
2620
2647
|
n.join(t);
|
|
@@ -2628,24 +2655,24 @@ function Ss(t, e) {
|
|
|
2628
2655
|
};
|
|
2629
2656
|
}, [t, e]);
|
|
2630
2657
|
}
|
|
2631
|
-
function
|
|
2658
|
+
function dn(t) {
|
|
2632
2659
|
return t instanceof Float64Array ? t : new Float64Array(t);
|
|
2633
2660
|
}
|
|
2634
|
-
function
|
|
2661
|
+
function gn(t) {
|
|
2635
2662
|
return t instanceof Float64Array || t.some((e) => e == null) ? t : new Float64Array(t);
|
|
2636
2663
|
}
|
|
2637
|
-
function
|
|
2638
|
-
return { x:
|
|
2664
|
+
function Xe(t) {
|
|
2665
|
+
return { x: dn(t.x), series: [gn(t.y)] };
|
|
2639
2666
|
}
|
|
2640
2667
|
function bs(t) {
|
|
2641
|
-
return { x:
|
|
2668
|
+
return { x: dn(t.x), series: t.series.map(gn) };
|
|
2642
2669
|
}
|
|
2643
|
-
function
|
|
2670
|
+
function pn(t) {
|
|
2644
2671
|
if (!Array.isArray(t))
|
|
2645
|
-
return [
|
|
2672
|
+
return [Xe(t)];
|
|
2646
2673
|
if (t.length === 0) return [];
|
|
2647
2674
|
const e = t[0];
|
|
2648
|
-
return e == null ? [] : "series" in e ? t.map(bs) : t.map(
|
|
2675
|
+
return e == null ? [] : "series" in e ? t.map(bs) : t.map(Xe);
|
|
2649
2676
|
}
|
|
2650
2677
|
function mn({
|
|
2651
2678
|
width: t,
|
|
@@ -2662,68 +2689,69 @@ function mn({
|
|
|
2662
2689
|
syncKey: d,
|
|
2663
2690
|
actions: u,
|
|
2664
2691
|
onClick: h,
|
|
2665
|
-
onContextMenu:
|
|
2692
|
+
onContextMenu: g,
|
|
2666
2693
|
onDblClick: w,
|
|
2667
|
-
onCursorMove:
|
|
2668
|
-
onCursorLeave:
|
|
2669
|
-
onScaleChange:
|
|
2670
|
-
onSelect:
|
|
2694
|
+
onCursorMove: S,
|
|
2695
|
+
onCursorLeave: b,
|
|
2696
|
+
onScaleChange: M,
|
|
2697
|
+
onSelect: p
|
|
2671
2698
|
}) {
|
|
2672
|
-
const
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
}, [
|
|
2676
|
-
|
|
2677
|
-
}, [
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2699
|
+
const m = ns(), [T, A] = ut(null), y = r ?? (typeof window < "u" && window.devicePixelRatio || 1);
|
|
2700
|
+
rt(() => {
|
|
2701
|
+
m.actionMap = u != null ? new Map([...ue, ...u]) : new Map(ue);
|
|
2702
|
+
}, [m, u]), j(() => {
|
|
2703
|
+
m.setLabels(i, l, c);
|
|
2704
|
+
}, [m, i, l, c]), rt(() => {
|
|
2705
|
+
const v = m.eventCallbacks;
|
|
2706
|
+
v.onClick = h, v.onContextMenu = g, v.onDblClick = w, v.onCursorMove = S, v.onCursorLeave = b, v.onScaleChange = M, v.onSelect = p;
|
|
2707
|
+
}, [m, h, g, w, S, b, M, p]), ps(m, T), Ss(m, d);
|
|
2708
|
+
const x = Y(null), P = Lt((v) => {
|
|
2709
|
+
x.current !== v && (x.current = v, m.setCanvas(v), v && m.scheduleRedraw());
|
|
2710
|
+
}, [m]), L = Y(null), F = Lt((v) => {
|
|
2711
|
+
L.current !== v && (L.current = v, A(v));
|
|
2712
|
+
}, []), I = Y(f);
|
|
2713
|
+
j(() => {
|
|
2714
|
+
I.current = f;
|
|
2715
|
+
});
|
|
2716
|
+
const C = Y(a);
|
|
2717
|
+
j(() => {
|
|
2718
|
+
C.current = a;
|
|
2719
|
+
});
|
|
2720
|
+
const E = Y(!1), H = Y(n);
|
|
2721
|
+
return j(() => {
|
|
2722
|
+
n === H.current && m.dataStore.data.length > 0 || (H.current = n, E.current = !0, m.setData(pn(n)), m.scheduleRedraw());
|
|
2723
|
+
}, [m, n]), j(() => {
|
|
2724
|
+
m.setSize(t, e, y), E.current && m.redrawSync();
|
|
2725
|
+
}, [m, t, e, y]), rt(() => () => {
|
|
2726
|
+
m.setCanvas(null), m.scheduler.cancel(), m.focusedSeries = null, m.eventCallbacks = {};
|
|
2727
|
+
}, [m]), rt(() => {
|
|
2728
|
+
if (T == null || typeof ResizeObserver > "u") return;
|
|
2729
|
+
const v = new ResizeObserver((k) => {
|
|
2730
|
+
const _ = k[0];
|
|
2731
|
+
if (_ == null) return;
|
|
2732
|
+
const { width: D, height: $ } = _.contentRect;
|
|
2733
|
+
D > 0 && $ > 0 && (D !== m.width || $ !== m.height) && (m.setSize(Math.round(D), Math.round($)), m.scheduleRedraw());
|
|
2696
2734
|
});
|
|
2697
|
-
return
|
|
2698
|
-
|
|
2735
|
+
return v.observe(T), () => {
|
|
2736
|
+
v.disconnect();
|
|
2699
2737
|
};
|
|
2700
|
-
}, [
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
Z(() => {
|
|
2705
|
-
n === S.current && v.dataStore.data.length > 0 || (S.current = n, v.setData($), v.scheduleRedraw());
|
|
2706
|
-
}, [v, n, $]);
|
|
2707
|
-
const C = N(f);
|
|
2708
|
-
C.current = f, Z(() => {
|
|
2709
|
-
const I = (H) => {
|
|
2710
|
-
var z;
|
|
2711
|
-
(z = C.current) == null || z.call(C, H);
|
|
2738
|
+
}, [m, T]), j(() => {
|
|
2739
|
+
const v = (k) => {
|
|
2740
|
+
var _;
|
|
2741
|
+
(_ = I.current) == null || _.call(I, k);
|
|
2712
2742
|
};
|
|
2713
|
-
return
|
|
2714
|
-
|
|
2743
|
+
return m.drawHooks.add(v), () => {
|
|
2744
|
+
m.drawHooks.delete(v);
|
|
2715
2745
|
};
|
|
2716
|
-
}, [
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
var G;
|
|
2721
|
-
(G = _.current) == null || G.call(_, H, z);
|
|
2746
|
+
}, [m]), j(() => {
|
|
2747
|
+
const v = (k, _) => {
|
|
2748
|
+
var D;
|
|
2749
|
+
(D = C.current) == null || D.call(C, k, _);
|
|
2722
2750
|
};
|
|
2723
|
-
return
|
|
2724
|
-
|
|
2751
|
+
return m.cursorDrawHooks.add(v), () => {
|
|
2752
|
+
m.cursorDrawHooks.delete(v);
|
|
2725
2753
|
};
|
|
2726
|
-
}, [
|
|
2754
|
+
}, [m]), /* @__PURE__ */ V(fn.Provider, { value: m, children: /* @__PURE__ */ dt(
|
|
2727
2755
|
"div",
|
|
2728
2756
|
{
|
|
2729
2757
|
className: s,
|
|
@@ -2734,11 +2762,11 @@ function mn({
|
|
|
2734
2762
|
width: `${t}px`
|
|
2735
2763
|
},
|
|
2736
2764
|
children: [
|
|
2737
|
-
/* @__PURE__ */
|
|
2765
|
+
/* @__PURE__ */ V(
|
|
2738
2766
|
"div",
|
|
2739
2767
|
{
|
|
2740
|
-
ref:
|
|
2741
|
-
tabIndex:
|
|
2768
|
+
ref: F,
|
|
2769
|
+
tabIndex: 0,
|
|
2742
2770
|
style: {
|
|
2743
2771
|
position: "relative",
|
|
2744
2772
|
width: `${t}px`,
|
|
@@ -2747,10 +2775,10 @@ function mn({
|
|
|
2747
2775
|
outline: "none",
|
|
2748
2776
|
order: 0
|
|
2749
2777
|
},
|
|
2750
|
-
children: /* @__PURE__ */
|
|
2778
|
+
children: /* @__PURE__ */ V(
|
|
2751
2779
|
"canvas",
|
|
2752
2780
|
{
|
|
2753
|
-
ref:
|
|
2781
|
+
ref: P,
|
|
2754
2782
|
style: {
|
|
2755
2783
|
position: "absolute",
|
|
2756
2784
|
left: 0,
|
|
@@ -2765,7 +2793,7 @@ function mn({
|
|
|
2765
2793
|
}
|
|
2766
2794
|
) });
|
|
2767
2795
|
}
|
|
2768
|
-
function
|
|
2796
|
+
function Ye(t) {
|
|
2769
2797
|
return t != null && typeof t == "object" && !Array.isArray(t);
|
|
2770
2798
|
}
|
|
2771
2799
|
function Ms(t, e) {
|
|
@@ -2782,28 +2810,30 @@ function ys(t, e) {
|
|
|
2782
2810
|
for (const i of r) {
|
|
2783
2811
|
const l = n[i], c = o[i];
|
|
2784
2812
|
if (l !== c)
|
|
2785
|
-
if (
|
|
2813
|
+
if (Ye(l) && Ye(c)) {
|
|
2786
2814
|
if (!Ms(l, c)) return !1;
|
|
2787
2815
|
} else
|
|
2788
2816
|
return !1;
|
|
2789
2817
|
}
|
|
2790
2818
|
return !0;
|
|
2791
2819
|
}
|
|
2792
|
-
function
|
|
2793
|
-
const r = st(), i =
|
|
2794
|
-
|
|
2820
|
+
function ve(t, e, n, o, s) {
|
|
2821
|
+
const r = st(), i = Y(t);
|
|
2822
|
+
j(() => {
|
|
2823
|
+
i.current = t;
|
|
2824
|
+
}), j(() => {
|
|
2795
2825
|
const c = i.current;
|
|
2796
2826
|
return n(r, c), r.scheduleRedraw(), () => {
|
|
2797
2827
|
o(r, c), r.scheduleRedraw();
|
|
2798
2828
|
};
|
|
2799
2829
|
}, [r, ...e]);
|
|
2800
|
-
const l =
|
|
2801
|
-
|
|
2830
|
+
const l = Y(t);
|
|
2831
|
+
j(() => {
|
|
2802
2832
|
ys(l.current, t) || (l.current = t, s(r, t), r.scheduleRedraw());
|
|
2803
2833
|
});
|
|
2804
2834
|
}
|
|
2805
2835
|
function hi(t) {
|
|
2806
|
-
return
|
|
2836
|
+
return ve(
|
|
2807
2837
|
t,
|
|
2808
2838
|
[t.id],
|
|
2809
2839
|
(e, n) => e.registerScale(n),
|
|
@@ -2869,7 +2899,7 @@ function gi(t, e = 65, n = 50) {
|
|
|
2869
2899
|
}
|
|
2870
2900
|
return o;
|
|
2871
2901
|
}
|
|
2872
|
-
const
|
|
2902
|
+
const Ne = [
|
|
2873
2903
|
"#e74c3c",
|
|
2874
2904
|
"#3498db",
|
|
2875
2905
|
"#2ecc71",
|
|
@@ -2886,9 +2916,9 @@ const Ue = [
|
|
|
2886
2916
|
"#8e44ad",
|
|
2887
2917
|
"#d35400"
|
|
2888
2918
|
];
|
|
2889
|
-
function
|
|
2919
|
+
function Ue(t, e) {
|
|
2890
2920
|
var i;
|
|
2891
|
-
const n = (i = t.paths) == null ? void 0 : i.defaults, o = t.stroke ??
|
|
2921
|
+
const n = (i = t.paths) == null ? void 0 : i.defaults, o = t.stroke ?? Ne[e % Ne.length] ?? "#000", s = t.fill ?? (n == null ? void 0 : n.fill), r = s === "auto" && typeof o == "string" ? Cs(o, 0.5) : s === "auto" ? void 0 : s;
|
|
2892
2922
|
return {
|
|
2893
2923
|
...n,
|
|
2894
2924
|
...t,
|
|
@@ -2899,23 +2929,23 @@ function Ke(t, e) {
|
|
|
2899
2929
|
};
|
|
2900
2930
|
}
|
|
2901
2931
|
function vn(t) {
|
|
2902
|
-
return
|
|
2932
|
+
return ve(
|
|
2903
2933
|
t,
|
|
2904
2934
|
[t.group, t.index],
|
|
2905
|
-
(e, n) => e.registerSeries(
|
|
2935
|
+
(e, n) => e.registerSeries(Ue(n, e.seriesConfigs.length)),
|
|
2906
2936
|
(e, n) => e.unregisterSeries(n.group, n.index),
|
|
2907
2937
|
(e, n) => {
|
|
2908
2938
|
const o = e.seriesConfigs.findIndex((s) => s.group === n.group && s.index === n.index);
|
|
2909
|
-
e.updateSeries(
|
|
2939
|
+
e.updateSeries(Ue(n, o >= 0 ? o : e.seriesConfigs.length));
|
|
2910
2940
|
}
|
|
2911
2941
|
), null;
|
|
2912
2942
|
}
|
|
2913
2943
|
function ks(t) {
|
|
2914
|
-
return { ...t, side: t.side ?? (t.scale === "x" ?
|
|
2944
|
+
return { ...t, side: t.side ?? (t.scale === "x" ? N.Bottom : N.Left), show: t.show ?? !0 };
|
|
2915
2945
|
}
|
|
2916
|
-
function
|
|
2946
|
+
function Ut(t) {
|
|
2917
2947
|
const e = ks(t);
|
|
2918
|
-
return
|
|
2948
|
+
return ve(
|
|
2919
2949
|
e,
|
|
2920
2950
|
[e.scale, e.side],
|
|
2921
2951
|
(n, o) => n.registerAxis(o),
|
|
@@ -2924,8 +2954,8 @@ function Yt(t) {
|
|
|
2924
2954
|
), null;
|
|
2925
2955
|
}
|
|
2926
2956
|
function pi({ series: t, group: e, fill: n, dir: o }) {
|
|
2927
|
-
const s = st(), r =
|
|
2928
|
-
return
|
|
2957
|
+
const s = st(), r = Y(null), i = t[0], l = t[1];
|
|
2958
|
+
return rt(() => {
|
|
2929
2959
|
const c = { series: [i, l], group: e, fill: n, dir: o };
|
|
2930
2960
|
return r.current != null && s.unregisterBand(r.current), r.current = c, s.registerBand(c), s.scheduleRedraw(), () => {
|
|
2931
2961
|
r.current != null && s.unregisterBand(r.current), r.current = null, s.scheduleRedraw();
|
|
@@ -2945,7 +2975,7 @@ const Ts = {
|
|
|
2945
2975
|
cursor: "pointer",
|
|
2946
2976
|
fontSize: 12,
|
|
2947
2977
|
fontFamily: "sans-serif"
|
|
2948
|
-
}, Is = { ...Sn, opacity: 1 },
|
|
2978
|
+
}, Is = { ...Sn, opacity: 1 }, Ps = { ...Sn, opacity: 0.4 }, Ke = /* @__PURE__ */ new Map(), Ls = {
|
|
2949
2979
|
display: "flex",
|
|
2950
2980
|
flexWrap: "wrap",
|
|
2951
2981
|
justifyContent: "center",
|
|
@@ -2959,29 +2989,29 @@ const Ts = {
|
|
|
2959
2989
|
padding: "4px 0"
|
|
2960
2990
|
};
|
|
2961
2991
|
function Ds({ group: t, index: e, label: n, color: o, isHidden: s, valueStr: r, store: i }) {
|
|
2962
|
-
let l =
|
|
2963
|
-
return l == null && (l = { ...Ts, backgroundColor: o },
|
|
2992
|
+
let l = Ke.get(o);
|
|
2993
|
+
return l == null && (l = { ...Ts, backgroundColor: o }, Ke.set(o, l)), /* @__PURE__ */ dt(
|
|
2964
2994
|
"span",
|
|
2965
2995
|
{
|
|
2966
2996
|
onClick: () => i.toggleSeries(t, e),
|
|
2967
|
-
style: s ?
|
|
2997
|
+
style: s ? Ps : Is,
|
|
2968
2998
|
children: [
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
r && /* @__PURE__ */
|
|
2999
|
+
/* @__PURE__ */ V("span", { style: l }),
|
|
3000
|
+
/* @__PURE__ */ V("span", { children: n }),
|
|
3001
|
+
r && /* @__PURE__ */ V("span", { style: As, children: r })
|
|
2972
3002
|
]
|
|
2973
3003
|
}
|
|
2974
3004
|
);
|
|
2975
3005
|
}
|
|
2976
3006
|
function mi({ show: t = !0, position: e = "bottom", className: n }) {
|
|
2977
|
-
const o = st(), s =
|
|
3007
|
+
const o = st(), s = Gt(o.subscribeCursor, o.getSnapshot);
|
|
2978
3008
|
if (!t) return null;
|
|
2979
3009
|
const { activeGroup: r, activeDataIdx: i } = s;
|
|
2980
|
-
return /* @__PURE__ */
|
|
3010
|
+
return /* @__PURE__ */ V(
|
|
2981
3011
|
"div",
|
|
2982
3012
|
{
|
|
2983
3013
|
className: n,
|
|
2984
|
-
style: e === "top" ?
|
|
3014
|
+
style: e === "top" ? Ls : _s,
|
|
2985
3015
|
children: o.seriesConfigs.map((l) => {
|
|
2986
3016
|
if (l.legend === !1) return null;
|
|
2987
3017
|
const c = typeof l.stroke == "string" ? l.stroke : "#000";
|
|
@@ -2990,7 +3020,7 @@ function mi({ show: t = !0, position: e = "bottom", className: n }) {
|
|
|
2990
3020
|
const d = o.dataStore.getYValues(l.group, l.index)[i];
|
|
2991
3021
|
d != null && (f = typeof d == "number" ? d.toPrecision(4) : String(d));
|
|
2992
3022
|
}
|
|
2993
|
-
return /* @__PURE__ */
|
|
3023
|
+
return /* @__PURE__ */ V(
|
|
2994
3024
|
Ds,
|
|
2995
3025
|
{
|
|
2996
3026
|
group: l.group,
|
|
@@ -3025,31 +3055,31 @@ const Es = {
|
|
|
3025
3055
|
borderRadius: 1,
|
|
3026
3056
|
display: "inline-block",
|
|
3027
3057
|
flexShrink: 0
|
|
3028
|
-
}, zs = { fontWeight: 600 },
|
|
3058
|
+
}, zs = { fontWeight: 600 }, Jt = {
|
|
3029
3059
|
display: "flex",
|
|
3030
3060
|
alignItems: "center",
|
|
3031
3061
|
gap: 4,
|
|
3032
3062
|
padding: "1px 4px"
|
|
3033
|
-
}, Hs = { ...
|
|
3034
|
-
function
|
|
3035
|
-
let e =
|
|
3036
|
-
return e == null && (e = { ...Fs, backgroundColor: t },
|
|
3063
|
+
}, Hs = { ...Jt, opacity: 1, cursor: "pointer" }, $s = { ...Jt, opacity: 1, cursor: "default" }, Ws = { ...Jt, opacity: 0.4, cursor: "pointer" }, Rs = { ...Jt, opacity: 0.4, cursor: "default" }, Oe = /* @__PURE__ */ new Map();
|
|
3064
|
+
function Gs(t) {
|
|
3065
|
+
let e = Oe.get(t);
|
|
3066
|
+
return e == null && (e = { ...Fs, backgroundColor: t }, Oe.set(t, e)), e;
|
|
3037
3067
|
}
|
|
3038
|
-
function
|
|
3068
|
+
function Se({
|
|
3039
3069
|
label: t,
|
|
3040
3070
|
color: e,
|
|
3041
3071
|
value: n,
|
|
3042
3072
|
isHidden: o,
|
|
3043
3073
|
onClick: s
|
|
3044
3074
|
}) {
|
|
3045
|
-
return /* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
n && /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ dt("div", { onClick: s, style: o ? s ? Ws : Rs : s ? Hs : $s, children: [
|
|
3076
|
+
/* @__PURE__ */ V("span", { style: Gs(e) }),
|
|
3077
|
+
/* @__PURE__ */ V("span", { children: t }),
|
|
3078
|
+
n && /* @__PURE__ */ V("span", { style: zs, children: n })
|
|
3049
3079
|
] });
|
|
3050
3080
|
}
|
|
3051
|
-
const
|
|
3052
|
-
return /* @__PURE__ */
|
|
3081
|
+
const Kt = In(function({ left: e, top: n, children: o, className: s, style: r, onMouseDown: i, onMouseEnter: l, onMouseLeave: c }, f) {
|
|
3082
|
+
return /* @__PURE__ */ V(
|
|
3053
3083
|
"div",
|
|
3054
3084
|
{
|
|
3055
3085
|
ref: f,
|
|
@@ -3062,62 +3092,67 @@ const Nt = In(function({ left: e, top: n, children: o, className: s, style: r, o
|
|
|
3062
3092
|
}
|
|
3063
3093
|
);
|
|
3064
3094
|
});
|
|
3065
|
-
function
|
|
3095
|
+
function Bs(t, e, n, o, s) {
|
|
3066
3096
|
if (s < 0 || o < 0) return "";
|
|
3067
3097
|
const i = t.dataStore.getYValues(e, n)[s];
|
|
3068
3098
|
return i == null ? "" : typeof i == "number" ? i.toPrecision(4) : String(i);
|
|
3069
3099
|
}
|
|
3070
|
-
const
|
|
3100
|
+
const Vs = {}, Xs = { pointerEvents: "none", zIndex: 100 }, Ys = { fontWeight: 600, marginBottom: 2, padding: "0 4px" };
|
|
3071
3101
|
function wi({
|
|
3072
3102
|
show: t = !0,
|
|
3073
3103
|
className: e,
|
|
3074
3104
|
children: n,
|
|
3075
|
-
offset: o =
|
|
3105
|
+
offset: o = Vs,
|
|
3106
|
+
precision: s = 2
|
|
3076
3107
|
}) {
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3108
|
+
const r = st(), i = Gt(r.subscribeCursor, r.getSnapshot), l = Y(null), [c, f] = ut({ w: 0, h: 0 });
|
|
3109
|
+
if (j(() => {
|
|
3110
|
+
const I = l.current;
|
|
3111
|
+
if (!I) return;
|
|
3112
|
+
const C = I.offsetWidth, E = I.offsetHeight;
|
|
3113
|
+
(C !== c.w || E !== c.h) && f({ w: C, h: E });
|
|
3114
|
+
}), !t || i.activeDataIdx < 0 || i.activeGroup < 0 || i.left < 0) return null;
|
|
3115
|
+
const { activeGroup: a, activeDataIdx: d } = i, u = r.plotBox, h = r.dataStore.data[a], g = h != null ? h.x[d] ?? null : null, w = g != null ? parseFloat(g.toFixed(s)).toString() : "", S = [];
|
|
3116
|
+
for (const I of r.seriesConfigs) {
|
|
3117
|
+
if (I.show === !1 || I.legend === !1) continue;
|
|
3118
|
+
const C = r.dataStore.getYValues(I.group, I.index), E = I.group === a ? C[d] : null;
|
|
3119
|
+
S.push({
|
|
3120
|
+
label: I.label ?? `Series ${I.index}`,
|
|
3121
|
+
value: E,
|
|
3122
|
+
color: typeof I.stroke == "string" ? I.stroke : "#000",
|
|
3123
|
+
group: I.group,
|
|
3124
|
+
index: I.index
|
|
3090
3125
|
});
|
|
3091
3126
|
}
|
|
3092
|
-
const
|
|
3093
|
-
x:
|
|
3094
|
-
xLabel:
|
|
3095
|
-
items:
|
|
3096
|
-
left:
|
|
3097
|
-
top:
|
|
3098
|
-
},
|
|
3099
|
-
return n ? /* @__PURE__ */
|
|
3127
|
+
const b = {
|
|
3128
|
+
x: g,
|
|
3129
|
+
xLabel: w,
|
|
3130
|
+
items: S,
|
|
3131
|
+
left: i.left + u.left,
|
|
3132
|
+
top: i.top + u.top
|
|
3133
|
+
}, M = o.x ?? 12, p = o.y ?? -12, m = c.w, T = c.h, A = i.left + u.left, y = i.top + u.top, x = u.left + u.width, P = u.top + u.height, L = tt(A + M, u.left, x - m), F = tt(y + p, u.top, P - T);
|
|
3134
|
+
return n ? /* @__PURE__ */ V(
|
|
3100
3135
|
"div",
|
|
3101
3136
|
{
|
|
3102
|
-
ref:
|
|
3137
|
+
ref: l,
|
|
3103
3138
|
className: e,
|
|
3104
|
-
style: { position: "absolute", left:
|
|
3105
|
-
children: n(
|
|
3139
|
+
style: { position: "absolute", left: L, top: F, whiteSpace: "nowrap", pointerEvents: "none", zIndex: 100 },
|
|
3140
|
+
children: n(b)
|
|
3106
3141
|
}
|
|
3107
|
-
) : /* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
|
|
3110
|
-
|
|
3142
|
+
) : /* @__PURE__ */ dt(Kt, { ref: l, left: L, top: F, className: e, style: Xs, children: [
|
|
3143
|
+
/* @__PURE__ */ V("div", { style: Ys, children: w }),
|
|
3144
|
+
S.map((I) => /* @__PURE__ */ V(
|
|
3145
|
+
Se,
|
|
3111
3146
|
{
|
|
3112
|
-
label:
|
|
3113
|
-
color:
|
|
3114
|
-
value:
|
|
3147
|
+
label: I.label,
|
|
3148
|
+
color: I.color,
|
|
3149
|
+
value: I.value != null ? I.value.toPrecision(4) : "—"
|
|
3115
3150
|
},
|
|
3116
|
-
`${
|
|
3151
|
+
`${I.group}:${I.index}`
|
|
3117
3152
|
))
|
|
3118
3153
|
] });
|
|
3119
3154
|
}
|
|
3120
|
-
const Ns = 8,
|
|
3155
|
+
const Ns = 8, je = 0.01, Us = [0.25, 0.75];
|
|
3121
3156
|
function vi({
|
|
3122
3157
|
width: t,
|
|
3123
3158
|
height: e,
|
|
@@ -3128,76 +3163,77 @@ function vi({
|
|
|
3128
3163
|
colors: i,
|
|
3129
3164
|
grips: l = !1
|
|
3130
3165
|
}) {
|
|
3131
|
-
const c =
|
|
3166
|
+
const c = Y(null), f = Pn(() => pn(n), [n]), [a, d] = ut(() => {
|
|
3132
3167
|
if (s != null && f.length > 0) {
|
|
3133
|
-
const
|
|
3134
|
-
if (
|
|
3135
|
-
const y =
|
|
3136
|
-
if (
|
|
3168
|
+
const A = f[0];
|
|
3169
|
+
if (A != null && A.x.length > 1) {
|
|
3170
|
+
const y = A.x[0], P = A.x[A.x.length - 1] - y;
|
|
3171
|
+
if (P > 0)
|
|
3137
3172
|
return [
|
|
3138
|
-
Math.max(0, (s[0] - y) /
|
|
3139
|
-
Math.min(1, (s[1] - y) /
|
|
3173
|
+
Math.max(0, (s[0] - y) / P),
|
|
3174
|
+
Math.min(1, (s[1] - y) / P)
|
|
3140
3175
|
];
|
|
3141
3176
|
}
|
|
3142
3177
|
}
|
|
3143
3178
|
return Us;
|
|
3144
|
-
}), u =
|
|
3145
|
-
|
|
3179
|
+
}), u = Y(null);
|
|
3180
|
+
rt(() => {
|
|
3146
3181
|
if (o == null || f.length === 0) return;
|
|
3147
|
-
const
|
|
3148
|
-
if (
|
|
3149
|
-
const y =
|
|
3150
|
-
|
|
3182
|
+
const A = f[0];
|
|
3183
|
+
if (A == null || A.x.length < 2) return;
|
|
3184
|
+
const y = A.x[0], P = A.x[A.x.length - 1] - y, L = y + a[0] * P, F = y + a[1] * P, I = u.current, C = Math.max(1e-10, Math.abs(F - L) * 1e-12);
|
|
3185
|
+
I != null && Math.abs(I[0] - L) < C && Math.abs(I[1] - F) < C || (u.current = [L, F], o(L, F));
|
|
3151
3186
|
}, [a, f, o]);
|
|
3152
|
-
const h =
|
|
3187
|
+
const h = Y(null), g = Lt((A) => {
|
|
3153
3188
|
const y = c.current;
|
|
3154
3189
|
if (y == null) return 0;
|
|
3155
3190
|
const x = y.getBoundingClientRect();
|
|
3156
|
-
return tt((
|
|
3157
|
-
}, []), w =
|
|
3191
|
+
return tt((A - x.left) / x.width, 0, 1);
|
|
3192
|
+
}, []), w = Lt((A) => {
|
|
3158
3193
|
const y = c.current;
|
|
3159
3194
|
if (y == null) return;
|
|
3160
|
-
const x =
|
|
3161
|
-
let
|
|
3195
|
+
const x = g(A.clientX), P = y.getBoundingClientRect().width, L = P > 0 ? Ns / P : 0;
|
|
3196
|
+
let F;
|
|
3162
3197
|
if (Math.abs(x - a[0]) < L)
|
|
3163
|
-
|
|
3198
|
+
F = "left";
|
|
3164
3199
|
else if (Math.abs(x - a[1]) < L)
|
|
3165
|
-
|
|
3200
|
+
F = "right";
|
|
3166
3201
|
else if (x >= a[0] && x <= a[1])
|
|
3167
|
-
|
|
3202
|
+
F = "move";
|
|
3168
3203
|
else {
|
|
3169
|
-
const
|
|
3170
|
-
d(
|
|
3204
|
+
const I = a[1] - a[0], C = I / 2, E = tt(x - C, 0, 1 - I), H = [E, E + I];
|
|
3205
|
+
d(H), h.current = { mode: "move", startX: A.clientX, startFrac: H }, y.setPointerCapture(A.pointerId), A.preventDefault();
|
|
3206
|
+
return;
|
|
3171
3207
|
}
|
|
3172
3208
|
h.current = {
|
|
3173
|
-
mode:
|
|
3174
|
-
startX:
|
|
3209
|
+
mode: F,
|
|
3210
|
+
startX: A.clientX,
|
|
3175
3211
|
startFrac: [...a]
|
|
3176
|
-
}, y.setPointerCapture(
|
|
3177
|
-
}, [a,
|
|
3212
|
+
}, y.setPointerCapture(A.pointerId), A.preventDefault();
|
|
3213
|
+
}, [a, g]), S = Lt((A) => {
|
|
3178
3214
|
const y = h.current;
|
|
3179
3215
|
if (y == null) return;
|
|
3180
|
-
const x =
|
|
3216
|
+
const x = g(A.clientX), P = g(y.startX), L = x - P;
|
|
3181
3217
|
if (y.mode === "move") {
|
|
3182
|
-
const
|
|
3183
|
-
d([
|
|
3218
|
+
const F = y.startFrac[1] - y.startFrac[0], I = tt(y.startFrac[0] + L, 0, 1 - F);
|
|
3219
|
+
d([I, I + F]);
|
|
3184
3220
|
} else if (y.mode === "left") {
|
|
3185
|
-
const
|
|
3186
|
-
d([
|
|
3221
|
+
const F = tt(y.startFrac[0] + L, 0, y.startFrac[1] - je);
|
|
3222
|
+
d([F, y.startFrac[1]]);
|
|
3187
3223
|
} else {
|
|
3188
|
-
const
|
|
3189
|
-
d([y.startFrac[0],
|
|
3224
|
+
const F = tt(y.startFrac[1] + L, y.startFrac[0] + je, 1);
|
|
3225
|
+
d([y.startFrac[0], F]);
|
|
3190
3226
|
}
|
|
3191
|
-
}, [
|
|
3227
|
+
}, [g]), b = Lt((A) => {
|
|
3192
3228
|
h.current = null;
|
|
3193
3229
|
const y = c.current;
|
|
3194
|
-
y != null && y.releasePointerCapture(
|
|
3195
|
-
}, []),
|
|
3196
|
-
return /* @__PURE__ */
|
|
3197
|
-
/* @__PURE__ */
|
|
3198
|
-
/* @__PURE__ */
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
Array.from({ length:
|
|
3230
|
+
y != null && y.releasePointerCapture(A.pointerId);
|
|
3231
|
+
}, []), M = `${a[0] * 100}%`, p = `${(a[1] - a[0]) * 100}%`, m = f[0], T = m != null ? m.series.length : 0;
|
|
3232
|
+
return /* @__PURE__ */ dt("div", { className: r, style: { position: "relative", width: t, height: e }, children: [
|
|
3233
|
+
/* @__PURE__ */ dt(mn, { width: t, height: e, data: n, children: [
|
|
3234
|
+
/* @__PURE__ */ V(Ut, { scale: "x", show: !1 }),
|
|
3235
|
+
/* @__PURE__ */ V(Ut, { scale: "y", show: !1 }),
|
|
3236
|
+
Array.from({ length: T }, (A, y) => /* @__PURE__ */ V(
|
|
3201
3237
|
vn,
|
|
3202
3238
|
{
|
|
3203
3239
|
group: 0,
|
|
@@ -3209,13 +3245,13 @@ function vi({
|
|
|
3209
3245
|
`0:${y}`
|
|
3210
3246
|
))
|
|
3211
3247
|
] }),
|
|
3212
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ dt(
|
|
3213
3249
|
"div",
|
|
3214
3250
|
{
|
|
3215
3251
|
ref: c,
|
|
3216
3252
|
onPointerDown: w,
|
|
3217
|
-
onPointerMove:
|
|
3218
|
-
onPointerUp:
|
|
3253
|
+
onPointerMove: S,
|
|
3254
|
+
onPointerUp: b,
|
|
3219
3255
|
style: {
|
|
3220
3256
|
position: "absolute",
|
|
3221
3257
|
top: 0,
|
|
@@ -3226,21 +3262,21 @@ function vi({
|
|
|
3226
3262
|
touchAction: "none"
|
|
3227
3263
|
},
|
|
3228
3264
|
children: [
|
|
3229
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ V(
|
|
3230
3266
|
"div",
|
|
3231
3267
|
{
|
|
3232
3268
|
style: {
|
|
3233
3269
|
position: "absolute",
|
|
3234
3270
|
top: 0,
|
|
3235
3271
|
left: 0,
|
|
3236
|
-
width:
|
|
3272
|
+
width: M,
|
|
3237
3273
|
height: "100%",
|
|
3238
3274
|
background: "rgba(0,0,0,0.3)",
|
|
3239
3275
|
pointerEvents: "none"
|
|
3240
3276
|
}
|
|
3241
3277
|
}
|
|
3242
3278
|
),
|
|
3243
|
-
/* @__PURE__ */
|
|
3279
|
+
/* @__PURE__ */ V(
|
|
3244
3280
|
"div",
|
|
3245
3281
|
{
|
|
3246
3282
|
style: {
|
|
@@ -3254,14 +3290,14 @@ function vi({
|
|
|
3254
3290
|
}
|
|
3255
3291
|
}
|
|
3256
3292
|
),
|
|
3257
|
-
/* @__PURE__ */
|
|
3293
|
+
/* @__PURE__ */ V(
|
|
3258
3294
|
"div",
|
|
3259
3295
|
{
|
|
3260
3296
|
style: {
|
|
3261
3297
|
position: "absolute",
|
|
3262
3298
|
top: 0,
|
|
3263
|
-
left:
|
|
3264
|
-
width:
|
|
3299
|
+
left: M,
|
|
3300
|
+
width: p,
|
|
3265
3301
|
height: "100%",
|
|
3266
3302
|
borderLeft: "2px solid rgba(0,100,255,0.8)",
|
|
3267
3303
|
borderRight: "2px solid rgba(0,100,255,0.8)",
|
|
@@ -3269,8 +3305,8 @@ function vi({
|
|
|
3269
3305
|
cursor: "grab",
|
|
3270
3306
|
pointerEvents: "none"
|
|
3271
3307
|
},
|
|
3272
|
-
children: l && /* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3308
|
+
children: l && /* @__PURE__ */ dt(kn, { children: [
|
|
3309
|
+
/* @__PURE__ */ V("div", { style: {
|
|
3274
3310
|
position: "absolute",
|
|
3275
3311
|
left: -5,
|
|
3276
3312
|
top: "50%",
|
|
@@ -3282,7 +3318,7 @@ function vi({
|
|
|
3282
3318
|
cursor: "ew-resize",
|
|
3283
3319
|
pointerEvents: "auto"
|
|
3284
3320
|
} }),
|
|
3285
|
-
/* @__PURE__ */
|
|
3321
|
+
/* @__PURE__ */ V("div", { style: {
|
|
3286
3322
|
position: "absolute",
|
|
3287
3323
|
right: -5,
|
|
3288
3324
|
top: "50%",
|
|
@@ -3302,18 +3338,24 @@ function vi({
|
|
|
3302
3338
|
)
|
|
3303
3339
|
] });
|
|
3304
3340
|
}
|
|
3305
|
-
function
|
|
3306
|
-
const
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3341
|
+
function Tt(t, e) {
|
|
3342
|
+
const n = st(), o = Y(t);
|
|
3343
|
+
j(() => {
|
|
3344
|
+
o.current = t;
|
|
3345
|
+
});
|
|
3346
|
+
const s = (e == null ? void 0 : e.clipped) !== !1;
|
|
3347
|
+
j(() => {
|
|
3348
|
+
const r = (l) => o.current(l), i = s ? n.drawHooks : n.unclippedDrawHooks;
|
|
3349
|
+
return i.add(r), () => {
|
|
3350
|
+
i.delete(r);
|
|
3311
3351
|
};
|
|
3312
|
-
}, [
|
|
3352
|
+
}, [n, s]);
|
|
3313
3353
|
}
|
|
3314
3354
|
function Si(t) {
|
|
3315
|
-
const e = st(), n =
|
|
3316
|
-
|
|
3355
|
+
const e = st(), n = Y(t);
|
|
3356
|
+
j(() => {
|
|
3357
|
+
n.current = t;
|
|
3358
|
+
}), j(() => {
|
|
3317
3359
|
const o = (s, r) => n.current(s, r);
|
|
3318
3360
|
return e.cursorDrawHooks.add(o), () => {
|
|
3319
3361
|
e.cursorDrawHooks.delete(o);
|
|
@@ -3327,28 +3369,35 @@ function bi({
|
|
|
3327
3369
|
scaleId: o = "x"
|
|
3328
3370
|
}) {
|
|
3329
3371
|
const s = st();
|
|
3330
|
-
return
|
|
3372
|
+
return Tt(({ ctx: r, plotBox: i, pxRatio: l }) => {
|
|
3331
3373
|
const c = s.scaleManager.getScale(o);
|
|
3332
3374
|
if (c == null || !K(c)) return;
|
|
3333
|
-
r.save()
|
|
3375
|
+
r.save();
|
|
3376
|
+
const f = (e + n) * l, a = e * l, d = i.top * l;
|
|
3377
|
+
r.fillStyle = "#666", r.font = `${11 * l}px sans-serif`, r.textAlign = "right", r.textBaseline = "middle";
|
|
3378
|
+
for (let u = 0; u < t.length; u++) {
|
|
3379
|
+
const h = t[u];
|
|
3380
|
+
if (h == null) continue;
|
|
3381
|
+
const g = d + u * f;
|
|
3382
|
+
r.fillText(h.label, (i.left - 6) * l, g + a / 2);
|
|
3383
|
+
}
|
|
3384
|
+
r.beginPath(), r.rect(
|
|
3334
3385
|
i.left * l,
|
|
3335
3386
|
i.top * l,
|
|
3336
3387
|
i.width * l,
|
|
3337
3388
|
i.height * l
|
|
3338
3389
|
), r.clip();
|
|
3339
|
-
const f = (e + n) * l, a = e * l, d = i.top * l;
|
|
3340
3390
|
for (let u = 0; u < t.length; u++) {
|
|
3341
3391
|
const h = t[u];
|
|
3342
3392
|
if (h == null) continue;
|
|
3343
|
-
const
|
|
3344
|
-
r.fillStyle = "#666", r.font = `${11 * l}px sans-serif`, r.textAlign = "right", r.textBaseline = "middle", r.fillText(h.label, (i.left - 6) * l, p + a / 2);
|
|
3393
|
+
const g = d + u * f;
|
|
3345
3394
|
for (const w of h.segments) {
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3395
|
+
const S = B(w.start, c, i.width, i.left) * l, M = B(w.end, c, i.width, i.left) * l - S;
|
|
3396
|
+
M <= 0 || (r.fillStyle = w.color ?? "#4dabf7", r.fillRect(S, g, M, a), w.label != null && M > 20 * l && (r.fillStyle = "#fff", r.font = `${10 * l}px sans-serif`, r.textAlign = "center", r.textBaseline = "middle", r.fillText(w.label, S + M / 2, g + a / 2, M - 4 * l)));
|
|
3348
3397
|
}
|
|
3349
3398
|
}
|
|
3350
3399
|
r.restore();
|
|
3351
|
-
}), null;
|
|
3400
|
+
}, { clipped: !1 }), null;
|
|
3352
3401
|
}
|
|
3353
3402
|
function Mi({
|
|
3354
3403
|
data: t,
|
|
@@ -3361,10 +3410,10 @@ function Mi({
|
|
|
3361
3410
|
fillTo: l,
|
|
3362
3411
|
className: c
|
|
3363
3412
|
}) {
|
|
3364
|
-
return /* @__PURE__ */
|
|
3365
|
-
/* @__PURE__ */
|
|
3366
|
-
/* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ V("div", { style: { pointerEvents: "none" }, className: c, children: /* @__PURE__ */ dt(mn, { width: e, height: n, data: t, children: [
|
|
3414
|
+
/* @__PURE__ */ V(Ut, { scale: "x", show: !1 }),
|
|
3415
|
+
/* @__PURE__ */ V(Ut, { scale: "y", show: !1 }),
|
|
3416
|
+
/* @__PURE__ */ V(
|
|
3368
3417
|
vn,
|
|
3369
3418
|
{
|
|
3370
3419
|
group: 0,
|
|
@@ -3379,19 +3428,19 @@ function Mi({
|
|
|
3379
3428
|
)
|
|
3380
3429
|
] }) });
|
|
3381
3430
|
}
|
|
3382
|
-
const
|
|
3431
|
+
const wt = 8, Ks = { x: 12, y: -12 }, Os = { pointerEvents: "none" };
|
|
3383
3432
|
function js(t, e, n, o) {
|
|
3384
3433
|
if (t != null && typeof t == "object") return t;
|
|
3385
3434
|
switch (t) {
|
|
3386
3435
|
case "top-left":
|
|
3387
|
-
return { x: e.left +
|
|
3436
|
+
return { x: e.left + wt, y: e.top + wt };
|
|
3388
3437
|
case "bottom-left":
|
|
3389
|
-
return { x: e.left +
|
|
3438
|
+
return { x: e.left + wt, y: e.top + e.height - o - wt };
|
|
3390
3439
|
case "bottom-right":
|
|
3391
|
-
return { x: e.left + e.width - n -
|
|
3440
|
+
return { x: e.left + e.width - n - wt, y: e.top + e.height - o - wt };
|
|
3392
3441
|
case "top-right":
|
|
3393
3442
|
default:
|
|
3394
|
-
return { x: e.left + e.width - n -
|
|
3443
|
+
return { x: e.left + e.width - n - wt, y: e.top + wt };
|
|
3395
3444
|
}
|
|
3396
3445
|
}
|
|
3397
3446
|
function yi({
|
|
@@ -3402,66 +3451,71 @@ function yi({
|
|
|
3402
3451
|
show: s = !0,
|
|
3403
3452
|
className: r
|
|
3404
3453
|
}) {
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
const
|
|
3411
|
-
|
|
3412
|
-
},
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3454
|
+
const i = st(), l = Gt(i.subscribeCursor, i.getSnapshot), [c, f] = ut(null), [a, d] = ut(!1), [u, h] = ut(!1), g = Y(!1), w = Y(!1), S = Y({ dx: 0, dy: 0 }), [b, M] = ut(!1), p = Y(null), [m, T] = ut({ w: 0, h: 0 });
|
|
3455
|
+
j(() => {
|
|
3456
|
+
if (t !== "cursor") return;
|
|
3457
|
+
const C = p.current;
|
|
3458
|
+
if (!C) return;
|
|
3459
|
+
const E = C.offsetWidth, H = C.offsetHeight;
|
|
3460
|
+
(E !== m.w || H !== m.h) && T({ w: E, h: H });
|
|
3461
|
+
}), j(() => {
|
|
3462
|
+
if (t !== "draggable" || b || l.plotWidth <= 0) return;
|
|
3463
|
+
M(!0);
|
|
3464
|
+
const C = p.current, E = (C == null ? void 0 : C.offsetWidth) ?? 0, H = (C == null ? void 0 : C.offsetHeight) ?? 0;
|
|
3465
|
+
f(js(e, i.plotBox, E, H));
|
|
3466
|
+
}, [t, b, l.plotWidth, e, i.plotBox]);
|
|
3467
|
+
const A = (C, E) => {
|
|
3468
|
+
w.current || i.toggleSeries(C, E);
|
|
3469
|
+
}, y = (C) => {
|
|
3416
3470
|
if (t !== "draggable") return;
|
|
3417
|
-
|
|
3418
|
-
const
|
|
3419
|
-
|
|
3471
|
+
C.stopPropagation(), C.preventDefault(), g.current = !0, h(!0), w.current = !1;
|
|
3472
|
+
const E = C.currentTarget.getBoundingClientRect();
|
|
3473
|
+
S.current = { dx: C.clientX - E.left, dy: C.clientY - E.top };
|
|
3420
3474
|
};
|
|
3421
|
-
if (
|
|
3475
|
+
if (rt(() => {
|
|
3422
3476
|
if (!s || t !== "draggable") return;
|
|
3423
|
-
const
|
|
3477
|
+
const C = (H) => {
|
|
3424
3478
|
var _;
|
|
3425
|
-
if (!
|
|
3479
|
+
if (!g.current) return;
|
|
3426
3480
|
w.current = !0;
|
|
3427
|
-
const
|
|
3428
|
-
if (!
|
|
3429
|
-
const
|
|
3430
|
-
f({ x:
|
|
3431
|
-
},
|
|
3432
|
-
|
|
3481
|
+
const v = (_ = i.canvas) == null ? void 0 : _.parentElement;
|
|
3482
|
+
if (!v) return;
|
|
3483
|
+
const k = v.getBoundingClientRect();
|
|
3484
|
+
f({ x: H.clientX - k.left - S.current.dx, y: H.clientY - k.top - S.current.dy });
|
|
3485
|
+
}, E = () => {
|
|
3486
|
+
g.current = !1, h(!1);
|
|
3433
3487
|
};
|
|
3434
|
-
return window.addEventListener("mousemove",
|
|
3435
|
-
window.removeEventListener("mousemove",
|
|
3488
|
+
return window.addEventListener("mousemove", C), window.addEventListener("mouseup", E), () => {
|
|
3489
|
+
window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", E);
|
|
3436
3490
|
};
|
|
3437
3491
|
}, [i, s, t]), !s) return null;
|
|
3438
|
-
const { activeGroup:
|
|
3439
|
-
const
|
|
3440
|
-
return /* @__PURE__ */
|
|
3441
|
-
|
|
3492
|
+
const { activeGroup: x, activeDataIdx: P, left: L, top: F } = l, I = i.seriesConfigs.filter((C) => C.legend !== !1).map((C) => {
|
|
3493
|
+
const E = typeof C.stroke == "string" ? C.stroke : "#000", H = Bs(i, C.group, C.index, x, P), v = t === "draggable";
|
|
3494
|
+
return /* @__PURE__ */ V(
|
|
3495
|
+
Se,
|
|
3442
3496
|
{
|
|
3443
|
-
label:
|
|
3444
|
-
color:
|
|
3445
|
-
value:
|
|
3446
|
-
isHidden:
|
|
3447
|
-
onClick:
|
|
3497
|
+
label: C.label ?? `Series ${C.index}`,
|
|
3498
|
+
color: E,
|
|
3499
|
+
value: H,
|
|
3500
|
+
isHidden: C.show === !1,
|
|
3501
|
+
onClick: v ? () => A(C.group, C.index) : void 0
|
|
3448
3502
|
},
|
|
3449
|
-
`${
|
|
3503
|
+
`${C.group}:${C.index}`
|
|
3450
3504
|
);
|
|
3451
3505
|
});
|
|
3452
3506
|
if (t === "cursor") {
|
|
3453
|
-
if (
|
|
3454
|
-
const
|
|
3455
|
-
return /* @__PURE__ */
|
|
3507
|
+
if (L < 0) return null;
|
|
3508
|
+
const C = m.w, E = m.h, H = l.plotLeft + l.plotWidth, v = l.plotTop + l.plotHeight, k = tt(L + l.plotLeft + n.x, l.plotLeft, H - C), _ = tt(F + l.plotTop + n.y, l.plotTop, v - E);
|
|
3509
|
+
return /* @__PURE__ */ V(Kt, { ref: p, left: k, top: _, className: r, style: Os, children: I });
|
|
3456
3510
|
}
|
|
3457
|
-
return c == null ? null : /* @__PURE__ */
|
|
3458
|
-
|
|
3511
|
+
return c == null ? null : /* @__PURE__ */ V(
|
|
3512
|
+
Kt,
|
|
3459
3513
|
{
|
|
3460
|
-
ref:
|
|
3514
|
+
ref: p,
|
|
3461
3515
|
left: c.x,
|
|
3462
3516
|
top: c.y,
|
|
3463
3517
|
className: r,
|
|
3464
|
-
onMouseDown:
|
|
3518
|
+
onMouseDown: y,
|
|
3465
3519
|
onMouseEnter: () => d(!0),
|
|
3466
3520
|
onMouseLeave: () => {
|
|
3467
3521
|
d(!1), w.current = !1;
|
|
@@ -3472,7 +3526,7 @@ function yi({
|
|
|
3472
3526
|
opacity: a || u ? 1 : o,
|
|
3473
3527
|
transition: "opacity 0.2s ease"
|
|
3474
3528
|
},
|
|
3475
|
-
children:
|
|
3529
|
+
children: I
|
|
3476
3530
|
}
|
|
3477
3531
|
);
|
|
3478
3532
|
}
|
|
@@ -3482,20 +3536,24 @@ function xi({
|
|
|
3482
3536
|
show: e = !0,
|
|
3483
3537
|
className: n
|
|
3484
3538
|
}) {
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3539
|
+
const o = st(), s = Gt(o.subscribeCursor, o.getSnapshot), [r, i] = ut(!1), l = Y(-1), c = Y(0), f = Y(null), [a, d] = ut({ w: 0, h: 0 });
|
|
3540
|
+
if (j(() => {
|
|
3541
|
+
const m = f.current;
|
|
3542
|
+
if (!m) return;
|
|
3543
|
+
const T = m.offsetWidth, A = m.offsetHeight;
|
|
3544
|
+
(T !== a.w || A !== a.h) && d({ w: T, h: A });
|
|
3545
|
+
}), rt(() => {
|
|
3546
|
+
const m = s.activeSeriesIdx;
|
|
3547
|
+
m !== l.current && (l.current = m, i(!1), window.clearTimeout(c.current), m >= 0 && (c.current = window.setTimeout(() => i(!0), t)));
|
|
3548
|
+
}, [s.activeSeriesIdx, t]), rt(() => () => {
|
|
3491
3549
|
window.clearTimeout(c.current);
|
|
3492
3550
|
}, []), !e || !r || s.left < 0) return null;
|
|
3493
|
-
const
|
|
3494
|
-
(
|
|
3551
|
+
const u = o.seriesConfigs.find(
|
|
3552
|
+
(m) => m.group === s.activeGroup && m.index === s.activeSeriesIdx
|
|
3495
3553
|
);
|
|
3496
|
-
if (!(
|
|
3497
|
-
const
|
|
3498
|
-
return /* @__PURE__ */
|
|
3554
|
+
if (!(u != null && u.label) || u.legend === !1) return null;
|
|
3555
|
+
const h = typeof u.stroke == "string" ? u.stroke : "#000", g = a.w, w = a.h, S = s.left + s.plotLeft, b = s.top + s.plotTop, M = tt(S - g / 2, s.plotLeft, s.plotLeft + s.plotWidth - g), p = tt(b - w - 12, s.plotTop, s.plotTop + s.plotHeight - w);
|
|
3556
|
+
return /* @__PURE__ */ V(Kt, { ref: f, left: M, top: p, className: n, style: qs, children: /* @__PURE__ */ V(Se, { label: u.label, color: h }) });
|
|
3499
3557
|
}
|
|
3500
3558
|
function bn(t, e, n, o, s, r, i, l, c) {
|
|
3501
3559
|
const f = i / 2;
|
|
@@ -3515,13 +3573,13 @@ function Ci({
|
|
|
3515
3573
|
medianColor: r = "#e74c3c",
|
|
3516
3574
|
whiskerColor: i = "#555"
|
|
3517
3575
|
}) {
|
|
3518
|
-
return
|
|
3576
|
+
return Tt(({ ctx: l, plotBox: c, valToX: f, valToY: a }) => {
|
|
3519
3577
|
const d = c.width / t.length * n, u = d * 0.3;
|
|
3520
3578
|
for (let h = 0; h < t.length; h++) {
|
|
3521
|
-
const
|
|
3522
|
-
if (
|
|
3523
|
-
const w = f(h + 1),
|
|
3524
|
-
w == null ||
|
|
3579
|
+
const g = t[h];
|
|
3580
|
+
if (g == null) continue;
|
|
3581
|
+
const w = f(h + 1), S = a(g.min, e), b = a(g.q1, e), M = a(g.median, e), p = a(g.q3, e), m = a(g.max, e);
|
|
3582
|
+
w == null || S == null || b == null || M == null || p == null || m == null || bn(l, w, S, m, b, p, d, M, {
|
|
3525
3583
|
wickColor: i,
|
|
3526
3584
|
bodyFill: o,
|
|
3527
3585
|
bodyStroke: s,
|
|
@@ -3568,28 +3626,28 @@ function ki({
|
|
|
3568
3626
|
colorMap: o = Zs,
|
|
3569
3627
|
yScale: s = "y"
|
|
3570
3628
|
}) {
|
|
3571
|
-
return
|
|
3572
|
-
var
|
|
3629
|
+
return Tt(({ ctx: r, valToX: i, valToY: l }) => {
|
|
3630
|
+
var b;
|
|
3573
3631
|
if (t.length === 0) return;
|
|
3574
|
-
const c = t.length, f = ((
|
|
3632
|
+
const c = t.length, f = ((b = t[0]) == null ? void 0 : b.length) ?? 0;
|
|
3575
3633
|
if (f === 0) return;
|
|
3576
|
-
const a = (e == null ? void 0 : e[0]) ?? 0, d = (e == null ? void 0 : e[1]) ?? c, u = (n == null ? void 0 : n[0]) ?? 0, h = (n == null ? void 0 : n[1]) ?? f,
|
|
3577
|
-
let
|
|
3578
|
-
for (const
|
|
3579
|
-
for (const
|
|
3580
|
-
|
|
3581
|
-
if (
|
|
3582
|
-
for (let
|
|
3583
|
-
const
|
|
3584
|
-
if (
|
|
3585
|
-
const
|
|
3586
|
-
if (
|
|
3587
|
-
const
|
|
3634
|
+
const a = (e == null ? void 0 : e[0]) ?? 0, d = (e == null ? void 0 : e[1]) ?? c, u = (n == null ? void 0 : n[0]) ?? 0, h = (n == null ? void 0 : n[1]) ?? f, g = (d - a) / c, w = (h - u) / f;
|
|
3635
|
+
let S = 0;
|
|
3636
|
+
for (const M of t)
|
|
3637
|
+
for (const p of M)
|
|
3638
|
+
p > S && (S = p);
|
|
3639
|
+
if (S !== 0)
|
|
3640
|
+
for (let M = 0; M < c; M++) {
|
|
3641
|
+
const p = t[M];
|
|
3642
|
+
if (p == null) continue;
|
|
3643
|
+
const m = i(a + M * g), T = i(a + (M + 1) * g);
|
|
3644
|
+
if (m == null || T == null) continue;
|
|
3645
|
+
const A = T - m;
|
|
3588
3646
|
for (let y = 0; y < f; y++) {
|
|
3589
|
-
const x =
|
|
3590
|
-
if (
|
|
3591
|
-
const
|
|
3592
|
-
r.fillStyle = o(x /
|
|
3647
|
+
const x = p[y] ?? 0, P = u + y * w, L = u + (y + 1) * w, F = l(L, s), I = l(P, s);
|
|
3648
|
+
if (F == null || I == null) continue;
|
|
3649
|
+
const C = I - F;
|
|
3650
|
+
r.fillStyle = o(x / S), r.fillRect(m, F, A, C);
|
|
3593
3651
|
}
|
|
3594
3652
|
}
|
|
3595
3653
|
}), null;
|
|
@@ -3613,65 +3671,65 @@ function Ti({
|
|
|
3613
3671
|
maxSize: r = 10
|
|
3614
3672
|
}) {
|
|
3615
3673
|
const i = st();
|
|
3616
|
-
return
|
|
3617
|
-
var
|
|
3674
|
+
return Tt(({ ctx: l, valToX: c, valToY: f }) => {
|
|
3675
|
+
var b;
|
|
3618
3676
|
const a = i.dataStore.data[e];
|
|
3619
3677
|
if (a == null) return;
|
|
3620
3678
|
const d = a.x, u = a.series[n];
|
|
3621
3679
|
if (u == null) return;
|
|
3622
|
-
let h = 1 / 0,
|
|
3623
|
-
for (let
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3680
|
+
let h = 1 / 0, g = -1 / 0;
|
|
3681
|
+
for (let M = 0; M < u.length; M++) {
|
|
3682
|
+
const p = u[M];
|
|
3683
|
+
p != null && (p < h && (h = p), p > g && (g = p));
|
|
3626
3684
|
}
|
|
3627
|
-
const w =
|
|
3628
|
-
(
|
|
3629
|
-
)) == null ? void 0 :
|
|
3685
|
+
const w = g - h || 1, S = ((b = i.seriesConfigs.find(
|
|
3686
|
+
(M) => M.group === e && M.index === n
|
|
3687
|
+
)) == null ? void 0 : b.yScale) ?? "y";
|
|
3630
3688
|
l.strokeStyle = o, l.lineWidth = 1.5, l.lineCap = "round";
|
|
3631
|
-
for (let
|
|
3632
|
-
const
|
|
3633
|
-
if (
|
|
3634
|
-
const
|
|
3635
|
-
if (
|
|
3636
|
-
const y = (
|
|
3637
|
-
Js(l,
|
|
3689
|
+
for (let M = 0; M < d.length; M++) {
|
|
3690
|
+
const p = u[M], m = t[M];
|
|
3691
|
+
if (p == null || m == null) continue;
|
|
3692
|
+
const T = c(d[M]), A = f(p, S);
|
|
3693
|
+
if (T == null || A == null) continue;
|
|
3694
|
+
const y = (p - h) / w, x = s + y * (r - s);
|
|
3695
|
+
Js(l, T, A, m, x);
|
|
3638
3696
|
}
|
|
3639
3697
|
}), null;
|
|
3640
3698
|
}
|
|
3641
3699
|
const Qs = 4;
|
|
3642
|
-
function
|
|
3700
|
+
function be(t, e) {
|
|
3643
3701
|
t.strokeStyle = e.stroke ?? "red", t.lineWidth = e.width ?? 1, e.dash && t.setLineDash(e.dash);
|
|
3644
3702
|
}
|
|
3645
|
-
function
|
|
3703
|
+
function Me(t, e) {
|
|
3646
3704
|
e.dash && t.setLineDash([]);
|
|
3647
3705
|
}
|
|
3648
3706
|
function ti(t, e, n, o = {}) {
|
|
3649
|
-
const { ctx: s, plotBox: r } = t, i =
|
|
3650
|
-
s.beginPath(), s.moveTo(r.left, i), s.lineTo(r.left + r.width, i),
|
|
3707
|
+
const { ctx: s, plotBox: r } = t, i = B(n, e, r.height, r.top);
|
|
3708
|
+
s.beginPath(), s.moveTo(r.left, i), s.lineTo(r.left + r.width, i), be(s, o), s.stroke(), Me(s, o);
|
|
3651
3709
|
}
|
|
3652
3710
|
function ei(t, e, n, o = {}) {
|
|
3653
|
-
const { ctx: s, plotBox: r } = t, i =
|
|
3654
|
-
s.beginPath(), s.moveTo(i, r.top), s.lineTo(i, r.top + r.height),
|
|
3711
|
+
const { ctx: s, plotBox: r } = t, i = B(n, e, r.width, r.left);
|
|
3712
|
+
s.beginPath(), s.moveTo(i, r.top), s.lineTo(i, r.top + r.height), be(s, o), s.stroke(), Me(s, o);
|
|
3655
3713
|
}
|
|
3656
3714
|
function Ai(t, e, n, o, s, r, i = {}) {
|
|
3657
|
-
const { ctx: l, plotBox: c } = t, f =
|
|
3715
|
+
const { ctx: l, plotBox: c } = t, f = B(o, e, c.width, c.left), a = B(s, n, c.height, c.top);
|
|
3658
3716
|
l.font = i.font ?? "12px sans-serif", l.fillStyle = i.fill ?? "#000", l.textBaseline = "bottom", l.fillText(r, f, a - Qs);
|
|
3659
3717
|
}
|
|
3660
3718
|
function ni(t, e, n, o, s = {}) {
|
|
3661
|
-
const { ctx: r, plotBox: i } = t, l =
|
|
3662
|
-
r.fillStyle = s.fill ?? "rgba(255,0,0,0.1)", r.fillRect(i.left, Math.min(l, c), i.width, Math.abs(c - l)), s.stroke && (
|
|
3719
|
+
const { ctx: r, plotBox: i } = t, l = B(o, e, i.height, i.top), c = B(n, e, i.height, i.top);
|
|
3720
|
+
r.fillStyle = s.fill ?? "rgba(255,0,0,0.1)", r.fillRect(i.left, Math.min(l, c), i.width, Math.abs(c - l)), s.stroke && (be(r, s), r.strokeRect(i.left, Math.min(l, c), i.width, Math.abs(c - l)), Me(r, s));
|
|
3663
3721
|
}
|
|
3664
|
-
function
|
|
3665
|
-
const o =
|
|
3666
|
-
|
|
3722
|
+
function ye(t, e, n) {
|
|
3723
|
+
const o = Y(t);
|
|
3724
|
+
j(() => {
|
|
3667
3725
|
o.current = t;
|
|
3668
|
-
}, [t]),
|
|
3726
|
+
}, [t]), Tt((s) => {
|
|
3669
3727
|
const r = s.getScale(e);
|
|
3670
3728
|
r != null && n(s, r, o.current);
|
|
3671
3729
|
});
|
|
3672
3730
|
}
|
|
3673
3731
|
function Ii(t) {
|
|
3674
|
-
return
|
|
3732
|
+
return ye(t, t.yScale ?? "y", (e, n, o) => {
|
|
3675
3733
|
if (ti(e, n, o.value, {
|
|
3676
3734
|
stroke: o.stroke,
|
|
3677
3735
|
width: o.width,
|
|
@@ -3684,8 +3742,8 @@ function Ii(t) {
|
|
|
3684
3742
|
}
|
|
3685
3743
|
}), null;
|
|
3686
3744
|
}
|
|
3687
|
-
function
|
|
3688
|
-
return
|
|
3745
|
+
function Pi(t) {
|
|
3746
|
+
return ye(t, t.xScale ?? "x", (e, n, o) => {
|
|
3689
3747
|
if (ei(e, n, o.value, {
|
|
3690
3748
|
stroke: o.stroke,
|
|
3691
3749
|
width: o.width,
|
|
@@ -3698,8 +3756,8 @@ function Li(t) {
|
|
|
3698
3756
|
}
|
|
3699
3757
|
}), null;
|
|
3700
3758
|
}
|
|
3701
|
-
function
|
|
3702
|
-
return
|
|
3759
|
+
function Li(t) {
|
|
3760
|
+
return ye(t, t.yScale ?? "y", (e, n, o) => {
|
|
3703
3761
|
ni(e, n, o.yMin, o.yMax, {
|
|
3704
3762
|
fill: o.fill,
|
|
3705
3763
|
stroke: o.stroke,
|
|
@@ -3709,10 +3767,10 @@ function Pi(t) {
|
|
|
3709
3767
|
}), null;
|
|
3710
3768
|
}
|
|
3711
3769
|
function _i(t) {
|
|
3712
|
-
const e =
|
|
3713
|
-
return
|
|
3770
|
+
const e = Y(t);
|
|
3771
|
+
return j(() => {
|
|
3714
3772
|
e.current = t;
|
|
3715
|
-
}),
|
|
3773
|
+
}), Tt((n) => {
|
|
3716
3774
|
const o = e.current, s = n.valToX(o.x, o.xScale ?? "x"), r = n.valToY(o.y, o.yScale ?? "y");
|
|
3717
3775
|
if (s == null || r == null) return;
|
|
3718
3776
|
const { ctx: i } = n;
|
|
@@ -3720,79 +3778,79 @@ function _i(t) {
|
|
|
3720
3778
|
}), null;
|
|
3721
3779
|
}
|
|
3722
3780
|
function Di(t) {
|
|
3723
|
-
const e = (n, o, s, r, i, l, c, f, a, d, u, h,
|
|
3724
|
-
const w = (
|
|
3725
|
-
if ([a, d] =
|
|
3781
|
+
const e = (n, o, s, r, i, l, c, f, a, d, u, h, g) => {
|
|
3782
|
+
const w = (g == null ? void 0 : g.align) ?? t ?? 1, S = (g == null ? void 0 : g.spanGaps) ?? !1;
|
|
3783
|
+
if ([a, d] = Ot(o, a, d), a === -1)
|
|
3726
3784
|
return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
|
|
3727
|
-
const
|
|
3728
|
-
let
|
|
3785
|
+
const b = (L) => h(B(L, s, i, c)), M = (L) => h(B(L, r, l, f)), p = s.ori === W.Horizontal ? qt : Zt, m = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null }, T = m.stroke;
|
|
3786
|
+
let A = !1;
|
|
3729
3787
|
const y = u === O.Forward ? a : d;
|
|
3730
|
-
let x =
|
|
3731
|
-
|
|
3788
|
+
let x = M(o[y]), P = b(n[y]);
|
|
3789
|
+
p(T, P, x);
|
|
3732
3790
|
for (let L = y; L >= a && L <= d; L += u) {
|
|
3733
|
-
const
|
|
3734
|
-
if (
|
|
3735
|
-
|
|
3791
|
+
const F = o[L];
|
|
3792
|
+
if (F == null) {
|
|
3793
|
+
F === null && !S && (A = !0);
|
|
3736
3794
|
continue;
|
|
3737
3795
|
}
|
|
3738
|
-
const
|
|
3796
|
+
const I = b(n[L]), C = M(F);
|
|
3739
3797
|
if (w === 1)
|
|
3740
|
-
|
|
3798
|
+
p(T, I, x);
|
|
3741
3799
|
else if (w === -1)
|
|
3742
|
-
|
|
3800
|
+
p(T, P, C);
|
|
3743
3801
|
else {
|
|
3744
|
-
const
|
|
3745
|
-
|
|
3802
|
+
const E = h((P + I) / 2);
|
|
3803
|
+
p(T, E, x), p(T, E, C);
|
|
3746
3804
|
}
|
|
3747
|
-
|
|
3805
|
+
p(T, I, C), x = C, P = I;
|
|
3748
3806
|
}
|
|
3749
3807
|
{
|
|
3750
|
-
const L =
|
|
3751
|
-
let
|
|
3752
|
-
u === O.Backward && ([
|
|
3808
|
+
const L = m.fill = new Path2D(T), F = (g == null ? void 0 : g.fillTo) ?? r.min ?? 0, I = M(F);
|
|
3809
|
+
let C = b(n[a]), E = b(n[d]);
|
|
3810
|
+
u === O.Backward && ([E, C] = [C, E]), p(L, E, I), p(L, C, I);
|
|
3753
3811
|
}
|
|
3754
|
-
if (
|
|
3755
|
-
const L =
|
|
3756
|
-
|
|
3812
|
+
if (A) {
|
|
3813
|
+
const L = pe(n, o, a, d, u, b);
|
|
3814
|
+
m.gaps = L, m.clip = me(L, s.ori, c, f, i, l);
|
|
3757
3815
|
}
|
|
3758
|
-
return
|
|
3816
|
+
return m;
|
|
3759
3817
|
};
|
|
3760
|
-
return e.defaults =
|
|
3818
|
+
return e.defaults = jt, e;
|
|
3761
3819
|
}
|
|
3762
|
-
function
|
|
3820
|
+
function xe(t) {
|
|
3763
3821
|
return t.defaults = qn, t;
|
|
3764
3822
|
}
|
|
3765
3823
|
function Mn() {
|
|
3766
|
-
return
|
|
3767
|
-
const
|
|
3768
|
-
let
|
|
3824
|
+
return xe((e, n, o, s, r, i, l, c, f, a, d, u, h) => {
|
|
3825
|
+
const g = (h == null ? void 0 : h.barWidth) ?? 0.6, w = (h == null ? void 0 : h.barGap) ?? 0, S = (h == null ? void 0 : h.barRadius) ?? 0, b = (h == null ? void 0 : h.barGroupIdx) ?? 0, M = (h == null ? void 0 : h.barGroupCount) ?? 1, p = (E) => u(B(E, o, r, l)), m = (E) => u(B(E, s, i, c));
|
|
3826
|
+
let T = r;
|
|
3769
3827
|
if (a > f) {
|
|
3770
|
-
let
|
|
3771
|
-
for (let
|
|
3772
|
-
if (n[
|
|
3773
|
-
if (
|
|
3774
|
-
const
|
|
3775
|
-
|
|
3828
|
+
let E = 1 / 0, H = -1;
|
|
3829
|
+
for (let v = f; v <= a; v++)
|
|
3830
|
+
if (n[v] != null) {
|
|
3831
|
+
if (H >= 0) {
|
|
3832
|
+
const k = e[v], _ = e[H], D = Math.abs(p(k) - p(_));
|
|
3833
|
+
D < E && (E = D);
|
|
3776
3834
|
}
|
|
3777
|
-
|
|
3835
|
+
H = v;
|
|
3778
3836
|
}
|
|
3779
|
-
|
|
3837
|
+
E < 1 / 0 && (T = E);
|
|
3780
3838
|
}
|
|
3781
|
-
const
|
|
3782
|
-
for (let
|
|
3783
|
-
const
|
|
3784
|
-
if (
|
|
3785
|
-
const
|
|
3839
|
+
const A = T * (1 - g), y = Math.max(0, A + w), x = Math.max(1, u(T - y)), P = M > 1 ? Math.max(1, u(x / Math.max(1, M))) : x, L = (h == null ? void 0 : h.fillTo) ?? s.min ?? 0, F = m(L), I = new Path2D(), C = o.ori === W.Horizontal;
|
|
3840
|
+
for (let E = d === O.Forward ? f : a; E >= f && E <= a; E += d) {
|
|
3841
|
+
const H = n[E];
|
|
3842
|
+
if (H == null) continue;
|
|
3843
|
+
const v = p(e[E]), k = m(H), _ = M > 1 ? (b - (M - 1) / 2) * P : 0, D = u(v - P / 2 + _), $ = Math.min(k, F), G = Math.max(k, F) - $;
|
|
3786
3844
|
if (G !== 0)
|
|
3787
|
-
if (
|
|
3788
|
-
const
|
|
3789
|
-
oi(
|
|
3845
|
+
if (S > 0) {
|
|
3846
|
+
const U = Math.min(S * P, G / 2);
|
|
3847
|
+
oi(I, C, D, $, P, G, U, H < L);
|
|
3790
3848
|
} else
|
|
3791
|
-
|
|
3849
|
+
C ? I.rect(D, $, P, G) : I.rect($, D, G, P);
|
|
3792
3850
|
}
|
|
3793
3851
|
return {
|
|
3794
|
-
stroke:
|
|
3795
|
-
fill:
|
|
3852
|
+
stroke: I,
|
|
3853
|
+
fill: I,
|
|
3796
3854
|
// bars are filled with the same path
|
|
3797
3855
|
clip: null,
|
|
3798
3856
|
band: null,
|
|
@@ -3802,21 +3860,21 @@ function Mn() {
|
|
|
3802
3860
|
}
|
|
3803
3861
|
function Ei(t, e) {
|
|
3804
3862
|
const n = Mn();
|
|
3805
|
-
return
|
|
3806
|
-
const
|
|
3807
|
-
...
|
|
3863
|
+
return xe((s, r, i, l, c, f, a, d, u, h, g, w, S) => {
|
|
3864
|
+
const b = {
|
|
3865
|
+
...S,
|
|
3808
3866
|
barGroupIdx: t,
|
|
3809
3867
|
barGroupCount: e
|
|
3810
3868
|
};
|
|
3811
|
-
return n(s, r, i, l, c, f, a, d, u, h,
|
|
3869
|
+
return n(s, r, i, l, c, f, a, d, u, h, g, w, b);
|
|
3812
3870
|
});
|
|
3813
3871
|
}
|
|
3814
3872
|
function Fi() {
|
|
3815
3873
|
const t = Mn();
|
|
3816
|
-
return
|
|
3874
|
+
return xe((n, o, s, r, i, l, c, f, a, d, u, h, g) => {
|
|
3817
3875
|
const w = {
|
|
3818
3876
|
barWidth: 0.8,
|
|
3819
|
-
...
|
|
3877
|
+
...g
|
|
3820
3878
|
};
|
|
3821
3879
|
return t(n, o, s, r, i, l, c, f, a, d, u, h, w);
|
|
3822
3880
|
});
|
|
@@ -3825,17 +3883,17 @@ function oi(t, e, n, o, s, r, i, l) {
|
|
|
3825
3883
|
i = Math.min(i, s / 2, r / 2), e ? l ? (t.moveTo(n, o), t.lineTo(n + s, o), t.lineTo(n + s, o + r - i), t.arc(n + s - i, o + r - i, i, 0, Math.PI / 2), t.lineTo(n + i, o + r), t.arc(n + i, o + r - i, i, Math.PI / 2, Math.PI), t.closePath()) : (t.moveTo(n, o + r), t.lineTo(n, o + i), t.arc(n + i, o + i, i, Math.PI, Math.PI * 1.5), t.lineTo(n + s - i, o), t.arc(n + s - i, o + i, i, Math.PI * 1.5, 0), t.lineTo(n + s, o + r), t.closePath()) : l ? (t.moveTo(o, n), t.lineTo(o, n + s), t.lineTo(o + r - i, n + s), t.arc(o + r - i, n + s - i, i, Math.PI / 2, 0, !0), t.lineTo(o + r, n + i), t.arc(o + r - i, n + i, i, 0, -Math.PI / 2, !0), t.closePath()) : (t.moveTo(o + r, n), t.lineTo(o + i, n), t.arc(o + i, n + i, i, -Math.PI / 2, Math.PI, !0), t.lineTo(o, n + s - i), t.arc(o + i, n + s - i, i, Math.PI, Math.PI / 2, !0), t.lineTo(o + r, n + s), t.closePath());
|
|
3826
3884
|
}
|
|
3827
3885
|
function yn(t) {
|
|
3828
|
-
const e = (n, o, s, r, i, l, c, f, a, d, u, h,
|
|
3829
|
-
const w = (
|
|
3830
|
-
if ([a, d] =
|
|
3886
|
+
const e = (n, o, s, r, i, l, c, f, a, d, u, h, g) => {
|
|
3887
|
+
const w = (g == null ? void 0 : g.spanGaps) ?? !1;
|
|
3888
|
+
if ([a, d] = Ot(o, a, d), a === -1)
|
|
3831
3889
|
return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
|
|
3832
|
-
const
|
|
3833
|
-
let
|
|
3834
|
-
for (let
|
|
3835
|
-
const L = o[
|
|
3836
|
-
L != null ? (
|
|
3890
|
+
const S = (P) => h(B(P, s, i, c)), b = (P) => h(B(P, r, l, f)), M = s.ori === W.Horizontal ? qt : Zt, p = [], m = [];
|
|
3891
|
+
let T = !1;
|
|
3892
|
+
for (let P = u === O.Forward ? a : d; P >= a && P <= d; P += u) {
|
|
3893
|
+
const L = o[P];
|
|
3894
|
+
L != null ? (p.push(S(n[P])), m.push(b(L))) : L === null && !w && (T = !0);
|
|
3837
3895
|
}
|
|
3838
|
-
const
|
|
3896
|
+
const A = s.ori === W.Horizontal, y = t(p, m, A, h), x = {
|
|
3839
3897
|
stroke: y ?? new Path2D(),
|
|
3840
3898
|
fill: null,
|
|
3841
3899
|
clip: null,
|
|
@@ -3843,17 +3901,17 @@ function yn(t) {
|
|
|
3843
3901
|
gaps: null
|
|
3844
3902
|
};
|
|
3845
3903
|
if (y != null) {
|
|
3846
|
-
const
|
|
3847
|
-
let
|
|
3848
|
-
u === O.Backward && ([
|
|
3904
|
+
const P = x.fill = new Path2D(y), L = (g == null ? void 0 : g.fillTo) ?? r.min ?? 0, F = b(L);
|
|
3905
|
+
let I = S(n[a]), C = S(n[d]);
|
|
3906
|
+
u === O.Backward && ([C, I] = [I, C]), M(P, C, F), M(P, I, F);
|
|
3849
3907
|
}
|
|
3850
|
-
if (
|
|
3851
|
-
const
|
|
3852
|
-
x.gaps =
|
|
3908
|
+
if (T) {
|
|
3909
|
+
const P = pe(n, o, a, d, u, S);
|
|
3910
|
+
x.gaps = P, x.clip = me(P, s.ori, c, f, i, l);
|
|
3853
3911
|
}
|
|
3854
3912
|
return x;
|
|
3855
3913
|
};
|
|
3856
|
-
return e.defaults =
|
|
3914
|
+
return e.defaults = jt, e;
|
|
3857
3915
|
}
|
|
3858
3916
|
function zi() {
|
|
3859
3917
|
return yn(si);
|
|
@@ -3871,18 +3929,18 @@ const si = (t, e, n, o) => {
|
|
|
3871
3929
|
a[u] = (e[u + 1] ?? 0) - (e[u] ?? 0), d[u] = (t[u + 1] ?? 0) - (t[u] ?? 0), f[u] = d[u] !== 0 ? (a[u] ?? 0) / (d[u] ?? 1) : 0;
|
|
3872
3930
|
c[0] = f[0] ?? 0;
|
|
3873
3931
|
for (let u = 1; u < s - 1; u++) {
|
|
3874
|
-
const h = f[u] ?? 0,
|
|
3875
|
-
if (h === 0 ||
|
|
3932
|
+
const h = f[u] ?? 0, g = f[u - 1] ?? 0;
|
|
3933
|
+
if (h === 0 || g === 0 || g > 0 != h > 0)
|
|
3876
3934
|
c[u] = 0;
|
|
3877
3935
|
else {
|
|
3878
|
-
const w = d[u] ?? 1,
|
|
3879
|
-
c[u] = 3 * (
|
|
3936
|
+
const w = d[u] ?? 1, S = d[u - 1] ?? 1;
|
|
3937
|
+
c[u] = 3 * (S + w) / ((2 * w + S) / g + (w + 2 * S) / h), isFinite(c[u] ?? 0) || (c[u] = 0);
|
|
3880
3938
|
}
|
|
3881
3939
|
}
|
|
3882
3940
|
c[s - 1] = f[s - 2] ?? 0;
|
|
3883
3941
|
for (let u = 0; u < s - 1; u++) {
|
|
3884
|
-
const h = d[u] ?? 1,
|
|
3885
|
-
n ? r.bezierCurveTo(
|
|
3942
|
+
const h = d[u] ?? 1, g = t[u] ?? 0, w = e[u] ?? 0, S = t[u + 1] ?? 0, b = e[u + 1] ?? 0, M = c[u] ?? 0, p = c[u + 1] ?? 0, m = g + h / 3, T = w + M * h / 3, A = S - h / 3, y = b - p * h / 3;
|
|
3943
|
+
n ? r.bezierCurveTo(m, T, A, y, S, b) : r.bezierCurveTo(T, m, y, A, b, S);
|
|
3886
3944
|
}
|
|
3887
3945
|
return r;
|
|
3888
3946
|
};
|
|
@@ -3898,34 +3956,34 @@ const ii = (t, e, n, o) => {
|
|
|
3898
3956
|
return n ? r.lineTo(c, f) : r.lineTo(f, c), r;
|
|
3899
3957
|
}
|
|
3900
3958
|
for (let c = 0; c < s - 1; c++) {
|
|
3901
|
-
const f = c === 0 ? 0 : c - 1, a = t[f] ?? 0, d = e[f] ?? 0, u = t[c] ?? 0, h = e[c] ?? 0,
|
|
3902
|
-
let
|
|
3903
|
-
if (
|
|
3904
|
-
const
|
|
3905
|
-
|
|
3959
|
+
const f = c === 0 ? 0 : c - 1, a = t[f] ?? 0, d = e[f] ?? 0, u = t[c] ?? 0, h = e[c] ?? 0, g = t[c + 1] ?? 0, w = e[c + 1] ?? 0, S = c + 2 < s ? t[c + 2] ?? 0 : g, b = c + 2 < s ? e[c + 2] ?? 0 : w, M = Math.hypot(a - u, d - h), p = Math.hypot(u - g, h - w), m = Math.hypot(g - S, w - b), T = Math.sqrt(m), A = m, y = Math.sqrt(p), x = p, P = Math.sqrt(M), L = M, F = 2 * L + 3 * P * y + x, I = 2 * A + 3 * T * y + x, C = 3 * P * (P + y), E = 3 * T * (T + y);
|
|
3960
|
+
let H, v, k, _;
|
|
3961
|
+
if (C > 0) {
|
|
3962
|
+
const D = 1 / C;
|
|
3963
|
+
H = (-x * a + F * u + L * g) * D, v = (-x * d + F * h + L * w) * D;
|
|
3906
3964
|
} else
|
|
3907
|
-
|
|
3908
|
-
if (
|
|
3909
|
-
const
|
|
3910
|
-
|
|
3965
|
+
H = u, v = h;
|
|
3966
|
+
if (E > 0) {
|
|
3967
|
+
const D = 1 / E;
|
|
3968
|
+
k = (A * u + I * g - x * S) * D, _ = (A * h + I * w - x * b) * D;
|
|
3911
3969
|
} else
|
|
3912
|
-
|
|
3913
|
-
n ? r.bezierCurveTo(
|
|
3970
|
+
k = g, _ = w;
|
|
3971
|
+
n ? r.bezierCurveTo(H, v, k, _, g, w) : r.bezierCurveTo(v, H, _, k, w, g);
|
|
3914
3972
|
}
|
|
3915
3973
|
return r;
|
|
3916
3974
|
};
|
|
3917
3975
|
function $i(t = 4) {
|
|
3918
|
-
const e = (n, o, s, r, i, l, c, f, a, d, u, h,
|
|
3919
|
-
const w = (
|
|
3920
|
-
for (let
|
|
3921
|
-
const
|
|
3922
|
-
if (
|
|
3923
|
-
const
|
|
3924
|
-
|
|
3976
|
+
const e = (n, o, s, r, i, l, c, f, a, d, u, h, g) => {
|
|
3977
|
+
const w = (m) => h(B(m, s, i, c)), S = (m) => h(B(m, r, l, f)), b = t / 2, M = new Path2D(), p = s.ori === W.Horizontal;
|
|
3978
|
+
for (let m = u === O.Forward ? a : d; m >= a && m <= d; m += u) {
|
|
3979
|
+
const T = o[m];
|
|
3980
|
+
if (T == null) continue;
|
|
3981
|
+
const A = w(n[m]), y = S(T);
|
|
3982
|
+
p ? (M.moveTo(A + b, y), M.arc(A, y, b, 0, Math.PI * 2)) : (M.moveTo(y + b, A), M.arc(y, A, b, 0, Math.PI * 2));
|
|
3925
3983
|
}
|
|
3926
3984
|
return {
|
|
3927
|
-
stroke:
|
|
3928
|
-
fill:
|
|
3985
|
+
stroke: M,
|
|
3986
|
+
fill: M,
|
|
3929
3987
|
clip: null,
|
|
3930
3988
|
band: null,
|
|
3931
3989
|
gaps: null
|
|
@@ -3943,29 +4001,29 @@ function Wi({
|
|
|
3943
4001
|
wickWidth: i = 1
|
|
3944
4002
|
}) {
|
|
3945
4003
|
const l = st();
|
|
3946
|
-
return
|
|
4004
|
+
return Tt(({ ctx: c, plotBox: f, valToX: a, valToY: d }) => {
|
|
3947
4005
|
const u = l.dataStore.data[t];
|
|
3948
4006
|
if (u == null) return;
|
|
3949
|
-
const h = u.x,
|
|
3950
|
-
if (
|
|
3951
|
-
const
|
|
3952
|
-
if (
|
|
3953
|
-
const
|
|
3954
|
-
for (let
|
|
3955
|
-
const
|
|
3956
|
-
if (
|
|
3957
|
-
const L = a(
|
|
3958
|
-
if (L == null ||
|
|
3959
|
-
const
|
|
3960
|
-
bn(c, L,
|
|
3961
|
-
wickColor:
|
|
4007
|
+
const h = u.x, g = u.series[e[0]], w = u.series[e[1]], S = u.series[e[2]], b = u.series[e[3]];
|
|
4008
|
+
if (g == null || w == null || S == null || b == null) return;
|
|
4009
|
+
const M = h.length;
|
|
4010
|
+
if (M === 0) return;
|
|
4011
|
+
const p = Math.max(2, f.width / M * r);
|
|
4012
|
+
for (let m = 0; m < M; m++) {
|
|
4013
|
+
const T = h[m], A = g[m], y = w[m], x = S[m], P = b[m];
|
|
4014
|
+
if (T == null || A == null || y == null || x == null || P == null) continue;
|
|
4015
|
+
const L = a(T), F = d(y, n), I = d(x, n), C = d(A, n), E = d(P, n);
|
|
4016
|
+
if (L == null || F == null || I == null || C == null || E == null) continue;
|
|
4017
|
+
const v = P >= A ? o : s;
|
|
4018
|
+
bn(c, L, F, I, C, E, p, null, {
|
|
4019
|
+
wickColor: v,
|
|
3962
4020
|
wickWidth: i,
|
|
3963
|
-
bodyFill:
|
|
4021
|
+
bodyFill: v
|
|
3964
4022
|
});
|
|
3965
4023
|
}
|
|
3966
4024
|
}), null;
|
|
3967
4025
|
}
|
|
3968
|
-
function
|
|
4026
|
+
function Ri(t, e, n = 0) {
|
|
3969
4027
|
const o = e ?? t.series.map((a, d) => d), s = t.x.length, r = [], i = new Float64Array(s);
|
|
3970
4028
|
for (let a = 0; a < o.length; a++) {
|
|
3971
4029
|
const d = o[a];
|
|
@@ -3973,9 +4031,9 @@ function Gi(t, e, n = 0) {
|
|
|
3973
4031
|
const u = t.series[d];
|
|
3974
4032
|
if (u == null) continue;
|
|
3975
4033
|
const h = new Array(s);
|
|
3976
|
-
for (let
|
|
3977
|
-
const w = u[
|
|
3978
|
-
w != null ? (i[
|
|
4034
|
+
for (let g = 0; g < s; g++) {
|
|
4035
|
+
const w = u[g];
|
|
4036
|
+
w != null ? (i[g] = i[g] + w, h[g] = i[g]) : h[g] = null;
|
|
3979
4037
|
}
|
|
3980
4038
|
r.push(h);
|
|
3981
4039
|
}
|
|
@@ -4002,7 +4060,7 @@ function Gi(t, e, n = 0) {
|
|
|
4002
4060
|
bands: f
|
|
4003
4061
|
};
|
|
4004
4062
|
}
|
|
4005
|
-
function
|
|
4063
|
+
function Gi(t) {
|
|
4006
4064
|
const e = /* @__PURE__ */ new Set();
|
|
4007
4065
|
for (const [r] of t)
|
|
4008
4066
|
for (let i = 0; i < r.length; i++) {
|
|
@@ -4027,14 +4085,14 @@ function Ri(t) {
|
|
|
4027
4085
|
}
|
|
4028
4086
|
return [{ x: n, series: s }];
|
|
4029
4087
|
}
|
|
4030
|
-
function
|
|
4088
|
+
function Bi(t) {
|
|
4031
4089
|
const e = (t == null ? void 0 : t.decimals) ?? 1;
|
|
4032
4090
|
return (n) => n.map((o) => {
|
|
4033
4091
|
const s = Math.abs(o);
|
|
4034
4092
|
return s >= 1e9 ? (o / 1e9).toFixed(e) + "B" : s >= 1e6 ? (o / 1e6).toFixed(e) + "M" : s >= 1e3 ? (o / 1e3).toFixed(e) + "K" : o.toFixed(s >= 1 ? 0 : e);
|
|
4035
4093
|
});
|
|
4036
4094
|
}
|
|
4037
|
-
function
|
|
4095
|
+
function Vi(t, e = 0) {
|
|
4038
4096
|
return (n) => n.map((o) => o.toFixed(e) + t);
|
|
4039
4097
|
}
|
|
4040
4098
|
function Xi(t, e = 0) {
|
|
@@ -4045,15 +4103,15 @@ function Yi(t, e, n = 0) {
|
|
|
4045
4103
|
}
|
|
4046
4104
|
function Ni(t) {
|
|
4047
4105
|
const e = (t == null ? void 0 : t.utc) ?? !1;
|
|
4048
|
-
return (n) => n.map((o) => e ?
|
|
4106
|
+
return (n) => n.map((o) => e ? at(o, { hour: "2-digit", minute: "2-digit", hour12: !1 }, "UTC") : at(o, { hour: "2-digit", minute: "2-digit", hour12: !1 }));
|
|
4049
4107
|
}
|
|
4050
4108
|
function Ui(t) {
|
|
4051
4109
|
const e = t != null && t.utc ? "UTC" : void 0, n = (t == null ? void 0 : t.format) ?? "short";
|
|
4052
|
-
return (o) => o.map((s) =>
|
|
4110
|
+
return (o) => o.map((s) => at(s, { month: n }, e));
|
|
4053
4111
|
}
|
|
4054
4112
|
function Ki(t) {
|
|
4055
4113
|
const { tz: e, ...n } = t ?? {};
|
|
4056
|
-
return (o) => o.map((s) =>
|
|
4114
|
+
return (o) => o.map((s) => at(s, n, e));
|
|
4057
4115
|
}
|
|
4058
4116
|
function Oi(t, e = 0) {
|
|
4059
4117
|
return (n) => n.map((o) => {
|
|
@@ -4063,32 +4121,32 @@ function Oi(t, e = 0) {
|
|
|
4063
4121
|
}
|
|
4064
4122
|
export {
|
|
4065
4123
|
_i as AnnotationLabel,
|
|
4066
|
-
|
|
4124
|
+
Ut as Axis,
|
|
4067
4125
|
pi as Band,
|
|
4068
4126
|
Ci as BoxWhisker,
|
|
4069
4127
|
Wi as Candlestick,
|
|
4070
4128
|
mn as Chart,
|
|
4071
4129
|
ue as DEFAULT_ACTIONS,
|
|
4072
4130
|
O as Direction,
|
|
4073
|
-
|
|
4131
|
+
q as Distribution,
|
|
4074
4132
|
yi as FloatingLegend,
|
|
4075
4133
|
Ii as HLine,
|
|
4076
4134
|
ki as Heatmap,
|
|
4077
4135
|
xi as HoverLabel,
|
|
4078
4136
|
mi as Legend,
|
|
4079
4137
|
W as Orientation,
|
|
4080
|
-
|
|
4138
|
+
Li as Region,
|
|
4081
4139
|
hi as Scale,
|
|
4082
4140
|
vn as Series,
|
|
4083
|
-
|
|
4084
|
-
|
|
4141
|
+
N as Side,
|
|
4142
|
+
Ht as SortOrder,
|
|
4085
4143
|
Mi as Sparkline,
|
|
4086
4144
|
bi as Timeline,
|
|
4087
4145
|
wi as Tooltip,
|
|
4088
|
-
|
|
4146
|
+
Pi as VLine,
|
|
4089
4147
|
Ti as Vector,
|
|
4090
4148
|
vi as ZoomRanger,
|
|
4091
|
-
|
|
4149
|
+
Gi as alignData,
|
|
4092
4150
|
Mn as bars,
|
|
4093
4151
|
Hi as catmullRom,
|
|
4094
4152
|
ti as drawHLine,
|
|
@@ -4096,30 +4154,30 @@ export {
|
|
|
4096
4154
|
ni as drawRegion,
|
|
4097
4155
|
ei as drawVLine,
|
|
4098
4156
|
di as fadeGradient,
|
|
4099
|
-
|
|
4157
|
+
Bi as fmtCompact,
|
|
4100
4158
|
Ki as fmtDateStr,
|
|
4101
4159
|
Ni as fmtHourMin,
|
|
4102
4160
|
Oi as fmtLabels,
|
|
4103
4161
|
Ui as fmtMonthName,
|
|
4104
4162
|
Xi as fmtPrefix,
|
|
4105
|
-
|
|
4163
|
+
Vi as fmtSuffix,
|
|
4106
4164
|
Yi as fmtWrap,
|
|
4107
4165
|
ai as focus,
|
|
4108
4166
|
Ei as groupedBars,
|
|
4109
4167
|
to as linear,
|
|
4110
|
-
|
|
4168
|
+
an as lttb,
|
|
4111
4169
|
ui as lttbGroup,
|
|
4112
4170
|
zi as monotoneCubic,
|
|
4113
4171
|
gi as palette,
|
|
4114
4172
|
$i as points,
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4173
|
+
bt as posToVal,
|
|
4174
|
+
Et as sideOrientation,
|
|
4175
|
+
Ri as stackGroup,
|
|
4118
4176
|
Fi as stackedBars,
|
|
4119
4177
|
Di as stepped,
|
|
4120
4178
|
fi as useChart,
|
|
4121
4179
|
Si as useCursorDrawHook,
|
|
4122
|
-
|
|
4123
|
-
|
|
4180
|
+
Tt as useDrawHook,
|
|
4181
|
+
B as valToPos,
|
|
4124
4182
|
Cs as withAlpha
|
|
4125
4183
|
};
|