uplot-plus 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/axes/layout.d.ts +2 -2
- package/dist/axes/layout.d.ts.map +1 -1
- package/dist/components/Chart.d.ts +1 -1
- package/dist/components/Chart.d.ts.map +1 -1
- package/dist/hooks/useChartStore.d.ts +5 -2
- package/dist/hooks/useChartStore.d.ts.map +1 -1
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1202 -1170
- package/dist/rendering/drawAxes.d.ts +1 -1
- package/dist/rendering/drawAxes.d.ts.map +1 -1
- package/dist/types/chart.d.ts +21 -2
- package/dist/types/chart.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as X, jsxs as Q, Fragment as Pe } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as E, useContext as Le, createContext as
|
|
3
|
-
var U = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(U || {}),
|
|
4
|
-
function
|
|
2
|
+
import { useRef as E, useContext as Le, createContext as ze, useEffect as K, useState as St, useCallback as Z, useSyncExternalStore as fe, memo as De, useLayoutEffect as Dt } from "react";
|
|
3
|
+
var U = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(U || {}), V = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(V || {}), N = /* @__PURE__ */ ((t) => (t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward", t))(N || {}), 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 || {}), yt = /* @__PURE__ */ ((t) => (t[t.Ascending = 1] = "Ascending", t[t.Descending = -1] = "Descending", t[t.Unsorted = 0] = "Unsorted", t))(yt || {});
|
|
4
|
+
function xt(t) {
|
|
5
5
|
return t % 2;
|
|
6
6
|
}
|
|
7
7
|
var tt = /* @__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))(tt || {});
|
|
8
|
-
const J = Math, _t = J.PI,
|
|
8
|
+
const J = Math, _t = J.PI, pt = J.abs, ot = J.floor, _ = J.round, Tt = J.ceil, Zt = J.min, kt = J.max, wt = J.pow, Ot = J.sign, et = J.log10, Mt = J.log2, Fe = (t, e = 1) => J.sinh(t) * e, Et = (t, e = 1) => J.asinh(t / e), O = 1 / 0, he = Number.isInteger;
|
|
9
9
|
function Vt(t, e) {
|
|
10
10
|
return t[e] ?? 0;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function ut(t, e, n = 0, s = e.length - 1) {
|
|
13
13
|
let o;
|
|
14
14
|
const i = s <= 2147483647;
|
|
15
15
|
for (; s - n > 1; )
|
|
16
|
-
o = i ? n + s >> 1 :
|
|
16
|
+
o = i ? n + s >> 1 : ot((n + s) / 2), Vt(e, o) < t ? n = o : s = o;
|
|
17
17
|
return t - Vt(e, n) <= Vt(e, s) - t ? n : s;
|
|
18
18
|
}
|
|
19
19
|
const de = (t) => t != null, ge = (t) => t != null && t > 0;
|
|
@@ -36,34 +36,34 @@ function pe(t) {
|
|
|
36
36
|
const Ft = pe(de), me = pe(ge);
|
|
37
37
|
function Re(t, e, n, s = yt.Unsorted, o = !1) {
|
|
38
38
|
const i = o ? me : Ft, l = o ? ge : de, [r, a] = i(t, e, n);
|
|
39
|
-
let
|
|
39
|
+
let u = t[r] ?? O, c = t[r] ?? -O;
|
|
40
40
|
if (r > -1)
|
|
41
41
|
if (s === yt.Ascending)
|
|
42
|
-
|
|
42
|
+
u = t[r] ?? O, c = t[a] ?? -O;
|
|
43
43
|
else if (s === yt.Descending)
|
|
44
|
-
|
|
44
|
+
u = t[a] ?? O, c = t[r] ?? -O;
|
|
45
45
|
else
|
|
46
|
-
for (let
|
|
47
|
-
const f = t[
|
|
48
|
-
f != null && l(f) && (f <
|
|
46
|
+
for (let h = r; h <= a; h++) {
|
|
47
|
+
const f = t[h];
|
|
48
|
+
f != null && l(f) && (f < u ? u = f : f > c && (c = f));
|
|
49
49
|
}
|
|
50
|
-
return [
|
|
50
|
+
return [u, c];
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ft(t, e = 0) {
|
|
53
53
|
if (he(t))
|
|
54
54
|
return t;
|
|
55
55
|
const n = 10 ** e, s = t * n * (1 + Number.EPSILON);
|
|
56
|
-
return
|
|
56
|
+
return _(s) / n;
|
|
57
57
|
}
|
|
58
58
|
const vt = /* @__PURE__ */ new Map();
|
|
59
|
-
function
|
|
59
|
+
function Ge(t) {
|
|
60
60
|
return (String(t).split(".")[1] ?? "").length;
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const He = /\.\d*?(?=9{6,}|0{6,})/gm;
|
|
63
63
|
function It(t) {
|
|
64
64
|
if (he(t) || vt.has(t))
|
|
65
65
|
return t;
|
|
66
|
-
const e = `${t}`, n = e.match(
|
|
66
|
+
const e = `${t}`, n = e.match(He);
|
|
67
67
|
if (n == null)
|
|
68
68
|
return t;
|
|
69
69
|
const s = n[0].length - 1;
|
|
@@ -71,26 +71,26 @@ function It(t) {
|
|
|
71
71
|
const o = e.split("e"), i = o[0] ?? "0", l = o[1] ?? "0";
|
|
72
72
|
return +`${It(+i)}e${l}`;
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return ft(t, s);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Xt(t, e, n = !0) {
|
|
77
77
|
return n ? It(Tt(It(t / e)) * e) : Tt(t / e) * e;
|
|
78
78
|
}
|
|
79
79
|
function we(t, e, n = !0) {
|
|
80
|
-
return n ? It(
|
|
80
|
+
return n ? It(ot(It(t / e)) * e) : ot(t / e) * e;
|
|
81
81
|
}
|
|
82
82
|
function ve(t, e, n, s) {
|
|
83
|
-
const o = [], i = s.map(
|
|
83
|
+
const o = [], i = s.map(Ge);
|
|
84
84
|
for (let l = e; l < n; l++) {
|
|
85
|
-
const r =
|
|
85
|
+
const r = pt(l);
|
|
86
86
|
for (let a = 0; a < s.length; a++) {
|
|
87
|
-
const
|
|
88
|
-
o.push(
|
|
87
|
+
const u = s[a] ?? 0, c = i[a] ?? 0, h = +`${u}e${l}`, f = (l >= 0 ? 0 : r) + (l >= c ? 0 : c), d = h;
|
|
88
|
+
o.push(d), vt.set(d, f);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return o;
|
|
92
92
|
}
|
|
93
|
-
const _e = new Intl.NumberFormat(),
|
|
93
|
+
const _e = new Intl.NumberFormat(), xe = (t) => _e.format(t), Ve = 0.1, it = {
|
|
94
94
|
mode: 3,
|
|
95
95
|
pad: Ve,
|
|
96
96
|
soft: null
|
|
@@ -98,31 +98,31 @@ const _e = new Intl.NumberFormat(), Me = (t) => _e.format(t), Ve = 0.1, lt = {
|
|
|
98
98
|
function bt(t, e, n, s) {
|
|
99
99
|
let o;
|
|
100
100
|
typeof n == "number" ? (Ct.pad = n, Ct.soft = null, Ct.mode = 0, o = $e) : o = n;
|
|
101
|
-
const i = o.min, l = o.max, r = i.pad, a = l.pad,
|
|
102
|
-
let
|
|
103
|
-
const L = et(
|
|
104
|
-
(
|
|
105
|
-
const
|
|
106
|
-
return
|
|
101
|
+
const i = o.min, l = o.max, r = i.pad, a = l.pad, u = i.hard ?? -O, c = l.hard ?? O, h = i.soft ?? O, f = l.soft ?? -O, d = i.mode, x = l.mode;
|
|
102
|
+
let b = e - t;
|
|
103
|
+
const L = et(b), g = kt(pt(t), pt(e)), w = et(g), P = pt(w - L);
|
|
104
|
+
(b < 1e-24 || P > 10) && (b = 0, (t === 0 || e === 0) && (b = 1e-24));
|
|
105
|
+
const z = b || g || 1e3, T = et(z), S = wt(10, ot(T)), C = z * (b === 0 ? t === 0 ? 0.1 : 1 : r), v = ft(we(t - C, S / 10), 24), I = t >= h && (d === 1 || d === 3 && v <= h || d === 2 && v >= h) ? h : O, D = kt(u, v < I && t >= I ? I : Zt(I, v)), m = z * (b === 0 ? e === 0 ? 0.1 : 1 : a), p = ft(Xt(e + m, S / 10), 24), M = e <= f && (x === 1 || x === 3 && p >= f || x === 2 && p <= f) ? f : -O, k = Zt(c, p > M && e <= M ? M : kt(M, p));
|
|
106
|
+
return D === k && D === 0 ? [-1, 1] : [D, k];
|
|
107
107
|
}
|
|
108
108
|
function Be(t, e, n, s) {
|
|
109
109
|
n === 2 && (s = !0);
|
|
110
|
-
const o =
|
|
110
|
+
const o = Ot(t), i = Ot(e);
|
|
111
111
|
t === e && (o === -1 ? (t *= n, e /= n) : (t /= n, e *= n));
|
|
112
|
-
const l = n === 10 ? et :
|
|
113
|
-
let
|
|
114
|
-
return n === 10 && (
|
|
112
|
+
const l = n === 10 ? et : Mt, r = o === 1 ? ot : Tt, a = i === 1 ? Tt : ot, u = l(pt(t)), c = l(pt(e)), h = r(u), f = a(c);
|
|
113
|
+
let d = wt(n, h), x = wt(n, f);
|
|
114
|
+
return n === 10 && (h < 0 && (d = ft(d, -h)), f < 0 && (x = ft(x, -f))), s ? (t = d * o, e = x * i) : (t = we(t, wt(n, ot(u)), !1), e = Xt(e, wt(n, ot(c)), !1)), [t, e];
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Jt(t) {
|
|
117
117
|
return (et((t ^ t >> 31) - (t >> 31)) | 0) + 1;
|
|
118
118
|
}
|
|
119
119
|
function We(t, e, n, s, o) {
|
|
120
|
-
const i = kt(
|
|
121
|
-
let r = kt(0,
|
|
120
|
+
const i = kt(Jt(t), Jt(e)), l = e - t;
|
|
121
|
+
let r = kt(0, ut(o / s * l, n) - 1);
|
|
122
122
|
do {
|
|
123
|
-
const a = n[r] ?? 0,
|
|
124
|
-
if (
|
|
125
|
-
return [a,
|
|
123
|
+
const a = n[r] ?? 0, u = s * a / l;
|
|
124
|
+
if (u >= o * 0.9 && i + (a < 5 ? vt.get(a) ?? 0 : 0) <= 17)
|
|
125
|
+
return [a, u];
|
|
126
126
|
} while (++r < n.length);
|
|
127
127
|
return [0, 0];
|
|
128
128
|
}
|
|
@@ -131,11 +131,11 @@ function Ee(t) {
|
|
|
131
131
|
id: t.id,
|
|
132
132
|
min: t.min ?? null,
|
|
133
133
|
max: t.max ?? null,
|
|
134
|
-
distr: t.distr ??
|
|
134
|
+
distr: t.distr ?? q.Linear,
|
|
135
135
|
log: t.log ?? 10,
|
|
136
136
|
asinh: t.asinh ?? 1,
|
|
137
|
-
ori: t.ori ?? (t.id === "x" ?
|
|
138
|
-
dir: t.dir ??
|
|
137
|
+
ori: t.ori ?? (t.id === "x" ? V.Horizontal : V.Vertical),
|
|
138
|
+
dir: t.dir ?? N.Forward,
|
|
139
139
|
time: t.time ?? !1,
|
|
140
140
|
auto: t.auto ?? !0,
|
|
141
141
|
range: t.range ?? null,
|
|
@@ -143,58 +143,58 @@ function Ee(t) {
|
|
|
143
143
|
_max: null
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function ct(t) {
|
|
147
147
|
t._min = null, t._max = null;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Me(t) {
|
|
150
150
|
if (t._min != null) return t._min;
|
|
151
151
|
const { min: e, distr: n } = t;
|
|
152
152
|
if (e == null) return 0;
|
|
153
|
-
if (n ===
|
|
153
|
+
if (n === q.Log) {
|
|
154
154
|
const s = e > 0 ? e : 1e-10;
|
|
155
|
-
t._min = (t.log === 10 ? et :
|
|
156
|
-
} else n ===
|
|
155
|
+
t._min = (t.log === 10 ? et : Mt)(s);
|
|
156
|
+
} else n === q.Asinh ? t._min = Et(e, t.asinh) : t._min = e;
|
|
157
157
|
return t._min;
|
|
158
158
|
}
|
|
159
159
|
function be(t) {
|
|
160
160
|
if (t._max != null) return t._max;
|
|
161
161
|
const { max: e, distr: n } = t;
|
|
162
162
|
if (e == null) return 0;
|
|
163
|
-
if (n ===
|
|
163
|
+
if (n === q.Log) {
|
|
164
164
|
const s = e > 0 ? e : 1e-10;
|
|
165
|
-
t._max = (t.log === 10 ? et :
|
|
166
|
-
} else n ===
|
|
165
|
+
t._max = (t.log === 10 ? et : Mt)(s);
|
|
166
|
+
} else n === q.Asinh ? t._max = Et(e, t.asinh) : t._max = e;
|
|
167
167
|
return t._max;
|
|
168
168
|
}
|
|
169
169
|
function Xe(t, e) {
|
|
170
170
|
if (e.min == null || e.max == null) return 0;
|
|
171
|
-
const n =
|
|
171
|
+
const n = Me(e), o = be(e) - n;
|
|
172
172
|
if (o === 0) return 0;
|
|
173
173
|
const { distr: i } = e;
|
|
174
|
-
if (i ===
|
|
175
|
-
const l = e.log === 10 ? et :
|
|
174
|
+
if (i === q.Log) {
|
|
175
|
+
const l = e.log === 10 ? et : Mt, r = t > 0 ? t : 1e-10;
|
|
176
176
|
return (l(r) - n) / o;
|
|
177
177
|
}
|
|
178
|
-
return i ===
|
|
178
|
+
return i === q.Asinh ? (Et(t, e.asinh) - n) / o : (t - n) / o;
|
|
179
179
|
}
|
|
180
180
|
function Ye(t, e) {
|
|
181
181
|
if (e.min == null || e.max == null) return 0;
|
|
182
|
-
const n =
|
|
182
|
+
const n = Me(e), s = be(e);
|
|
183
183
|
if (s === n) return e.min;
|
|
184
184
|
const { distr: o } = e;
|
|
185
|
-
return o ===
|
|
185
|
+
return o === q.Log ? Math.pow(e.log, n + t * (s - n)) : o === q.Asinh ? Fe(n + t * (s - n), e.asinh) : n + t * (s - n);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function $(t, e, n, s) {
|
|
188
188
|
const o = Xe(t, e);
|
|
189
189
|
let i;
|
|
190
|
-
return e.ori ===
|
|
190
|
+
return e.ori === V.Horizontal ? i = e.dir === N.Forward ? o : 1 - o : i = e.dir === N.Forward ? 1 - o : o, s + i * n;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function rt(t, e, n, s) {
|
|
193
193
|
if (n === 0) return e.min ?? 0;
|
|
194
194
|
let o = (t - s) / n;
|
|
195
|
-
return e.ori ===
|
|
195
|
+
return e.ori === V.Horizontal ? e.dir === N.Backward && (o = 1 - o) : e.dir !== N.Backward && (o = 1 - o), Ye(o, e);
|
|
196
196
|
}
|
|
197
|
-
class
|
|
197
|
+
class Ke {
|
|
198
198
|
constructor() {
|
|
199
199
|
this.scales = /* @__PURE__ */ new Map(), this.groupXScales = /* @__PURE__ */ new Map();
|
|
200
200
|
}
|
|
@@ -224,7 +224,7 @@ class Ue {
|
|
|
224
224
|
*/
|
|
225
225
|
setRange(e, n, s) {
|
|
226
226
|
const o = this.scales.get(e);
|
|
227
|
-
o && (o.min = n, o.max = s,
|
|
227
|
+
o && (o.min = n, o.max = s, ct(o));
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Auto-range only x-scales from data (cheap: just reads first/last x values).
|
|
@@ -233,31 +233,31 @@ class Ue {
|
|
|
233
233
|
autoRangeX(e) {
|
|
234
234
|
var s, o, i, l, r, a;
|
|
235
235
|
const n = /* @__PURE__ */ new Map();
|
|
236
|
-
for (const [
|
|
237
|
-
const
|
|
238
|
-
if (!
|
|
239
|
-
const f = e[
|
|
236
|
+
for (const [u, c] of this.groupXScales) {
|
|
237
|
+
const h = this.scales.get(c);
|
|
238
|
+
if (!h || !h.auto) continue;
|
|
239
|
+
const f = e[u];
|
|
240
240
|
if (!f || f.x.length === 0) continue;
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
|
|
241
|
+
const d = f.x[0], x = f.x[f.x.length - 1];
|
|
242
|
+
if (d == null || x == null) continue;
|
|
243
|
+
const b = n.get(c);
|
|
244
|
+
b ? (b.dataMin = Math.min(b.dataMin, d), b.dataMax = Math.max(b.dataMax, x)) : n.set(c, { dataMin: d, dataMax: x });
|
|
245
245
|
}
|
|
246
|
-
for (const [
|
|
247
|
-
const f = this.scales.get(
|
|
246
|
+
for (const [u, { dataMin: c, dataMax: h }] of n) {
|
|
247
|
+
const f = this.scales.get(u);
|
|
248
248
|
if (f) {
|
|
249
249
|
if (f.range) {
|
|
250
|
-
const [
|
|
250
|
+
const [d, x] = bt(c, h, {
|
|
251
251
|
min: { pad: ((s = f.range.min) == null ? void 0 : s.pad) ?? 0, soft: ((o = f.range.min) == null ? void 0 : o.soft) ?? null, mode: ((i = f.range.min) == null ? void 0 : i.mode) ?? 0 },
|
|
252
252
|
max: { pad: ((l = f.range.max) == null ? void 0 : l.pad) ?? 0, soft: ((r = f.range.max) == null ? void 0 : r.soft) ?? null, mode: ((a = f.range.max) == null ? void 0 : a.mode) ?? 0 }
|
|
253
253
|
});
|
|
254
|
-
f.min =
|
|
254
|
+
f.min = d, f.max = x;
|
|
255
255
|
} else
|
|
256
|
-
|
|
256
|
+
c === h ? [f.min, f.max] = bt(c, h, {
|
|
257
257
|
min: { pad: 0.1, soft: null, mode: 0 },
|
|
258
258
|
max: { pad: 0.1, soft: null, mode: 0 }
|
|
259
|
-
}) : (f.min =
|
|
260
|
-
|
|
259
|
+
}) : (f.min = c, f.max = h);
|
|
260
|
+
ct(f);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -267,66 +267,66 @@ class Ue {
|
|
|
267
267
|
* For each y-scale: range from all series that reference it, within the visible x-window.
|
|
268
268
|
*/
|
|
269
269
|
autoRange(e, n, s) {
|
|
270
|
-
var r, a,
|
|
270
|
+
var r, a, u, c, h, f, d, x, b, L, g, w;
|
|
271
271
|
const o = /* @__PURE__ */ new Map();
|
|
272
|
-
for (const [P,
|
|
273
|
-
const T = this.scales.get(
|
|
272
|
+
for (const [P, z] of this.groupXScales) {
|
|
273
|
+
const T = this.scales.get(z);
|
|
274
274
|
if (!T || !T.auto) continue;
|
|
275
|
-
const
|
|
276
|
-
if (!
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
for (const [P, { dataMin:
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
if (
|
|
286
|
-
const [
|
|
287
|
-
min: { pad: ((r =
|
|
288
|
-
max: { pad: ((
|
|
275
|
+
const S = e[P];
|
|
276
|
+
if (!S || S.x.length === 0) continue;
|
|
277
|
+
const C = S.x[0], v = S.x[S.x.length - 1];
|
|
278
|
+
if (C == null || v == null) continue;
|
|
279
|
+
const I = o.get(z);
|
|
280
|
+
I ? (I.dataMin = Math.min(I.dataMin, C), I.dataMax = Math.max(I.dataMax, v)) : o.set(z, { dataMin: C, dataMax: v });
|
|
281
|
+
}
|
|
282
|
+
for (const [P, { dataMin: z, dataMax: T }] of o) {
|
|
283
|
+
const S = this.scales.get(P);
|
|
284
|
+
if (S) {
|
|
285
|
+
if (S.range) {
|
|
286
|
+
const [C, v] = bt(z, T, {
|
|
287
|
+
min: { pad: ((r = S.range.min) == null ? void 0 : r.pad) ?? 0, soft: ((a = S.range.min) == null ? void 0 : a.soft) ?? null, mode: ((u = S.range.min) == null ? void 0 : u.mode) ?? 0 },
|
|
288
|
+
max: { pad: ((c = S.range.max) == null ? void 0 : c.pad) ?? 0, soft: ((h = S.range.max) == null ? void 0 : h.soft) ?? null, mode: ((f = S.range.max) == null ? void 0 : f.mode) ?? 0 }
|
|
289
289
|
});
|
|
290
|
-
|
|
290
|
+
S.min = C, S.max = v;
|
|
291
291
|
} else
|
|
292
|
-
|
|
292
|
+
z === T ? [S.min, S.max] = bt(z, T, {
|
|
293
293
|
min: { pad: 0.1, soft: null, mode: 0 },
|
|
294
294
|
max: { pad: 0.1, soft: null, mode: 0 }
|
|
295
|
-
}) : (
|
|
296
|
-
|
|
295
|
+
}) : (S.min = z, S.max = T);
|
|
296
|
+
ct(S);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
const i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
300
|
-
for (const { group: P, index:
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
303
|
-
const
|
|
304
|
-
if (!
|
|
305
|
-
const
|
|
306
|
-
i.set(T,
|
|
307
|
-
}
|
|
308
|
-
for (const [P,
|
|
300
|
+
for (const { group: P, index: z, yScale: T } of n) {
|
|
301
|
+
const S = e[P];
|
|
302
|
+
if (!S) continue;
|
|
303
|
+
const C = S.series[z];
|
|
304
|
+
if (!C || C.length === 0) continue;
|
|
305
|
+
const v = s.windows.get(P), I = v ? v[0] : 0, D = v ? v[1] : C.length - 1, m = this.scales.get(T), p = (m == null ? void 0 : m.distr) === q.Log, [M, k] = s.getCachedMinMax(P, z, I, D, 0, p), y = i.get(T), A = l.get(T);
|
|
306
|
+
i.set(T, y != null ? Math.min(y, M) : M), l.set(T, A != null ? Math.max(A, k) : k);
|
|
307
|
+
}
|
|
308
|
+
for (const [P, z] of i) {
|
|
309
309
|
const T = this.scales.get(P);
|
|
310
310
|
if (!T || !T.auto) continue;
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
let
|
|
314
|
-
if (T.distr ===
|
|
315
|
-
[
|
|
311
|
+
const S = l.get(P) ?? -O;
|
|
312
|
+
if (z === O) continue;
|
|
313
|
+
let C, v;
|
|
314
|
+
if (T.distr === q.Log)
|
|
315
|
+
[C, v] = Be(z, S, T.log, !1);
|
|
316
316
|
else {
|
|
317
|
-
const
|
|
318
|
-
[
|
|
319
|
-
min: { pad: ((
|
|
320
|
-
max: { pad: ((L =
|
|
317
|
+
const I = T.range ?? { min: it, max: it };
|
|
318
|
+
[C, v] = bt(z, S, {
|
|
319
|
+
min: { pad: ((d = I.min) == null ? void 0 : d.pad) ?? it.pad, soft: ((x = I.min) == null ? void 0 : x.soft) ?? it.soft, mode: ((b = I.min) == null ? void 0 : b.mode) ?? it.mode },
|
|
320
|
+
max: { pad: ((L = I.max) == null ? void 0 : L.pad) ?? it.pad, soft: ((g = I.max) == null ? void 0 : g.soft) ?? it.soft, mode: ((w = I.max) == null ? void 0 : w.mode) ?? it.mode }
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
|
-
T.min =
|
|
323
|
+
T.min = C, T.max = v, ct(T);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
const
|
|
327
|
+
const Ue = 1024;
|
|
328
328
|
class Ne {
|
|
329
|
-
constructor(e, n =
|
|
329
|
+
constructor(e, n = Ue) {
|
|
330
330
|
this.data = e, this.len = e.length, this.blockSize = n, this.nBlocks = Math.ceil(e.length / n), this.blocks = new Float64Array(this.nBlocks * 2), this.buildAll();
|
|
331
331
|
}
|
|
332
332
|
/** Build min/max for all blocks */
|
|
@@ -334,12 +334,12 @@ class Ne {
|
|
|
334
334
|
const { data: e, blockSize: n, nBlocks: s, blocks: o, len: i } = this;
|
|
335
335
|
for (let l = 0; l < s; l++) {
|
|
336
336
|
const r = l * n, a = Math.min(r + n, i);
|
|
337
|
-
let
|
|
338
|
-
for (let
|
|
339
|
-
const f = e[
|
|
340
|
-
f != null && (f <
|
|
337
|
+
let u = 1 / 0, c = -1 / 0;
|
|
338
|
+
for (let h = r; h < a; h++) {
|
|
339
|
+
const f = e[h];
|
|
340
|
+
f != null && (f < u && (u = f), f > c && (c = f));
|
|
341
341
|
}
|
|
342
|
-
o[l * 2] =
|
|
342
|
+
o[l * 2] = u, o[l * 2 + 1] = c;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
@@ -349,27 +349,27 @@ class Ne {
|
|
|
349
349
|
rangeMinMax(e, n) {
|
|
350
350
|
const { data: s, blockSize: o, blocks: i } = this;
|
|
351
351
|
let l = 1 / 0, r = -1 / 0;
|
|
352
|
-
const a = Math.floor(e / o),
|
|
353
|
-
if (a ===
|
|
352
|
+
const a = Math.floor(e / o), u = Math.floor(n / o);
|
|
353
|
+
if (a === u) {
|
|
354
354
|
for (let f = e; f <= n; f++) {
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const d = s[f];
|
|
356
|
+
d != null && (d < l && (l = d), d > r && (r = d));
|
|
357
357
|
}
|
|
358
358
|
return [l, r];
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
for (let f = e; f <=
|
|
362
|
-
const
|
|
363
|
-
|
|
360
|
+
const c = (a + 1) * o - 1;
|
|
361
|
+
for (let f = e; f <= c; f++) {
|
|
362
|
+
const d = s[f];
|
|
363
|
+
d != null && (d < l && (l = d), d > r && (r = d));
|
|
364
364
|
}
|
|
365
|
-
for (let f = a + 1; f <
|
|
366
|
-
const
|
|
367
|
-
|
|
365
|
+
for (let f = a + 1; f < u; f++) {
|
|
366
|
+
const d = i[f * 2] ?? 1 / 0, x = i[f * 2 + 1] ?? -1 / 0;
|
|
367
|
+
d < l && (l = d), x > r && (r = x);
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
for (let f =
|
|
371
|
-
const
|
|
372
|
-
|
|
369
|
+
const h = u * o;
|
|
370
|
+
for (let f = h; f <= n; f++) {
|
|
371
|
+
const d = s[f];
|
|
372
|
+
d != null && (d < l && (l = d), d > r && (r = d));
|
|
373
373
|
}
|
|
374
374
|
return [l, r];
|
|
375
375
|
}
|
|
@@ -381,12 +381,12 @@ class Ne {
|
|
|
381
381
|
const { data: n, blockSize: s, blocks: o, len: i } = this;
|
|
382
382
|
if (e >= this.nBlocks) return;
|
|
383
383
|
const l = e * s, r = Math.min(l + s, i);
|
|
384
|
-
let a = 1 / 0,
|
|
385
|
-
for (let
|
|
386
|
-
const
|
|
387
|
-
|
|
384
|
+
let a = 1 / 0, u = -1 / 0;
|
|
385
|
+
for (let c = l; c < r; c++) {
|
|
386
|
+
const h = n[c];
|
|
387
|
+
h != null && (h < a && (a = h), h > u && (u = h));
|
|
388
388
|
}
|
|
389
|
-
o[e * 2] = a, o[e * 2 + 1] =
|
|
389
|
+
o[e * 2] = a, o[e * 2 + 1] = u;
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
392
392
|
* Grow the tree to accommodate new data length.
|
|
@@ -437,20 +437,20 @@ class je {
|
|
|
437
437
|
let n = !1;
|
|
438
438
|
for (let o = 0; o < this.data.length; o++) {
|
|
439
439
|
const i = this.data[o], l = e(o), r = this.windows.get(o);
|
|
440
|
-
let a,
|
|
440
|
+
let a, u;
|
|
441
441
|
if (!i || !l || l.min == null || l.max == null)
|
|
442
|
-
a = 0,
|
|
442
|
+
a = 0, u = Math.max(0, ((i == null ? void 0 : i.x.length) ?? 1) - 1);
|
|
443
443
|
else {
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
a = 0,
|
|
444
|
+
const c = i.x;
|
|
445
|
+
if (c.length === 0)
|
|
446
|
+
a = 0, u = 0;
|
|
447
447
|
else {
|
|
448
|
-
a =
|
|
449
|
-
const
|
|
450
|
-
a > 0 &&
|
|
448
|
+
a = ut(l.min, c), u = ut(l.max, c);
|
|
449
|
+
const h = c[a], f = c[u];
|
|
450
|
+
a > 0 && h != null && h > l.min && a--, u < c.length - 1 && f != null && f < l.max && u++;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
(!r || r[0] !== a || r[1] !==
|
|
453
|
+
(!r || r[0] !== a || r[1] !== u) && (n = !0, (s = this.minMaxCache.get(o)) == null || s.clear()), this.windows.set(o, [a, u]);
|
|
454
454
|
}
|
|
455
455
|
return n;
|
|
456
456
|
}
|
|
@@ -474,17 +474,17 @@ class je {
|
|
|
474
474
|
let r = this.minMaxCache.get(e);
|
|
475
475
|
const a = `${n}:${s}:${o}`;
|
|
476
476
|
if (r) {
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
477
|
+
const d = r.get(a);
|
|
478
|
+
if (d != null) return d;
|
|
479
479
|
} else
|
|
480
480
|
r = /* @__PURE__ */ new Map(), this.minMaxCache.set(e, r);
|
|
481
|
-
const
|
|
482
|
-
if (!
|
|
483
|
-
const
|
|
484
|
-
if (!
|
|
485
|
-
let
|
|
481
|
+
const u = this.data[e];
|
|
482
|
+
if (!u) return [1 / 0, -1 / 0];
|
|
483
|
+
const c = u.series[n];
|
|
484
|
+
if (!c || c.length === 0) return [1 / 0, -1 / 0];
|
|
485
|
+
let h;
|
|
486
486
|
const f = !l && i === yt.Unsorted ? this.getOrBuildTree(e, n) : void 0;
|
|
487
|
-
return f ?
|
|
487
|
+
return f ? h = f.rangeMinMax(s, o) : h = Re(c, s, o, i, l), r.set(a, h), h;
|
|
488
488
|
}
|
|
489
489
|
/** Get block tree for a series (exposed for incremental append) */
|
|
490
490
|
getBlockTree(e, n) {
|
|
@@ -510,12 +510,12 @@ class je {
|
|
|
510
510
|
for (let r = 0; r < o.series.length; r++) {
|
|
511
511
|
const a = o.series[r];
|
|
512
512
|
if (!a || !Array.isArray(a)) continue;
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
for (let
|
|
516
|
-
a.push(
|
|
517
|
-
const
|
|
518
|
-
|
|
513
|
+
const u = s[r];
|
|
514
|
+
if (u)
|
|
515
|
+
for (let h = 0; h < u.length; h++)
|
|
516
|
+
a.push(u[h] ?? null);
|
|
517
|
+
const c = this.blockTrees.get(`${e}:${r}`);
|
|
518
|
+
c && (c.setData(a), c.grow(a.length));
|
|
519
519
|
}
|
|
520
520
|
(l = this.minMaxCache.get(e)) == null || l.clear();
|
|
521
521
|
}
|
|
@@ -556,44 +556,44 @@ class qe {
|
|
|
556
556
|
*/
|
|
557
557
|
update(e, n, s, o, i, l, r, a) {
|
|
558
558
|
this.state.left = e, this.state.top = n;
|
|
559
|
-
let
|
|
560
|
-
const
|
|
561
|
-
for (const
|
|
562
|
-
if (
|
|
563
|
-
let
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
for (let
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
569
|
-
const L =
|
|
559
|
+
let u = 1 / 0, c = -1, h = -1, f = -1;
|
|
560
|
+
const d = /* @__PURE__ */ new Map();
|
|
561
|
+
for (const x of i) {
|
|
562
|
+
if (x.show === !1) continue;
|
|
563
|
+
let b = d.get(x.group);
|
|
564
|
+
b == null && (b = [], d.set(x.group, b)), b.push(x);
|
|
565
|
+
}
|
|
566
|
+
for (let x = 0; x < o.length; x++) {
|
|
567
|
+
const b = o[x];
|
|
568
|
+
if (b == null) continue;
|
|
569
|
+
const L = b.x;
|
|
570
570
|
if (L.length === 0) continue;
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
573
|
-
const
|
|
574
|
-
if (
|
|
575
|
-
const [P,
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
for (const
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
581
|
-
const
|
|
582
|
-
for (const
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
585
|
-
const A =
|
|
571
|
+
const g = a(x);
|
|
572
|
+
if (g == null) continue;
|
|
573
|
+
const w = l(g);
|
|
574
|
+
if (w == null || w.min == null || w.max == null) continue;
|
|
575
|
+
const [P, z] = r(x), T = s.width, S = s.left, C = rt(e + S, w, T, S), v = ut(C, L, P, z), I = [v];
|
|
576
|
+
v > P && I.push(v - 1), v < z && I.push(v + 1);
|
|
577
|
+
const D = /* @__PURE__ */ new Map();
|
|
578
|
+
for (const m of I) {
|
|
579
|
+
const p = L[m];
|
|
580
|
+
if (p == null) continue;
|
|
581
|
+
const M = $(p, w, T, S);
|
|
582
|
+
for (const k of d.get(x) ?? []) {
|
|
583
|
+
const y = b.series[k.index];
|
|
584
|
+
if (y == null) continue;
|
|
585
|
+
const A = y[m];
|
|
586
586
|
if (A == null) continue;
|
|
587
|
-
let F =
|
|
588
|
-
if (F == null && !
|
|
589
|
-
const R = s.height,
|
|
590
|
-
if (
|
|
587
|
+
let F = D.get(k.yScale);
|
|
588
|
+
if (F == null && !D.has(k.yScale) && (F = l(k.yScale), D.set(k.yScale, F)), F == null || F.min == null || F.max == null) continue;
|
|
589
|
+
const R = s.height, G = s.top, H = $(A, F, R, G), B = e + S - M, W = n + G - H, Y = B * B + W * W;
|
|
590
|
+
if (Y < u && (u = Y, c = x, h = k.index, f = m, Y === 0))
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
593
|
-
if (
|
|
593
|
+
if (u === 0) break;
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
-
this.state.activeGroup =
|
|
596
|
+
this.state.activeGroup = c, this.state.activeSeriesIdx = h, this.state.activeDataIdx = f;
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* Sync cursor to a specific x-value (from another chart in a sync group).
|
|
@@ -608,24 +608,24 @@ class qe {
|
|
|
608
608
|
if (i == null) return;
|
|
609
609
|
const l = n.scaleManager.getScale(i);
|
|
610
610
|
if (l == null || l.min == null || l.max == null) return;
|
|
611
|
-
const [r, a] = n.dataStore.getWindow(0),
|
|
612
|
-
if (
|
|
613
|
-
const
|
|
614
|
-
this.state.left =
|
|
615
|
-
let f = 0,
|
|
616
|
-
for (const
|
|
617
|
-
if (
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
620
|
-
const L =
|
|
611
|
+
const [r, a] = n.dataStore.getWindow(0), u = ut(e, o.x, r, a), c = o.x[u];
|
|
612
|
+
if (c == null) return;
|
|
613
|
+
const h = $(c, l, n.plotBox.width, n.plotBox.left);
|
|
614
|
+
this.state.left = h - n.plotBox.left, this.state.activeGroup = 0, this.state.activeDataIdx = u;
|
|
615
|
+
let f = 0, d = n.plotBox.height / 2;
|
|
616
|
+
for (const x of n.seriesConfigs) {
|
|
617
|
+
if (x.group !== 0 || x.show === !1) continue;
|
|
618
|
+
const b = o.series[x.index];
|
|
619
|
+
if (b == null) continue;
|
|
620
|
+
const L = b[u];
|
|
621
621
|
if (L == null) continue;
|
|
622
|
-
const
|
|
623
|
-
if (!(
|
|
624
|
-
|
|
622
|
+
const g = n.scaleManager.getScale(x.yScale);
|
|
623
|
+
if (!(g == null || g.min == null || g.max == null)) {
|
|
624
|
+
d = $(L, g, n.plotBox.height, n.plotBox.top) - n.plotBox.top, f = x.index;
|
|
625
625
|
break;
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
this.state.top =
|
|
628
|
+
this.state.top = d, this.state.activeSeriesIdx = f;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
631
|
class Ze {
|
|
@@ -672,41 +672,41 @@ class Ze {
|
|
|
672
672
|
function Rt(t, e, n) {
|
|
673
673
|
t.lineTo(e, n);
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function Gt(t, e, n) {
|
|
676
676
|
t.lineTo(n, e);
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Yt(t, e, n, s, o, i) {
|
|
679
679
|
const l = [];
|
|
680
680
|
let r = -1;
|
|
681
|
-
const a = o ===
|
|
682
|
-
for (let
|
|
683
|
-
if (e[
|
|
681
|
+
const a = o === N.Forward ? n : s, u = o === N.Forward ? s : n, c = o;
|
|
682
|
+
for (let h = a; o === N.Forward ? h <= u : h >= u; h += c)
|
|
683
|
+
if (e[h] === null || e[h] === void 0) {
|
|
684
684
|
if (r === -1) {
|
|
685
|
-
const f = Math.max(n, Math.min(
|
|
685
|
+
const f = Math.max(n, Math.min(h - o, s));
|
|
686
686
|
r = i(t[f]);
|
|
687
687
|
}
|
|
688
688
|
} else
|
|
689
|
-
r !== -1 && (l.push([r, i(t[
|
|
689
|
+
r !== -1 && (l.push([r, i(t[h])]), r = -1);
|
|
690
690
|
return r !== -1 && l.push([r, i(t[s])]), l;
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function Kt(t, e, n, s, o, i) {
|
|
693
693
|
const l = new Path2D();
|
|
694
|
-
let r = e ===
|
|
695
|
-
const a = e ===
|
|
696
|
-
for (const [
|
|
697
|
-
|
|
698
|
-
return r < a && (e ===
|
|
694
|
+
let r = e === V.Horizontal ? n : s;
|
|
695
|
+
const a = e === V.Horizontal ? n + o : s + i, u = e === V.Horizontal ? s : n, c = e === V.Horizontal ? i : o;
|
|
696
|
+
for (const [h, f] of t)
|
|
697
|
+
h > r && (e === V.Horizontal ? l.rect(r, u, h - r, c) : l.rect(u, r, c, h - r)), r = f;
|
|
698
|
+
return r < a && (e === V.Horizontal ? l.rect(r, u, a - r, c) : l.rect(u, r, c, a - r)), l;
|
|
699
699
|
}
|
|
700
700
|
function Se(t) {
|
|
701
701
|
return (e, n, s, o, i, l) => {
|
|
702
702
|
s !== o && (i !== s && l !== s && t(e, n, s), i !== o && l !== o && t(e, n, o), t(e, n, l));
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
|
-
const Oe = Se(Rt), Je = Se(
|
|
705
|
+
const Oe = Se(Rt), Je = Se(Gt);
|
|
706
706
|
function Qe() {
|
|
707
|
-
return (t, e, n, s, o, i, l, r, a,
|
|
708
|
-
const
|
|
709
|
-
if ([a,
|
|
707
|
+
return (t, e, n, s, o, i, l, r, a, u, c, h, f) => {
|
|
708
|
+
const d = (f == null ? void 0 : f.spanGaps) ?? !1;
|
|
709
|
+
if ([a, u] = (s.distr === q.Log ? me : Ft)(e, a, u), a === -1)
|
|
710
710
|
return {
|
|
711
711
|
stroke: new Path2D(),
|
|
712
712
|
fill: null,
|
|
@@ -714,71 +714,71 @@ function Qe() {
|
|
|
714
714
|
band: null,
|
|
715
715
|
gaps: null
|
|
716
716
|
};
|
|
717
|
-
const
|
|
718
|
-
let
|
|
719
|
-
n.ori ===
|
|
717
|
+
const b = (C) => h($(C, n, o, l)), L = (C) => h($(C, s, i, r));
|
|
718
|
+
let g, w;
|
|
719
|
+
n.ori === V.Horizontal ? (g = Rt, w = Oe) : (g = Gt, w = Je);
|
|
720
720
|
const P = {
|
|
721
721
|
stroke: new Path2D(),
|
|
722
722
|
fill: null,
|
|
723
723
|
clip: null,
|
|
724
724
|
band: null,
|
|
725
725
|
gaps: null
|
|
726
|
-
},
|
|
726
|
+
}, z = P.stroke;
|
|
727
727
|
let T = !1;
|
|
728
|
-
if (
|
|
729
|
-
const
|
|
730
|
-
let
|
|
731
|
-
const
|
|
732
|
-
let
|
|
733
|
-
for (let A =
|
|
734
|
-
const F = t[A],
|
|
735
|
-
|
|
728
|
+
if (u - a >= o * 4) {
|
|
729
|
+
const C = (A) => rt(A, n, o, l);
|
|
730
|
+
let v = null, I = 0, D = 0, m = 0, p = b(t[c === N.Forward ? a : u]);
|
|
731
|
+
const M = b(t[a]), k = b(t[u]);
|
|
732
|
+
let y = C(c === N.Forward ? M + 1 : k - 1);
|
|
733
|
+
for (let A = c === N.Forward ? a : u; A >= a && A <= u; A += c) {
|
|
734
|
+
const F = t[A], G = (c === N.Forward ? F < y : F > y) ? p : b(F), H = e[A];
|
|
735
|
+
G === p ? H != null ? (m = H, v == null ? (g(z, G, L(m)), D = v = I = m) : m < v ? v = m : m > I && (I = m)) : H === null && !d && (T = !0) : (v != null && w(z, p, L(v), L(I), L(D), L(m)), H != null ? (m = H, g(z, G, L(m)), v = I = D = m) : (v = null, I = 0, H === null && !d && (T = !0)), p = G, y = C(p + c));
|
|
736
736
|
}
|
|
737
|
-
|
|
737
|
+
v != null && (v !== I ? w(z, p, L(v), L(I), L(D), L(m)) : g(z, p, L(m)));
|
|
738
738
|
} else
|
|
739
|
-
for (let
|
|
740
|
-
const
|
|
741
|
-
|
|
739
|
+
for (let C = c === N.Forward ? a : u; C >= a && C <= u; C += c) {
|
|
740
|
+
const v = e[C];
|
|
741
|
+
v === null && !d ? T = !0 : v != null && g(z, b(t[C]), L(v));
|
|
742
742
|
}
|
|
743
743
|
{
|
|
744
|
-
const
|
|
745
|
-
let
|
|
746
|
-
|
|
744
|
+
const C = P.fill = new Path2D(z), v = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, I = L(v);
|
|
745
|
+
let D = l, m = l + o;
|
|
746
|
+
c === N.Backward && ([m, D] = [D, m]), g(C, m, I), g(C, D, I);
|
|
747
747
|
}
|
|
748
748
|
if (T) {
|
|
749
|
-
const
|
|
750
|
-
P.gaps =
|
|
749
|
+
const C = Yt(t, e, a, u, c, b);
|
|
750
|
+
P.gaps = C, P.clip = Kt(C, n.ori, l, r, o, i);
|
|
751
751
|
}
|
|
752
752
|
return P;
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
|
-
const
|
|
756
|
-
function
|
|
755
|
+
const Qt = /* @__PURE__ */ new WeakMap();
|
|
756
|
+
function te(t, e, n) {
|
|
757
757
|
return typeof e == "string" ? e : tn(t, e, n);
|
|
758
758
|
}
|
|
759
759
|
function tn(t, e, n) {
|
|
760
|
-
const s =
|
|
760
|
+
const s = Qt.get(e);
|
|
761
761
|
if (s != null && s.top === n.top && s.height === n.height)
|
|
762
762
|
return s.grad;
|
|
763
763
|
const o = t.createLinearGradient(0, n.top, 0, n.top + n.height);
|
|
764
764
|
for (const [i, l] of e.stops)
|
|
765
765
|
o.addColorStop(i, l);
|
|
766
|
-
return
|
|
766
|
+
return Qt.set(e, { grad: o, top: n.top, height: n.height }), o;
|
|
767
767
|
}
|
|
768
768
|
function en(t, e, n, s, o) {
|
|
769
769
|
if (e.show === !1) return;
|
|
770
770
|
const i = e.alpha ?? 1;
|
|
771
771
|
t.save(), i < 1 && (t.globalAlpha = i), n.clip && t.clip(n.clip);
|
|
772
772
|
const l = o ?? { top: 0, width: t.canvas.width / s, height: t.canvas.height / s };
|
|
773
|
-
if (e.fill && n.fill && (t.fillStyle =
|
|
773
|
+
if (e.fill && n.fill && (t.fillStyle = te(t, e.fill, l), t.fill(n.fill)), e.stroke) {
|
|
774
774
|
const r = (e.width ?? 1) * s;
|
|
775
|
-
t.strokeStyle =
|
|
776
|
-
const a = e.pxAlign ?? 1,
|
|
777
|
-
a === 1 &&
|
|
775
|
+
t.strokeStyle = te(t, e.stroke, l), t.lineWidth = r, t.lineJoin = e.join ?? "round", t.lineCap = e.cap ?? "butt", e.dash && t.setLineDash(e.dash.map((h) => h * s));
|
|
776
|
+
const a = e.pxAlign ?? 1, u = r % 2 / 2;
|
|
777
|
+
a === 1 && u > 0 && t.translate(u, u), t.stroke(n.stroke);
|
|
778
778
|
}
|
|
779
779
|
t.restore();
|
|
780
780
|
}
|
|
781
|
-
const nn = Qe(),
|
|
781
|
+
const nn = Qe(), ee = 64;
|
|
782
782
|
class sn {
|
|
783
783
|
constructor() {
|
|
784
784
|
this.ctx = null, this.pxRatio = 1, this.pathCache = /* @__PURE__ */ new Map(), this.pathCacheSize = 0, this.bandCache = /* @__PURE__ */ new Map(), this.lruHead = null, this.lruTail = null, this.lruMap = /* @__PURE__ */ new Map(), this.snapshotCanvas = null, this.snapshotValid = !1, this.cachedFillStyle = "", this.cachedStrokeStyle = "", this.cachedLineWidth = -1, this.cachedFont = "", this.cachedTextAlign = "", this.cachedTextBaseline = "", this.cachedGlobalAlpha = -1;
|
|
@@ -857,35 +857,35 @@ class sn {
|
|
|
857
857
|
if (l == null) return;
|
|
858
858
|
const r = this.windowKey(s, o), a = l.get(r);
|
|
859
859
|
if (a != null) {
|
|
860
|
-
const
|
|
861
|
-
|
|
860
|
+
const u = this.lruMap.get(this.lruKey(e, n, r));
|
|
861
|
+
u != null && u !== this.lruTail && (this.lruUnlink(u), this.lruAppend(u));
|
|
862
862
|
}
|
|
863
863
|
return a;
|
|
864
864
|
}
|
|
865
865
|
/** Store paths in cache, evicting oldest 25% when at capacity */
|
|
866
866
|
setCachedPaths(e, n, s, o, i) {
|
|
867
|
-
if (this.pathCacheSize >=
|
|
868
|
-
const
|
|
869
|
-
let
|
|
870
|
-
for (let f = 0; f <
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
873
|
-
const
|
|
874
|
-
|
|
867
|
+
if (this.pathCacheSize >= ee) {
|
|
868
|
+
const c = ee >> 2;
|
|
869
|
+
let h = this.lruHead;
|
|
870
|
+
for (let f = 0; f < c && h != null; f++) {
|
|
871
|
+
const d = h.next, x = this.pathCache.get(h.group);
|
|
872
|
+
if (x != null) {
|
|
873
|
+
const b = x.get(h.index);
|
|
874
|
+
b != null && (b.delete(h.key), this.pathCacheSize--, b.size === 0 && x.delete(h.index), x.size === 0 && this.pathCache.delete(h.group));
|
|
875
875
|
}
|
|
876
|
-
this.lruMap.delete(this.lruKey(
|
|
876
|
+
this.lruMap.delete(this.lruKey(h.group, h.index, h.key)), h = d;
|
|
877
877
|
}
|
|
878
|
-
this.lruHead =
|
|
878
|
+
this.lruHead = h, h != null ? h.prev = null : this.lruTail = null;
|
|
879
879
|
}
|
|
880
880
|
let l = this.pathCache.get(e);
|
|
881
881
|
l == null && (l = /* @__PURE__ */ new Map(), this.pathCache.set(e, l));
|
|
882
882
|
let r = l.get(n);
|
|
883
883
|
r == null && (r = /* @__PURE__ */ new Map(), l.set(n, r));
|
|
884
|
-
const a = this.windowKey(s, o),
|
|
884
|
+
const a = this.windowKey(s, o), u = this.lruKey(e, n, a);
|
|
885
885
|
if (!r.has(a)) {
|
|
886
886
|
this.pathCacheSize++;
|
|
887
|
-
const
|
|
888
|
-
this.lruAppend(
|
|
887
|
+
const c = { group: e, index: n, key: a, prev: null, next: null };
|
|
888
|
+
this.lruAppend(c), this.lruMap.set(u, c);
|
|
889
889
|
}
|
|
890
890
|
r.set(a, i);
|
|
891
891
|
}
|
|
@@ -942,10 +942,10 @@ class sn {
|
|
|
942
942
|
const o = this.ctx;
|
|
943
943
|
if (o == null || e.config.show === !1) return;
|
|
944
944
|
const i = e.config.group, l = e.config.index, [r, a] = e.window;
|
|
945
|
-
let
|
|
946
|
-
if (
|
|
947
|
-
const
|
|
948
|
-
|
|
945
|
+
let u = this.getCachedPaths(i, l, r, a);
|
|
946
|
+
if (u == null) {
|
|
947
|
+
const c = e.config.paths ?? nn, h = e.xScale.dir, f = (b) => _(b), d = e.config.fillTo, x = typeof d == "function" ? d(e.yScale.min ?? 0, e.yScale.max ?? 0) : d;
|
|
948
|
+
u = c(
|
|
949
949
|
e.dataX,
|
|
950
950
|
e.dataY,
|
|
951
951
|
e.xScale,
|
|
@@ -956,12 +956,12 @@ class sn {
|
|
|
956
956
|
n.top,
|
|
957
957
|
r,
|
|
958
958
|
a,
|
|
959
|
-
|
|
959
|
+
h,
|
|
960
960
|
f,
|
|
961
|
-
{ fillTo:
|
|
962
|
-
), this.setCachedPaths(i, l, r, a,
|
|
961
|
+
{ fillTo: x, spanGaps: e.config.spanGaps }
|
|
962
|
+
), this.setCachedPaths(i, l, r, a, u);
|
|
963
963
|
}
|
|
964
|
-
en(o, e.config,
|
|
964
|
+
en(o, e.config, u, s, n);
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* Full draw cycle: clear canvas and draw all series.
|
|
@@ -976,51 +976,51 @@ class sn {
|
|
|
976
976
|
i.restore(), this.resetPropertyCache();
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
const ye = [1, 2, 2.5, 5], on = ve(10, -32, 0, ye), ln = ve(10, 0, 32, ye),
|
|
979
|
+
const ye = [1, 2, 2.5, 5], on = ve(10, -32, 0, ye), ln = ve(10, 0, 32, ye), ht = on.concat(ln);
|
|
980
980
|
function rn(t, e, n, s, o) {
|
|
981
981
|
if (n <= 0 || e < t) return [];
|
|
982
|
-
const i = [], l = vt.get(n) ?? 0, r = o ? t :
|
|
983
|
-
for (let a = r; a <= e; a =
|
|
982
|
+
const i = [], l = vt.get(n) ?? 0, r = o ? t : ft(Xt(t, n), l);
|
|
983
|
+
for (let a = r; a <= e; a = ft(a + n, l))
|
|
984
984
|
i.push(Object.is(a, -0) ? 0 : a);
|
|
985
985
|
return i;
|
|
986
986
|
}
|
|
987
|
-
function
|
|
988
|
-
return t.map((e) =>
|
|
987
|
+
function ne(t) {
|
|
988
|
+
return t.map((e) => xe(e));
|
|
989
989
|
}
|
|
990
990
|
function an(t, e, n) {
|
|
991
991
|
if (t <= 0 || e <= 0 || t >= e) return [];
|
|
992
|
-
const s = [], i =
|
|
992
|
+
const s = [], i = ot((n === 10 ? et : Mt)(t));
|
|
993
993
|
let l = wt(n, i);
|
|
994
|
-
n === 10 && (l =
|
|
994
|
+
n === 10 && (l = ht[ut(l, ht)] ?? l);
|
|
995
995
|
let r = l, a = l * n;
|
|
996
|
-
n === 10 && (a =
|
|
997
|
-
let
|
|
996
|
+
n === 10 && (a = ht[ut(a, ht)] ?? a);
|
|
997
|
+
let u = 0;
|
|
998
998
|
do {
|
|
999
999
|
if (r >= t && s.push(r), r = r + l, n === 10 && !vt.has(r)) {
|
|
1000
|
-
const
|
|
1001
|
-
r =
|
|
1000
|
+
const c = vt.get(l) ?? 0;
|
|
1001
|
+
r = ft(r, c);
|
|
1002
1002
|
}
|
|
1003
|
-
r >= a * (1 - 1e-10) && (l = r, a = l * n, n === 10 && (a =
|
|
1004
|
-
} while (r <= e && ++
|
|
1003
|
+
r >= a * (1 - 1e-10) && (l = r, a = l * n, n === 10 && (a = ht[ut(a, ht)] ?? a));
|
|
1004
|
+
} while (r <= e && ++u < 1e4);
|
|
1005
1005
|
return s;
|
|
1006
1006
|
}
|
|
1007
1007
|
function cn(t, e) {
|
|
1008
|
-
const n = e === 10 ? et :
|
|
1008
|
+
const n = e === 10 ? et : Mt;
|
|
1009
1009
|
return t.map((s) => {
|
|
1010
1010
|
if (s === 0) return !0;
|
|
1011
1011
|
if (s < 0) return !1;
|
|
1012
1012
|
const o = n(s);
|
|
1013
|
-
return
|
|
1013
|
+
return pt(o - Math.round(o)) < 1e-10;
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
function un(t, e) {
|
|
1017
|
-
const s =
|
|
1017
|
+
const s = xe(Math.max(Math.abs(t), Math.abs(e))).length * 7;
|
|
1018
1018
|
return Math.max(50, s + 16);
|
|
1019
1019
|
}
|
|
1020
1020
|
function fn(t, e, n, s) {
|
|
1021
1021
|
if (s <= 0)
|
|
1022
1022
|
return [0, 0];
|
|
1023
|
-
const o =
|
|
1023
|
+
const o = xt(t.side) === V.Vertical, i = t.space ?? (o ? 30 : un(e, n)), l = t.incrs ?? ht;
|
|
1024
1024
|
return We(e, n, l, s, i);
|
|
1025
1025
|
}
|
|
1026
1026
|
const hn = 50;
|
|
@@ -1029,12 +1029,12 @@ function dn(t, e, n) {
|
|
|
1029
1029
|
if (t.size != null)
|
|
1030
1030
|
return t.size;
|
|
1031
1031
|
const s = ((r = t.ticks) == null ? void 0 : r.show) !== !1 ? ((a = t.ticks) == null ? void 0 : a.size) ?? 10 : 0, o = t.gap ?? 5, i = 12;
|
|
1032
|
-
if (
|
|
1033
|
-
let
|
|
1034
|
-
for (const
|
|
1035
|
-
|
|
1036
|
-
const
|
|
1037
|
-
return Math.max(50, s + o +
|
|
1032
|
+
if (xt(t.side) === V.Vertical && e != null) {
|
|
1033
|
+
let u = 0;
|
|
1034
|
+
for (const h of e)
|
|
1035
|
+
h.length > u && (u = h.length);
|
|
1036
|
+
const c = u * 7;
|
|
1037
|
+
return Math.max(50, s + o + c + 4);
|
|
1038
1038
|
}
|
|
1039
1039
|
return Math.max(50, s + o + i + 3);
|
|
1040
1040
|
}
|
|
@@ -1052,7 +1052,7 @@ function gn(t) {
|
|
|
1052
1052
|
_rotate: 0
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
const mt = 60,
|
|
1055
|
+
const mt = 60, dt = 3600, at = 86400, gt = 2592e3, At = 31536e3, pn = [
|
|
1056
1056
|
// Seconds
|
|
1057
1057
|
1,
|
|
1058
1058
|
5,
|
|
@@ -1066,23 +1066,23 @@ const mt = 60, ht = 3600, rt = 86400, dt = 2592e3, At = 31536e3, pn = [
|
|
|
1066
1066
|
15 * mt,
|
|
1067
1067
|
30 * mt,
|
|
1068
1068
|
// Hours
|
|
1069
|
-
ht,
|
|
1070
|
-
2 * ht,
|
|
1071
|
-
3 * ht,
|
|
1072
|
-
4 * ht,
|
|
1073
|
-
6 * ht,
|
|
1074
|
-
12 * ht,
|
|
1075
|
-
// Days
|
|
1076
|
-
rt,
|
|
1077
|
-
2 * rt,
|
|
1078
|
-
3 * rt,
|
|
1079
|
-
7 * rt,
|
|
1080
|
-
14 * rt,
|
|
1081
|
-
// Months (approximate)
|
|
1082
1069
|
dt,
|
|
1083
1070
|
2 * dt,
|
|
1084
1071
|
3 * dt,
|
|
1072
|
+
4 * dt,
|
|
1085
1073
|
6 * dt,
|
|
1074
|
+
12 * dt,
|
|
1075
|
+
// Days
|
|
1076
|
+
at,
|
|
1077
|
+
2 * at,
|
|
1078
|
+
3 * at,
|
|
1079
|
+
7 * at,
|
|
1080
|
+
14 * at,
|
|
1081
|
+
// Months (approximate)
|
|
1082
|
+
gt,
|
|
1083
|
+
2 * gt,
|
|
1084
|
+
3 * gt,
|
|
1085
|
+
6 * gt,
|
|
1086
1086
|
// Years
|
|
1087
1087
|
At
|
|
1088
1088
|
];
|
|
@@ -1096,21 +1096,21 @@ function mn(t, e, n, s) {
|
|
|
1096
1096
|
o.push(i), l.setUTCFullYear(l.getUTCFullYear() + Math.round(n / At)), i = l.getTime() / 1e3;
|
|
1097
1097
|
return o;
|
|
1098
1098
|
}
|
|
1099
|
-
if (n >=
|
|
1099
|
+
if (n >= gt) {
|
|
1100
1100
|
const l = new Date(t * 1e3);
|
|
1101
1101
|
l.setUTCDate(1), l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3;
|
|
1102
|
-
const r = Math.max(1, Math.round(n /
|
|
1102
|
+
const r = Math.max(1, Math.round(n / gt));
|
|
1103
1103
|
if (i < t && (l.setUTCMonth(l.getUTCMonth() + 1), i = l.getTime() / 1e3), r > 1) {
|
|
1104
|
-
const a = l.getUTCMonth(),
|
|
1105
|
-
l.setUTCMonth(
|
|
1104
|
+
const a = l.getUTCMonth(), u = Math.ceil((a + 1) / r) * r;
|
|
1105
|
+
l.setUTCMonth(u - 1), i = l.getTime() / 1e3;
|
|
1106
1106
|
}
|
|
1107
1107
|
for (; i <= e; )
|
|
1108
1108
|
o.push(i), l.setUTCMonth(l.getUTCMonth() + r), i = l.getTime() / 1e3;
|
|
1109
1109
|
return o;
|
|
1110
1110
|
}
|
|
1111
|
-
if (n >=
|
|
1111
|
+
if (n >= at) {
|
|
1112
1112
|
const l = new Date(t * 1e3);
|
|
1113
|
-
l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (i +=
|
|
1113
|
+
l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (i += at);
|
|
1114
1114
|
} else
|
|
1115
1115
|
i = Math.ceil(t / n) * n;
|
|
1116
1116
|
for (let l = 0; ; l++) {
|
|
@@ -1120,11 +1120,11 @@ function mn(t, e, n, s) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
return o;
|
|
1122
1122
|
}
|
|
1123
|
-
const
|
|
1123
|
+
const se = /* @__PURE__ */ new Map();
|
|
1124
1124
|
function wn(t, e) {
|
|
1125
1125
|
const n = JSON.stringify(t) + (e ?? "");
|
|
1126
|
-
let s =
|
|
1127
|
-
return s == null && (s = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }),
|
|
1126
|
+
let s = se.get(n);
|
|
1127
|
+
return s == null && (s = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }), se.set(n, s)), s;
|
|
1128
1128
|
}
|
|
1129
1129
|
function nt(t, e, n) {
|
|
1130
1130
|
const s = new Date(t * 1e3);
|
|
@@ -1133,10 +1133,10 @@ function nt(t, e, n) {
|
|
|
1133
1133
|
function vn(t, e) {
|
|
1134
1134
|
return nt(t, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1136
|
+
function xn(t, e) {
|
|
1137
1137
|
return nt(t, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Mn(t, e) {
|
|
1140
1140
|
return nt(t, { hour: "2-digit", minute: "2-digit", hour12: !1 }, e);
|
|
1141
1141
|
}
|
|
1142
1142
|
function bn(t, e) {
|
|
@@ -1150,15 +1150,15 @@ function yn(t, e) {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
function kn(t, e, n) {
|
|
1152
1152
|
let s;
|
|
1153
|
-
return e >= At ? s = Sn : e >=
|
|
1153
|
+
return e >= At ? s = Sn : e >= gt ? s = yn : e >= at ? s = bn : e >= dt ? s = Mn : e >= mt ? s = xn : s = vn, t.map((o) => s(o, n));
|
|
1154
1154
|
}
|
|
1155
1155
|
function Cn(t, e, n, s, o) {
|
|
1156
1156
|
const i = e - t;
|
|
1157
1157
|
if (i <= 0 || s <= 0) return [0, 0];
|
|
1158
1158
|
for (const r of n) {
|
|
1159
|
-
const a = i / r,
|
|
1160
|
-
if (
|
|
1161
|
-
return [r,
|
|
1159
|
+
const a = i / r, u = s / a;
|
|
1160
|
+
if (u >= o)
|
|
1161
|
+
return [r, u];
|
|
1162
1162
|
}
|
|
1163
1163
|
const l = n[n.length - 1] ?? At;
|
|
1164
1164
|
return [l, s / (i / l)];
|
|
@@ -1176,53 +1176,53 @@ function In(t, e, n, s, o) {
|
|
|
1176
1176
|
continue;
|
|
1177
1177
|
} else
|
|
1178
1178
|
l._show || (i = !1, l._show = !0);
|
|
1179
|
-
const
|
|
1180
|
-
let
|
|
1179
|
+
const u = r.side, h = xt(u) === V.Horizontal ? n : s, { min: f, max: d } = a;
|
|
1180
|
+
let x, b;
|
|
1181
1181
|
if (a.time) {
|
|
1182
|
-
const
|
|
1183
|
-
[
|
|
1182
|
+
const g = r.space ?? 80;
|
|
1183
|
+
[x, b] = Cn(f, d, pn, h, g);
|
|
1184
1184
|
} else
|
|
1185
|
-
[
|
|
1186
|
-
if (l._incr =
|
|
1185
|
+
[x, b] = fn(r, f, d, h);
|
|
1186
|
+
if (l._incr = x, l._space = b, b === 0)
|
|
1187
1187
|
continue;
|
|
1188
1188
|
if (r.splits)
|
|
1189
|
-
l._splits = r.splits(f,
|
|
1189
|
+
l._splits = r.splits(f, d, x, b);
|
|
1190
1190
|
else if (a.time)
|
|
1191
|
-
l._splits = mn(f,
|
|
1192
|
-
else if (a.distr ===
|
|
1193
|
-
l._splits = an(f,
|
|
1191
|
+
l._splits = mn(f, d, x);
|
|
1192
|
+
else if (a.distr === q.Log)
|
|
1193
|
+
l._splits = an(f, d, a.log);
|
|
1194
1194
|
else {
|
|
1195
|
-
const
|
|
1196
|
-
l._splits = rn(f,
|
|
1195
|
+
const g = a.distr === q.Ordinal;
|
|
1196
|
+
l._splits = rn(f, d, x, b, g);
|
|
1197
1197
|
}
|
|
1198
1198
|
if (r.values)
|
|
1199
|
-
l._values = r.values(l._splits,
|
|
1199
|
+
l._values = r.values(l._splits, b, x);
|
|
1200
1200
|
else if (a.time)
|
|
1201
|
-
l._values = kn(l._splits,
|
|
1202
|
-
else if (a.distr ===
|
|
1203
|
-
const
|
|
1204
|
-
l._values =
|
|
1201
|
+
l._values = kn(l._splits, x);
|
|
1202
|
+
else if (a.distr === q.Log) {
|
|
1203
|
+
const g = cn(l._splits, a.log), w = ne(l._splits);
|
|
1204
|
+
l._values = w.map((P, z) => g[z] ? P : "");
|
|
1205
1205
|
} else
|
|
1206
|
-
l._values =
|
|
1207
|
-
l._rotate =
|
|
1206
|
+
l._values = ne(l._splits);
|
|
1207
|
+
l._rotate = u === U.Bottom ? r.rotate ?? 0 : 0;
|
|
1208
1208
|
const L = l._size;
|
|
1209
1209
|
l._size = Tt(dn(r, l._values)), L !== l._size && (i = !1);
|
|
1210
1210
|
}
|
|
1211
1211
|
return i;
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
let
|
|
1215
|
-
for (const
|
|
1216
|
-
if (!
|
|
1213
|
+
function oe(t, e, n, s = 0) {
|
|
1214
|
+
let o = t, i = e - s, l = 0, r = s;
|
|
1215
|
+
for (const a of n) {
|
|
1216
|
+
if (!a._show)
|
|
1217
1217
|
continue;
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1218
|
+
const u = a.config.side, c = xt(u) === V.Vertical, h = a.config.label != null ? a.config.labelSize ?? 20 : 0, f = a._size + h;
|
|
1219
|
+
f > 0 && (c ? (o -= f, u === U.Left && (l += f)) : (i -= f, u === U.Top && (r += f)));
|
|
1220
1220
|
}
|
|
1221
1221
|
return {
|
|
1222
|
-
left:
|
|
1223
|
-
top:
|
|
1224
|
-
width: Math.max(
|
|
1225
|
-
height: Math.max(
|
|
1222
|
+
left: l,
|
|
1223
|
+
top: r,
|
|
1224
|
+
width: Math.max(o, 0),
|
|
1225
|
+
height: Math.max(i, 0)
|
|
1226
1226
|
};
|
|
1227
1227
|
}
|
|
1228
1228
|
function An(t, e) {
|
|
@@ -1232,12 +1232,12 @@ function An(t, e) {
|
|
|
1232
1232
|
case U.Top:
|
|
1233
1233
|
return n -= a, n + a;
|
|
1234
1234
|
case U.Right: {
|
|
1235
|
-
const
|
|
1236
|
-
return s += a,
|
|
1235
|
+
const u = s;
|
|
1236
|
+
return s += a, u;
|
|
1237
1237
|
}
|
|
1238
1238
|
case U.Bottom: {
|
|
1239
|
-
const
|
|
1240
|
-
return o += a,
|
|
1239
|
+
const u = o;
|
|
1240
|
+
return o += a, u;
|
|
1241
1241
|
}
|
|
1242
1242
|
case U.Left:
|
|
1243
1243
|
return i -= a, i + a;
|
|
@@ -1250,100 +1250,104 @@ function An(t, e) {
|
|
|
1250
1250
|
continue;
|
|
1251
1251
|
const a = r.config.side;
|
|
1252
1252
|
if (r._pos = l(a, r._size), r.config.label != null) {
|
|
1253
|
-
const
|
|
1254
|
-
r._lpos = l(a,
|
|
1253
|
+
const u = r.config.labelSize ?? 20;
|
|
1254
|
+
r._lpos = l(a, u);
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
function Pn(t, e, n, s) {
|
|
1259
|
-
for (const
|
|
1260
|
-
|
|
1261
|
-
let
|
|
1262
|
-
for (; !
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1258
|
+
function Pn(t, e, n, s, o = 0) {
|
|
1259
|
+
for (const a of n)
|
|
1260
|
+
a._size = 0;
|
|
1261
|
+
let i = !1, l = 0, r = { left: 0, top: 0, width: t, height: e };
|
|
1262
|
+
for (; !i; ) {
|
|
1263
|
+
l++;
|
|
1264
|
+
const a = In(
|
|
1265
1265
|
n,
|
|
1266
1266
|
s,
|
|
1267
|
-
|
|
1268
|
-
|
|
1267
|
+
r.width,
|
|
1268
|
+
r.height
|
|
1269
1269
|
);
|
|
1270
|
-
|
|
1270
|
+
i = l === Tn || a, i || (r = oe(t, e, n, o));
|
|
1271
1271
|
}
|
|
1272
|
-
return
|
|
1272
|
+
return r = oe(t, e, n, o), An(n, r), r;
|
|
1273
1273
|
}
|
|
1274
|
-
const
|
|
1275
|
-
function
|
|
1274
|
+
const le = "top", ie = "bottom", Ln = "left", zn = "right";
|
|
1275
|
+
function $t(t, e) {
|
|
1276
1276
|
return e === 1 ? t : t.replace(/(\d+(?:\.\d+)?)px/, (n, s) => `${Math.round(Number(s) * e)}px`);
|
|
1277
1277
|
}
|
|
1278
|
-
function re(t, e, n, s, o, i, l, r, a,
|
|
1279
|
-
const
|
|
1280
|
-
t.save(), t.translate(
|
|
1281
|
-
let f = 0,
|
|
1278
|
+
function re(t, e, n, s, o, i, l, r, a, u, c) {
|
|
1279
|
+
const h = r % 2 / 2;
|
|
1280
|
+
t.save(), t.translate(h, h), t.strokeStyle = a, t.lineWidth = r, u.length > 0 && t.setLineDash(u), t.beginPath();
|
|
1281
|
+
let f = 0, d = 0, x = 0, b = 0;
|
|
1282
1282
|
const L = i + (o === U.Top || o === U.Left ? -l : l);
|
|
1283
|
-
s ===
|
|
1284
|
-
for (let
|
|
1285
|
-
n[
|
|
1283
|
+
s === V.Horizontal ? (d = i, b = L) : (f = i, x = L);
|
|
1284
|
+
for (let g = 0; g < e.length; g++)
|
|
1285
|
+
n[g] != null && (s === V.Horizontal ? f = x = e[g] ?? 0 : d = b = e[g] ?? 0, t.moveTo(f, d), t.lineTo(x, b));
|
|
1286
1286
|
t.stroke(), t.restore();
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
const
|
|
1288
|
+
function Dn(t, e, n, s, o, i) {
|
|
1289
|
+
const l = _(s.left * o), r = _(s.top * o), a = _(s.width * o), u = _(s.height * o);
|
|
1290
1290
|
for (const c of e) {
|
|
1291
1291
|
if (!c._show)
|
|
1292
1292
|
continue;
|
|
1293
|
-
const
|
|
1294
|
-
if (!
|
|
1293
|
+
const h = c.config, f = h.side, d = xt(f), x = n(h.scale);
|
|
1294
|
+
if (!x || x.min == null || x.max == null)
|
|
1295
1295
|
continue;
|
|
1296
|
-
const
|
|
1297
|
-
if (!
|
|
1296
|
+
const b = h.stroke ?? "#000", L = f === U.Top || f === U.Left ? -1 : 1, g = c._splits, w = c._values;
|
|
1297
|
+
if (!g || !w || c._space === 0)
|
|
1298
1298
|
continue;
|
|
1299
|
-
const
|
|
1300
|
-
if ((
|
|
1301
|
-
const
|
|
1302
|
-
re(t,
|
|
1299
|
+
const P = d === V.Horizontal ? s.width : s.height, z = d === V.Horizontal ? s.left : s.top, T = g.map((D) => _($(D, x, P, z) * o)), S = w.map((D) => D === "" ? null : D), C = h.grid;
|
|
1300
|
+
if ((C == null ? void 0 : C.show) !== !1) {
|
|
1301
|
+
const D = (C == null ? void 0 : C.stroke) ?? "rgba(0,0,0,0.12)", m = _(((C == null ? void 0 : C.width) ?? 2) * o), p = ((C == null ? void 0 : C.dash) ?? []).map((y) => y * o), M = d === V.Horizontal ? r : l, k = d === V.Horizontal ? u : a;
|
|
1302
|
+
re(t, T, S, d, 2, M, k, m, D, p);
|
|
1303
1303
|
}
|
|
1304
|
-
const
|
|
1305
|
-
if ((
|
|
1306
|
-
const
|
|
1307
|
-
re(t,
|
|
1304
|
+
const v = h.ticks;
|
|
1305
|
+
if ((v == null ? void 0 : v.show) !== !1) {
|
|
1306
|
+
const D = (v == null ? void 0 : v.stroke) ?? b, m = _(((v == null ? void 0 : v.width) ?? 1) * o), p = _(((v == null ? void 0 : v.size) ?? 10) * o), M = ((v == null ? void 0 : v.dash) ?? []).map((y) => y * o), k = _(c._pos * o);
|
|
1307
|
+
re(t, T, S, d, f, k, p, m, D, M);
|
|
1308
1308
|
}
|
|
1309
1309
|
{
|
|
1310
|
-
const
|
|
1311
|
-
t.font = y, t.fillStyle =
|
|
1312
|
-
const
|
|
1313
|
-
if (
|
|
1314
|
-
const
|
|
1315
|
-
for (let
|
|
1316
|
-
const
|
|
1317
|
-
if (
|
|
1310
|
+
const D = (v == null ? void 0 : v.show) !== !1 ? ((v == null ? void 0 : v.size) ?? 10) * o : 0, m = _((h.gap ?? 5) * o), p = _(c._pos * o), M = (D + m) * L, k = p + M, y = $t(h.font ?? "12px system-ui, sans-serif", o), A = d === V.Horizontal ? "center" : f === U.Left ? zn : Ln, F = d === V.Horizontal ? f === U.Bottom ? le : ie : "middle";
|
|
1311
|
+
t.font = y, t.fillStyle = b, t.textAlign = A, t.textBaseline = F;
|
|
1312
|
+
const R = c._rotate * -_t / 180;
|
|
1313
|
+
if (R !== 0) {
|
|
1314
|
+
const G = Math.cos(R), H = Math.sin(R);
|
|
1315
|
+
for (let B = 0; B < w.length; B++) {
|
|
1316
|
+
const W = w[B];
|
|
1317
|
+
if (W == null || W === "")
|
|
1318
1318
|
continue;
|
|
1319
|
-
const
|
|
1320
|
-
t.setTransform(
|
|
1319
|
+
const Y = T[B] ?? 0;
|
|
1320
|
+
t.setTransform(G, H, -H, G, Y, k), t.fillText(W, 0, 0);
|
|
1321
1321
|
}
|
|
1322
1322
|
t.setTransform(1, 0, 0, 1, 0, 0);
|
|
1323
1323
|
} else
|
|
1324
|
-
for (let
|
|
1325
|
-
const H =
|
|
1324
|
+
for (let G = 0; G < w.length; G++) {
|
|
1325
|
+
const H = w[G];
|
|
1326
1326
|
if (H == null || H === "")
|
|
1327
1327
|
continue;
|
|
1328
|
-
const
|
|
1329
|
-
t.fillText(H,
|
|
1328
|
+
const B = T[G] ?? 0, W = d === V.Horizontal ? B : k, Y = d === V.Horizontal ? k : B;
|
|
1329
|
+
t.fillText(H, W, Y);
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
|
-
if (
|
|
1333
|
-
const
|
|
1334
|
-
t.font =
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
), t.rotate((
|
|
1332
|
+
if (h.label != null) {
|
|
1333
|
+
const D = $t(h.labelFont ?? "bold 12px system-ui, sans-serif", o);
|
|
1334
|
+
t.font = D, t.fillStyle = b, t.textAlign = "center", t.textBaseline = f === U.Bottom ? le : ie;
|
|
1335
|
+
const m = _((c._lpos + (h.labelGap ?? 0) * L) * o);
|
|
1336
|
+
d === V.Vertical ? (t.save(), t.translate(
|
|
1337
|
+
m,
|
|
1338
|
+
_(r + u / 2)
|
|
1339
|
+
), t.rotate((f === U.Left ? -_t : _t) / 2), t.fillText(h.label, 0, 0), t.restore()) : t.fillText(h.label, _(l + a / 2), m);
|
|
1340
1340
|
}
|
|
1341
|
-
const
|
|
1342
|
-
if ((
|
|
1343
|
-
const
|
|
1344
|
-
t.strokeStyle =
|
|
1341
|
+
const I = h.border;
|
|
1342
|
+
if ((I == null ? void 0 : I.show) !== !1 && I != null) {
|
|
1343
|
+
const D = I.stroke ?? b, m = _((I.width ?? 1) * o), p = (I.dash ?? []).map((k) => k * o), M = _(c._pos * o);
|
|
1344
|
+
t.strokeStyle = D, t.lineWidth = m, p.length > 0 && t.setLineDash(p), t.beginPath(), d === V.Horizontal ? (t.moveTo(l, M), t.lineTo(l + a, M)) : (t.moveTo(M, r), t.lineTo(M, r + u)), t.stroke(), p.length > 0 && t.setLineDash([]);
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
1347
|
+
if (i != null) {
|
|
1348
|
+
const c = $t("bold 14px system-ui, sans-serif", o);
|
|
1349
|
+
t.font = c, t.fillStyle = "#000", t.textAlign = "center", t.textBaseline = "top", t.fillText(i, _(l + a / 2), _(4 * o));
|
|
1350
|
+
}
|
|
1347
1351
|
}
|
|
1348
1352
|
const Fn = {
|
|
1349
1353
|
stroke: "#607D8B",
|
|
@@ -1356,24 +1360,24 @@ const Fn = {
|
|
|
1356
1360
|
function ae(t, e, n, s, o, i, l, r, a) {
|
|
1357
1361
|
var P;
|
|
1358
1362
|
if (e.left < 0 || e.top < 0) return;
|
|
1359
|
-
const
|
|
1360
|
-
if (t.save(), t.strokeStyle =
|
|
1361
|
-
const
|
|
1362
|
-
if (
|
|
1363
|
-
const
|
|
1364
|
-
if (
|
|
1365
|
-
let
|
|
1366
|
-
for (const
|
|
1367
|
-
if (
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1363
|
+
const u = { ...Fn, ...a }, c = s, h = _(n.left * c), f = _(n.top * c), d = _(n.width * c), x = _(n.height * c), b = _(u.width * c), L = b % 2 / 2, g = _((n.left + e.left) * c) + L, w = _((n.top + e.top) * c) + L;
|
|
1364
|
+
if (t.save(), t.strokeStyle = u.stroke, t.lineWidth = b, t.setLineDash(u.dash.map((z) => z * c)), u.showX && (t.beginPath(), t.moveTo(g, f), t.lineTo(g, f + x), t.stroke()), u.showY && (t.beginPath(), t.moveTo(h, w), t.lineTo(h + d, w), t.stroke()), t.setLineDash([]), e.activeGroup >= 0 && e.activeDataIdx >= 0) {
|
|
1365
|
+
const z = e.activeGroup, T = e.activeSeriesIdx, S = e.activeDataIdx, C = o[z];
|
|
1366
|
+
if (C != null && T >= 0 && T < C.series.length && S < C.x.length) {
|
|
1367
|
+
const v = C.x[S], I = C.series[T], D = I != null ? I[S] : null;
|
|
1368
|
+
if (v != null && D != null) {
|
|
1369
|
+
let m = u.stroke, p = !0;
|
|
1370
|
+
for (const M of i)
|
|
1371
|
+
if (M.group === z && M.index === T) {
|
|
1372
|
+
const k = M.stroke;
|
|
1373
|
+
m = (typeof k == "string" ? k : void 0) ?? u.stroke, p = ((P = M.cursor) == null ? void 0 : P.show) !== !1;
|
|
1370
1374
|
break;
|
|
1371
1375
|
}
|
|
1372
|
-
if (
|
|
1373
|
-
const
|
|
1374
|
-
if (
|
|
1375
|
-
const F = $(
|
|
1376
|
-
t.beginPath(), t.arc(F, R,
|
|
1376
|
+
if (p) {
|
|
1377
|
+
const M = r(z), k = M != null ? l(M) : void 0, y = Rn(i, z, T), A = y != null ? l(y) : void 0;
|
|
1378
|
+
if (k != null && A != null && k.min != null && k.max != null && A.min != null && A.max != null) {
|
|
1379
|
+
const F = _($(v, k, n.width, n.left) * c), R = _($(D, A, n.height, n.top) * c), G = u.pointRadius * c, H = _(2 * c);
|
|
1380
|
+
t.beginPath(), t.arc(F, R, G, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = m, t.lineWidth = H, t.stroke();
|
|
1377
1381
|
}
|
|
1378
1382
|
}
|
|
1379
1383
|
}
|
|
@@ -1386,26 +1390,26 @@ function Rn(t, e, n) {
|
|
|
1386
1390
|
if (s.group === e && s.index === n)
|
|
1387
1391
|
return s.yScale;
|
|
1388
1392
|
}
|
|
1389
|
-
const
|
|
1393
|
+
const Gn = {
|
|
1390
1394
|
fill: "rgba(0,0,0,0.07)",
|
|
1391
1395
|
stroke: "rgba(0,0,0,0.15)",
|
|
1392
1396
|
width: 1
|
|
1393
1397
|
};
|
|
1394
1398
|
function ce(t, e, n, s, o) {
|
|
1395
1399
|
if (!e.show || e.width <= 0) return;
|
|
1396
|
-
const i = { ...
|
|
1397
|
-
t.save(), t.fillStyle = i.fill, t.fillRect(r, a,
|
|
1400
|
+
const i = { ...Gn, ...o }, l = s, r = _((n.left + e.left) * l), a = _((n.top + e.top) * l), u = _(e.width * l), c = _(e.height * l);
|
|
1401
|
+
t.save(), t.fillStyle = i.fill, t.fillRect(r, a, u, c), i.width > 0 && (t.strokeStyle = i.stroke, t.lineWidth = _(i.width * l), t.strokeRect(r, a, u, c)), t.restore();
|
|
1398
1402
|
}
|
|
1399
|
-
function
|
|
1400
|
-
const f =
|
|
1401
|
-
t.save(), t.strokeStyle =
|
|
1403
|
+
function Hn(t, e, n, s, o, i, l, r, a, u, c, h) {
|
|
1404
|
+
const f = c / 2 * l, d = Math.max(1, _(c * 0.2)) * l, x = (u == null ? void 0 : u.stroke) ?? h, b = (u == null ? void 0 : u.fill) ?? "#fff";
|
|
1405
|
+
t.save(), t.strokeStyle = x, t.fillStyle = b, t.lineWidth = d, (u == null ? void 0 : u.dash) != null && t.setLineDash(u.dash.map((L) => L * l));
|
|
1402
1406
|
for (let L = r; L <= a; L++) {
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
1405
|
-
const
|
|
1406
|
-
if (
|
|
1407
|
-
const P = $(
|
|
1408
|
-
t.beginPath(), t.arc(P,
|
|
1407
|
+
const g = n[L];
|
|
1408
|
+
if (g == null) continue;
|
|
1409
|
+
const w = e[L];
|
|
1410
|
+
if (w == null) continue;
|
|
1411
|
+
const P = _($(w, s, i.width, i.left) * l), z = _($(g, o, i.height, i.top) * l);
|
|
1412
|
+
t.beginPath(), t.arc(P, z, f, 0, Math.PI * 2), t.fill(), t.stroke();
|
|
1409
1413
|
}
|
|
1410
1414
|
t.restore();
|
|
1411
1415
|
}
|
|
@@ -1419,36 +1423,36 @@ function _n(t, e, n, s, o, i, l) {
|
|
|
1419
1423
|
}
|
|
1420
1424
|
function Vn(t, e, n, s, o, i, l, r, a) {
|
|
1421
1425
|
if (r > a || r < 0) return null;
|
|
1422
|
-
const
|
|
1426
|
+
const u = (d) => $(d, s, i.width, i.left) * l, c = (d) => $(d, o, i.height, i.top) * l, h = new Path2D();
|
|
1423
1427
|
let f = !1;
|
|
1424
|
-
for (let
|
|
1425
|
-
const
|
|
1426
|
-
if (
|
|
1427
|
-
const L =
|
|
1428
|
-
f ?
|
|
1428
|
+
for (let d = r; d <= a; d++) {
|
|
1429
|
+
const x = e[d], b = t[d];
|
|
1430
|
+
if (x == null || b == null) continue;
|
|
1431
|
+
const L = u(b), g = c(x);
|
|
1432
|
+
f ? h.lineTo(L, g) : (h.moveTo(L, g), f = !0);
|
|
1429
1433
|
}
|
|
1430
1434
|
if (!f) return null;
|
|
1431
|
-
for (let
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1435
|
+
for (let d = a; d >= r; d--) {
|
|
1436
|
+
const x = n[d], b = t[d];
|
|
1437
|
+
x == null || b == null || h.lineTo(u(b), c(x));
|
|
1434
1438
|
}
|
|
1435
|
-
return
|
|
1439
|
+
return h.closePath(), h;
|
|
1436
1440
|
}
|
|
1437
1441
|
function $n(t, e, n) {
|
|
1438
1442
|
t.save(), t.fillStyle = e.fill ?? "rgba(0, 120, 255, 0.1)", t.fill(n), t.restore();
|
|
1439
1443
|
}
|
|
1440
|
-
function
|
|
1444
|
+
function Bt(t, e, n, s) {
|
|
1441
1445
|
return { ctx: t, plotBox: e, pxRatio: n, getScale: s, valToX: (l, r = "x") => {
|
|
1442
1446
|
const a = s(r);
|
|
1443
|
-
return a == null || a.min == null || a.max == null ? null :
|
|
1447
|
+
return a == null || a.min == null || a.max == null ? null : $(l, a, e.width, e.left);
|
|
1444
1448
|
}, valToY: (l, r) => {
|
|
1445
1449
|
const a = s(r);
|
|
1446
|
-
return a == null || a.min == null || a.max == null ? null :
|
|
1450
|
+
return a == null || a.min == null || a.max == null ? null : $(l, a, e.height, e.top);
|
|
1447
1451
|
} };
|
|
1448
1452
|
}
|
|
1449
1453
|
function Bn() {
|
|
1450
1454
|
const t = {
|
|
1451
|
-
scaleManager: new
|
|
1455
|
+
scaleManager: new Ke(),
|
|
1452
1456
|
dataStore: new je(),
|
|
1453
1457
|
renderer: new sn(),
|
|
1454
1458
|
cursorManager: new qe(),
|
|
@@ -1470,6 +1474,7 @@ function Bn() {
|
|
|
1470
1474
|
focusedSeries: null,
|
|
1471
1475
|
focusAlpha: 0.15,
|
|
1472
1476
|
wheelZoom: !1,
|
|
1477
|
+
title: void 0,
|
|
1473
1478
|
revision: 0,
|
|
1474
1479
|
eventCallbacks: {},
|
|
1475
1480
|
_prevScaleRanges: /* @__PURE__ */ new Map(),
|
|
@@ -1511,169 +1516,174 @@ function Bn() {
|
|
|
1511
1516
|
};
|
|
1512
1517
|
},
|
|
1513
1518
|
redraw() {
|
|
1514
|
-
const { scaleManager: e, dataStore: n, renderer: s, seriesConfigs: o, width: i, height: l, pxRatio: r, canvas: a, scheduler:
|
|
1519
|
+
const { scaleManager: e, dataStore: n, renderer: s, seriesConfigs: o, width: i, height: l, pxRatio: r, canvas: a, scheduler: u } = t;
|
|
1515
1520
|
if (a == null || i === 0 || l === 0) return;
|
|
1516
|
-
const
|
|
1517
|
-
if (
|
|
1518
|
-
s.setContext(
|
|
1519
|
-
const f = (
|
|
1520
|
-
if (f && s.restoreSnapshot(
|
|
1521
|
+
const c = a.getContext("2d");
|
|
1522
|
+
if (c == null) return;
|
|
1523
|
+
s.setContext(c, r);
|
|
1524
|
+
const f = (u.dirty & ~(tt.Cursor | tt.Select)) === 0, d = (g) => e.getScale(g);
|
|
1525
|
+
if (f && s.restoreSnapshot(c)) {
|
|
1521
1526
|
if (ae(
|
|
1522
|
-
|
|
1527
|
+
c,
|
|
1523
1528
|
t.cursorManager.state,
|
|
1524
1529
|
t.plotBox,
|
|
1525
1530
|
r,
|
|
1526
1531
|
n.data,
|
|
1527
1532
|
o,
|
|
1528
|
-
|
|
1529
|
-
(
|
|
1530
|
-
), ce(
|
|
1531
|
-
|
|
1532
|
-
const
|
|
1533
|
-
for (const
|
|
1533
|
+
d,
|
|
1534
|
+
(g) => e.getGroupXScaleKey(g)
|
|
1535
|
+
), ce(c, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
|
|
1536
|
+
c.save(), c.scale(r, r);
|
|
1537
|
+
const g = Bt(c, t.plotBox, r, d);
|
|
1538
|
+
for (const w of t.cursorDrawHooks)
|
|
1534
1539
|
try {
|
|
1535
|
-
|
|
1540
|
+
w(g, t.cursorManager.state);
|
|
1536
1541
|
} catch (P) {
|
|
1537
1542
|
console.warn("[uPlot+] draw hook error:", P);
|
|
1538
1543
|
}
|
|
1539
|
-
|
|
1544
|
+
c.restore();
|
|
1540
1545
|
}
|
|
1541
|
-
for (const
|
|
1546
|
+
for (const g of t.listeners) g();
|
|
1542
1547
|
return;
|
|
1543
1548
|
}
|
|
1544
|
-
e.autoRangeX(n.data), n.updateWindows((
|
|
1545
|
-
const
|
|
1546
|
-
return
|
|
1549
|
+
e.autoRangeX(n.data), n.updateWindows((g) => {
|
|
1550
|
+
const w = e.getGroupXScaleKey(g);
|
|
1551
|
+
return w != null ? e.getScale(w) : void 0;
|
|
1547
1552
|
});
|
|
1548
|
-
const
|
|
1549
|
-
group:
|
|
1550
|
-
index:
|
|
1551
|
-
yScale:
|
|
1553
|
+
const x = o.map((g) => ({
|
|
1554
|
+
group: g.group,
|
|
1555
|
+
index: g.index,
|
|
1556
|
+
yScale: g.yScale
|
|
1552
1557
|
}));
|
|
1553
|
-
e.autoRange(n.data,
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1558
|
+
if (e.autoRange(n.data, x, n), Wn(t), t.axisStates.length > 0) {
|
|
1559
|
+
const g = t.title != null ? 20 : 0;
|
|
1560
|
+
t.plotBox = Pn(i, l, t.axisStates, d, g);
|
|
1561
|
+
} else
|
|
1562
|
+
t.plotBox = {
|
|
1563
|
+
left: 10,
|
|
1564
|
+
top: 10,
|
|
1565
|
+
width: i - 20,
|
|
1566
|
+
height: l - 20
|
|
1567
|
+
};
|
|
1568
|
+
c.clearRect(0, 0, i * r, l * r), t.axisStates.length > 0 && Dn(c, t.axisStates, d, t.plotBox, r, t.title);
|
|
1569
|
+
const b = [];
|
|
1570
|
+
for (const g of o) {
|
|
1571
|
+
const w = e.getGroupXScaleKey(g.group), P = w != null ? e.getScale(w) : void 0, z = e.getScale(g.yScale);
|
|
1572
|
+
P == null || z == null || b.push({
|
|
1573
|
+
config: g,
|
|
1574
|
+
dataX: n.getXValues(g.group),
|
|
1575
|
+
dataY: n.getYValues(g.group, g.index),
|
|
1566
1576
|
xScale: P,
|
|
1567
|
-
yScale:
|
|
1568
|
-
window: n.getWindow(
|
|
1577
|
+
yScale: z,
|
|
1578
|
+
window: n.getWindow(g.group)
|
|
1569
1579
|
});
|
|
1570
1580
|
}
|
|
1571
|
-
|
|
1572
|
-
for (let
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1581
|
+
c.save(), c.scale(r, r), c.beginPath(), c.rect(t.plotBox.left, t.plotBox.top, t.plotBox.width, t.plotBox.height), c.clip();
|
|
1582
|
+
for (let g = 0; g < b.length; g++) {
|
|
1583
|
+
const w = b[g];
|
|
1584
|
+
w != null && (t.focusedSeries != null && g !== t.focusedSeries ? (c.globalAlpha = t.focusAlpha, s.drawSeries(w, t.plotBox, 1), c.globalAlpha = 1) : s.drawSeries(w, t.plotBox, 1));
|
|
1575
1585
|
}
|
|
1576
1586
|
const L = /* @__PURE__ */ new Map();
|
|
1577
|
-
for (const
|
|
1578
|
-
L.set(`${
|
|
1579
|
-
for (const
|
|
1580
|
-
const
|
|
1581
|
-
if (P == null ||
|
|
1582
|
-
const
|
|
1583
|
-
if (
|
|
1584
|
-
const [
|
|
1585
|
-
let
|
|
1586
|
-
|
|
1587
|
-
n.getXValues(
|
|
1588
|
-
n.getYValues(
|
|
1589
|
-
n.getYValues(
|
|
1587
|
+
for (const g of o)
|
|
1588
|
+
L.set(`${g.group}-${g.index}`, g);
|
|
1589
|
+
for (const g of t.bandConfigs) {
|
|
1590
|
+
const w = e.getGroupXScaleKey(g.group), P = w != null ? e.getScale(w) : void 0, z = L.get(`${g.group}-${g.series[0]}`), T = L.get(`${g.group}-${g.series[1]}`);
|
|
1591
|
+
if (P == null || z == null || T == null) continue;
|
|
1592
|
+
const S = e.getScale(z.yScale);
|
|
1593
|
+
if (S == null) continue;
|
|
1594
|
+
const [C, v] = n.getWindow(g.group), I = g.series[0], D = g.series[1];
|
|
1595
|
+
let m = s.getCachedBandPath(g.group, I, D, C, v);
|
|
1596
|
+
m == null && (m = Vn(
|
|
1597
|
+
n.getXValues(g.group),
|
|
1598
|
+
n.getYValues(g.group, I),
|
|
1599
|
+
n.getYValues(g.group, D),
|
|
1590
1600
|
P,
|
|
1591
|
-
|
|
1601
|
+
S,
|
|
1592
1602
|
t.plotBox,
|
|
1593
1603
|
r,
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
) ?? void 0,
|
|
1604
|
+
C,
|
|
1605
|
+
v
|
|
1606
|
+
) ?? void 0, m != null && s.setCachedBandPath(g.group, I, D, C, v, m)), m != null && $n(c, g, m);
|
|
1597
1607
|
}
|
|
1598
|
-
for (const
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const P =
|
|
1602
|
-
_n(P == null ? void 0 : P.show,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
+
for (const g of b) {
|
|
1609
|
+
const w = g.config;
|
|
1610
|
+
if (w.show === !1) continue;
|
|
1611
|
+
const P = w.points, z = w.width ?? 1, T = (P == null ? void 0 : P.size) ?? 3 + z * 2, S = (P == null ? void 0 : P.space) ?? T * 2, [C, v] = g.window;
|
|
1612
|
+
_n(P == null ? void 0 : P.show, w.group, w.index, C, v, t.plotBox.width, S) && Hn(
|
|
1613
|
+
c,
|
|
1614
|
+
g.dataX,
|
|
1615
|
+
g.dataY,
|
|
1616
|
+
g.xScale,
|
|
1617
|
+
g.yScale,
|
|
1608
1618
|
t.plotBox,
|
|
1609
1619
|
r,
|
|
1610
|
-
|
|
1611
|
-
|
|
1620
|
+
C,
|
|
1621
|
+
v,
|
|
1612
1622
|
P,
|
|
1613
1623
|
T,
|
|
1614
|
-
(typeof
|
|
1624
|
+
(typeof w.stroke == "string" ? w.stroke : null) ?? "#000"
|
|
1615
1625
|
);
|
|
1616
1626
|
}
|
|
1617
|
-
if (
|
|
1618
|
-
|
|
1627
|
+
if (c.restore(), t.drawHooks.size > 0) {
|
|
1628
|
+
c.save(), c.beginPath(), c.rect(
|
|
1619
1629
|
t.plotBox.left * r,
|
|
1620
1630
|
t.plotBox.top * r,
|
|
1621
1631
|
t.plotBox.width * r,
|
|
1622
1632
|
t.plotBox.height * r
|
|
1623
|
-
),
|
|
1624
|
-
const
|
|
1625
|
-
for (const
|
|
1633
|
+
), c.clip(), c.scale(r, r);
|
|
1634
|
+
const g = Bt(c, t.plotBox, r, d);
|
|
1635
|
+
for (const w of t.drawHooks)
|
|
1626
1636
|
try {
|
|
1627
|
-
|
|
1637
|
+
w(g);
|
|
1628
1638
|
} catch (P) {
|
|
1629
1639
|
console.warn("[uPlot+] draw hook error:", P);
|
|
1630
1640
|
}
|
|
1631
|
-
|
|
1641
|
+
c.restore();
|
|
1632
1642
|
}
|
|
1633
|
-
if (t.cursorManager.state.left >= 0 && (s.saveSnapshot(
|
|
1643
|
+
if (t.cursorManager.state.left >= 0 && (s.saveSnapshot(c, i * r, l * r), t.cursorManager.update(
|
|
1634
1644
|
t.cursorManager.state.left,
|
|
1635
1645
|
t.cursorManager.state.top,
|
|
1636
1646
|
t.plotBox,
|
|
1637
1647
|
n.data,
|
|
1638
1648
|
o,
|
|
1639
|
-
|
|
1640
|
-
(
|
|
1641
|
-
(
|
|
1649
|
+
d,
|
|
1650
|
+
(g) => n.getWindow(g),
|
|
1651
|
+
(g) => e.getGroupXScaleKey(g)
|
|
1642
1652
|
)), ae(
|
|
1643
|
-
|
|
1653
|
+
c,
|
|
1644
1654
|
t.cursorManager.state,
|
|
1645
1655
|
t.plotBox,
|
|
1646
1656
|
r,
|
|
1647
1657
|
n.data,
|
|
1648
1658
|
o,
|
|
1649
|
-
|
|
1650
|
-
(
|
|
1651
|
-
), ce(
|
|
1652
|
-
|
|
1653
|
-
const
|
|
1654
|
-
for (const
|
|
1659
|
+
d,
|
|
1660
|
+
(g) => e.getGroupXScaleKey(g)
|
|
1661
|
+
), ce(c, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
|
|
1662
|
+
c.save(), c.scale(r, r);
|
|
1663
|
+
const g = Bt(c, t.plotBox, r, d);
|
|
1664
|
+
for (const w of t.cursorDrawHooks)
|
|
1655
1665
|
try {
|
|
1656
|
-
|
|
1666
|
+
w(g, t.cursorManager.state);
|
|
1657
1667
|
} catch (P) {
|
|
1658
1668
|
console.warn("[uPlot+] draw hook error:", P);
|
|
1659
1669
|
}
|
|
1660
|
-
|
|
1670
|
+
c.restore();
|
|
1661
1671
|
}
|
|
1662
|
-
for (const
|
|
1672
|
+
for (const g of t.listeners) g();
|
|
1663
1673
|
if (t._prevScaleRanges.size > 0 && t.eventCallbacks.onScaleChange != null)
|
|
1664
|
-
for (const
|
|
1665
|
-
if (
|
|
1666
|
-
const
|
|
1667
|
-
if (
|
|
1674
|
+
for (const g of e.getAllScales()) {
|
|
1675
|
+
if (g.min == null || g.max == null) continue;
|
|
1676
|
+
const w = t._prevScaleRanges.get(g.id);
|
|
1677
|
+
if (w == null || w.min !== g.min || w.max !== g.max)
|
|
1668
1678
|
try {
|
|
1669
|
-
t.eventCallbacks.onScaleChange(
|
|
1679
|
+
t.eventCallbacks.onScaleChange(g.id, g.min, g.max);
|
|
1670
1680
|
} catch (P) {
|
|
1671
1681
|
console.warn("[uPlot+] event callback error:", P);
|
|
1672
1682
|
}
|
|
1673
1683
|
}
|
|
1674
1684
|
t._prevScaleRanges.clear();
|
|
1675
|
-
for (const
|
|
1676
|
-
|
|
1685
|
+
for (const g of e.getAllScales())
|
|
1686
|
+
g.min != null && g.max != null && t._prevScaleRanges.set(g.id, { min: g.min, max: g.max });
|
|
1677
1687
|
}
|
|
1678
1688
|
};
|
|
1679
1689
|
return t.scheduler.onRedraw(() => t.redraw()), t;
|
|
@@ -1691,15 +1701,15 @@ function En() {
|
|
|
1691
1701
|
const t = E(null);
|
|
1692
1702
|
return t.current === null && (t.current = Bn()), t.current;
|
|
1693
1703
|
}
|
|
1694
|
-
const ke =
|
|
1695
|
-
function
|
|
1704
|
+
const ke = ze(null);
|
|
1705
|
+
function lt() {
|
|
1696
1706
|
const t = Le(ke);
|
|
1697
1707
|
if (!t)
|
|
1698
1708
|
throw new Error("useChart must be used within a <Chart> component");
|
|
1699
1709
|
return t;
|
|
1700
1710
|
}
|
|
1701
1711
|
function Xn(t, e) {
|
|
1702
|
-
|
|
1712
|
+
K(() => {
|
|
1703
1713
|
if (e != null)
|
|
1704
1714
|
return Yn(t, e);
|
|
1705
1715
|
}, [t, e]);
|
|
@@ -1708,103 +1718,103 @@ function Yn(t, e) {
|
|
|
1708
1718
|
let n = null;
|
|
1709
1719
|
const s = { show: !1, left: 0, top: 0, width: 0, height: 0 };
|
|
1710
1720
|
let o = null, i = null, l = !1;
|
|
1711
|
-
function r(
|
|
1712
|
-
const
|
|
1713
|
-
return { cx:
|
|
1721
|
+
function r(m) {
|
|
1722
|
+
const p = e.getBoundingClientRect(), M = t.plotBox, k = m.clientX - p.left - M.left, y = m.clientY - p.top - M.top;
|
|
1723
|
+
return { cx: k, cy: y };
|
|
1714
1724
|
}
|
|
1715
|
-
function a(
|
|
1716
|
-
const
|
|
1717
|
-
return
|
|
1725
|
+
function a(m, p) {
|
|
1726
|
+
const M = t.plotBox;
|
|
1727
|
+
return m >= 0 && m <= M.width && p >= 0 && p <= M.height;
|
|
1718
1728
|
}
|
|
1719
|
-
function
|
|
1720
|
-
const
|
|
1729
|
+
function u(m, p) {
|
|
1730
|
+
const M = e.getBoundingClientRect(), k = m - M.left, y = p - M.top, A = t.plotBox;
|
|
1721
1731
|
for (const F of t.axisStates) {
|
|
1722
|
-
const R = F.config,
|
|
1732
|
+
const R = F.config, G = R.side;
|
|
1723
1733
|
if (F._size <= 0) continue;
|
|
1724
|
-
const B =
|
|
1725
|
-
if (
|
|
1726
|
-
const
|
|
1727
|
-
return { scaleId: R.scale, ori:
|
|
1734
|
+
const B = y >= A.top && y <= A.top + A.height, W = k >= A.left && k <= A.left + A.width;
|
|
1735
|
+
if (G === U.Left && k < A.left && B || G === U.Right && k > A.left + A.width && B || G === U.Top && y < A.top && W || G === U.Bottom && y > A.top + A.height && W) {
|
|
1736
|
+
const j = xt(G);
|
|
1737
|
+
return { scaleId: R.scale, ori: j };
|
|
1728
1738
|
}
|
|
1729
1739
|
}
|
|
1730
1740
|
return null;
|
|
1731
1741
|
}
|
|
1732
|
-
function
|
|
1733
|
-
const
|
|
1734
|
-
let
|
|
1735
|
-
if (
|
|
1736
|
-
const A = t.dataStore.data[
|
|
1742
|
+
function c(m, p, M) {
|
|
1743
|
+
const k = t.cursorManager.state;
|
|
1744
|
+
let y = null;
|
|
1745
|
+
if (k.activeGroup >= 0 && k.activeDataIdx >= 0) {
|
|
1746
|
+
const A = t.dataStore.data[k.activeGroup];
|
|
1737
1747
|
if (A != null) {
|
|
1738
|
-
const F = A.x[
|
|
1739
|
-
if (F != null &&
|
|
1740
|
-
const
|
|
1741
|
-
(
|
|
1742
|
-
),
|
|
1743
|
-
let
|
|
1744
|
-
(W == null ? void 0 : W.min) != null && W.max != null && (
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
group:
|
|
1748
|
-
seriesIdx:
|
|
1749
|
-
dataIdx:
|
|
1748
|
+
const F = A.x[k.activeDataIdx], R = A.series[k.activeSeriesIdx], G = R != null ? R[k.activeDataIdx] : void 0;
|
|
1749
|
+
if (F != null && G != null) {
|
|
1750
|
+
const H = t.plotBox, B = t.scaleManager.getGroupXScaleKey(k.activeGroup), W = B != null ? t.scaleManager.getScale(B) : void 0, Y = t.seriesConfigs.find(
|
|
1751
|
+
(qt) => qt.group === k.activeGroup && qt.index === k.activeSeriesIdx
|
|
1752
|
+
), j = Y != null ? t.scaleManager.getScale(Y.yScale) : void 0;
|
|
1753
|
+
let st = p, Ht = M;
|
|
1754
|
+
(W == null ? void 0 : W.min) != null && W.max != null && (st = $(F, W, H.width, H.left) - H.left), (j == null ? void 0 : j.min) != null && j.max != null && (Ht = $(G, j, H.height, H.top) - H.top);
|
|
1755
|
+
const Nt = p - st, jt = M - Ht;
|
|
1756
|
+
y = {
|
|
1757
|
+
group: k.activeGroup,
|
|
1758
|
+
seriesIdx: k.activeSeriesIdx,
|
|
1759
|
+
dataIdx: k.activeDataIdx,
|
|
1750
1760
|
xVal: F,
|
|
1751
|
-
yVal:
|
|
1752
|
-
pxX:
|
|
1753
|
-
pxY:
|
|
1754
|
-
dist: Math.sqrt(
|
|
1761
|
+
yVal: G,
|
|
1762
|
+
pxX: st,
|
|
1763
|
+
pxY: Ht,
|
|
1764
|
+
dist: Math.sqrt(Nt * Nt + jt * jt)
|
|
1755
1765
|
};
|
|
1756
1766
|
}
|
|
1757
1767
|
}
|
|
1758
1768
|
}
|
|
1759
|
-
return { plotX:
|
|
1769
|
+
return { plotX: p, plotY: M, point: y, srcEvent: m };
|
|
1760
1770
|
}
|
|
1761
|
-
function
|
|
1762
|
-
const
|
|
1771
|
+
function h(m) {
|
|
1772
|
+
const p = t.plotBox, M = m.left / p.width, k = (m.left + m.width) / p.width, y = {};
|
|
1763
1773
|
for (const A of t.scaleManager.getAllScales()) {
|
|
1764
|
-
if (A.ori !==
|
|
1765
|
-
const F =
|
|
1766
|
-
|
|
1774
|
+
if (A.ori !== V.Horizontal || A.min == null || A.max == null) continue;
|
|
1775
|
+
const F = rt(
|
|
1776
|
+
p.left + M * p.width,
|
|
1767
1777
|
A,
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
), R =
|
|
1771
|
-
|
|
1778
|
+
p.width,
|
|
1779
|
+
p.left
|
|
1780
|
+
), R = rt(
|
|
1781
|
+
p.left + k * p.width,
|
|
1772
1782
|
A,
|
|
1773
|
-
|
|
1774
|
-
|
|
1783
|
+
p.width,
|
|
1784
|
+
p.left
|
|
1775
1785
|
);
|
|
1776
|
-
|
|
1786
|
+
y[A.id] = {
|
|
1777
1787
|
min: Math.min(F, R),
|
|
1778
1788
|
max: Math.max(F, R)
|
|
1779
1789
|
};
|
|
1780
1790
|
}
|
|
1781
|
-
return { left:
|
|
1791
|
+
return { left: M, right: k, ranges: y };
|
|
1782
1792
|
}
|
|
1783
1793
|
function f() {
|
|
1784
|
-
const
|
|
1785
|
-
if (
|
|
1786
|
-
for (const
|
|
1787
|
-
if (
|
|
1788
|
-
const
|
|
1789
|
-
(
|
|
1794
|
+
const m = t.eventCallbacks.onScaleChange;
|
|
1795
|
+
if (m != null)
|
|
1796
|
+
for (const p of t.scaleManager.getAllScales()) {
|
|
1797
|
+
if (p.min == null || p.max == null) continue;
|
|
1798
|
+
const M = t._prevScaleRanges.get(p.id);
|
|
1799
|
+
(M == null || M.min !== p.min || M.max !== p.max) && m(p.id, p.min, p.max);
|
|
1790
1800
|
}
|
|
1791
1801
|
}
|
|
1792
|
-
function
|
|
1802
|
+
function d(m, p) {
|
|
1793
1803
|
if (i != null) {
|
|
1794
|
-
const A = e.getBoundingClientRect(), F =
|
|
1795
|
-
B != null && (B.min = i.startMin +
|
|
1804
|
+
const A = e.getBoundingClientRect(), F = m.clientY - A.top, R = t.plotBox, G = (F - i.startY) / R.height, H = i.startMax - i.startMin, B = t.scaleManager.getScale(i.scaleId);
|
|
1805
|
+
B != null && (B.min = i.startMin + G * H, B.max = i.startMax + G * H, B.auto = !1, ct(B), t.renderer.clearCache(), t.scheduleRedraw());
|
|
1796
1806
|
return;
|
|
1797
1807
|
}
|
|
1798
|
-
const
|
|
1799
|
-
if (
|
|
1800
|
-
const { cx:
|
|
1801
|
-
if (!a(
|
|
1808
|
+
const M = r(m);
|
|
1809
|
+
if (M == null) return;
|
|
1810
|
+
const { cx: k, cy: y } = M;
|
|
1811
|
+
if (!a(k, y) && n == null) {
|
|
1802
1812
|
t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw();
|
|
1803
1813
|
return;
|
|
1804
1814
|
}
|
|
1805
1815
|
if (t.cursorManager.update(
|
|
1806
|
-
y,
|
|
1807
1816
|
k,
|
|
1817
|
+
y,
|
|
1808
1818
|
t.plotBox,
|
|
1809
1819
|
t.dataStore.data,
|
|
1810
1820
|
t.seriesConfigs,
|
|
@@ -1820,41 +1830,41 @@ function Yn(t, e) {
|
|
|
1820
1830
|
F >= 0 && t.focusedSeries !== F && (t.focusedSeries = F, t.scheduleRedraw());
|
|
1821
1831
|
}
|
|
1822
1832
|
}
|
|
1823
|
-
if (
|
|
1833
|
+
if (p != null && t.eventCallbacks.onCursorMove != null && a(k, y))
|
|
1824
1834
|
try {
|
|
1825
|
-
t.eventCallbacks.onCursorMove(
|
|
1835
|
+
t.eventCallbacks.onCursorMove(c(p, k, y));
|
|
1826
1836
|
} catch (A) {
|
|
1827
1837
|
console.warn("[uPlot+] event callback error:", A);
|
|
1828
1838
|
}
|
|
1829
1839
|
if (n != null) {
|
|
1830
|
-
const A = n.x, F = t.plotBox, R = Math.max(0, Math.min(
|
|
1840
|
+
const A = n.x, F = t.plotBox, R = Math.max(0, Math.min(k, F.width));
|
|
1831
1841
|
s.show = !0, s.left = Math.min(A, R), s.top = 0, s.width = Math.abs(R - A), s.height = F.height, t.selectState = s;
|
|
1832
1842
|
}
|
|
1833
1843
|
n != null ? t.scheduler.mark(tt.Cursor | tt.Select) : t.scheduleCursorRedraw();
|
|
1834
1844
|
}
|
|
1835
|
-
function
|
|
1836
|
-
|
|
1845
|
+
function x(m) {
|
|
1846
|
+
d(m, m);
|
|
1837
1847
|
}
|
|
1838
|
-
function
|
|
1839
|
-
if (
|
|
1840
|
-
const
|
|
1841
|
-
if (
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1844
|
-
const
|
|
1848
|
+
function b(m) {
|
|
1849
|
+
if (m.button !== 0) return;
|
|
1850
|
+
const p = u(m.clientX, m.clientY);
|
|
1851
|
+
if (p != null && p.ori === V.Vertical) {
|
|
1852
|
+
const k = t.scaleManager.getScale(p.scaleId);
|
|
1853
|
+
if (k != null && k.min != null && k.max != null) {
|
|
1854
|
+
const y = e.getBoundingClientRect();
|
|
1845
1855
|
i = {
|
|
1846
|
-
scaleId:
|
|
1847
|
-
startY:
|
|
1848
|
-
startMin:
|
|
1849
|
-
startMax:
|
|
1850
|
-
},
|
|
1856
|
+
scaleId: p.scaleId,
|
|
1857
|
+
startY: m.clientY - y.top,
|
|
1858
|
+
startMin: k.min,
|
|
1859
|
+
startMax: k.max
|
|
1860
|
+
}, m.preventDefault();
|
|
1851
1861
|
return;
|
|
1852
1862
|
}
|
|
1853
1863
|
}
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1864
|
+
const M = r(m);
|
|
1865
|
+
M != null && a(M.cx, M.cy) && (n = { x: M.cx, y: M.cy }, l = !1, s.show = !1, s.left = 0, s.width = 0, t.selectState = s);
|
|
1856
1866
|
}
|
|
1857
|
-
function L(
|
|
1867
|
+
function L(m) {
|
|
1858
1868
|
if (i != null) {
|
|
1859
1869
|
f(), i = null;
|
|
1860
1870
|
return;
|
|
@@ -1862,159 +1872,180 @@ function Yn(t, e) {
|
|
|
1862
1872
|
if (n != null) {
|
|
1863
1873
|
if (s.width > 5) {
|
|
1864
1874
|
l = !0;
|
|
1865
|
-
let
|
|
1875
|
+
let p = !0;
|
|
1866
1876
|
if (t.eventCallbacks.onSelect != null) {
|
|
1867
|
-
const
|
|
1868
|
-
let
|
|
1877
|
+
const M = h(s);
|
|
1878
|
+
let k;
|
|
1869
1879
|
try {
|
|
1870
|
-
|
|
1871
|
-
} catch (
|
|
1872
|
-
console.warn("[uPlot+] event callback error:",
|
|
1880
|
+
k = t.eventCallbacks.onSelect(M);
|
|
1881
|
+
} catch (y) {
|
|
1882
|
+
console.warn("[uPlot+] event callback error:", y);
|
|
1873
1883
|
}
|
|
1874
|
-
|
|
1884
|
+
k === !1 && (p = !1);
|
|
1875
1885
|
}
|
|
1876
|
-
|
|
1886
|
+
p && (C(s), f());
|
|
1877
1887
|
}
|
|
1878
1888
|
n = null, s.show = !1, s.left = 0, s.width = 0, t.selectState = s, t.scheduleRedraw();
|
|
1879
1889
|
}
|
|
1880
1890
|
}
|
|
1881
|
-
function
|
|
1891
|
+
function g(m) {
|
|
1882
1892
|
L();
|
|
1883
1893
|
}
|
|
1884
|
-
function
|
|
1894
|
+
function w(m) {
|
|
1885
1895
|
if (l) {
|
|
1886
1896
|
l = !1;
|
|
1887
1897
|
return;
|
|
1888
1898
|
}
|
|
1889
|
-
const
|
|
1890
|
-
if (
|
|
1891
|
-
const
|
|
1892
|
-
if (
|
|
1899
|
+
const p = t.eventCallbacks.onClick;
|
|
1900
|
+
if (p == null) return;
|
|
1901
|
+
const M = r(m);
|
|
1902
|
+
if (M != null && a(M.cx, M.cy))
|
|
1893
1903
|
try {
|
|
1894
|
-
|
|
1895
|
-
} catch (
|
|
1896
|
-
console.warn("[uPlot+] event callback error:",
|
|
1904
|
+
p(c(m, M.cx, M.cy));
|
|
1905
|
+
} catch (k) {
|
|
1906
|
+
console.warn("[uPlot+] event callback error:", k);
|
|
1897
1907
|
}
|
|
1898
1908
|
}
|
|
1899
|
-
function P(
|
|
1900
|
-
const
|
|
1901
|
-
if (
|
|
1902
|
-
const
|
|
1903
|
-
if (
|
|
1904
|
-
|
|
1909
|
+
function P(m) {
|
|
1910
|
+
const p = t.eventCallbacks.onContextMenu;
|
|
1911
|
+
if (p == null) return;
|
|
1912
|
+
const M = r(m);
|
|
1913
|
+
if (M != null && a(M.cx, M.cy)) {
|
|
1914
|
+
m.preventDefault();
|
|
1905
1915
|
try {
|
|
1906
|
-
|
|
1907
|
-
} catch (
|
|
1908
|
-
console.warn("[uPlot+] event callback error:",
|
|
1916
|
+
p(c(m, M.cx, M.cy));
|
|
1917
|
+
} catch (k) {
|
|
1918
|
+
console.warn("[uPlot+] event callback error:", k);
|
|
1909
1919
|
}
|
|
1910
1920
|
}
|
|
1911
1921
|
}
|
|
1912
|
-
function
|
|
1913
|
-
var
|
|
1922
|
+
function z(m) {
|
|
1923
|
+
var p, M;
|
|
1914
1924
|
t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), n != null && (n = null, s.show = !1, s.width = 0, t.selectState = s), i != null && (i = null), t.scheduleCursorRedraw();
|
|
1915
1925
|
try {
|
|
1916
|
-
(
|
|
1917
|
-
} catch (
|
|
1918
|
-
console.warn("[uPlot+] event callback error:",
|
|
1926
|
+
(M = (p = t.eventCallbacks).onCursorLeave) == null || M.call(p);
|
|
1927
|
+
} catch (k) {
|
|
1928
|
+
console.warn("[uPlot+] event callback error:", k);
|
|
1919
1929
|
}
|
|
1920
1930
|
}
|
|
1921
|
-
function T(
|
|
1931
|
+
function T(m) {
|
|
1922
1932
|
if (t.eventCallbacks.onDblClick != null) {
|
|
1923
|
-
const
|
|
1924
|
-
if (
|
|
1925
|
-
let
|
|
1933
|
+
const p = r(m);
|
|
1934
|
+
if (p != null && a(p.cx, p.cy)) {
|
|
1935
|
+
let M;
|
|
1926
1936
|
try {
|
|
1927
|
-
|
|
1928
|
-
} catch (
|
|
1929
|
-
console.warn("[uPlot+] event callback error:",
|
|
1937
|
+
M = t.eventCallbacks.onDblClick(c(m, p.cx, p.cy));
|
|
1938
|
+
} catch (k) {
|
|
1939
|
+
console.warn("[uPlot+] event callback error:", k);
|
|
1930
1940
|
}
|
|
1931
|
-
if (
|
|
1941
|
+
if (M === !1)
|
|
1932
1942
|
return;
|
|
1933
1943
|
}
|
|
1934
1944
|
}
|
|
1935
|
-
for (const
|
|
1936
|
-
t.scaleManager.addScale(
|
|
1945
|
+
for (const p of t.scaleConfigs)
|
|
1946
|
+
t.scaleManager.addScale(p);
|
|
1937
1947
|
t.renderer.clearCache(), t.scheduleRedraw();
|
|
1938
1948
|
}
|
|
1939
|
-
function
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
p
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
+
function S(m) {
|
|
1950
|
+
const p = t.wheelZoom;
|
|
1951
|
+
if (!p) return;
|
|
1952
|
+
let M = !1, k = !1;
|
|
1953
|
+
if (p === !0 || p === "x")
|
|
1954
|
+
M = !0;
|
|
1955
|
+
else if (p === "y")
|
|
1956
|
+
k = !0;
|
|
1957
|
+
else if (p === "xy")
|
|
1958
|
+
M = !0, k = !0;
|
|
1959
|
+
else if (typeof p == "object") {
|
|
1960
|
+
if (p.x) {
|
|
1961
|
+
const R = typeof p.x == "object" ? p.x.key : void 0;
|
|
1962
|
+
M = R == null || m[`${R}Key`];
|
|
1963
|
+
}
|
|
1964
|
+
if (p.y) {
|
|
1965
|
+
const R = typeof p.y == "object" ? p.y.key : void 0;
|
|
1966
|
+
k = R == null || m[`${R}Key`];
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
if (!M && !k) return;
|
|
1970
|
+
const y = r(m);
|
|
1971
|
+
if (y == null || !a(y.cx, y.cy)) return;
|
|
1972
|
+
m.preventDefault();
|
|
1973
|
+
const A = Math.max(0.1, Math.min(10, 1 - m.deltaY * 1e-3)), F = t.plotBox;
|
|
1974
|
+
for (const R of t.scaleManager.getAllScales()) {
|
|
1975
|
+
if (R.min == null || R.max == null) continue;
|
|
1976
|
+
const G = R.ori === V.Horizontal;
|
|
1977
|
+
if (G && !M || !G && !k) continue;
|
|
1978
|
+
const H = G ? F.width : F.height, B = G ? F.left : F.top, W = G ? y.cx + F.left : y.cy + F.top, Y = rt(W, R, H, B), j = Y - (Y - R.min) * A, st = Y + (R.max - Y) * A;
|
|
1979
|
+
R.min = Math.min(j, st), R.max = Math.max(j, st), R.auto = !1, ct(R);
|
|
1949
1980
|
}
|
|
1950
1981
|
t.renderer.clearCache(), t.scheduleRedraw(), f();
|
|
1951
1982
|
}
|
|
1952
|
-
function
|
|
1953
|
-
const
|
|
1954
|
-
for (const
|
|
1955
|
-
if (
|
|
1956
|
-
const A =
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
), F =
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1983
|
+
function C(m) {
|
|
1984
|
+
const p = t.plotBox, M = m.left / p.width, k = (m.left + m.width) / p.width;
|
|
1985
|
+
for (const y of t.scaleManager.getAllScales()) {
|
|
1986
|
+
if (y.ori !== V.Horizontal || y.min == null || y.max == null) continue;
|
|
1987
|
+
const A = rt(
|
|
1988
|
+
p.left + M * p.width,
|
|
1989
|
+
y,
|
|
1990
|
+
p.width,
|
|
1991
|
+
p.left
|
|
1992
|
+
), F = rt(
|
|
1993
|
+
p.left + k * p.width,
|
|
1994
|
+
y,
|
|
1995
|
+
p.width,
|
|
1996
|
+
p.left
|
|
1966
1997
|
);
|
|
1967
|
-
|
|
1998
|
+
y.min = Math.min(A, F), y.max = Math.max(A, F), y.auto = !1, ct(y);
|
|
1968
1999
|
}
|
|
1969
2000
|
t.renderer.clearCache();
|
|
1970
2001
|
}
|
|
1971
|
-
function
|
|
1972
|
-
if (
|
|
1973
|
-
const
|
|
2002
|
+
function v(m) {
|
|
2003
|
+
if (m.touches.length === 2) {
|
|
2004
|
+
const k = m.touches[0], y = m.touches[1], A = y.clientX - k.clientX, F = y.clientY - k.clientY;
|
|
1974
2005
|
o = {
|
|
1975
2006
|
dist: Math.sqrt(A * A + F * F),
|
|
1976
|
-
midX: (
|
|
1977
|
-
midY: (
|
|
2007
|
+
midX: (k.clientX + y.clientX) / 2,
|
|
2008
|
+
midY: (k.clientY + y.clientY) / 2
|
|
1978
2009
|
}, n = null;
|
|
1979
2010
|
return;
|
|
1980
2011
|
}
|
|
1981
|
-
const
|
|
1982
|
-
if (
|
|
1983
|
-
const
|
|
1984
|
-
|
|
2012
|
+
const p = m.touches[0];
|
|
2013
|
+
if (p == null) return;
|
|
2014
|
+
const M = r(p);
|
|
2015
|
+
M != null && a(M.cx, M.cy) && (n = { x: M.cx, y: M.cy }, l = !1);
|
|
1985
2016
|
}
|
|
1986
|
-
function
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
1989
|
-
const
|
|
2017
|
+
function I(m) {
|
|
2018
|
+
if (m.touches.length === 2 && o != null) {
|
|
2019
|
+
m.preventDefault();
|
|
2020
|
+
const M = m.touches[0], k = m.touches[1], y = k.clientX - M.clientX, A = k.clientY - M.clientY, F = Math.sqrt(y * y + A * A), R = F / o.dist, G = e.getBoundingClientRect(), H = t.plotBox, B = o.midX - G.left - H.left;
|
|
1990
2021
|
for (const W of t.scaleManager.getAllScales()) {
|
|
1991
|
-
if (W.ori !==
|
|
1992
|
-
const
|
|
1993
|
-
W.min = Math.min(
|
|
2022
|
+
if (W.ori !== V.Horizontal || W.min == null || W.max == null) continue;
|
|
2023
|
+
const Y = rt(B + H.left, W, H.width, H.left), j = Y - (Y - W.min) / R, st = Y + (W.max - Y) / R;
|
|
2024
|
+
W.min = Math.min(j, st), W.max = Math.max(j, st), W.auto = !1, ct(W);
|
|
1994
2025
|
}
|
|
1995
2026
|
o.dist = F, t.renderer.clearCache(), t.scheduleRedraw(), f();
|
|
1996
2027
|
return;
|
|
1997
2028
|
}
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2029
|
+
const p = m.touches[0];
|
|
2030
|
+
p != null && (d(p, m), n != null && m.preventDefault());
|
|
2000
2031
|
}
|
|
2001
|
-
function
|
|
2032
|
+
function D(m) {
|
|
2002
2033
|
if (o != null) {
|
|
2003
2034
|
o = null;
|
|
2004
2035
|
return;
|
|
2005
2036
|
}
|
|
2006
|
-
|
|
2037
|
+
m.changedTouches[0] != null && L();
|
|
2007
2038
|
}
|
|
2008
|
-
return e.addEventListener("mousemove",
|
|
2009
|
-
e.removeEventListener("mousemove",
|
|
2039
|
+
return e.addEventListener("mousemove", x), e.addEventListener("mousedown", b), e.addEventListener("mouseup", g), e.addEventListener("click", w), e.addEventListener("contextmenu", P), e.addEventListener("mouseleave", z), e.addEventListener("dblclick", T), e.addEventListener("wheel", S, { passive: !1 }), e.addEventListener("touchstart", v, { passive: !0 }), e.addEventListener("touchmove", I, { passive: !1 }), e.addEventListener("touchend", D), () => {
|
|
2040
|
+
e.removeEventListener("mousemove", x), e.removeEventListener("mousedown", b), e.removeEventListener("mouseup", g), e.removeEventListener("click", w), e.removeEventListener("contextmenu", P), e.removeEventListener("mouseleave", z), e.removeEventListener("dblclick", T), e.removeEventListener("wheel", S), e.removeEventListener("touchstart", v), e.removeEventListener("touchmove", I), e.removeEventListener("touchend", D);
|
|
2010
2041
|
};
|
|
2011
2042
|
}
|
|
2012
|
-
const
|
|
2013
|
-
function
|
|
2014
|
-
let e =
|
|
2015
|
-
return e == null && (e = new
|
|
2043
|
+
const Wt = /* @__PURE__ */ new Map();
|
|
2044
|
+
function Kn(t) {
|
|
2045
|
+
let e = Wt.get(t);
|
|
2046
|
+
return e == null && (e = new Un(t), Wt.set(t, e)), e;
|
|
2016
2047
|
}
|
|
2017
|
-
class
|
|
2048
|
+
class Un {
|
|
2018
2049
|
constructor(e) {
|
|
2019
2050
|
this.members = /* @__PURE__ */ new Set(), this.publishing = !1, this.syncedStores = /* @__PURE__ */ new WeakSet(), this.key = e;
|
|
2020
2051
|
}
|
|
@@ -2024,7 +2055,7 @@ class Kn {
|
|
|
2024
2055
|
}
|
|
2025
2056
|
/** Remove a chart from this sync group. Cleans up empty groups. */
|
|
2026
2057
|
leave(e) {
|
|
2027
|
-
this.members.delete(e), this.members.size === 0 &&
|
|
2058
|
+
this.members.delete(e), this.members.size === 0 && Wt.delete(this.key);
|
|
2028
2059
|
}
|
|
2029
2060
|
/**
|
|
2030
2061
|
* Publish cursor position from one chart to all others in the group.
|
|
@@ -2055,9 +2086,9 @@ class Kn {
|
|
|
2055
2086
|
}
|
|
2056
2087
|
}
|
|
2057
2088
|
function Nn(t, e) {
|
|
2058
|
-
|
|
2089
|
+
K(() => {
|
|
2059
2090
|
if (e == null) return;
|
|
2060
|
-
const n =
|
|
2091
|
+
const n = Kn(e);
|
|
2061
2092
|
n.join(t);
|
|
2062
2093
|
let s = -1, o = -1;
|
|
2063
2094
|
const i = t.subscribe(() => {
|
|
@@ -2076,77 +2107,78 @@ function Ce({
|
|
|
2076
2107
|
children: s,
|
|
2077
2108
|
className: o,
|
|
2078
2109
|
pxRatio: i,
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2110
|
+
title: l,
|
|
2111
|
+
onDraw: r,
|
|
2112
|
+
onCursorDraw: a,
|
|
2113
|
+
syncKey: u,
|
|
2082
2114
|
cursor: c,
|
|
2083
|
-
onClick:
|
|
2084
|
-
onContextMenu:
|
|
2085
|
-
onDblClick:
|
|
2086
|
-
onCursorMove:
|
|
2087
|
-
onCursorLeave:
|
|
2088
|
-
onScaleChange:
|
|
2089
|
-
onSelect:
|
|
2115
|
+
onClick: h,
|
|
2116
|
+
onContextMenu: f,
|
|
2117
|
+
onDblClick: d,
|
|
2118
|
+
onCursorMove: x,
|
|
2119
|
+
onCursorLeave: b,
|
|
2120
|
+
onScaleChange: L,
|
|
2121
|
+
onSelect: g
|
|
2090
2122
|
}) {
|
|
2091
|
-
var
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
}, [
|
|
2096
|
-
const
|
|
2097
|
-
|
|
2098
|
-
}, [
|
|
2099
|
-
|
|
2123
|
+
var k;
|
|
2124
|
+
const w = En(), [P, z] = St(null), T = i ?? (typeof window < "u" && window.devicePixelRatio || 1), S = c == null ? void 0 : c.wheelZoom, C = typeof S == "object" ? JSON.stringify(S) : S, v = ((k = c == null ? void 0 : c.focus) == null ? void 0 : k.alpha) ?? ((c == null ? void 0 : c.focus) != null ? 0.15 : 1);
|
|
2125
|
+
K(() => {
|
|
2126
|
+
w.wheelZoom = S, w.focusAlpha = v;
|
|
2127
|
+
}, [w, C, v]), w.title = l, w.eventCallbacks.onClick = h, w.eventCallbacks.onContextMenu = f, w.eventCallbacks.onDblClick = d, w.eventCallbacks.onCursorMove = x, w.eventCallbacks.onCursorLeave = b, w.eventCallbacks.onScaleChange = L, w.eventCallbacks.onSelect = g, Xn(w, P), Nn(w, u);
|
|
2128
|
+
const I = Z((y) => {
|
|
2129
|
+
w.canvas = y, y && w.scheduleRedraw();
|
|
2130
|
+
}, [w]), D = Z((y) => {
|
|
2131
|
+
z(y);
|
|
2100
2132
|
}, []);
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
}, [
|
|
2104
|
-
|
|
2105
|
-
}, [
|
|
2106
|
-
if (
|
|
2107
|
-
const
|
|
2108
|
-
const
|
|
2109
|
-
if (
|
|
2110
|
-
const { width:
|
|
2111
|
-
|
|
2133
|
+
K(() => {
|
|
2134
|
+
w.pxRatio = T, w.setSize(t, e);
|
|
2135
|
+
}, [w, t, e, T]), K(() => () => {
|
|
2136
|
+
w.canvas = null, w.scheduler.cancel(), w.focusedSeries = null;
|
|
2137
|
+
}, [w]), K(() => {
|
|
2138
|
+
if (P == null || typeof ResizeObserver > "u") return;
|
|
2139
|
+
const y = new ResizeObserver((A) => {
|
|
2140
|
+
const F = A[0];
|
|
2141
|
+
if (F == null) return;
|
|
2142
|
+
const { width: R, height: G } = F.contentRect;
|
|
2143
|
+
R > 0 && G > 0 && (R !== w.width || G !== w.height) && w.setSize(Math.round(R), Math.round(G));
|
|
2112
2144
|
});
|
|
2113
|
-
return
|
|
2114
|
-
|
|
2145
|
+
return y.observe(P), () => {
|
|
2146
|
+
y.disconnect();
|
|
2115
2147
|
};
|
|
2116
|
-
}, [
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
if (n ===
|
|
2120
|
-
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2123
|
-
id:
|
|
2148
|
+
}, [w, P]);
|
|
2149
|
+
const m = E(n);
|
|
2150
|
+
K(() => {
|
|
2151
|
+
if (n === m.current && w.dataStore.data.length > 0) return;
|
|
2152
|
+
m.current = n, w.dataStore.setData(n), w.renderer.clearCache();
|
|
2153
|
+
const y = "x";
|
|
2154
|
+
w.scaleManager.getScale(y) || w.registerScale({
|
|
2155
|
+
id: y,
|
|
2124
2156
|
auto: !0
|
|
2125
2157
|
});
|
|
2126
|
-
for (let
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
}, [
|
|
2130
|
-
const
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
var
|
|
2134
|
-
(
|
|
2158
|
+
for (let A = 0; A < n.length; A++)
|
|
2159
|
+
w.scaleManager.setGroupXScale(A, y);
|
|
2160
|
+
w.scheduleRedraw();
|
|
2161
|
+
}, [w, n]);
|
|
2162
|
+
const p = E(r);
|
|
2163
|
+
p.current = r, K(() => {
|
|
2164
|
+
const y = (A) => {
|
|
2165
|
+
var F;
|
|
2166
|
+
(F = p.current) == null || F.call(p, A);
|
|
2135
2167
|
};
|
|
2136
|
-
return
|
|
2137
|
-
|
|
2168
|
+
return w.drawHooks.add(y), () => {
|
|
2169
|
+
w.drawHooks.delete(y);
|
|
2138
2170
|
};
|
|
2139
|
-
}, [
|
|
2140
|
-
const
|
|
2141
|
-
return
|
|
2142
|
-
const
|
|
2143
|
-
var
|
|
2144
|
-
(
|
|
2171
|
+
}, [w]);
|
|
2172
|
+
const M = E(a);
|
|
2173
|
+
return M.current = a, K(() => {
|
|
2174
|
+
const y = (A, F) => {
|
|
2175
|
+
var R;
|
|
2176
|
+
(R = M.current) == null || R.call(M, A, F);
|
|
2145
2177
|
};
|
|
2146
|
-
return
|
|
2147
|
-
|
|
2178
|
+
return w.cursorDrawHooks.add(y), () => {
|
|
2179
|
+
w.cursorDrawHooks.delete(y);
|
|
2148
2180
|
};
|
|
2149
|
-
}, [
|
|
2181
|
+
}, [w]), /* @__PURE__ */ X(ke.Provider, { value: w, children: /* @__PURE__ */ Q(
|
|
2150
2182
|
"div",
|
|
2151
2183
|
{
|
|
2152
2184
|
className: o,
|
|
@@ -2160,7 +2192,7 @@ function Ce({
|
|
|
2160
2192
|
/* @__PURE__ */ X(
|
|
2161
2193
|
"div",
|
|
2162
2194
|
{
|
|
2163
|
-
ref:
|
|
2195
|
+
ref: D,
|
|
2164
2196
|
style: {
|
|
2165
2197
|
position: "relative",
|
|
2166
2198
|
width: `${t}px`,
|
|
@@ -2171,7 +2203,7 @@ function Ce({
|
|
|
2171
2203
|
children: /* @__PURE__ */ X(
|
|
2172
2204
|
"canvas",
|
|
2173
2205
|
{
|
|
2174
|
-
ref:
|
|
2206
|
+
ref: I,
|
|
2175
2207
|
style: {
|
|
2176
2208
|
position: "absolute",
|
|
2177
2209
|
left: 0,
|
|
@@ -2211,30 +2243,30 @@ function Ut(t, e) {
|
|
|
2211
2243
|
return !0;
|
|
2212
2244
|
}
|
|
2213
2245
|
function Lt(t) {
|
|
2214
|
-
const e =
|
|
2215
|
-
n.current = t,
|
|
2246
|
+
const e = lt(), n = E(t);
|
|
2247
|
+
n.current = t, K(() => {
|
|
2216
2248
|
const o = n.current;
|
|
2217
2249
|
return e.registerScale({ ...o }), e.scheduleRedraw(), () => {
|
|
2218
2250
|
e.unregisterScale(o.id), e.scheduleRedraw();
|
|
2219
2251
|
};
|
|
2220
2252
|
}, [e, t.id]);
|
|
2221
2253
|
const s = E(null);
|
|
2222
|
-
return
|
|
2254
|
+
return K(() => {
|
|
2223
2255
|
Ut(s.current, t) || (s.current = t, e.scaleConfigs = e.scaleConfigs.map(
|
|
2224
2256
|
(o) => o.id === t.id ? { ...t } : o
|
|
2225
2257
|
), e.scaleManager.addScale({ ...t }), e.renderer.clearCache(), e.scheduleRedraw());
|
|
2226
2258
|
}), null;
|
|
2227
2259
|
}
|
|
2228
2260
|
function Te(t) {
|
|
2229
|
-
const e =
|
|
2230
|
-
n.current = t,
|
|
2261
|
+
const e = lt(), n = E(t);
|
|
2262
|
+
n.current = t, K(() => {
|
|
2231
2263
|
const o = n.current;
|
|
2232
2264
|
return e.registerSeries({ ...o, show: o.show ?? !0 }), e.renderer.clearCache(), e.scheduleRedraw(), () => {
|
|
2233
2265
|
e.unregisterSeries(o.group, o.index), e.renderer.clearCache(), e.scheduleRedraw();
|
|
2234
2266
|
};
|
|
2235
2267
|
}, [e, t.group, t.index]);
|
|
2236
2268
|
const s = E(null);
|
|
2237
|
-
return
|
|
2269
|
+
return K(() => {
|
|
2238
2270
|
Ut(s.current, t) || (s.current = t, e.seriesConfigs = e.seriesConfigs.map(
|
|
2239
2271
|
(o) => o.group === t.group && o.index === t.index ? { ...t, show: t.show ?? !0 } : o
|
|
2240
2272
|
), e.renderer.invalidateSeries(t.group, t.index), e.scheduleRedraw());
|
|
@@ -2243,9 +2275,9 @@ function Te(t) {
|
|
|
2243
2275
|
function qn(t) {
|
|
2244
2276
|
return { ...t, side: t.side ?? (t.scale === "x" ? U.Bottom : U.Left), show: t.show ?? !0 };
|
|
2245
2277
|
}
|
|
2246
|
-
function
|
|
2247
|
-
const e =
|
|
2248
|
-
s.current = n,
|
|
2278
|
+
function zt(t) {
|
|
2279
|
+
const e = lt(), n = qn(t), s = E(n);
|
|
2280
|
+
s.current = n, K(() => {
|
|
2249
2281
|
const i = s.current;
|
|
2250
2282
|
return e.axisConfigs = e.axisConfigs.filter(
|
|
2251
2283
|
(l) => !(l.scale === i.scale && l.side === i.side)
|
|
@@ -2256,18 +2288,18 @@ function Dt(t) {
|
|
|
2256
2288
|
};
|
|
2257
2289
|
}, [e, n.scale, n.side]);
|
|
2258
2290
|
const o = E(null);
|
|
2259
|
-
return
|
|
2291
|
+
return K(() => {
|
|
2260
2292
|
Ut(o.current, t) || (o.current = t, e.axisConfigs = e.axisConfigs.map(
|
|
2261
2293
|
(i) => i.scale === n.scale && i.side === n.side ? n : i
|
|
2262
2294
|
), e.scheduleRedraw());
|
|
2263
2295
|
}), null;
|
|
2264
2296
|
}
|
|
2265
2297
|
function as({ series: t, group: e, fill: n, dir: s }) {
|
|
2266
|
-
const o =
|
|
2267
|
-
return
|
|
2298
|
+
const o = lt(), i = E(null), l = t[0], r = t[1];
|
|
2299
|
+
return K(() => {
|
|
2268
2300
|
const a = { series: [l, r], group: e, fill: n, dir: s };
|
|
2269
|
-
return i.current != null && (o.bandConfigs = o.bandConfigs.filter((
|
|
2270
|
-
o.bandConfigs = o.bandConfigs.filter((
|
|
2301
|
+
return i.current != null && (o.bandConfigs = o.bandConfigs.filter((u) => u !== i.current)), i.current = a, o.bandConfigs.push(a), o.scheduleRedraw(), () => {
|
|
2302
|
+
o.bandConfigs = o.bandConfigs.filter((u) => u !== i.current), i.current = null, o.scheduleRedraw();
|
|
2271
2303
|
};
|
|
2272
2304
|
}, [o, l, r, e, n, s]), null;
|
|
2273
2305
|
}
|
|
@@ -2284,8 +2316,8 @@ const Zn = {
|
|
|
2284
2316
|
cursor: "pointer",
|
|
2285
2317
|
fontSize: 12,
|
|
2286
2318
|
fontFamily: "sans-serif"
|
|
2287
|
-
}, Qn =
|
|
2288
|
-
const a =
|
|
2319
|
+
}, Qn = De(function({ group: e, index: n, label: s, color: o, isHidden: i, valueStr: l, store: r }) {
|
|
2320
|
+
const a = Z(() => {
|
|
2289
2321
|
r.toggleSeries(e, n);
|
|
2290
2322
|
}, [r, e, n]);
|
|
2291
2323
|
return /* @__PURE__ */ Q(
|
|
@@ -2302,18 +2334,18 @@ const Zn = {
|
|
|
2302
2334
|
);
|
|
2303
2335
|
});
|
|
2304
2336
|
function cs({ show: t = !0, position: e = "bottom", className: n }) {
|
|
2305
|
-
const s =
|
|
2306
|
-
(
|
|
2337
|
+
const s = lt(), o = E({ activeGroup: -1, activeDataIdx: -1, seriesCount: 0, revision: -1 }), i = Z(
|
|
2338
|
+
(c) => s.subscribe(c),
|
|
2307
2339
|
[s]
|
|
2308
|
-
), l =
|
|
2309
|
-
const { activeGroup:
|
|
2310
|
-
if (
|
|
2311
|
-
return
|
|
2312
|
-
const
|
|
2313
|
-
return o.current =
|
|
2340
|
+
), l = Z(() => {
|
|
2341
|
+
const { activeGroup: c, activeDataIdx: h } = s.cursorManager.state, f = s.seriesConfigs.length, { revision: d } = s, x = o.current;
|
|
2342
|
+
if (x.activeGroup === c && x.activeDataIdx === h && x.seriesCount === f && x.revision === d)
|
|
2343
|
+
return x;
|
|
2344
|
+
const b = { activeGroup: c, activeDataIdx: h, seriesCount: f, revision: d };
|
|
2345
|
+
return o.current = b, b;
|
|
2314
2346
|
}, [s]), r = fe(i, l);
|
|
2315
2347
|
if (!t) return null;
|
|
2316
|
-
const { activeGroup: a, activeDataIdx:
|
|
2348
|
+
const { activeGroup: a, activeDataIdx: u } = r;
|
|
2317
2349
|
return /* @__PURE__ */ X(
|
|
2318
2350
|
"div",
|
|
2319
2351
|
{
|
|
@@ -2325,25 +2357,25 @@ function cs({ show: t = !0, position: e = "bottom", className: n }) {
|
|
|
2325
2357
|
order: e === "top" ? -1 : 1,
|
|
2326
2358
|
padding: "4px 0"
|
|
2327
2359
|
},
|
|
2328
|
-
children: s.seriesConfigs.map((
|
|
2329
|
-
const
|
|
2360
|
+
children: s.seriesConfigs.map((c) => {
|
|
2361
|
+
const h = typeof c.stroke == "string" ? c.stroke : "#000";
|
|
2330
2362
|
let f = "";
|
|
2331
|
-
if (
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2363
|
+
if (u >= 0 && a >= 0) {
|
|
2364
|
+
const x = s.dataStore.getYValues(c.group, c.index)[u];
|
|
2365
|
+
x != null && (f = typeof x == "number" ? x.toPrecision(4) : String(x));
|
|
2334
2366
|
}
|
|
2335
2367
|
return /* @__PURE__ */ X(
|
|
2336
2368
|
Qn,
|
|
2337
2369
|
{
|
|
2338
|
-
group:
|
|
2339
|
-
index:
|
|
2340
|
-
label:
|
|
2341
|
-
color:
|
|
2342
|
-
isHidden:
|
|
2370
|
+
group: c.group,
|
|
2371
|
+
index: c.index,
|
|
2372
|
+
label: c.label ?? `Series ${c.index}`,
|
|
2373
|
+
color: h,
|
|
2374
|
+
isHidden: c.show === !1,
|
|
2343
2375
|
valueStr: f,
|
|
2344
2376
|
store: s
|
|
2345
2377
|
},
|
|
2346
|
-
`${
|
|
2378
|
+
`${c.group}:${c.index}`
|
|
2347
2379
|
);
|
|
2348
2380
|
})
|
|
2349
2381
|
}
|
|
@@ -2355,57 +2387,57 @@ function us({
|
|
|
2355
2387
|
children: n,
|
|
2356
2388
|
offset: s = {}
|
|
2357
2389
|
}) {
|
|
2358
|
-
var
|
|
2359
|
-
const o =
|
|
2360
|
-
(
|
|
2390
|
+
var M, k;
|
|
2391
|
+
const o = lt(), i = E({ left: -10, top: -10, activeGroup: -1, activeDataIdx: -1, revision: -1 }), l = E(null), r = Z(
|
|
2392
|
+
(y) => o.subscribe(y),
|
|
2361
2393
|
[o]
|
|
2362
|
-
), a =
|
|
2363
|
-
const
|
|
2364
|
-
if (F.left ===
|
|
2394
|
+
), a = Z(() => {
|
|
2395
|
+
const y = o.cursorManager.state, { revision: A } = o, F = i.current;
|
|
2396
|
+
if (F.left === y.left && F.top === y.top && F.activeGroup === y.activeGroup && F.activeDataIdx === y.activeDataIdx && F.revision === A)
|
|
2365
2397
|
return F;
|
|
2366
2398
|
const R = {
|
|
2367
|
-
left:
|
|
2368
|
-
top:
|
|
2369
|
-
activeGroup:
|
|
2370
|
-
activeDataIdx:
|
|
2399
|
+
left: y.left,
|
|
2400
|
+
top: y.top,
|
|
2401
|
+
activeGroup: y.activeGroup,
|
|
2402
|
+
activeDataIdx: y.activeDataIdx,
|
|
2371
2403
|
revision: A
|
|
2372
2404
|
};
|
|
2373
2405
|
return i.current = R, R;
|
|
2374
|
-
}, [o]),
|
|
2375
|
-
if (!t ||
|
|
2376
|
-
const { activeGroup:
|
|
2377
|
-
for (const
|
|
2378
|
-
if (
|
|
2379
|
-
const A = o.dataStore.getYValues(
|
|
2406
|
+
}, [o]), u = fe(r, a);
|
|
2407
|
+
if (!t || u.activeDataIdx < 0 || u.activeGroup < 0 || u.left < 0) return null;
|
|
2408
|
+
const { activeGroup: c, activeDataIdx: h } = u, f = o.plotBox, d = o.dataStore.data[c], x = d != null ? d.x[h] ?? null : null, b = x != null ? parseFloat(x.toPrecision(6)).toString() : "", L = [];
|
|
2409
|
+
for (const y of o.seriesConfigs) {
|
|
2410
|
+
if (y.show === !1) continue;
|
|
2411
|
+
const A = o.dataStore.getYValues(y.group, y.index), F = y.group === c ? A[h] : null;
|
|
2380
2412
|
L.push({
|
|
2381
|
-
label:
|
|
2413
|
+
label: y.label ?? `Series ${y.index}`,
|
|
2382
2414
|
value: F,
|
|
2383
|
-
color: typeof
|
|
2384
|
-
group:
|
|
2385
|
-
index:
|
|
2415
|
+
color: typeof y.stroke == "string" ? y.stroke : "#000",
|
|
2416
|
+
group: y.group,
|
|
2417
|
+
index: y.index
|
|
2386
2418
|
});
|
|
2387
2419
|
}
|
|
2388
|
-
const
|
|
2389
|
-
x
|
|
2390
|
-
xLabel:
|
|
2420
|
+
const g = {
|
|
2421
|
+
x,
|
|
2422
|
+
xLabel: b,
|
|
2391
2423
|
items: L,
|
|
2392
|
-
left:
|
|
2393
|
-
top:
|
|
2394
|
-
},
|
|
2424
|
+
left: u.left + f.left,
|
|
2425
|
+
top: u.top + f.top
|
|
2426
|
+
}, w = s.x ?? 12, P = s.y ?? -12, z = ((M = l.current) == null ? void 0 : M.offsetWidth) ?? 0, T = ((k = l.current) == null ? void 0 : k.offsetHeight) ?? 0, S = u.left + f.left, C = u.top + f.top, v = f.left + f.width, I = f.top + f.height, D = Math.max(f.left, Math.min(S + w, v - z)), m = Math.max(f.top, Math.min(C + P, I - T)), p = {
|
|
2395
2427
|
position: "absolute",
|
|
2396
|
-
left:
|
|
2397
|
-
top:
|
|
2428
|
+
left: D,
|
|
2429
|
+
top: m,
|
|
2398
2430
|
whiteSpace: "nowrap",
|
|
2399
2431
|
pointerEvents: "none",
|
|
2400
2432
|
zIndex: 100
|
|
2401
2433
|
};
|
|
2402
|
-
return n ? /* @__PURE__ */ X("div", { ref: l, className: e, style:
|
|
2434
|
+
return n ? /* @__PURE__ */ X("div", { ref: l, className: e, style: p, children: n(g) }) : /* @__PURE__ */ Q(
|
|
2403
2435
|
"div",
|
|
2404
2436
|
{
|
|
2405
2437
|
ref: l,
|
|
2406
2438
|
className: e,
|
|
2407
2439
|
style: {
|
|
2408
|
-
...
|
|
2440
|
+
...p,
|
|
2409
2441
|
background: "rgba(0,0,0,0.85)",
|
|
2410
2442
|
color: "#fff",
|
|
2411
2443
|
padding: "6px 10px",
|
|
@@ -2416,15 +2448,15 @@ function us({
|
|
|
2416
2448
|
lineHeight: 1.5
|
|
2417
2449
|
},
|
|
2418
2450
|
children: [
|
|
2419
|
-
/* @__PURE__ */ X("div", { style: { fontWeight: 600, marginBottom: 2 }, children:
|
|
2420
|
-
L.map((
|
|
2421
|
-
/* @__PURE__ */ X("span", { style: { width: 8, height: 8, borderRadius: "50%", backgroundColor:
|
|
2451
|
+
/* @__PURE__ */ X("div", { style: { fontWeight: 600, marginBottom: 2 }, children: b }),
|
|
2452
|
+
L.map((y) => /* @__PURE__ */ Q("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
2453
|
+
/* @__PURE__ */ X("span", { style: { width: 8, height: 8, borderRadius: "50%", backgroundColor: y.color, display: "inline-block" } }),
|
|
2422
2454
|
/* @__PURE__ */ Q("span", { children: [
|
|
2423
|
-
|
|
2455
|
+
y.label,
|
|
2424
2456
|
":"
|
|
2425
2457
|
] }),
|
|
2426
|
-
/* @__PURE__ */ X("span", { style: { fontWeight: 600 }, children:
|
|
2427
|
-
] }, `${
|
|
2458
|
+
/* @__PURE__ */ X("span", { style: { fontWeight: 600 }, children: y.value != null ? y.value.toPrecision(4) : "—" })
|
|
2459
|
+
] }, `${y.group}:${y.index}`))
|
|
2428
2460
|
]
|
|
2429
2461
|
}
|
|
2430
2462
|
);
|
|
@@ -2439,96 +2471,96 @@ function fs({
|
|
|
2439
2471
|
colors: l,
|
|
2440
2472
|
grips: r = !1
|
|
2441
2473
|
}) {
|
|
2442
|
-
const a = E(null), [
|
|
2474
|
+
const a = E(null), [u, c] = St(() => {
|
|
2443
2475
|
if (o != null && n.length > 0) {
|
|
2444
2476
|
const T = n[0];
|
|
2445
2477
|
if (T != null && T.x.length > 1) {
|
|
2446
|
-
const
|
|
2447
|
-
if (
|
|
2478
|
+
const S = T.x[0], v = T.x[T.x.length - 1] - S;
|
|
2479
|
+
if (v > 0)
|
|
2448
2480
|
return [
|
|
2449
|
-
Math.max(0, (o[0] -
|
|
2450
|
-
Math.min(1, (o[1] -
|
|
2481
|
+
Math.max(0, (o[0] - S) / v),
|
|
2482
|
+
Math.min(1, (o[1] - S) / v)
|
|
2451
2483
|
];
|
|
2452
2484
|
}
|
|
2453
2485
|
}
|
|
2454
2486
|
return [0.25, 0.75];
|
|
2455
|
-
}),
|
|
2456
|
-
|
|
2487
|
+
}), h = E(null);
|
|
2488
|
+
K(() => {
|
|
2457
2489
|
if (s == null || n.length === 0) return;
|
|
2458
2490
|
const T = n[0];
|
|
2459
2491
|
if (T == null || T.x.length < 2) return;
|
|
2460
|
-
const
|
|
2461
|
-
|
|
2462
|
-
}, [
|
|
2463
|
-
const f = E(null),
|
|
2464
|
-
const
|
|
2465
|
-
if (
|
|
2466
|
-
const
|
|
2467
|
-
return Math.max(0, Math.min(1, (T -
|
|
2468
|
-
}, []),
|
|
2469
|
-
const
|
|
2470
|
-
if (
|
|
2471
|
-
const
|
|
2472
|
-
let
|
|
2473
|
-
if (Math.abs(
|
|
2474
|
-
|
|
2475
|
-
else if (Math.abs(
|
|
2476
|
-
|
|
2477
|
-
else if (
|
|
2478
|
-
|
|
2492
|
+
const S = T.x[0], v = T.x[T.x.length - 1] - S, I = S + u[0] * v, D = S + u[1] * v, m = h.current, p = Math.max(1e-10, Math.abs(D - I) * 1e-12);
|
|
2493
|
+
m != null && Math.abs(m[0] - I) < p && Math.abs(m[1] - D) < p || (h.current = [I, D], s(I, D));
|
|
2494
|
+
}, [u, n, s]);
|
|
2495
|
+
const f = E(null), d = Z((T) => {
|
|
2496
|
+
const S = a.current;
|
|
2497
|
+
if (S == null) return 0;
|
|
2498
|
+
const C = S.getBoundingClientRect();
|
|
2499
|
+
return Math.max(0, Math.min(1, (T - C.left) / C.width));
|
|
2500
|
+
}, []), x = Z((T) => {
|
|
2501
|
+
const S = a.current;
|
|
2502
|
+
if (S == null) return;
|
|
2503
|
+
const C = d(T.clientX), v = S.getBoundingClientRect().width, I = v > 0 ? 8 / v : 0;
|
|
2504
|
+
let D;
|
|
2505
|
+
if (Math.abs(C - u[0]) < I)
|
|
2506
|
+
D = "left";
|
|
2507
|
+
else if (Math.abs(C - u[1]) < I)
|
|
2508
|
+
D = "right";
|
|
2509
|
+
else if (C >= u[0] && C <= u[1])
|
|
2510
|
+
D = "move";
|
|
2479
2511
|
else {
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2512
|
+
const m = u[1] - u[0], p = m / 2, M = Math.max(0, Math.min(1 - m, C - p));
|
|
2513
|
+
c([M, M + m]), D = "move";
|
|
2482
2514
|
}
|
|
2483
2515
|
f.current = {
|
|
2484
|
-
mode:
|
|
2516
|
+
mode: D,
|
|
2485
2517
|
startX: T.clientX,
|
|
2486
|
-
startFrac: [...
|
|
2487
|
-
},
|
|
2488
|
-
}, [
|
|
2489
|
-
const
|
|
2490
|
-
if (
|
|
2491
|
-
const
|
|
2492
|
-
if (
|
|
2493
|
-
const
|
|
2494
|
-
let
|
|
2495
|
-
|
|
2496
|
-
} else if (
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2518
|
+
startFrac: [...u]
|
|
2519
|
+
}, S.setPointerCapture(T.pointerId), T.preventDefault();
|
|
2520
|
+
}, [u, d]), b = Z((T) => {
|
|
2521
|
+
const S = f.current;
|
|
2522
|
+
if (S == null) return;
|
|
2523
|
+
const C = d(T.clientX), v = d(S.startX), I = C - v;
|
|
2524
|
+
if (S.mode === "move") {
|
|
2525
|
+
const D = S.startFrac[1] - S.startFrac[0];
|
|
2526
|
+
let m = S.startFrac[0] + I;
|
|
2527
|
+
m = Math.max(0, Math.min(1 - D, m)), c([m, m + D]);
|
|
2528
|
+
} else if (S.mode === "left") {
|
|
2529
|
+
const D = Math.max(0, Math.min(S.startFrac[1] - 0.01, S.startFrac[0] + I));
|
|
2530
|
+
c([D, S.startFrac[1]]);
|
|
2499
2531
|
} else {
|
|
2500
|
-
const
|
|
2501
|
-
|
|
2532
|
+
const D = Math.min(1, Math.max(S.startFrac[0] + 0.01, S.startFrac[1] + I));
|
|
2533
|
+
c([S.startFrac[0], D]);
|
|
2502
2534
|
}
|
|
2503
|
-
}, [
|
|
2535
|
+
}, [d]), L = Z((T) => {
|
|
2504
2536
|
f.current = null;
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2507
|
-
}, []),
|
|
2537
|
+
const S = a.current;
|
|
2538
|
+
S != null && S.releasePointerCapture(T.pointerId);
|
|
2539
|
+
}, []), g = `${u[0] * 100}%`, w = `${(u[1] - u[0]) * 100}%`, P = n[0], z = P != null ? P.series.length : 0;
|
|
2508
2540
|
return /* @__PURE__ */ Q("div", { className: i, style: { position: "relative", width: t, height: e }, children: [
|
|
2509
2541
|
/* @__PURE__ */ Q(Ce, { width: t, height: e, data: n, children: [
|
|
2510
2542
|
/* @__PURE__ */ X(Lt, { id: "x" }),
|
|
2511
2543
|
/* @__PURE__ */ X(Lt, { id: "y" }),
|
|
2512
|
-
/* @__PURE__ */ X(
|
|
2513
|
-
/* @__PURE__ */ X(
|
|
2514
|
-
Array.from({ length:
|
|
2544
|
+
/* @__PURE__ */ X(zt, { scale: "x", show: !1 }),
|
|
2545
|
+
/* @__PURE__ */ X(zt, { scale: "y", show: !1 }),
|
|
2546
|
+
Array.from({ length: z }, (T, S) => /* @__PURE__ */ X(
|
|
2515
2547
|
Te,
|
|
2516
2548
|
{
|
|
2517
2549
|
group: 0,
|
|
2518
|
-
index:
|
|
2550
|
+
index: S,
|
|
2519
2551
|
yScale: "y",
|
|
2520
|
-
stroke: l != null && l[
|
|
2552
|
+
stroke: l != null && l[S] != null ? l[S] : `hsl(${S * 137}, 60%, 50%)`,
|
|
2521
2553
|
width: 1
|
|
2522
2554
|
},
|
|
2523
|
-
|
|
2555
|
+
S
|
|
2524
2556
|
))
|
|
2525
2557
|
] }),
|
|
2526
2558
|
/* @__PURE__ */ Q(
|
|
2527
2559
|
"div",
|
|
2528
2560
|
{
|
|
2529
2561
|
ref: a,
|
|
2530
|
-
onPointerDown:
|
|
2531
|
-
onPointerMove:
|
|
2562
|
+
onPointerDown: x,
|
|
2563
|
+
onPointerMove: b,
|
|
2532
2564
|
onPointerUp: L,
|
|
2533
2565
|
style: {
|
|
2534
2566
|
position: "absolute",
|
|
@@ -2547,7 +2579,7 @@ function fs({
|
|
|
2547
2579
|
position: "absolute",
|
|
2548
2580
|
top: 0,
|
|
2549
2581
|
left: 0,
|
|
2550
|
-
width:
|
|
2582
|
+
width: g,
|
|
2551
2583
|
height: "100%",
|
|
2552
2584
|
background: "rgba(0,0,0,0.3)",
|
|
2553
2585
|
pointerEvents: "none"
|
|
@@ -2560,7 +2592,7 @@ function fs({
|
|
|
2560
2592
|
style: {
|
|
2561
2593
|
position: "absolute",
|
|
2562
2594
|
top: 0,
|
|
2563
|
-
left: `${
|
|
2595
|
+
left: `${u[1] * 100}%`,
|
|
2564
2596
|
right: 0,
|
|
2565
2597
|
height: "100%",
|
|
2566
2598
|
background: "rgba(0,0,0,0.3)",
|
|
@@ -2574,8 +2606,8 @@ function fs({
|
|
|
2574
2606
|
style: {
|
|
2575
2607
|
position: "absolute",
|
|
2576
2608
|
top: 0,
|
|
2577
|
-
left:
|
|
2578
|
-
width:
|
|
2609
|
+
left: g,
|
|
2610
|
+
width: w,
|
|
2579
2611
|
height: "100%",
|
|
2580
2612
|
borderLeft: "2px solid rgba(0,100,255,0.8)",
|
|
2581
2613
|
borderRight: "2px solid rgba(0,100,255,0.8)",
|
|
@@ -2617,8 +2649,8 @@ function fs({
|
|
|
2617
2649
|
] });
|
|
2618
2650
|
}
|
|
2619
2651
|
function Pt(t) {
|
|
2620
|
-
const e =
|
|
2621
|
-
n.current = t,
|
|
2652
|
+
const e = lt(), n = E(t);
|
|
2653
|
+
n.current = t, K(() => {
|
|
2622
2654
|
const s = (o) => n.current(o);
|
|
2623
2655
|
return e.drawHooks.add(s), () => {
|
|
2624
2656
|
e.drawHooks.delete(s);
|
|
@@ -2626,8 +2658,8 @@ function Pt(t) {
|
|
|
2626
2658
|
}, [e]);
|
|
2627
2659
|
}
|
|
2628
2660
|
function hs(t) {
|
|
2629
|
-
const e =
|
|
2630
|
-
n.current = t,
|
|
2661
|
+
const e = lt(), n = E(t);
|
|
2662
|
+
n.current = t, K(() => {
|
|
2631
2663
|
const s = (o, i) => n.current(o, i);
|
|
2632
2664
|
return e.cursorDrawHooks.add(s), () => {
|
|
2633
2665
|
e.cursorDrawHooks.delete(s);
|
|
@@ -2640,7 +2672,7 @@ function ds({
|
|
|
2640
2672
|
gap: n = 2,
|
|
2641
2673
|
scaleId: s = "x"
|
|
2642
2674
|
}) {
|
|
2643
|
-
const o =
|
|
2675
|
+
const o = lt();
|
|
2644
2676
|
return Pt(({ ctx: i, plotBox: l, pxRatio: r }) => {
|
|
2645
2677
|
const a = o.scaleManager.getScale(s);
|
|
2646
2678
|
if (a == null || a.min == null || a.max == null) return;
|
|
@@ -2650,15 +2682,15 @@ function ds({
|
|
|
2650
2682
|
l.width * r,
|
|
2651
2683
|
l.height * r
|
|
2652
2684
|
), i.clip();
|
|
2653
|
-
const
|
|
2685
|
+
const u = (e + n) * r, c = e * r, h = l.top * r;
|
|
2654
2686
|
for (let f = 0; f < t.length; f++) {
|
|
2655
|
-
const
|
|
2656
|
-
if (
|
|
2657
|
-
const
|
|
2658
|
-
i.fillStyle = "#666", i.font = `${11 * r}px sans-serif`, i.textAlign = "right", i.textBaseline = "middle", i.fillText(
|
|
2659
|
-
for (const
|
|
2660
|
-
const L =
|
|
2661
|
-
|
|
2687
|
+
const d = t[f];
|
|
2688
|
+
if (d == null) continue;
|
|
2689
|
+
const x = h + f * u;
|
|
2690
|
+
i.fillStyle = "#666", i.font = `${11 * r}px sans-serif`, i.textAlign = "right", i.textBaseline = "middle", i.fillText(d.label, (l.left - 6) * r, x + c / 2);
|
|
2691
|
+
for (const b of d.segments) {
|
|
2692
|
+
const L = $(b.start, a, l.width, l.left) * r, w = $(b.end, a, l.width, l.left) * r - L;
|
|
2693
|
+
w <= 0 || (i.fillStyle = b.color ?? "#4dabf7", i.fillRect(L, x, w, c), b.label != null && w > 20 * r && (i.fillStyle = "#fff", i.font = `${10 * r}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(b.label, L + w / 2, x + c / 2, w - 4 * r)));
|
|
2662
2694
|
}
|
|
2663
2695
|
}
|
|
2664
2696
|
i.restore();
|
|
@@ -2678,8 +2710,8 @@ function gs({
|
|
|
2678
2710
|
return /* @__PURE__ */ X("div", { style: { pointerEvents: "none" }, className: a, children: /* @__PURE__ */ Q(Ce, { width: e, height: n, data: t, children: [
|
|
2679
2711
|
/* @__PURE__ */ X(Lt, { id: "x" }),
|
|
2680
2712
|
/* @__PURE__ */ X(Lt, { id: "y" }),
|
|
2681
|
-
/* @__PURE__ */ X(
|
|
2682
|
-
/* @__PURE__ */ X(
|
|
2713
|
+
/* @__PURE__ */ X(zt, { scale: "x", show: !1 }),
|
|
2714
|
+
/* @__PURE__ */ X(zt, { scale: "y", show: !1 }),
|
|
2683
2715
|
/* @__PURE__ */ X(
|
|
2684
2716
|
Te,
|
|
2685
2717
|
{
|
|
@@ -2696,24 +2728,24 @@ function gs({
|
|
|
2696
2728
|
] }) });
|
|
2697
2729
|
}
|
|
2698
2730
|
function ts(t, e, n, s = {}) {
|
|
2699
|
-
const { ctx: o, plotBox: i } = t, l =
|
|
2731
|
+
const { ctx: o, plotBox: i } = t, l = $(n, e, i.height, i.top);
|
|
2700
2732
|
o.beginPath(), o.moveTo(i.left, l), o.lineTo(i.left + i.width, l), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
|
|
2701
2733
|
}
|
|
2702
2734
|
function es(t, e, n, s = {}) {
|
|
2703
|
-
const { ctx: o, plotBox: i } = t, l =
|
|
2735
|
+
const { ctx: o, plotBox: i } = t, l = $(n, e, i.width, i.left);
|
|
2704
2736
|
o.beginPath(), o.moveTo(l, i.top), o.lineTo(l, i.top + i.height), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
|
|
2705
2737
|
}
|
|
2706
2738
|
function ps(t, e, n, s, o, i, l = {}) {
|
|
2707
|
-
const { ctx: r, plotBox: a } = t,
|
|
2708
|
-
r.font = l.font ?? "12px sans-serif", r.fillStyle = l.fill ?? "#000", r.textBaseline = "bottom", r.fillText(i,
|
|
2739
|
+
const { ctx: r, plotBox: a } = t, u = $(s, e, a.width, a.left), c = $(o, n, a.height, a.top);
|
|
2740
|
+
r.font = l.font ?? "12px sans-serif", r.fillStyle = l.fill ?? "#000", r.textBaseline = "bottom", r.fillText(i, u, c - 4);
|
|
2709
2741
|
}
|
|
2710
2742
|
function ns(t, e, n, s, o = {}) {
|
|
2711
|
-
const { ctx: i, plotBox: l } = t, r =
|
|
2743
|
+
const { ctx: i, plotBox: l } = t, r = $(s, e, l.height, l.top), a = $(n, e, l.height, l.top);
|
|
2712
2744
|
i.fillStyle = o.fill ?? "rgba(255,0,0,0.1)", i.fillRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.stroke && (i.strokeStyle = o.stroke, i.lineWidth = o.width ?? 1, o.dash && i.setLineDash(o.dash), i.strokeRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.dash && i.setLineDash([]));
|
|
2713
2745
|
}
|
|
2714
2746
|
function ms(t) {
|
|
2715
2747
|
const e = E(t);
|
|
2716
|
-
return
|
|
2748
|
+
return Dt(() => {
|
|
2717
2749
|
e.current = t;
|
|
2718
2750
|
}), Pt((n) => {
|
|
2719
2751
|
const s = e.current, o = s.yScale ?? "y", i = n.getScale(o);
|
|
@@ -2731,7 +2763,7 @@ function ms(t) {
|
|
|
2731
2763
|
}
|
|
2732
2764
|
function ws(t) {
|
|
2733
2765
|
const e = E(t);
|
|
2734
|
-
return
|
|
2766
|
+
return Dt(() => {
|
|
2735
2767
|
e.current = t;
|
|
2736
2768
|
}), Pt((n) => {
|
|
2737
2769
|
const s = e.current, o = s.xScale ?? "x", i = n.getScale(o);
|
|
@@ -2749,7 +2781,7 @@ function ws(t) {
|
|
|
2749
2781
|
}
|
|
2750
2782
|
function vs(t) {
|
|
2751
2783
|
const e = E(t);
|
|
2752
|
-
return
|
|
2784
|
+
return Dt(() => {
|
|
2753
2785
|
e.current = t;
|
|
2754
2786
|
}), Pt((n) => {
|
|
2755
2787
|
const s = e.current, o = n.getScale(s.yScale ?? "y");
|
|
@@ -2761,9 +2793,9 @@ function vs(t) {
|
|
|
2761
2793
|
});
|
|
2762
2794
|
}), null;
|
|
2763
2795
|
}
|
|
2764
|
-
function
|
|
2796
|
+
function xs(t) {
|
|
2765
2797
|
const e = E(t);
|
|
2766
|
-
return
|
|
2798
|
+
return Dt(() => {
|
|
2767
2799
|
e.current = t;
|
|
2768
2800
|
}), Pt((n) => {
|
|
2769
2801
|
const s = e.current, o = n.valToX(s.x, s.xScale ?? "x"), i = n.valToY(s.y, s.yScale ?? "y");
|
|
@@ -2772,138 +2804,138 @@ function Ms(t) {
|
|
|
2772
2804
|
l.font = s.font ?? "12px sans-serif", l.fillStyle = s.fill ?? "#000", l.textAlign = s.align ?? "left", l.textBaseline = s.baseline ?? "bottom", l.fillText(s.text, o, i - 4);
|
|
2773
2805
|
}), null;
|
|
2774
2806
|
}
|
|
2775
|
-
function
|
|
2776
|
-
const { window: n, batchSize: s = 1 } = e, o = e.autoStart ?? !0, [i, l] = St(t), [r, a] = St(!1), [
|
|
2807
|
+
function Ms(t, e) {
|
|
2808
|
+
const { window: n, batchSize: s = 1 } = e, o = e.autoStart ?? !0, [i, l] = St(t), [r, a] = St(!1), [u, c] = St(0), h = E(0), f = E(0), d = E(0), x = E(/* @__PURE__ */ new Map()), b = E(0), L = E(n);
|
|
2777
2809
|
L.current = n;
|
|
2778
|
-
const
|
|
2779
|
-
(T,
|
|
2780
|
-
let
|
|
2781
|
-
|
|
2782
|
-
for (let
|
|
2783
|
-
let
|
|
2784
|
-
|
|
2810
|
+
const g = Z(
|
|
2811
|
+
(T, S, ...C) => {
|
|
2812
|
+
let v = x.current.get(T);
|
|
2813
|
+
v == null && (v = { x: [], series: C.map(() => []) }, x.current.set(T, v)), v.x.push(...S);
|
|
2814
|
+
for (let I = 0; I < C.length; I++) {
|
|
2815
|
+
let D = v.series[I];
|
|
2816
|
+
D == null && (D = [], v.series[I] = D), D.push(...C[I] ?? []);
|
|
2785
2817
|
}
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2790
|
-
const
|
|
2791
|
-
l((
|
|
2792
|
-
const
|
|
2793
|
-
for (const [
|
|
2794
|
-
const A =
|
|
2818
|
+
b.current === 0 && (b.current = requestAnimationFrame(() => {
|
|
2819
|
+
b.current = 0;
|
|
2820
|
+
const I = x.current;
|
|
2821
|
+
x.current = /* @__PURE__ */ new Map();
|
|
2822
|
+
const D = L.current;
|
|
2823
|
+
l((m) => {
|
|
2824
|
+
const p = m.slice();
|
|
2825
|
+
for (const [M, { x: k, series: y }] of I) {
|
|
2826
|
+
const A = p[M];
|
|
2795
2827
|
if (A == null) continue;
|
|
2796
|
-
const F = A.x, R = Math.max(0, F.length +
|
|
2797
|
-
const
|
|
2798
|
-
return R > 0 ?
|
|
2828
|
+
const F = A.x, R = Math.max(0, F.length + k.length - D), G = R > 0 ? F.slice(R).concat(k) : F.concat(k), H = A.series.map((B, W) => {
|
|
2829
|
+
const Y = B, j = y[W] ?? [];
|
|
2830
|
+
return R > 0 ? Y.slice(R).concat(j) : Y.concat(j);
|
|
2799
2831
|
});
|
|
2800
|
-
|
|
2832
|
+
p[M] = { x: G, series: H };
|
|
2801
2833
|
}
|
|
2802
|
-
return
|
|
2834
|
+
return p;
|
|
2803
2835
|
});
|
|
2804
2836
|
}));
|
|
2805
2837
|
},
|
|
2806
2838
|
[]
|
|
2807
|
-
),
|
|
2808
|
-
(T, ...
|
|
2809
|
-
|
|
2839
|
+
), w = Z(
|
|
2840
|
+
(T, ...S) => {
|
|
2841
|
+
g(0, T, ...S);
|
|
2810
2842
|
},
|
|
2811
|
-
[
|
|
2812
|
-
), P =
|
|
2843
|
+
[g]
|
|
2844
|
+
), P = Z(() => {
|
|
2813
2845
|
a(!0);
|
|
2814
|
-
}, []),
|
|
2846
|
+
}, []), z = Z(() => {
|
|
2815
2847
|
a(!1);
|
|
2816
2848
|
}, []);
|
|
2817
|
-
return
|
|
2849
|
+
return K(() => {
|
|
2818
2850
|
if (!r) {
|
|
2819
|
-
|
|
2851
|
+
h.current !== 0 && (cancelAnimationFrame(h.current), h.current = 0);
|
|
2820
2852
|
return;
|
|
2821
2853
|
}
|
|
2822
|
-
|
|
2823
|
-
const T = (
|
|
2854
|
+
d.current = performance.now(), f.current = 0;
|
|
2855
|
+
const T = (S) => {
|
|
2824
2856
|
f.current++;
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2857
|
+
const C = S - d.current;
|
|
2858
|
+
C >= 1e3 && (c(Math.round(f.current * 1e3 / C)), f.current = 0, d.current = S), h.current = requestAnimationFrame(T);
|
|
2827
2859
|
};
|
|
2828
|
-
return
|
|
2829
|
-
|
|
2860
|
+
return h.current = requestAnimationFrame(T), () => {
|
|
2861
|
+
h.current !== 0 && (cancelAnimationFrame(h.current), h.current = 0);
|
|
2830
2862
|
};
|
|
2831
|
-
}, [r]),
|
|
2832
|
-
|
|
2833
|
-
}, []),
|
|
2863
|
+
}, [r]), K(() => () => {
|
|
2864
|
+
b.current !== 0 && cancelAnimationFrame(b.current);
|
|
2865
|
+
}, []), K(() => {
|
|
2834
2866
|
o && a(!0);
|
|
2835
|
-
}, [o]), { data: i, push:
|
|
2867
|
+
}, [o]), { data: i, push: w, pushGroup: g, start: P, stop: z, running: r, fps: u };
|
|
2836
2868
|
}
|
|
2837
2869
|
function bs(t) {
|
|
2838
|
-
return (e, n, s, o, i, l, r, a,
|
|
2839
|
-
const
|
|
2840
|
-
if ([
|
|
2870
|
+
return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
|
|
2871
|
+
const x = (d == null ? void 0 : d.align) ?? t ?? 1, b = (d == null ? void 0 : d.spanGaps) ?? !1;
|
|
2872
|
+
if ([u, c] = Ft(n, u, c), u === -1)
|
|
2841
2873
|
return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
|
|
2842
|
-
const L = (
|
|
2874
|
+
const L = (I) => f($(I, s, i, r)), g = (I) => f($(I, o, l, a)), w = s.ori === V.Horizontal ? Rt : Gt, P = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null }, z = P.stroke;
|
|
2843
2875
|
let T = !1;
|
|
2844
|
-
const
|
|
2845
|
-
let
|
|
2846
|
-
|
|
2847
|
-
for (let
|
|
2848
|
-
const
|
|
2849
|
-
if (
|
|
2850
|
-
|
|
2876
|
+
const S = h === N.Forward ? u : c;
|
|
2877
|
+
let C = g(n[S]), v = L(e[S]);
|
|
2878
|
+
w(z, v, C);
|
|
2879
|
+
for (let I = S; I >= u && I <= c; I += h) {
|
|
2880
|
+
const D = n[I];
|
|
2881
|
+
if (D == null) {
|
|
2882
|
+
D === null && !b && (T = !0);
|
|
2851
2883
|
continue;
|
|
2852
2884
|
}
|
|
2853
|
-
const
|
|
2854
|
-
if (
|
|
2855
|
-
|
|
2856
|
-
else if (
|
|
2857
|
-
|
|
2885
|
+
const m = L(e[I]), p = g(D);
|
|
2886
|
+
if (x === 1)
|
|
2887
|
+
w(z, m, C);
|
|
2888
|
+
else if (x === -1)
|
|
2889
|
+
w(z, v, p);
|
|
2858
2890
|
else {
|
|
2859
|
-
const
|
|
2860
|
-
|
|
2891
|
+
const M = f((v + m) / 2);
|
|
2892
|
+
w(z, M, C), w(z, M, p);
|
|
2861
2893
|
}
|
|
2862
|
-
|
|
2894
|
+
w(z, m, p), C = p, v = m;
|
|
2863
2895
|
}
|
|
2864
2896
|
{
|
|
2865
|
-
const
|
|
2866
|
-
let
|
|
2867
|
-
|
|
2897
|
+
const I = P.fill = new Path2D(z), D = (d == null ? void 0 : d.fillTo) ?? o.min ?? 0, m = g(D);
|
|
2898
|
+
let p = r, M = r + i;
|
|
2899
|
+
h === N.Backward && ([M, p] = [p, M]), w(I, M, m), w(I, p, m);
|
|
2868
2900
|
}
|
|
2869
2901
|
if (T) {
|
|
2870
|
-
const
|
|
2871
|
-
P.gaps =
|
|
2902
|
+
const I = Yt(e, n, u, c, h, L);
|
|
2903
|
+
P.gaps = I, P.clip = Kt(I, s.ori, r, a, i, l);
|
|
2872
2904
|
}
|
|
2873
2905
|
return P;
|
|
2874
2906
|
};
|
|
2875
2907
|
}
|
|
2876
2908
|
function Ss() {
|
|
2877
|
-
return (t, e, n, s, o, i, l, r, a,
|
|
2878
|
-
const
|
|
2879
|
-
let
|
|
2880
|
-
if (
|
|
2881
|
-
let
|
|
2882
|
-
for (let
|
|
2883
|
-
if (e[
|
|
2884
|
-
if (
|
|
2885
|
-
const A = t[
|
|
2886
|
-
R <
|
|
2909
|
+
return (t, e, n, s, o, i, l, r, a, u, c, h, f) => {
|
|
2910
|
+
const d = (f == null ? void 0 : f.barWidth) ?? 0.6, x = (f == null ? void 0 : f.barGap) ?? 0, b = (f == null ? void 0 : f.barRadius) ?? 0, L = (f == null ? void 0 : f.barGroupIdx) ?? 0, g = (f == null ? void 0 : f.barGroupCount) ?? 1, w = (M) => h($(M, n, o, l)), P = (M) => h($(M, s, i, r));
|
|
2911
|
+
let z = o;
|
|
2912
|
+
if (u > a) {
|
|
2913
|
+
let M = 1 / 0, k = -1;
|
|
2914
|
+
for (let y = a; y <= u; y++)
|
|
2915
|
+
if (e[y] != null) {
|
|
2916
|
+
if (k >= 0) {
|
|
2917
|
+
const A = t[y], F = t[k], R = Math.abs(w(A) - w(F));
|
|
2918
|
+
R < M && (M = R);
|
|
2887
2919
|
}
|
|
2888
|
-
|
|
2920
|
+
k = y;
|
|
2889
2921
|
}
|
|
2890
|
-
|
|
2922
|
+
M < 1 / 0 && (z = M);
|
|
2891
2923
|
}
|
|
2892
|
-
const T =
|
|
2893
|
-
for (let
|
|
2894
|
-
const
|
|
2895
|
-
if (
|
|
2896
|
-
const
|
|
2924
|
+
const T = z * (1 - d), S = Math.max(0, T + x), C = Math.max(1, h(z - S)), v = g > 1 ? Math.max(1, h(C / Math.max(1, g))) : C, I = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, D = P(I), m = new Path2D(), p = n.ori === V.Horizontal;
|
|
2925
|
+
for (let M = c === N.Forward ? a : u; M >= a && M <= u; M += c) {
|
|
2926
|
+
const k = e[M];
|
|
2927
|
+
if (k == null) continue;
|
|
2928
|
+
const y = w(t[M]), A = P(k), F = g > 1 ? (L - (g - 1) / 2) * v : 0, R = h(y - v / 2 + F), G = Math.min(A, D), B = Math.max(A, D) - G;
|
|
2897
2929
|
if (B !== 0)
|
|
2898
|
-
if (
|
|
2899
|
-
const W = Math.min(
|
|
2900
|
-
ss(
|
|
2930
|
+
if (b > 0) {
|
|
2931
|
+
const W = Math.min(b * v, B / 2);
|
|
2932
|
+
ss(m, p, R, G, v, B, W, k < I);
|
|
2901
2933
|
} else
|
|
2902
|
-
|
|
2934
|
+
p ? m.rect(R, G, v, B) : m.rect(G, R, B, v);
|
|
2903
2935
|
}
|
|
2904
2936
|
return {
|
|
2905
|
-
stroke:
|
|
2906
|
-
fill:
|
|
2937
|
+
stroke: m,
|
|
2938
|
+
fill: m,
|
|
2907
2939
|
// bars are filled with the same path
|
|
2908
2940
|
clip: null,
|
|
2909
2941
|
band: null,
|
|
@@ -2915,33 +2947,33 @@ function ss(t, e, n, s, o, i, l, r) {
|
|
|
2915
2947
|
l = Math.min(l, o / 2, i / 2), e ? r ? (t.moveTo(n, s), t.lineTo(n + o, s), t.lineTo(n + o, s + i - l), t.arc(n + o - l, s + i - l, l, 0, Math.PI / 2), t.lineTo(n + l, s + i), t.arc(n + l, s + i - l, l, Math.PI / 2, Math.PI), t.closePath()) : (t.moveTo(n, s + i), t.lineTo(n, s + l), t.arc(n + l, s + l, l, Math.PI, Math.PI * 1.5), t.lineTo(n + o - l, s), t.arc(n + o - l, s + l, l, Math.PI * 1.5, 0), t.lineTo(n + o, s + i), t.closePath()) : r ? (t.moveTo(s, n), t.lineTo(s, n + o), t.lineTo(s + i - l, n + o), t.arc(s + i - l, n + o - l, l, Math.PI / 2, 0, !0), t.lineTo(s + i, n + l), t.arc(s + i - l, n + l, l, 0, -Math.PI / 2, !0), t.closePath()) : (t.moveTo(s + i, n), t.lineTo(s + l, n), t.arc(s + l, n + l, l, -Math.PI / 2, Math.PI, !0), t.lineTo(s, n + o - l), t.arc(s + l, n + o - l, l, Math.PI, Math.PI / 2, !0), t.lineTo(s + i, n + o), t.closePath());
|
|
2916
2948
|
}
|
|
2917
2949
|
function Ie(t) {
|
|
2918
|
-
return (e, n, s, o, i, l, r, a,
|
|
2919
|
-
const
|
|
2920
|
-
if ([
|
|
2950
|
+
return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
|
|
2951
|
+
const x = (d == null ? void 0 : d.spanGaps) ?? !1;
|
|
2952
|
+
if ([u, c] = Ft(n, u, c), u === -1)
|
|
2921
2953
|
return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
|
|
2922
|
-
const
|
|
2923
|
-
let
|
|
2924
|
-
for (let
|
|
2925
|
-
const
|
|
2926
|
-
|
|
2927
|
-
}
|
|
2928
|
-
const T = s.ori ===
|
|
2929
|
-
stroke:
|
|
2954
|
+
const b = (v) => f($(v, s, i, r)), L = (v) => f($(v, o, l, a)), g = s.ori === V.Horizontal ? Rt : Gt, w = [], P = [];
|
|
2955
|
+
let z = !1;
|
|
2956
|
+
for (let v = h === N.Forward ? u : c; v >= u && v <= c; v += h) {
|
|
2957
|
+
const I = n[v];
|
|
2958
|
+
I != null ? (w.push(b(e[v])), P.push(L(I))) : I === null && !x && (z = !0);
|
|
2959
|
+
}
|
|
2960
|
+
const T = s.ori === V.Horizontal, S = t(w, P, T, f), C = {
|
|
2961
|
+
stroke: S ?? new Path2D(),
|
|
2930
2962
|
fill: null,
|
|
2931
2963
|
clip: null,
|
|
2932
2964
|
band: null,
|
|
2933
2965
|
gaps: null
|
|
2934
2966
|
};
|
|
2935
|
-
if (
|
|
2936
|
-
const
|
|
2937
|
-
let
|
|
2938
|
-
|
|
2967
|
+
if (S != null) {
|
|
2968
|
+
const v = C.fill = new Path2D(S), I = (d == null ? void 0 : d.fillTo) ?? o.min ?? 0, D = L(I);
|
|
2969
|
+
let m = r, p = r + i;
|
|
2970
|
+
h === N.Backward && ([p, m] = [m, p]), g(v, p, D), g(v, m, D);
|
|
2939
2971
|
}
|
|
2940
|
-
if (
|
|
2941
|
-
const
|
|
2942
|
-
|
|
2972
|
+
if (z) {
|
|
2973
|
+
const v = Yt(e, n, u, c, h, b);
|
|
2974
|
+
C.gaps = v, C.clip = Kt(v, s.ori, r, a, i, l);
|
|
2943
2975
|
}
|
|
2944
|
-
return
|
|
2976
|
+
return C;
|
|
2945
2977
|
};
|
|
2946
2978
|
}
|
|
2947
2979
|
function ys() {
|
|
@@ -2952,26 +2984,26 @@ const os = (t, e, n, s) => {
|
|
|
2952
2984
|
if (o < 2) return null;
|
|
2953
2985
|
const i = new Path2D(), l = t[0] ?? 0, r = e[0] ?? 0;
|
|
2954
2986
|
if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
|
|
2955
|
-
const f = t[1] ?? 0,
|
|
2956
|
-
return n ? i.lineTo(f,
|
|
2987
|
+
const f = t[1] ?? 0, d = e[1] ?? 0;
|
|
2988
|
+
return n ? i.lineTo(f, d) : i.lineTo(d, f), i;
|
|
2957
2989
|
}
|
|
2958
|
-
const a = new Array(o),
|
|
2990
|
+
const a = new Array(o), u = new Array(o - 1), c = new Array(o - 1), h = new Array(o - 1);
|
|
2959
2991
|
for (let f = 0; f < o - 1; f++)
|
|
2960
|
-
|
|
2961
|
-
a[0] =
|
|
2992
|
+
c[f] = (e[f + 1] ?? 0) - (e[f] ?? 0), h[f] = (t[f + 1] ?? 0) - (t[f] ?? 0), u[f] = h[f] !== 0 ? (c[f] ?? 0) / (h[f] ?? 1) : 0;
|
|
2993
|
+
a[0] = u[0] ?? 0;
|
|
2962
2994
|
for (let f = 1; f < o - 1; f++) {
|
|
2963
|
-
const
|
|
2964
|
-
if (
|
|
2995
|
+
const d = u[f] ?? 0, x = u[f - 1] ?? 0;
|
|
2996
|
+
if (d === 0 || x === 0 || x > 0 != d > 0)
|
|
2965
2997
|
a[f] = 0;
|
|
2966
2998
|
else {
|
|
2967
|
-
const
|
|
2968
|
-
a[f] = 3 * (L +
|
|
2999
|
+
const b = h[f] ?? 1, L = h[f - 1] ?? 1;
|
|
3000
|
+
a[f] = 3 * (L + b) / ((2 * b + L) / x + (b + 2 * L) / d), isFinite(a[f] ?? 0) || (a[f] = 0);
|
|
2969
3001
|
}
|
|
2970
3002
|
}
|
|
2971
|
-
a[o - 1] =
|
|
3003
|
+
a[o - 1] = u[o - 2] ?? 0;
|
|
2972
3004
|
for (let f = 0; f < o - 1; f++) {
|
|
2973
|
-
const
|
|
2974
|
-
n ? i.bezierCurveTo(
|
|
3005
|
+
const d = h[f] ?? 1, x = t[f] ?? 0, b = e[f] ?? 0, L = t[f + 1] ?? 0, g = e[f + 1] ?? 0, w = a[f] ?? 0, P = a[f + 1] ?? 0, z = x + d / 3, T = b + w * d / 3, S = L - d / 3, C = g - P * d / 3;
|
|
3006
|
+
n ? i.bezierCurveTo(z, T, S, C, L, g) : i.bezierCurveTo(T, z, C, S, g, L);
|
|
2975
3007
|
}
|
|
2976
3008
|
return i;
|
|
2977
3009
|
};
|
|
@@ -2983,38 +3015,38 @@ const ls = (t, e, n, s) => {
|
|
|
2983
3015
|
if (o < 2) return null;
|
|
2984
3016
|
const i = new Path2D(), l = s(t[0] ?? 0), r = s(e[0] ?? 0);
|
|
2985
3017
|
if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
|
|
2986
|
-
const a = s(t[1] ?? 0),
|
|
2987
|
-
return n ? i.lineTo(a,
|
|
3018
|
+
const a = s(t[1] ?? 0), u = s(e[1] ?? 0);
|
|
3019
|
+
return n ? i.lineTo(a, u) : i.lineTo(u, a), i;
|
|
2988
3020
|
}
|
|
2989
3021
|
for (let a = 0; a < o - 1; a++) {
|
|
2990
|
-
const
|
|
2991
|
-
let
|
|
2992
|
-
if (
|
|
2993
|
-
const
|
|
2994
|
-
|
|
3022
|
+
const u = a === 0 ? 0 : a - 1, c = t[u] ?? 0, h = e[u] ?? 0, f = t[a] ?? 0, d = e[a] ?? 0, x = t[a + 1] ?? 0, b = e[a + 1] ?? 0, L = a + 2 < o ? t[a + 2] ?? 0 : x, g = a + 2 < o ? e[a + 2] ?? 0 : b, w = Math.hypot(c - f, h - d), P = Math.hypot(f - x, d - b), z = Math.hypot(x - L, b - g), T = Math.sqrt(z), S = z, C = Math.sqrt(P), v = P, I = Math.sqrt(w), D = w, m = 2 * D + 3 * I * C + v, p = 2 * S + 3 * T * C + v, M = 3 * I * (I + C), k = 3 * T * (T + C);
|
|
3023
|
+
let y, A, F, R;
|
|
3024
|
+
if (M > 0) {
|
|
3025
|
+
const G = 1 / M;
|
|
3026
|
+
y = (-v * c + m * f + D * x) * G, A = (-v * h + m * d + D * b) * G;
|
|
2995
3027
|
} else
|
|
2996
|
-
|
|
2997
|
-
if (
|
|
2998
|
-
const
|
|
2999
|
-
F = (
|
|
3028
|
+
y = f, A = d;
|
|
3029
|
+
if (k > 0) {
|
|
3030
|
+
const G = 1 / k;
|
|
3031
|
+
F = (S * f + p * x - v * L) * G, R = (S * d + p * b - v * g) * G;
|
|
3000
3032
|
} else
|
|
3001
|
-
F =
|
|
3002
|
-
n ? i.bezierCurveTo(
|
|
3033
|
+
F = x, R = b;
|
|
3034
|
+
n ? i.bezierCurveTo(y, A, F, R, x, b) : i.bezierCurveTo(A, y, R, F, b, x);
|
|
3003
3035
|
}
|
|
3004
3036
|
return i;
|
|
3005
3037
|
};
|
|
3006
3038
|
function Cs(t = 4) {
|
|
3007
|
-
return (e, n, s, o, i, l, r, a,
|
|
3008
|
-
const
|
|
3009
|
-
for (let P =
|
|
3010
|
-
const
|
|
3011
|
-
if (
|
|
3012
|
-
const T =
|
|
3013
|
-
|
|
3039
|
+
return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
|
|
3040
|
+
const x = (P) => f($(P, s, i, r)), b = (P) => f($(P, o, l, a)), L = t / 2, g = new Path2D(), w = s.ori === V.Horizontal;
|
|
3041
|
+
for (let P = h === N.Forward ? u : c; P >= u && P <= c; P += h) {
|
|
3042
|
+
const z = n[P];
|
|
3043
|
+
if (z == null) continue;
|
|
3044
|
+
const T = x(e[P]), S = b(z);
|
|
3045
|
+
w ? (g.moveTo(T + L, S), g.arc(T, S, L, 0, Math.PI * 2)) : (g.moveTo(S + L, T), g.arc(S, T, L, 0, Math.PI * 2));
|
|
3014
3046
|
}
|
|
3015
3047
|
return {
|
|
3016
|
-
stroke:
|
|
3017
|
-
fill:
|
|
3048
|
+
stroke: g,
|
|
3049
|
+
fill: g,
|
|
3018
3050
|
clip: null,
|
|
3019
3051
|
band: null,
|
|
3020
3052
|
gaps: null
|
|
@@ -3029,54 +3061,54 @@ function Ts(t) {
|
|
|
3029
3061
|
high: l,
|
|
3030
3062
|
low: r,
|
|
3031
3063
|
close: a,
|
|
3032
|
-
xScale:
|
|
3033
|
-
yScale:
|
|
3034
|
-
upColor:
|
|
3064
|
+
xScale: u,
|
|
3065
|
+
yScale: c,
|
|
3066
|
+
upColor: h = "#26a69a",
|
|
3035
3067
|
downColor: f = "#ef5350",
|
|
3036
|
-
bodyWidth:
|
|
3037
|
-
wickWidth:
|
|
3068
|
+
bodyWidth: d = 0.6,
|
|
3069
|
+
wickWidth: x = 1
|
|
3038
3070
|
} = t;
|
|
3039
|
-
if (
|
|
3040
|
-
const
|
|
3041
|
-
if (
|
|
3042
|
-
const
|
|
3071
|
+
if (u.min == null || u.max == null || c.min == null || c.max == null) return;
|
|
3072
|
+
const b = o.length;
|
|
3073
|
+
if (b === 0) return;
|
|
3074
|
+
const g = Math.max(2, n.width / b * d) * s / 2;
|
|
3043
3075
|
e.save();
|
|
3044
|
-
for (let
|
|
3045
|
-
const P = o[
|
|
3046
|
-
if (P == null ||
|
|
3047
|
-
const
|
|
3048
|
-
e.strokeStyle =
|
|
3049
|
-
const
|
|
3050
|
-
e.fillStyle =
|
|
3076
|
+
for (let w = 0; w < b; w++) {
|
|
3077
|
+
const P = o[w], z = i[w], T = l[w], S = r[w], C = a[w];
|
|
3078
|
+
if (P == null || z == null || T == null || S == null || C == null) continue;
|
|
3079
|
+
const v = $(P, u, n.width, n.left) * s, I = $(z, c, n.height, n.top) * s, D = $(T, c, n.height, n.top) * s, m = $(S, c, n.height, n.top) * s, p = $(C, c, n.height, n.top) * s, k = C >= z ? h : f;
|
|
3080
|
+
e.strokeStyle = k, e.lineWidth = x * s, e.beginPath(), e.moveTo(v, D), e.lineTo(v, m), e.stroke();
|
|
3081
|
+
const y = Math.min(I, p), A = Math.abs(p - I);
|
|
3082
|
+
e.fillStyle = k, e.fillRect(v - g, y, g * 2, Math.max(A, 1 * s));
|
|
3051
3083
|
}
|
|
3052
3084
|
e.restore();
|
|
3053
3085
|
};
|
|
3054
3086
|
}
|
|
3055
3087
|
function Is(t, e, n = 0) {
|
|
3056
|
-
const s = e ?? t.series.map((
|
|
3057
|
-
for (let
|
|
3058
|
-
const
|
|
3059
|
-
if (
|
|
3060
|
-
const
|
|
3061
|
-
if (
|
|
3088
|
+
const s = e ?? t.series.map((u, c) => c), o = t.x.length, i = [], l = new Float64Array(o);
|
|
3089
|
+
for (let u = 0; u < s.length; u++) {
|
|
3090
|
+
const c = s[u];
|
|
3091
|
+
if (c == null) continue;
|
|
3092
|
+
const h = t.series[c];
|
|
3093
|
+
if (h == null) continue;
|
|
3062
3094
|
const f = new Array(o);
|
|
3063
|
-
for (let
|
|
3064
|
-
const
|
|
3065
|
-
|
|
3095
|
+
for (let d = 0; d < o; d++) {
|
|
3096
|
+
const x = h[d];
|
|
3097
|
+
x != null ? (l[d] = l[d] + x, f[d] = l[d]) : f[d] = null;
|
|
3066
3098
|
}
|
|
3067
3099
|
i.push(f);
|
|
3068
3100
|
}
|
|
3069
3101
|
const r = [];
|
|
3070
|
-
for (let
|
|
3071
|
-
const
|
|
3072
|
-
|
|
3102
|
+
for (let u = 0; u < t.series.length; u++) {
|
|
3103
|
+
const c = s.indexOf(u), h = c >= 0 ? i[c] : void 0;
|
|
3104
|
+
h != null ? r.push(h) : r.push(t.series[u] ?? []);
|
|
3073
3105
|
}
|
|
3074
3106
|
const a = [];
|
|
3075
|
-
for (let
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3107
|
+
for (let u = s.length - 1; u > 0; u--) {
|
|
3108
|
+
const c = s[u], h = s[u - 1];
|
|
3109
|
+
c != null && h != null && a.push({
|
|
3078
3110
|
group: n,
|
|
3079
|
-
series: [
|
|
3111
|
+
series: [c, h]
|
|
3080
3112
|
});
|
|
3081
3113
|
}
|
|
3082
3114
|
return {
|
|
@@ -3100,10 +3132,10 @@ function As(t) {
|
|
|
3100
3132
|
for (const [i, l] of t) {
|
|
3101
3133
|
const r = new Array(n.length).fill(null);
|
|
3102
3134
|
for (let a = 0; a < i.length; a++) {
|
|
3103
|
-
const
|
|
3104
|
-
if (
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3135
|
+
const u = i[a];
|
|
3136
|
+
if (u == null) continue;
|
|
3137
|
+
const c = s.get(u);
|
|
3138
|
+
c != null && (r[c] = l[a] ?? null);
|
|
3107
3139
|
}
|
|
3108
3140
|
o.push(r);
|
|
3109
3141
|
}
|
|
@@ -3119,11 +3151,11 @@ function Ps(t) {
|
|
|
3119
3151
|
function Ls(t, e = 0) {
|
|
3120
3152
|
return (n) => n.map((s) => s.toFixed(e) + t);
|
|
3121
3153
|
}
|
|
3122
|
-
function
|
|
3154
|
+
function zs(t) {
|
|
3123
3155
|
const e = (t == null ? void 0 : t.utc) ?? !1;
|
|
3124
3156
|
return (n) => n.map((s) => e ? nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }, "UTC") : nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }));
|
|
3125
3157
|
}
|
|
3126
|
-
function
|
|
3158
|
+
function Ds(t) {
|
|
3127
3159
|
const e = t != null && t.utc ? "UTC" : void 0, n = (t == null ? void 0 : t.format) ?? "short";
|
|
3128
3160
|
return (s) => s.map((o) => nt(o, { month: n }, e));
|
|
3129
3161
|
}
|
|
@@ -3155,7 +3187,7 @@ function Ae(t) {
|
|
|
3155
3187
|
const s = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);
|
|
3156
3188
|
return s ? [Number(s[1]), Number(s[2]), Number(s[3])] : null;
|
|
3157
3189
|
}
|
|
3158
|
-
function
|
|
3190
|
+
function Gs(t, e = 0.8, n = 0) {
|
|
3159
3191
|
const s = Ae(t);
|
|
3160
3192
|
if (s == null)
|
|
3161
3193
|
return { type: "linear", stops: [[0, t], [1, t]] };
|
|
@@ -3168,7 +3200,7 @@ function Hs(t, e = 0.8, n = 0) {
|
|
|
3168
3200
|
]
|
|
3169
3201
|
};
|
|
3170
3202
|
}
|
|
3171
|
-
function
|
|
3203
|
+
function Hs(t, e) {
|
|
3172
3204
|
const n = Ae(t);
|
|
3173
3205
|
if (n == null) return t;
|
|
3174
3206
|
const [s, o, i] = n;
|
|
@@ -3183,15 +3215,15 @@ function _s(t, e = 65, n = 50) {
|
|
|
3183
3215
|
return s;
|
|
3184
3216
|
}
|
|
3185
3217
|
export {
|
|
3186
|
-
|
|
3187
|
-
|
|
3218
|
+
xs as AnnotationLabel,
|
|
3219
|
+
zt as Axis,
|
|
3188
3220
|
as as Band,
|
|
3189
3221
|
Ce as Chart,
|
|
3190
|
-
|
|
3191
|
-
|
|
3222
|
+
N as Direction,
|
|
3223
|
+
q as Distribution,
|
|
3192
3224
|
ms as HLine,
|
|
3193
3225
|
cs as Legend,
|
|
3194
|
-
|
|
3226
|
+
V as Orientation,
|
|
3195
3227
|
vs as Region,
|
|
3196
3228
|
Lt as Scale,
|
|
3197
3229
|
Te as Series,
|
|
@@ -3210,25 +3242,25 @@ export {
|
|
|
3210
3242
|
ps as drawLabel,
|
|
3211
3243
|
ns as drawRegion,
|
|
3212
3244
|
es as drawVLine,
|
|
3213
|
-
|
|
3245
|
+
Gs as fadeGradient,
|
|
3214
3246
|
Ps as fmtCompact,
|
|
3215
3247
|
Fs as fmtDateStr,
|
|
3216
|
-
|
|
3248
|
+
zs as fmtHourMin,
|
|
3217
3249
|
Rs as fmtLabels,
|
|
3218
|
-
|
|
3250
|
+
Ds as fmtMonthName,
|
|
3219
3251
|
Ls as fmtSuffix,
|
|
3220
3252
|
Qe as linear,
|
|
3221
3253
|
ys as monotoneCubic,
|
|
3222
3254
|
_s as palette,
|
|
3223
3255
|
Cs as points,
|
|
3224
|
-
|
|
3225
|
-
|
|
3256
|
+
rt as posToVal,
|
|
3257
|
+
xt as sideOrientation,
|
|
3226
3258
|
Is as stackGroup,
|
|
3227
3259
|
bs as stepped,
|
|
3228
|
-
|
|
3260
|
+
lt as useChart,
|
|
3229
3261
|
hs as useCursorDrawHook,
|
|
3230
3262
|
Pt as useDrawHook,
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3263
|
+
Ms as useStreamingData,
|
|
3264
|
+
$ as valToPos,
|
|
3265
|
+
Hs as withAlpha
|
|
3234
3266
|
};
|