@umriss-ui/charts 0.3.2 → 0.4.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/CHANGELOG.md +207 -0
- package/README.md +5 -4
- package/dist/charts.css +1 -1
- package/dist/charts.js +2192 -1743
- package/dist/index.d.ts +173 -63
- package/package.json +2 -2
package/dist/charts.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import "./charts.css";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import {
|
|
6
|
-
import { useRef as
|
|
7
|
-
function
|
|
2
|
+
var He = Object.defineProperty;
|
|
3
|
+
var Ve = (i, t, e) => t in i ? He(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
4
|
+
var x = (i, t, e) => Ve(i, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { jsxs as G, jsx as I, Fragment as bt } from "react/jsx-runtime";
|
|
6
|
+
import { useRef as Q, useEffect as C, createContext as _e, useContext as Ye, useSyncExternalStore as Kt, useCallback as ze, useState as be, useMemo as P } from "react";
|
|
7
|
+
function Be() {
|
|
8
8
|
var t;
|
|
9
|
-
const
|
|
10
|
-
return typeof ((t =
|
|
9
|
+
const i = import.meta;
|
|
10
|
+
return typeof ((t = i.env) == null ? void 0 : t.DEV) == "boolean" ? i.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function ut(
|
|
14
|
-
if (
|
|
12
|
+
const ht = Be();
|
|
13
|
+
function ut(i, t) {
|
|
14
|
+
if (ht && !i)
|
|
15
15
|
throw new Error(`@umriss-ui/charts: ${t}`);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
!
|
|
17
|
+
const Jt = /* @__PURE__ */ new Set();
|
|
18
|
+
function J(i, t) {
|
|
19
|
+
!ht || Jt.has(i) || (Jt.add(i), console.warn(`@umriss-ui/charts: ${t}`));
|
|
20
20
|
}
|
|
21
21
|
const O = {
|
|
22
22
|
colorAxis: "rgba(23, 23, 23, 0.17)",
|
|
@@ -29,85 +29,85 @@ const O = {
|
|
|
29
29
|
font: "system-ui, sans-serif",
|
|
30
30
|
fontMono: "ui-monospace, monospace",
|
|
31
31
|
series: ["#2563eb", "#db2777", "#059669", "#d97706", "#7c3aed", "#0891b2"]
|
|
32
|
-
},
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
function
|
|
41
|
-
const e =
|
|
42
|
-
e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.visibility = "hidden",
|
|
32
|
+
}, Qt = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
let Ht = 0;
|
|
34
|
+
const Vt = /* @__PURE__ */ new Set();
|
|
35
|
+
let Lt = null;
|
|
36
|
+
function Ft(i, t, e) {
|
|
37
|
+
const n = i.getPropertyValue(t).trim();
|
|
38
|
+
return n === "" ? e : n;
|
|
39
|
+
}
|
|
40
|
+
function ve(i, t) {
|
|
41
|
+
const e = i.ownerDocument.createElement("span");
|
|
42
|
+
e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.visibility = "hidden", i.appendChild(e);
|
|
43
43
|
try {
|
|
44
|
-
return t((
|
|
45
|
-
e.style.color = "", e.style.color =
|
|
46
|
-
const
|
|
47
|
-
return
|
|
44
|
+
return t((n) => {
|
|
45
|
+
e.style.color = "", e.style.color = n;
|
|
46
|
+
const s = getComputedStyle(e).color;
|
|
47
|
+
return s === "" || s.startsWith("var(") ? n : s;
|
|
48
48
|
});
|
|
49
49
|
} finally {
|
|
50
50
|
e.remove();
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const t = getComputedStyle(
|
|
55
|
-
return
|
|
56
|
-
const
|
|
57
|
-
const a =
|
|
58
|
-
if (a ===
|
|
53
|
+
function Ge(i) {
|
|
54
|
+
const t = getComputedStyle(i);
|
|
55
|
+
return ve(i, (e) => {
|
|
56
|
+
const n = (o, r) => {
|
|
57
|
+
const a = Ft(t, o, r);
|
|
58
|
+
if (a === r) return r;
|
|
59
59
|
const l = e(`var(${o})`);
|
|
60
60
|
return l === `var(${o})` ? a : l;
|
|
61
|
-
},
|
|
61
|
+
}, s = [];
|
|
62
62
|
for (let o = 1; o <= 6; o++)
|
|
63
|
-
|
|
63
|
+
s.push(n(`--uc-series-${o}`, O.series[o - 1] ?? "#2563eb"));
|
|
64
64
|
return {
|
|
65
|
-
colorAxis:
|
|
66
|
-
colorGrid:
|
|
67
|
-
colorText:
|
|
68
|
-
colorBg:
|
|
69
|
-
colorWarning:
|
|
70
|
-
colorAlarm:
|
|
71
|
-
colorOk:
|
|
72
|
-
font:
|
|
73
|
-
fontMono:
|
|
74
|
-
series:
|
|
65
|
+
colorAxis: n("--uc-color-axis", O.colorAxis),
|
|
66
|
+
colorGrid: n("--uc-color-grid", O.colorGrid),
|
|
67
|
+
colorText: n("--uc-color-text", O.colorText),
|
|
68
|
+
colorBg: n("--uc-color-bg", O.colorBg),
|
|
69
|
+
colorWarning: n("--uc-color-warning", O.colorWarning),
|
|
70
|
+
colorAlarm: n("--uc-color-alarm", O.colorAlarm),
|
|
71
|
+
colorOk: n("--uc-color-ok", O.colorOk),
|
|
72
|
+
font: Ft(t, "--uc-font", O.font),
|
|
73
|
+
fontMono: Ft(t, "--uc-font-mono", O.fontMono),
|
|
74
|
+
series: s
|
|
75
75
|
};
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
var
|
|
80
|
-
|
|
78
|
+
function Ne() {
|
|
79
|
+
var i, t;
|
|
80
|
+
Lt === null && (typeof MutationObserver > "u" || typeof document > "u" || (Lt = new MutationObserver(() => jt()), Lt.observe(document.documentElement, { attributes: !0 }), typeof window < "u" && typeof window.matchMedia == "function" && ((t = (i = window.matchMedia("(prefers-color-scheme: dark)")).addEventListener) == null || t.call(i, "change", () => jt()))));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
return
|
|
84
|
-
const
|
|
85
|
-
for (const
|
|
86
|
-
return
|
|
82
|
+
function qe(i, t) {
|
|
83
|
+
return Ne(), ve(i, (e) => {
|
|
84
|
+
const n = {};
|
|
85
|
+
for (const s of Object.keys(t)) n[s] = e(t[s]);
|
|
86
|
+
return n;
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
const t =
|
|
92
|
-
if (t !== void 0 && t.generation ===
|
|
93
|
-
const e =
|
|
94
|
-
return
|
|
89
|
+
function Ke(i) {
|
|
90
|
+
Ne();
|
|
91
|
+
const t = Qt.get(i);
|
|
92
|
+
if (t !== void 0 && t.generation === Ht) return t.theme;
|
|
93
|
+
const e = Ge(i);
|
|
94
|
+
return Qt.set(i, { generation: Ht, theme: e }), e;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
for (const
|
|
96
|
+
function jt() {
|
|
97
|
+
Ht++;
|
|
98
|
+
for (const i of Vt) i();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
102
|
-
|
|
100
|
+
function Ue(i) {
|
|
101
|
+
return Vt.add(i), () => {
|
|
102
|
+
Vt.delete(i);
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
class
|
|
105
|
+
const Xe = { width: 0, height: 0 };
|
|
106
|
+
class Ze {
|
|
107
107
|
constructor(t) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
x(this, "span", null);
|
|
109
|
+
x(this, "root");
|
|
110
|
+
x(this, "cache", /* @__PURE__ */ new Map());
|
|
111
111
|
this.root = t;
|
|
112
112
|
}
|
|
113
113
|
ensure() {
|
|
@@ -118,13 +118,13 @@ class Ae {
|
|
|
118
118
|
}
|
|
119
119
|
/** Width and height of a text in the presentation of the given class. */
|
|
120
120
|
measure(t, e) {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
121
|
+
const n = `${e}|${t}`, s = this.cache.get(n);
|
|
122
|
+
if (s !== void 0) return s;
|
|
123
123
|
const o = this.ensure();
|
|
124
|
-
if (o === null) return
|
|
124
|
+
if (o === null) return Xe;
|
|
125
125
|
o.className = `uc-measure ${e}`, o.textContent = t;
|
|
126
|
-
const
|
|
127
|
-
return this.cache.set(
|
|
126
|
+
const r = o.getBoundingClientRect(), a = { width: r.width, height: r.height };
|
|
127
|
+
return this.cache.set(n, a), a;
|
|
128
128
|
}
|
|
129
129
|
clear() {
|
|
130
130
|
this.cache.clear();
|
|
@@ -134,59 +134,79 @@ class Ae {
|
|
|
134
134
|
(t = this.span) == null || t.remove(), this.span = null, this.cache.clear();
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return Object.is(
|
|
137
|
+
function vt(i) {
|
|
138
|
+
return Object.is(i, -0) ? 0 : i;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!Number.isFinite(
|
|
142
|
-
const e = Math.max(1, Math.floor(t)),
|
|
143
|
-
return (o <= 1 +
|
|
140
|
+
function et(i, t) {
|
|
141
|
+
if (!Number.isFinite(i) || i <= 0) return 1;
|
|
142
|
+
const e = Math.max(1, Math.floor(t)), n = i / e, s = Math.pow(10, Math.floor(Math.log10(n))), o = n / s, r = 1e-9;
|
|
143
|
+
return (o <= 1 + r ? 1 : o <= 2 + r ? 2 : o <= 5 + r ? 5 : 10) * s;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const t = Math.abs(
|
|
145
|
+
function At(i) {
|
|
146
|
+
const t = Math.abs(i);
|
|
147
147
|
if (!Number.isFinite(t) || t === 0) return 0;
|
|
148
148
|
const e = Math.floor(Math.log10(t));
|
|
149
|
-
let
|
|
150
|
-
const
|
|
151
|
-
for (;
|
|
152
|
-
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
function
|
|
156
|
-
return t <= 0 || !Number.isFinite(
|
|
157
|
-
}
|
|
158
|
-
function
|
|
159
|
-
if (!Number.isFinite(
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
149
|
+
let n = e < 0 ? -e : 0;
|
|
150
|
+
const s = t * 1e-9;
|
|
151
|
+
for (; n < 12 && Math.abs(Number(t.toFixed(n)) - t) > s; )
|
|
152
|
+
n++;
|
|
153
|
+
return n;
|
|
154
|
+
}
|
|
155
|
+
function Nt(i, t) {
|
|
156
|
+
return t <= 0 || !Number.isFinite(i) || Math.abs(i) >= 1e21 ? vt(i) : vt(Number(i.toFixed(Math.min(20, t))));
|
|
157
|
+
}
|
|
158
|
+
function Je(i, t, e) {
|
|
159
|
+
if (!Number.isFinite(i) || !Number.isFinite(t)) return [0, 1];
|
|
160
|
+
if (i === t) return [i - 1, t + 1];
|
|
161
|
+
const n = et(t - i, e), s = At(n);
|
|
162
162
|
return [
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
Nt(Math.floor(i / n) * n, s),
|
|
164
|
+
Nt(Math.ceil(t / n) * n, s)
|
|
165
165
|
];
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return !Number.isFinite(
|
|
169
|
-
}
|
|
170
|
-
function
|
|
171
|
-
if (!Number.isFinite(
|
|
172
|
-
if (
|
|
173
|
-
const [
|
|
174
|
-
if (!Number.isFinite(l) || !Number.isFinite(
|
|
175
|
-
const
|
|
176
|
-
for (let
|
|
177
|
-
|
|
178
|
-
return
|
|
167
|
+
function Dt(i, t) {
|
|
168
|
+
return !Number.isFinite(i) || !Number.isFinite(t) ? [0, 1] : i === t ? [i - 1, t + 1] : [i, t];
|
|
169
|
+
}
|
|
170
|
+
function ke(i, t, e) {
|
|
171
|
+
if (!Number.isFinite(i) || !Number.isFinite(t)) return [];
|
|
172
|
+
if (i === t) return [vt(i)];
|
|
173
|
+
const [n, s] = i < t ? [i, t] : [t, i], o = et(s - n, e), r = At(o), a = o * 1e-9, l = Math.ceil((n - a) / o), u = Math.floor((s + a) / o);
|
|
174
|
+
if (!Number.isFinite(l) || !Number.isFinite(u)) return [];
|
|
175
|
+
const d = [];
|
|
176
|
+
for (let f = l; f <= u; f++)
|
|
177
|
+
d.push(Nt(f * o, r));
|
|
178
|
+
return d;
|
|
179
|
+
}
|
|
180
|
+
function Qe(i, t, e, n) {
|
|
181
|
+
const s = n.length, o = n[0], r = n[s - 1];
|
|
182
|
+
if (s < 2 || o === void 0 || r === void 0 || !Number.isFinite(i) || !Number.isFinite(t))
|
|
183
|
+
return null;
|
|
184
|
+
const [a, l] = i === t ? [i - 1, t + 1] : [i, t], u = (r - o) / (s - 1), d = (o - e[0]) / u, f = (e[1] - r) / u, h = s - 1 + d + f, m = (p) => vt(Number(p.toPrecision(12)));
|
|
185
|
+
let c = et((l - a) / h, 1);
|
|
186
|
+
for (let p = 0; p < 64; p++) {
|
|
187
|
+
const y = c * 1e-9, g = Math.floor((a + d * c + y) / c) * c, b = g - d * c;
|
|
188
|
+
if (b + h * c >= l - y) {
|
|
189
|
+
const N = At(c);
|
|
190
|
+
return {
|
|
191
|
+
domain: [m(b), m(b + h * c)],
|
|
192
|
+
ticks: Array.from({ length: s }, (A, $) => Nt(g + $ * c, N)),
|
|
193
|
+
step: c
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
c = et(c * 1.5, 1);
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
179
199
|
}
|
|
180
|
-
class
|
|
200
|
+
class te {
|
|
181
201
|
constructor(t, e) {
|
|
182
|
-
|
|
183
|
-
|
|
202
|
+
x(this, "domain");
|
|
203
|
+
x(this, "range");
|
|
184
204
|
/** Pre-computed line equation px = v·m + b - the draw loop uses it directly. */
|
|
185
|
-
|
|
186
|
-
|
|
205
|
+
x(this, "m");
|
|
206
|
+
x(this, "b");
|
|
187
207
|
this.domain = t, this.range = e;
|
|
188
|
-
const
|
|
189
|
-
|
|
208
|
+
const n = t[1] - t[0];
|
|
209
|
+
n === 0 || !Number.isFinite(n) ? (this.m = 0, this.b = (e[0] + e[1]) / 2) : (this.m = (e[1] - e[0]) / n, this.b = e[0] - t[0] * this.m);
|
|
190
210
|
}
|
|
191
211
|
toPx(t) {
|
|
192
212
|
return t * this.m + this.b;
|
|
@@ -195,899 +215,1078 @@ class _t {
|
|
|
195
215
|
return this.m === 0 ? this.domain[0] : (t - this.b) / this.m;
|
|
196
216
|
}
|
|
197
217
|
ticks(t) {
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
let
|
|
202
|
-
function
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
return
|
|
206
|
-
}
|
|
207
|
-
const
|
|
208
|
-
function
|
|
209
|
-
const t =
|
|
210
|
-
let
|
|
211
|
-
return
|
|
212
|
-
minimumFractionDigits:
|
|
213
|
-
maximumFractionDigits:
|
|
218
|
+
return ke(this.domain[0], this.domain[1], t);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
let mt = null;
|
|
222
|
+
function we() {
|
|
223
|
+
if (mt !== null) return mt;
|
|
224
|
+
const i = typeof navigator > "u" ? void 0 : navigator.language;
|
|
225
|
+
return mt = typeof i == "string" && i !== "" ? i : "en-US", mt;
|
|
226
|
+
}
|
|
227
|
+
const kt = /* @__PURE__ */ new Map();
|
|
228
|
+
function je(i) {
|
|
229
|
+
const t = we(), e = `${t}|${i}`;
|
|
230
|
+
let n = kt.get(e);
|
|
231
|
+
return n === void 0 && (n = new Intl.NumberFormat(t, {
|
|
232
|
+
minimumFractionDigits: i,
|
|
233
|
+
maximumFractionDigits: i,
|
|
214
234
|
useGrouping: !0
|
|
215
|
-
}),
|
|
235
|
+
}), kt.set(e, n)), n;
|
|
216
236
|
}
|
|
217
|
-
function
|
|
218
|
-
return
|
|
237
|
+
function Ie(i, t) {
|
|
238
|
+
return je(Math.min(6, At(t))).format(i);
|
|
219
239
|
}
|
|
220
|
-
function
|
|
221
|
-
if (!Number.isFinite(
|
|
222
|
-
const t =
|
|
223
|
-
let
|
|
224
|
-
return
|
|
240
|
+
function ee(i) {
|
|
241
|
+
if (!Number.isFinite(i)) return "–";
|
|
242
|
+
const t = we(), e = `${t}|value`;
|
|
243
|
+
let n = kt.get(e);
|
|
244
|
+
return n === void 0 && (n = new Intl.NumberFormat(t, { maximumFractionDigits: 3, useGrouping: !0 }), kt.set(e, n)), n.format(i);
|
|
225
245
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
const t =
|
|
246
|
+
const j = 1e3, q = 60 * j, tt = 60 * q, K = 24 * tt;
|
|
247
|
+
function tn(i) {
|
|
248
|
+
const t = i.filter((o) => Number.isFinite(o.from) && Number.isFinite(o.to) && o.to > o.from).sort((o, r) => o.from - r.from), e = [];
|
|
229
249
|
for (const o of t) {
|
|
230
|
-
const
|
|
231
|
-
|
|
250
|
+
const r = e[e.length - 1];
|
|
251
|
+
r !== void 0 && o.from <= r.to ? o.to > r.to && (e[e.length - 1] = { from: r.from, to: o.to }) : e.push({ from: o.from, to: o.to });
|
|
232
252
|
}
|
|
233
|
-
const
|
|
234
|
-
let
|
|
253
|
+
const n = [];
|
|
254
|
+
let s = 0;
|
|
235
255
|
for (const o of e)
|
|
236
|
-
|
|
237
|
-
return { intervals: e, offsets:
|
|
256
|
+
n.push(s), s += o.to - o.from;
|
|
257
|
+
return { intervals: e, offsets: n, total: s };
|
|
238
258
|
}
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
if (!Array.isArray(
|
|
242
|
-
const t =
|
|
259
|
+
const ne = /* @__PURE__ */ new WeakMap();
|
|
260
|
+
function Z(i) {
|
|
261
|
+
if (!Array.isArray(i)) return i;
|
|
262
|
+
const t = i, e = ne.get(t);
|
|
243
263
|
if (e !== void 0) return e;
|
|
244
|
-
const
|
|
245
|
-
return
|
|
264
|
+
const n = tn(t);
|
|
265
|
+
return ne.set(t, n), n;
|
|
246
266
|
}
|
|
247
|
-
function
|
|
248
|
-
const e =
|
|
249
|
-
let
|
|
250
|
-
for (;
|
|
251
|
-
const
|
|
252
|
-
e[
|
|
267
|
+
function en(i, t) {
|
|
268
|
+
const e = i.intervals;
|
|
269
|
+
let n = 0, s = e.length - 1, o = -1;
|
|
270
|
+
for (; n <= s; ) {
|
|
271
|
+
const r = n + s >> 1;
|
|
272
|
+
e[r].from <= t ? (o = r, n = r + 1) : s = r - 1;
|
|
253
273
|
}
|
|
254
274
|
return o < 0 ? -1 : t <= e[o].to ? o : -1;
|
|
255
275
|
}
|
|
256
|
-
function
|
|
257
|
-
const e =
|
|
258
|
-
if (e.intervals.length === 0) return
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
}
|
|
262
|
-
function
|
|
263
|
-
const e =
|
|
264
|
-
if (
|
|
265
|
-
if (!(
|
|
266
|
-
if (
|
|
267
|
-
return
|
|
268
|
-
let
|
|
269
|
-
for (;
|
|
270
|
-
const a =
|
|
271
|
-
e.offsets[a] <=
|
|
272
|
-
}
|
|
273
|
-
return
|
|
274
|
-
}
|
|
275
|
-
function
|
|
276
|
-
const
|
|
276
|
+
function st(i, t) {
|
|
277
|
+
const e = Z(t);
|
|
278
|
+
if (e.intervals.length === 0) return i;
|
|
279
|
+
const n = en(e, i);
|
|
280
|
+
return n < 0 ? Number.NaN : e.offsets[n] + (i - e.intervals[n].from);
|
|
281
|
+
}
|
|
282
|
+
function ot(i, t) {
|
|
283
|
+
const e = Z(t), n = e.intervals;
|
|
284
|
+
if (n.length === 0) return i;
|
|
285
|
+
if (!(i >= 0) || i > e.total) return Number.NaN;
|
|
286
|
+
if (i === e.total)
|
|
287
|
+
return n[n.length - 1].to;
|
|
288
|
+
let s = 0, o = n.length - 1, r = 0;
|
|
289
|
+
for (; s <= o; ) {
|
|
290
|
+
const a = s + o >> 1;
|
|
291
|
+
e.offsets[a] <= i ? (r = a, s = a + 1) : o = a - 1;
|
|
292
|
+
}
|
|
293
|
+
return n[r].from + (i - e.offsets[r]);
|
|
294
|
+
}
|
|
295
|
+
function Si(i, t, e, n) {
|
|
296
|
+
const s = Z(i);
|
|
277
297
|
for (let o = 0; o < e; o++)
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
function
|
|
281
|
-
const e =
|
|
282
|
-
if (e.intervals.length === 0) return
|
|
283
|
-
const
|
|
284
|
-
if (!Number.isNaN(
|
|
285
|
-
if (!Number.isFinite(
|
|
286
|
-
for (let
|
|
287
|
-
const o = e.intervals[
|
|
288
|
-
if (
|
|
298
|
+
n[o] = st(t[o], s);
|
|
299
|
+
}
|
|
300
|
+
function nn(i, t) {
|
|
301
|
+
const e = Z(t);
|
|
302
|
+
if (e.intervals.length === 0) return i;
|
|
303
|
+
const n = st(i, e);
|
|
304
|
+
if (!Number.isNaN(n)) return n;
|
|
305
|
+
if (!Number.isFinite(i)) return Number.NaN;
|
|
306
|
+
for (let s = 0; s < e.intervals.length; s++) {
|
|
307
|
+
const o = e.intervals[s];
|
|
308
|
+
if (i < o.from) return e.offsets[s];
|
|
289
309
|
}
|
|
290
310
|
return e.total;
|
|
291
311
|
}
|
|
292
|
-
function
|
|
293
|
-
const e =
|
|
294
|
-
return e.intervals.length === 0 ? !1 : Number.isNaN(
|
|
312
|
+
function sn(i, t) {
|
|
313
|
+
const e = Z(t);
|
|
314
|
+
return e.intervals.length === 0 ? !1 : Number.isNaN(st(i, e));
|
|
295
315
|
}
|
|
296
|
-
function
|
|
297
|
-
const t =
|
|
298
|
-
for (let
|
|
316
|
+
function on(i) {
|
|
317
|
+
const t = Z(i), e = [];
|
|
318
|
+
for (let n = 1; n < t.intervals.length; n++)
|
|
299
319
|
e.push({
|
|
300
|
-
from: t.intervals[
|
|
301
|
-
to: t.intervals[
|
|
302
|
-
operatingTime: t.offsets[
|
|
320
|
+
from: t.intervals[n - 1].to,
|
|
321
|
+
to: t.intervals[n].from,
|
|
322
|
+
operatingTime: t.offsets[n]
|
|
303
323
|
});
|
|
304
324
|
return e;
|
|
305
325
|
}
|
|
306
|
-
function
|
|
307
|
-
return
|
|
308
|
-
}
|
|
309
|
-
const
|
|
326
|
+
function rn(i, t, e) {
|
|
327
|
+
return on(i).map((n) => n.operatingTime).filter((n) => n >= t && n <= e);
|
|
328
|
+
}
|
|
329
|
+
const ie = [
|
|
330
|
+
j,
|
|
331
|
+
2 * j,
|
|
332
|
+
5 * j,
|
|
333
|
+
10 * j,
|
|
334
|
+
15 * j,
|
|
335
|
+
30 * j,
|
|
336
|
+
q,
|
|
337
|
+
2 * q,
|
|
338
|
+
5 * q,
|
|
339
|
+
10 * q,
|
|
340
|
+
15 * q,
|
|
341
|
+
30 * q,
|
|
342
|
+
tt,
|
|
343
|
+
2 * tt,
|
|
344
|
+
3 * tt,
|
|
345
|
+
6 * tt,
|
|
346
|
+
12 * tt,
|
|
310
347
|
K,
|
|
311
348
|
2 * K,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
30 * K,
|
|
316
|
-
U,
|
|
317
|
-
2 * U,
|
|
318
|
-
5 * U,
|
|
319
|
-
10 * U,
|
|
320
|
-
15 * U,
|
|
321
|
-
30 * U,
|
|
322
|
-
Q,
|
|
323
|
-
2 * Q,
|
|
324
|
-
3 * Q,
|
|
325
|
-
6 * Q,
|
|
326
|
-
12 * Q,
|
|
327
|
-
X,
|
|
328
|
-
2 * X,
|
|
329
|
-
7 * X,
|
|
330
|
-
14 * X,
|
|
331
|
-
28 * X
|
|
349
|
+
7 * K,
|
|
350
|
+
14 * K,
|
|
351
|
+
28 * K
|
|
332
352
|
];
|
|
333
|
-
function
|
|
334
|
-
const e =
|
|
335
|
-
if (!Number.isFinite(
|
|
336
|
-
const
|
|
337
|
-
for (const
|
|
338
|
-
return
|
|
339
|
-
}
|
|
340
|
-
function
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
function an(i, t) {
|
|
354
|
+
const e = ie[0];
|
|
355
|
+
if (!Number.isFinite(i) || i <= 0) return e;
|
|
356
|
+
const n = i / Math.max(1, Math.floor(t));
|
|
357
|
+
for (const s of ie) if (s >= n) return s;
|
|
358
|
+
return K * et(n / K, 1);
|
|
359
|
+
}
|
|
360
|
+
function Ti(i) {
|
|
361
|
+
return new Date(i).getTimezoneOffset() * q;
|
|
362
|
+
}
|
|
363
|
+
function ln(i, t, e, n, s = 0) {
|
|
364
|
+
const o = Z(i), r = [];
|
|
365
|
+
if (!Number.isFinite(t) || !Number.isFinite(e) || !(n > 0)) return r;
|
|
366
|
+
const a = Math.ceil((t - s) / n), l = Math.floor((e - s) / n);
|
|
367
|
+
if (!Number.isFinite(a) || !Number.isFinite(l)) return r;
|
|
368
|
+
let u = Number.NaN;
|
|
369
|
+
for (let d = a; d <= l; d++) {
|
|
370
|
+
const f = s + d * n, h = st(f, o);
|
|
371
|
+
Number.isNaN(h) || h === u || (r.push({ wallClock: f, operatingTime: h }), u = h);
|
|
349
372
|
}
|
|
350
|
-
return
|
|
373
|
+
return r;
|
|
351
374
|
}
|
|
352
|
-
function
|
|
353
|
-
const o =
|
|
375
|
+
function Li(i, t, e, n, s = 0) {
|
|
376
|
+
const o = Z(i);
|
|
354
377
|
if (o.intervals.length === 0 || !(e > t)) return [];
|
|
355
|
-
const
|
|
356
|
-
return
|
|
378
|
+
const r = Math.max(0, Math.min(o.total, t)), a = Math.max(0, Math.min(o.total, e)), l = an(e - t, n);
|
|
379
|
+
return ln(
|
|
357
380
|
o,
|
|
358
|
-
|
|
359
|
-
|
|
381
|
+
ot(r, o),
|
|
382
|
+
ot(a, o),
|
|
360
383
|
l,
|
|
361
|
-
|
|
362
|
-
).map((
|
|
384
|
+
s
|
|
385
|
+
).map((d) => d.operatingTime).filter((d) => d >= t && d <= e);
|
|
386
|
+
}
|
|
387
|
+
const se = 365 * K, cn = [
|
|
388
|
+
...[1, 2, 5, 10, 15, 30].map((i) => ({ unit: "minute", n: i, ms: i * q })),
|
|
389
|
+
...[1, 2, 3, 6, 12].map((i) => ({ unit: "hour", n: i, ms: i * tt })),
|
|
390
|
+
...[1, 2, 7, 14].map((i) => ({ unit: "day", n: i, ms: i * K })),
|
|
391
|
+
...[1, 2, 3, 6].map((i) => ({ unit: "month", n: i, ms: i * 30 * K }))
|
|
392
|
+
];
|
|
393
|
+
function un(i, t) {
|
|
394
|
+
const e = i / Math.max(1, Math.floor(t));
|
|
395
|
+
for (const s of cn) if (s.ms >= e) return s;
|
|
396
|
+
const n = Math.max(1, et(e / se, 1));
|
|
397
|
+
return { unit: "year", n, ms: n * se };
|
|
398
|
+
}
|
|
399
|
+
const wt = { year: 0, month: 1, day: 2, hour: 3, minute: 4 };
|
|
400
|
+
function _t(i, t) {
|
|
401
|
+
const e = new Date(i), n = [e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes()], s = wt[t.unit];
|
|
402
|
+
for (let r = s + 1; r < n.length; r++) n[r] = r === wt.day ? 1 : 0;
|
|
403
|
+
const o = n[s];
|
|
404
|
+
if (t.unit === "day") {
|
|
405
|
+
const r = Math.round(Date.UTC(n[0], n[1], o) / K);
|
|
406
|
+
n[s] = o - ((r + 3) % t.n + t.n) % t.n;
|
|
407
|
+
} else
|
|
408
|
+
n[s] = Math.floor(o / t.n) * t.n;
|
|
409
|
+
return n;
|
|
410
|
+
}
|
|
411
|
+
function xt(i, t, e) {
|
|
412
|
+
const n = i.slice();
|
|
413
|
+
return n[wt[t.unit]] = n[wt[t.unit]] + e * t.n, new Date(n[0], n[1], n[2], n[3], n[4]).getTime();
|
|
414
|
+
}
|
|
415
|
+
function oe(i, t, e) {
|
|
416
|
+
const n = [];
|
|
417
|
+
if (!Number.isFinite(i) || !Number.isFinite(t)) return n;
|
|
418
|
+
const s = _t(i, e);
|
|
419
|
+
for (let o = 0; o < 1e3; o++) {
|
|
420
|
+
const r = xt(s, e, o);
|
|
421
|
+
if (r > t) break;
|
|
422
|
+
r >= i && !(r <= n[n.length - 1]) && n.push(r);
|
|
423
|
+
}
|
|
424
|
+
return n;
|
|
425
|
+
}
|
|
426
|
+
function hn(i, t, e) {
|
|
427
|
+
const n = _t(t, e), s = xt(n, e, 0);
|
|
428
|
+
return [xt(_t(i, e), e, 0), s < t ? xt(n, e, 1) : s];
|
|
429
|
+
}
|
|
430
|
+
const Me = new Intl.DateTimeFormat("en-GB", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }), dn = new Intl.DateTimeFormat("en-GB", {
|
|
431
|
+
hour: "2-digit",
|
|
432
|
+
minute: "2-digit",
|
|
433
|
+
second: "2-digit",
|
|
434
|
+
hourCycle: "h23"
|
|
435
|
+
}), Ae = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short" }), fn = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric" }), mn = new Intl.DateTimeFormat("en-GB", { month: "short", year: "numeric" }), pn = new Intl.DateTimeFormat("en-GB", { year: "numeric" });
|
|
436
|
+
function Yt(i, t = !1) {
|
|
437
|
+
return Number.isFinite(i) ? `${Ae.format(i)} ${(t ? dn : Me).format(i)}` : "";
|
|
438
|
+
}
|
|
439
|
+
function yn(i, t) {
|
|
440
|
+
return i.map((e, n) => {
|
|
441
|
+
const s = n === 0 ? void 0 : new Date(i[n - 1]), o = new Date(e);
|
|
442
|
+
switch (t.unit) {
|
|
443
|
+
case "minute":
|
|
444
|
+
case "hour":
|
|
445
|
+
return s === void 0 || s.toDateString() !== o.toDateString() ? Yt(e) : Me.format(e);
|
|
446
|
+
case "day":
|
|
447
|
+
return s === void 0 || s.getFullYear() !== o.getFullYear() ? fn.format(e) : Ae.format(e);
|
|
448
|
+
case "month":
|
|
449
|
+
return mn.format(e);
|
|
450
|
+
default:
|
|
451
|
+
return pn.format(e);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
363
454
|
}
|
|
364
|
-
const
|
|
455
|
+
const zt = 5, Bt = 4, Et = 8, re = 4, gn = 8, it = "uc-tick-label", pt = "uc-axis-title", Se = {
|
|
365
456
|
width: 0,
|
|
366
457
|
height: 0,
|
|
367
458
|
plot: { x: 0, y: 0, width: 0, height: 0 },
|
|
368
459
|
axes: []
|
|
369
460
|
};
|
|
370
|
-
function
|
|
371
|
-
const
|
|
372
|
-
return
|
|
461
|
+
function ae(i, t, e) {
|
|
462
|
+
const n = Math.ceil(t), s = e.get(i);
|
|
463
|
+
return s === void 0 || n > s || s - n >= gn ? (e.set(i, n), n) : s;
|
|
464
|
+
}
|
|
465
|
+
function St(i) {
|
|
466
|
+
return i.calendar !== void 0 && i.calendar.length > 0 ? i.calendar : void 0;
|
|
467
|
+
}
|
|
468
|
+
function Te(i) {
|
|
469
|
+
return i[1] - i[0] >= q;
|
|
470
|
+
}
|
|
471
|
+
function It(i, t) {
|
|
472
|
+
return un(i[1] - i[0], t);
|
|
373
473
|
}
|
|
374
|
-
function
|
|
375
|
-
const e =
|
|
474
|
+
function Pt(i, t) {
|
|
475
|
+
const e = i.domainMode;
|
|
376
476
|
if (Array.isArray(e)) {
|
|
377
477
|
const o = e;
|
|
378
478
|
return o[0] === o[1] ? [o[0] - 1, o[1] + 1] : o;
|
|
379
479
|
}
|
|
380
|
-
const [
|
|
381
|
-
return
|
|
382
|
-
}
|
|
383
|
-
function
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return i !== void 0 && i.length > 0 ? _e(i, t[0], t[1], e) : oe(t[0], t[1], e);
|
|
393
|
-
}
|
|
394
|
-
function Xt(n, t, e) {
|
|
395
|
-
const i = n.calendar;
|
|
396
|
-
if (i !== void 0 && i.length > 0) {
|
|
397
|
-
const o = n.tickFormat;
|
|
398
|
-
return o === void 0 ? (s) => Ye(dt(s, i)) : (s) => o(dt(s, i));
|
|
399
|
-
}
|
|
400
|
-
if (n.tickFormat !== void 0) return n.tickFormat;
|
|
401
|
-
const r = mt(Math.abs(t[1] - t[0]), e);
|
|
402
|
-
return (o) => Ee(o, r);
|
|
403
|
-
}
|
|
404
|
-
function ze(n) {
|
|
405
|
-
const { width: t, height: e, padding: i, axes: r, measure: o, hysteresis: s } = n, a = r.filter((v) => v.position === "left"), l = r.filter((v) => v.position === "right"), c = r.filter((v) => v.position === "top"), u = r.filter((v) => v.position === "bottom"), h = Math.ceil(o("0", it).height) || 14, p = /* @__PURE__ */ new Map();
|
|
406
|
-
for (const v of [...c, ...u]) {
|
|
407
|
-
const M = v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, lt).height) + Gt;
|
|
408
|
-
p.set(v.key, qt(v.key, Lt + Tt + h + M, s));
|
|
409
|
-
}
|
|
410
|
-
const d = (v, M) => {
|
|
411
|
-
let x = 0;
|
|
412
|
-
for (let T = 0; T < v.length; T++) {
|
|
413
|
-
const C = v[T];
|
|
414
|
-
C !== void 0 && (x += M.get(C.key) ?? 0, T > 0 && (x += xt));
|
|
480
|
+
const [n, s] = i.extent;
|
|
481
|
+
return St(i) !== void 0 || e === "data" ? Dt(n, s) : i.time === !0 ? Te([n, s]) ? hn(n, s, It([n, s], t)) : Dt(n, s) : Je(n, s, t);
|
|
482
|
+
}
|
|
483
|
+
function le(i, t, e) {
|
|
484
|
+
const n = St(i);
|
|
485
|
+
if (i.tickValues !== void 0)
|
|
486
|
+
return (n !== void 0 ? i.tickValues.map((o) => st(o, n)) : i.tickValues).filter((o) => o >= t[0] && o <= t[1]);
|
|
487
|
+
if (n !== void 0) {
|
|
488
|
+
const s = Z(n), o = (a) => ot(Math.min(Math.max(a, 0), s.total), s), r = [];
|
|
489
|
+
for (const a of oe(o(t[0]), o(t[1]), It(t, e))) {
|
|
490
|
+
const l = st(a, s);
|
|
491
|
+
Number.isNaN(l) || l === r[r.length - 1] || l >= t[0] && l <= t[1] && r.push(l);
|
|
415
492
|
}
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
493
|
+
return r;
|
|
494
|
+
}
|
|
495
|
+
return i.time === !0 ? Te(t) ? oe(t[0], t[1], It(t, e)) : [] : ke(t[0], t[1], e);
|
|
496
|
+
}
|
|
497
|
+
function ce(i, t, e) {
|
|
498
|
+
const n = i.tickFormat, s = St(i);
|
|
499
|
+
if (s !== void 0)
|
|
500
|
+
return n !== void 0 ? (r) => n(ot(r, s)) : (r, a) => Yt(ot(r, s), a);
|
|
501
|
+
if (n !== void 0) return (r) => n(r);
|
|
502
|
+
if (i.time === !0) return Yt;
|
|
503
|
+
const o = et(Math.abs(t[1] - t[0]), e);
|
|
504
|
+
return (r) => Ie(r, o);
|
|
505
|
+
}
|
|
506
|
+
function ue(i, t, e, n, s) {
|
|
507
|
+
const o = St(i);
|
|
508
|
+
if (i.tickFormat !== void 0 || i.time !== !0 && o === void 0) return n.map(s);
|
|
509
|
+
const r = o === void 0 ? n : n.map((a) => ot(a, o));
|
|
510
|
+
return yn(r, It(t, e));
|
|
511
|
+
}
|
|
512
|
+
function Le(i, t, e) {
|
|
513
|
+
return Math.min(Math.max(i, 0), Math.max(0, e - t));
|
|
514
|
+
}
|
|
515
|
+
function xn(i) {
|
|
516
|
+
const { width: t, height: e, padding: n, axes: s, measure: o, hysteresis: r } = i, a = s.filter((k) => k.position === "left"), l = s.filter((k) => k.position === "right"), u = s.filter((k) => k.position === "top"), d = s.filter((k) => k.position === "bottom"), f = Math.ceil(o("0", it).height) || 14, h = /* @__PURE__ */ new Map();
|
|
517
|
+
for (const k of [...u, ...d]) {
|
|
518
|
+
const D = k.label === void 0 || k.label === "" ? 0 : Math.ceil(o(k.label, pt).height) + re;
|
|
519
|
+
h.set(k.key, ae(k.key, zt + Bt + f + D, r));
|
|
520
|
+
}
|
|
521
|
+
const m = (k, D) => {
|
|
522
|
+
let v = 0;
|
|
523
|
+
for (let F = 0; F < k.length; F++) {
|
|
524
|
+
const R = k[F];
|
|
525
|
+
R !== void 0 && (v += D.get(R.key) ?? 0, F > 0 && (v += Et));
|
|
526
|
+
}
|
|
527
|
+
return v;
|
|
528
|
+
}, c = n.top + m(u, h), p = e - n.bottom - m(d, h), y = Math.max(0, p - c), g = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), N = s.find((k) => k.orientation === "y");
|
|
529
|
+
for (const k of [...a, ...l].sort((D, v) => D === N ? -1 : v === N ? 1 : 0)) {
|
|
530
|
+
const D = k.tickCount ?? Math.max(2, Math.round(y / 50)), v = N === void 0 ? void 0 : g.get(N.key), [F, R] = Array.isArray(k.domainMode) ? Pt(k, D) : k.extent, M = k.alignTicks === !0 && k !== N && v !== void 0 ? Qe(F, R, v.domain, v.values) : null, V = (M == null ? void 0 : M.domain) ?? Pt(k, D), E = (M == null ? void 0 : M.ticks) ?? le(k, V, D), z = M === null ? ce(k, V, D) : k.tickFormat ?? ((Y) => Ie(Y, M.step)), B = ue(k, V, D, E, z), U = B.map((Y) => o(Y, it).width);
|
|
531
|
+
let _ = 0;
|
|
532
|
+
for (const Y of U) Y > _ && (_ = Y);
|
|
533
|
+
for (const Y of k.limitLabels ?? []) _ = Math.max(_, o(Y, it).width + 4);
|
|
534
|
+
const nt = k.label === void 0 || k.label === "" ? 0 : Math.ceil(o(k.label, pt).height) + re;
|
|
535
|
+
g.set(k.key, { axis: k, domain: V, values: E, labels: B, widths: U, format: z }), b.set(
|
|
536
|
+
k.key,
|
|
537
|
+
ae(k.key, zt + Bt + _ + nt, r)
|
|
427
538
|
);
|
|
428
539
|
}
|
|
429
|
-
const
|
|
430
|
-
switch (
|
|
540
|
+
const A = n.left + m(a, b), $ = t - n.right - m(l, b), w = Math.max(0, $ - A), W = { x: A, y: c, width: w, height: y }, L = (k, D, v, F) => {
|
|
541
|
+
switch (k.position) {
|
|
431
542
|
case "left":
|
|
432
|
-
return { x:
|
|
543
|
+
return { x: A - v - F, y: c, width: F, height: y };
|
|
433
544
|
case "right":
|
|
434
|
-
return { x:
|
|
545
|
+
return { x: $ + v, y: c, width: F, height: y };
|
|
435
546
|
case "top":
|
|
436
|
-
return { x:
|
|
547
|
+
return { x: A, y: c - v - F, width: w, height: F };
|
|
437
548
|
default:
|
|
438
|
-
return { x:
|
|
549
|
+
return { x: A, y: p + v, width: w, height: F };
|
|
439
550
|
}
|
|
440
|
-
},
|
|
441
|
-
let
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
value:
|
|
447
|
-
label: (
|
|
448
|
-
px:
|
|
551
|
+
}, S = [], T = (k) => {
|
|
552
|
+
let D = 0;
|
|
553
|
+
k.forEach((v, F) => {
|
|
554
|
+
const R = b.get(v.key) ?? 0, M = g.get(v.key), V = L(v, F, D, R);
|
|
555
|
+
D += R + Et;
|
|
556
|
+
const E = (M == null ? void 0 : M.domain) ?? [0, 1], z = (M == null ? void 0 : M.format) ?? ((_) => String(_)), B = new te(E, [c + y, c]), U = ((M == null ? void 0 : M.values) ?? []).map((_, nt) => ({
|
|
557
|
+
value: _,
|
|
558
|
+
label: (M == null ? void 0 : M.labels[nt]) ?? "",
|
|
559
|
+
px: B.toPx(_),
|
|
449
560
|
labelLeft: 0,
|
|
450
|
-
labelWidth: (
|
|
561
|
+
labelWidth: (M == null ? void 0 : M.widths[nt]) ?? 0
|
|
451
562
|
}));
|
|
452
|
-
|
|
453
|
-
key:
|
|
454
|
-
id:
|
|
563
|
+
S.push({
|
|
564
|
+
key: v.key,
|
|
565
|
+
id: v.id,
|
|
455
566
|
orientation: "y",
|
|
456
|
-
position:
|
|
457
|
-
label:
|
|
458
|
-
grid:
|
|
459
|
-
band:
|
|
460
|
-
size:
|
|
461
|
-
stack:
|
|
462
|
-
domain:
|
|
463
|
-
scale:
|
|
464
|
-
ticks:
|
|
465
|
-
format:
|
|
466
|
-
titleSize:
|
|
567
|
+
position: v.position,
|
|
568
|
+
label: v.label,
|
|
569
|
+
grid: v.grid,
|
|
570
|
+
band: V,
|
|
571
|
+
size: R,
|
|
572
|
+
stack: F,
|
|
573
|
+
domain: E,
|
|
574
|
+
scale: B,
|
|
575
|
+
ticks: U,
|
|
576
|
+
format: z,
|
|
577
|
+
titleSize: v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, pt).height),
|
|
467
578
|
breaks: []
|
|
468
579
|
});
|
|
469
580
|
});
|
|
470
581
|
};
|
|
471
|
-
|
|
472
|
-
const
|
|
473
|
-
let
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
return { value: Y, label:
|
|
582
|
+
T(a), T(l);
|
|
583
|
+
const H = (k) => {
|
|
584
|
+
let D = 0;
|
|
585
|
+
k.forEach((v, F) => {
|
|
586
|
+
const R = h.get(v.key) ?? 0, M = L(v, F, D, R);
|
|
587
|
+
D += R + Et;
|
|
588
|
+
const V = v.tickCount ?? Math.max(2, Math.round(w / 80)), E = Pt(v, V), z = le(v, E, V), B = ce(v, E, V), U = ue(v, E, V, z, B), _ = new te(E, [A, A + w]), nt = z.map((Y, We) => {
|
|
589
|
+
const Xt = U[We] ?? "", Tt = o(Xt, it).width, Zt = _.toPx(Y), Re = Le(Zt - Tt / 2, Tt, t);
|
|
590
|
+
return { value: Y, label: Xt, px: Zt, labelLeft: Re, labelWidth: Tt };
|
|
480
591
|
});
|
|
481
|
-
|
|
482
|
-
key:
|
|
483
|
-
id:
|
|
592
|
+
S.push({
|
|
593
|
+
key: v.key,
|
|
594
|
+
id: v.id,
|
|
484
595
|
orientation: "x",
|
|
485
|
-
position:
|
|
486
|
-
label:
|
|
487
|
-
grid:
|
|
488
|
-
band:
|
|
489
|
-
size:
|
|
490
|
-
stack:
|
|
491
|
-
domain:
|
|
492
|
-
scale:
|
|
493
|
-
ticks:
|
|
494
|
-
format:
|
|
495
|
-
titleSize:
|
|
496
|
-
breaks:
|
|
596
|
+
position: v.position,
|
|
597
|
+
label: v.label,
|
|
598
|
+
grid: v.grid,
|
|
599
|
+
band: M,
|
|
600
|
+
size: R,
|
|
601
|
+
stack: F,
|
|
602
|
+
domain: E,
|
|
603
|
+
scale: _,
|
|
604
|
+
ticks: nt,
|
|
605
|
+
format: B,
|
|
606
|
+
titleSize: v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, pt).height),
|
|
607
|
+
breaks: v.calendar === void 0 || v.calendar.length === 0 ? [] : rn(v.calendar, E[0], E[1]).map((Y) => _.toPx(Y))
|
|
497
608
|
});
|
|
498
609
|
});
|
|
499
610
|
};
|
|
500
|
-
return
|
|
501
|
-
}
|
|
502
|
-
function Ge(n, t, e) {
|
|
503
|
-
if (t <= 0 || !(e >= n[0])) return -1;
|
|
504
|
-
let i = 0, r = t - 1;
|
|
505
|
-
if (n[r] <= e) return r;
|
|
506
|
-
for (; r - i > 1; ) {
|
|
507
|
-
const o = i + r >> 1;
|
|
508
|
-
n[o] <= e ? i = o : r = o;
|
|
509
|
-
}
|
|
510
|
-
return i;
|
|
511
|
-
}
|
|
512
|
-
function le(n, t, e, i) {
|
|
513
|
-
return e + 1 < t ? n[e + 1] : i;
|
|
514
|
-
}
|
|
515
|
-
const ce = 0.28;
|
|
516
|
-
function ot(n, t) {
|
|
517
|
-
return Number.isFinite(n) ? n : t;
|
|
518
|
-
}
|
|
519
|
-
function ue(n) {
|
|
520
|
-
return !Number.isFinite(n);
|
|
521
|
-
}
|
|
522
|
-
function Zt(n, t) {
|
|
523
|
-
return n < t;
|
|
524
|
-
}
|
|
525
|
-
function qe(n, t, e, i) {
|
|
526
|
-
const r = new Int32Array(e);
|
|
527
|
-
for (let o = 0; o < e; o++) {
|
|
528
|
-
const s = n[o], a = ot(t[o], i);
|
|
529
|
-
if (!Zt(s, a)) continue;
|
|
530
|
-
let l = 0;
|
|
531
|
-
for (let c = 0; c < o; c++) {
|
|
532
|
-
const u = n[c], h = ot(t[c], i);
|
|
533
|
-
Zt(u, h) && s < h && u < a && l++;
|
|
534
|
-
}
|
|
535
|
-
r[o] = l;
|
|
536
|
-
}
|
|
537
|
-
return r;
|
|
611
|
+
return H(u), H(d), { width: t, height: e, plot: W, axes: S };
|
|
538
612
|
}
|
|
539
|
-
function
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
613
|
+
function he(i, t, e) {
|
|
614
|
+
if (t <= 0 || !(e >= i[0])) return -1;
|
|
615
|
+
let n = 0, s = t - 1;
|
|
616
|
+
if (i[s] <= e) return s;
|
|
617
|
+
for (; s - n > 1; ) {
|
|
618
|
+
const o = n + s >> 1;
|
|
619
|
+
i[o] <= e ? n = o : s = o;
|
|
546
620
|
}
|
|
547
|
-
return
|
|
621
|
+
return n;
|
|
548
622
|
}
|
|
549
|
-
function
|
|
550
|
-
return
|
|
551
|
-
}
|
|
552
|
-
function
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
623
|
+
function Fe(i, t, e, n) {
|
|
624
|
+
return e + 1 < t ? i[e + 1] : n;
|
|
625
|
+
}
|
|
626
|
+
function bn(i, t, e, n, s) {
|
|
627
|
+
const o = i[t - 1], r = e > o ? e : n > 0 ? o + n : s;
|
|
628
|
+
return Math.min(r, s);
|
|
629
|
+
}
|
|
630
|
+
function vn(i, t) {
|
|
631
|
+
const e = [];
|
|
632
|
+
for (let n = 1; n < t; n++) {
|
|
633
|
+
const s = i[n] - i[n - 1];
|
|
634
|
+
s > 0 && e.push(s);
|
|
635
|
+
}
|
|
636
|
+
return e.length === 0 ? 0 : (e.sort((n, s) => n - s), e[e.length - 1 >> 1]);
|
|
637
|
+
}
|
|
638
|
+
function dt(i) {
|
|
639
|
+
return Math.round(i) + 0.5;
|
|
640
|
+
}
|
|
641
|
+
function Nn(i, t) {
|
|
642
|
+
const { plot: e, axes: n, theme: s } = t, o = e.x, r = e.x + e.width, a = e.y, l = e.y + e.height;
|
|
643
|
+
i.lineWidth = 1;
|
|
644
|
+
for (const u of n)
|
|
645
|
+
if (u.grid)
|
|
646
|
+
for (const d of [0, 1]) {
|
|
647
|
+
const f = d === 1;
|
|
648
|
+
i.beginPath();
|
|
649
|
+
let h = !1;
|
|
650
|
+
for (const m of u.ticks)
|
|
651
|
+
if ((u.orientation === "y" && m.value === 0) === f)
|
|
652
|
+
if (h = !0, u.orientation === "y") {
|
|
653
|
+
const p = dt(m.px);
|
|
654
|
+
i.moveTo(o, p), i.lineTo(r, p);
|
|
566
655
|
} else {
|
|
567
|
-
const
|
|
568
|
-
|
|
656
|
+
const p = dt(m.px);
|
|
657
|
+
i.moveTo(p, a), i.lineTo(p, l);
|
|
569
658
|
}
|
|
570
|
-
|
|
659
|
+
h && (i.strokeStyle = f ? s.colorAxis : s.colorGrid, i.stroke());
|
|
571
660
|
}
|
|
572
661
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
662
|
+
const kn = 60;
|
|
663
|
+
function wn(i, t, e) {
|
|
664
|
+
return (e === 0 || Number.isNaN(i[e - 1])) && (e === t - 1 || Number.isNaN(i[e + 1]));
|
|
665
|
+
}
|
|
666
|
+
function In(i, t) {
|
|
667
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.step === !0, d = new Path2D();
|
|
668
|
+
let f = !1, h = 0;
|
|
669
|
+
for (let m = 0; m < e; m++) {
|
|
670
|
+
const c = l[m], p = a[m] * n + s;
|
|
671
|
+
if (Number.isNaN(c)) {
|
|
672
|
+
u && f && d.lineTo(p, h), f = !1;
|
|
580
673
|
continue;
|
|
581
674
|
}
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
}
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
587
|
-
for (let
|
|
588
|
-
const
|
|
589
|
-
if (Number.isNaN(m)) continue;
|
|
590
|
-
const
|
|
591
|
-
p.moveTo(
|
|
675
|
+
const y = c * o + r;
|
|
676
|
+
f ? (u && d.lineTo(p, h), d.lineTo(p, y)) : (d.moveTo(p, y), f = !0), h = y;
|
|
677
|
+
}
|
|
678
|
+
if (i.strokeStyle = t.color, i.lineWidth = t.strokeWidth, t.dash !== void 0 && t.dash.length > 0 ? i.setLineDash(t.dash) : i.setLineDash([]), i.stroke(d), i.setLineDash([]), t.markers !== "never") {
|
|
679
|
+
const m = t.markers === "always" || e <= kn, c = t.strokeWidth + 1.5, p = new Path2D();
|
|
680
|
+
for (let y = 0; y < e; y++) {
|
|
681
|
+
const g = l[y];
|
|
682
|
+
if (Number.isNaN(g) || !m && !wn(l, e, y)) continue;
|
|
683
|
+
const b = a[y] * n + s, N = g * o + r;
|
|
684
|
+
p.moveTo(b + c, N), p.arc(b, N, c, 0, Math.PI * 2);
|
|
592
685
|
}
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
function
|
|
597
|
-
const e = t.length,
|
|
598
|
-
let
|
|
599
|
-
for (;
|
|
600
|
-
for (;
|
|
601
|
-
|
|
602
|
-
if (
|
|
603
|
-
const
|
|
604
|
-
for (;
|
|
605
|
-
|
|
606
|
-
const y =
|
|
607
|
-
|
|
608
|
-
const
|
|
609
|
-
|
|
686
|
+
i.fillStyle = t.color, i.fill(p);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function Mn(i, t) {
|
|
690
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.y0, d = t.baseline * o + r, f = new Path2D(), h = new Path2D(), m = new Path2D();
|
|
691
|
+
let c = 0;
|
|
692
|
+
for (; c < e; ) {
|
|
693
|
+
for (; c < e && (Number.isNaN(l[c]) || u !== null && Number.isNaN(u[c])); )
|
|
694
|
+
c++;
|
|
695
|
+
if (c >= e) break;
|
|
696
|
+
const p = c;
|
|
697
|
+
for (; c < e && !Number.isNaN(l[c]) && (u === null || !Number.isNaN(u[c])); )
|
|
698
|
+
c++;
|
|
699
|
+
const y = c - 1;
|
|
700
|
+
if (p === y) {
|
|
701
|
+
const g = a[p] * n + s;
|
|
702
|
+
m.moveTo(g, u === null ? d : u[p] * o + r), m.lineTo(g, l[p] * o + r);
|
|
703
|
+
continue;
|
|
704
|
+
}
|
|
705
|
+
for (let g = p; g <= y; g++) {
|
|
706
|
+
const b = a[g] * n + s, N = l[g] * o + r;
|
|
707
|
+
g === p ? (f.moveTo(b, N), h.moveTo(b, N)) : (f.lineTo(b, N), h.lineTo(b, N));
|
|
610
708
|
}
|
|
611
|
-
if (
|
|
612
|
-
|
|
709
|
+
if (u === null)
|
|
710
|
+
f.lineTo(a[y] * n + s, d), f.lineTo(a[p] * n + s, d);
|
|
613
711
|
else
|
|
614
|
-
for (let
|
|
615
|
-
|
|
616
|
-
|
|
712
|
+
for (let g = y; g >= p; g--)
|
|
713
|
+
f.lineTo(a[g] * n + s, u[g] * o + r);
|
|
714
|
+
f.closePath();
|
|
617
715
|
}
|
|
618
|
-
|
|
716
|
+
i.globalAlpha = t.alpha * t.fillOpacity, i.fillStyle = t.color, i.fill(f), i.globalAlpha = t.alpha, i.strokeStyle = t.color, t.strokeWidth > 0 && (i.setLineDash(t.dash ?? []), i.lineWidth = t.strokeWidth, i.stroke(h)), i.setLineDash([]), i.lineWidth = Math.max(1, t.strokeWidth), i.stroke(m);
|
|
619
717
|
}
|
|
620
|
-
function
|
|
621
|
-
const e = t.length,
|
|
622
|
-
for (let
|
|
623
|
-
const
|
|
718
|
+
function An(i, t) {
|
|
719
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.baseline * o + r, d = t.offset * n, f = t.width * n, h = new Path2D();
|
|
720
|
+
for (let m = 0; m < e; m++) {
|
|
721
|
+
const c = l[m];
|
|
722
|
+
if (Number.isNaN(c)) continue;
|
|
723
|
+
const p = a[m] * n + s + d, y = c * o + r;
|
|
724
|
+
h.rect(p, y, f, u - y);
|
|
725
|
+
}
|
|
726
|
+
i.fillStyle = t.color, i.fill(h);
|
|
727
|
+
}
|
|
728
|
+
function Sn(i, t) {
|
|
729
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.radius, d = new Path2D();
|
|
730
|
+
for (let f = 0; f < e; f++) {
|
|
731
|
+
const h = l[f];
|
|
732
|
+
if (Number.isNaN(h)) continue;
|
|
733
|
+
const m = a[f] * n + s, c = h * o + r;
|
|
734
|
+
d.moveTo(m + u, c), d.arc(m, c, u, 0, Math.PI * 2);
|
|
735
|
+
}
|
|
736
|
+
i.fillStyle = t.color, i.fill(d);
|
|
737
|
+
}
|
|
738
|
+
function Tn(i, t) {
|
|
739
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.x, r = t.y, a = t.laneTop, l = t.laneBottom - t.laneTop, u = t.colors.length;
|
|
740
|
+
if (u === 0 || l <= 0) return;
|
|
741
|
+
const d = [];
|
|
742
|
+
for (let h = 0; h < u; h++) d.push(new Path2D());
|
|
743
|
+
let f = !1;
|
|
744
|
+
for (let h = 0; h < e; h++) {
|
|
745
|
+
const m = r[h];
|
|
624
746
|
if (Number.isNaN(m)) continue;
|
|
625
|
-
const
|
|
626
|
-
p
|
|
747
|
+
const c = m | 0, p = d[c];
|
|
748
|
+
if (p === void 0) continue;
|
|
749
|
+
const y = o[h], g = Fe(o, e, h, t.lastEnd);
|
|
750
|
+
g > y && (p.rect(y * n + s, a, (g - y) * n, l), f = !0);
|
|
751
|
+
}
|
|
752
|
+
if (f)
|
|
753
|
+
for (let h = 0; h < u; h++)
|
|
754
|
+
i.fillStyle = t.colors[h], i.fill(d[h]);
|
|
755
|
+
}
|
|
756
|
+
function Ln(i, t) {
|
|
757
|
+
const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.buckets, d = t.colors.length;
|
|
758
|
+
if (d === 0) return;
|
|
759
|
+
const f = t.width * n, h = Math.abs(t.height * o), m = [];
|
|
760
|
+
for (let c = 0; c < d; c++) m.push(new Path2D());
|
|
761
|
+
for (let c = 0; c < e; c++) {
|
|
762
|
+
const p = u[c];
|
|
763
|
+
if (p < 0) continue;
|
|
764
|
+
const y = m[p];
|
|
765
|
+
if (y === void 0) continue;
|
|
766
|
+
const g = a[c] * n + s - f / 2, b = l[c] * o + r - h / 2;
|
|
767
|
+
y.rect(g, b, f, h);
|
|
627
768
|
}
|
|
628
|
-
|
|
769
|
+
for (let c = 0; c < d; c++)
|
|
770
|
+
i.fillStyle = t.colors[c], i.fill(m[c]);
|
|
629
771
|
}
|
|
630
|
-
function
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const d = a[h] * i + r, m = p * o + s;
|
|
636
|
-
u.moveTo(d + c, m), u.arc(d, m, c, 0, Math.PI * 2);
|
|
637
|
-
}
|
|
638
|
-
n.fillStyle = t.color, n.fill(u);
|
|
639
|
-
}
|
|
640
|
-
function Qe(n, t) {
|
|
641
|
-
const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.x, s = t.y, a = t.laneTop, l = t.laneBottom - t.laneTop, c = t.colors.length;
|
|
642
|
-
if (c === 0 || l <= 0) return;
|
|
643
|
-
const u = [];
|
|
644
|
-
for (let p = 0; p < c; p++) u.push(new Path2D());
|
|
645
|
-
let h = !1;
|
|
646
|
-
for (let p = 0; p < e; p++) {
|
|
647
|
-
const d = s[p];
|
|
648
|
-
if (Number.isNaN(d)) continue;
|
|
649
|
-
const m = d | 0, y = u[m];
|
|
650
|
-
if (y === void 0) continue;
|
|
651
|
-
const f = o[p], b = le(o, e, p, t.domainEnd);
|
|
652
|
-
b > f && (y.rect(f * i + r, a, (b - f) * i, l), h = !0);
|
|
653
|
-
}
|
|
654
|
-
if (h)
|
|
655
|
-
for (let p = 0; p < c; p++)
|
|
656
|
-
n.fillStyle = t.colors[p], n.fill(u[p]);
|
|
657
|
-
}
|
|
658
|
-
function tn(n, t) {
|
|
659
|
-
const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.buckets, u = t.colors.length;
|
|
660
|
-
if (u === 0) return;
|
|
661
|
-
const h = t.width * i, p = Math.abs(t.height * o), d = [];
|
|
662
|
-
for (let m = 0; m < u; m++) d.push(new Path2D());
|
|
663
|
-
for (let m = 0; m < e; m++) {
|
|
664
|
-
const y = c[m];
|
|
665
|
-
if (y < 0) continue;
|
|
666
|
-
const f = d[y];
|
|
667
|
-
if (f === void 0) continue;
|
|
668
|
-
const b = a[m] * i + r - h / 2, k = l[m] * o + s - p / 2;
|
|
669
|
-
f.rect(b, k, h, p);
|
|
670
|
-
}
|
|
671
|
-
for (let m = 0; m < u; m++)
|
|
672
|
-
n.fillStyle = t.colors[m], n.fill(d[m]);
|
|
673
|
-
}
|
|
674
|
-
function en(n, t) {
|
|
675
|
-
const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.x1, u = t.depth, h = Math.abs(t.height * o), p = h * ce, d = new Path2D(), m = new Path2D();
|
|
676
|
-
for (let y = 0; y < e; y++) {
|
|
677
|
-
const f = l[y];
|
|
678
|
-
if (Number.isNaN(f)) continue;
|
|
679
|
-
const b = a[y];
|
|
680
|
-
if (Number.isNaN(b)) continue;
|
|
681
|
-
const k = c[y], w = ot(k, t.domainEnd);
|
|
682
|
-
if (!(w >= b)) continue;
|
|
683
|
-
const I = b * i + r, A = Math.max(1, (w - b) * i), F = f * o + s + u[y] * p;
|
|
684
|
-
(ue(k) ? m : d).rect(I, F - h / 2, A, h);
|
|
685
|
-
}
|
|
686
|
-
n.fillStyle = t.color, n.fill(d), n.save(), n.globalAlpha = n.globalAlpha * 0.45, n.fill(m), n.restore(), n.strokeStyle = t.color, n.lineWidth = 1, n.setLineDash([3, 2]), n.stroke(m), n.setLineDash([]);
|
|
687
|
-
}
|
|
688
|
-
function jt(n, t, e) {
|
|
689
|
-
for (const i of e) {
|
|
690
|
-
if (i.band) {
|
|
691
|
-
const r = Math.min(i.fromPx, i.toPx), o = Math.max(i.fromPx, i.toPx);
|
|
692
|
-
n.fillStyle = i.color, n.save(), n.globalAlpha = 0.12, i.orientation === "y" ? n.fillRect(t.x, r, t.width, o - r) : n.fillRect(r, t.y, o - r, t.height), n.restore();
|
|
772
|
+
function de(i, t, e) {
|
|
773
|
+
for (const n of e) {
|
|
774
|
+
if (n.band) {
|
|
775
|
+
const s = Math.min(n.fromPx, n.toPx), o = Math.max(n.fromPx, n.toPx);
|
|
776
|
+
i.fillStyle = n.color, i.save(), i.globalAlpha = 0.12, n.orientation === "y" ? i.fillRect(t.x, s, t.width, o - s) : i.fillRect(s, t.y, o - s, t.height), i.restore();
|
|
693
777
|
continue;
|
|
694
778
|
}
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
|
|
779
|
+
if (i.beginPath(), n.orientation === "y") {
|
|
780
|
+
const s = dt(n.fromPx);
|
|
781
|
+
i.moveTo(t.x, s), i.lineTo(t.x + t.width, s);
|
|
698
782
|
} else {
|
|
699
|
-
const
|
|
700
|
-
|
|
783
|
+
const s = dt(n.fromPx);
|
|
784
|
+
i.moveTo(s, t.y), i.lineTo(s, t.y + t.height);
|
|
701
785
|
}
|
|
702
|
-
|
|
786
|
+
i.strokeStyle = n.color, i.lineWidth = 1, i.setLineDash(n.dash), i.stroke(), i.setLineDash([]);
|
|
703
787
|
}
|
|
704
788
|
}
|
|
705
|
-
function
|
|
706
|
-
const { width: e, height:
|
|
707
|
-
if (
|
|
708
|
-
|
|
709
|
-
for (const
|
|
710
|
-
if (
|
|
711
|
-
switch (
|
|
789
|
+
function Fn(i, t) {
|
|
790
|
+
const { width: e, height: n, plot: s, series: o } = t;
|
|
791
|
+
if (i.clearRect(0, 0, e, n), !(s.width <= 0 || s.height <= 0)) {
|
|
792
|
+
Nn(i, t), i.save(), i.beginPath(), i.rect(s.x, s.y, s.width, s.height), i.clip(), i.lineJoin = "round", i.lineCap = "round", i.globalAlpha = 1, de(i, s, t.limitBands);
|
|
793
|
+
for (const r of o)
|
|
794
|
+
if (r.length !== 0)
|
|
795
|
+
switch (i.globalAlpha = r.alpha, r.kind) {
|
|
712
796
|
case "line":
|
|
713
|
-
|
|
797
|
+
In(i, r);
|
|
714
798
|
break;
|
|
715
799
|
case "area":
|
|
716
|
-
|
|
800
|
+
Mn(i, r);
|
|
717
801
|
break;
|
|
718
802
|
case "bar":
|
|
719
|
-
|
|
803
|
+
An(i, r);
|
|
720
804
|
break;
|
|
721
805
|
case "scatter":
|
|
722
|
-
|
|
806
|
+
Sn(i, r);
|
|
723
807
|
break;
|
|
724
808
|
case "state":
|
|
725
|
-
|
|
809
|
+
Tn(i, r);
|
|
726
810
|
break;
|
|
727
811
|
case "matrix":
|
|
728
|
-
|
|
729
|
-
break;
|
|
730
|
-
case "span":
|
|
731
|
-
en(n, s);
|
|
812
|
+
Ln(i, r);
|
|
732
813
|
break;
|
|
733
814
|
}
|
|
734
|
-
|
|
815
|
+
i.globalAlpha = 1, de(i, s, t.limitLines), i.restore();
|
|
735
816
|
}
|
|
736
817
|
}
|
|
737
|
-
function
|
|
738
|
-
const { width: e, height:
|
|
739
|
-
|
|
740
|
-
const a =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
818
|
+
function Dn(i, t) {
|
|
819
|
+
const { width: e, height: n, plot: s, theme: o, hover: r } = t;
|
|
820
|
+
i.clearRect(0, 0, e, n);
|
|
821
|
+
const a = (r == null ? void 0 : r.hit.xPx) ?? t.syncPx;
|
|
822
|
+
if (a === null || s.width <= 0 || s.height <= 0) return;
|
|
823
|
+
const l = dt(a);
|
|
824
|
+
l >= s.x && l <= s.x + s.width && (i.beginPath(), i.moveTo(l, s.y), i.lineTo(l, s.y + s.height), i.lineWidth = 1, i.strokeStyle = o.colorAxis, i.setLineDash([]), i.stroke());
|
|
825
|
+
for (const u of (r == null ? void 0 : r.marker) ?? [])
|
|
826
|
+
u.x < s.x || u.x > s.x + s.width || u.y < s.y || u.y > s.y + s.height || (i.beginPath(), i.arc(u.x, u.y, 5.5, 0, Math.PI * 2), i.fillStyle = o.colorBg, i.fill(), i.beginPath(), i.arc(u.x, u.y, 3.5, 0, Math.PI * 2), i.fillStyle = u.color, i.fill());
|
|
744
827
|
}
|
|
745
|
-
function
|
|
828
|
+
function De(i, t, e) {
|
|
746
829
|
if (t <= 0) return -1;
|
|
747
830
|
if (t === 1) return 0;
|
|
748
|
-
let
|
|
749
|
-
if (e <= n
|
|
750
|
-
if (e >=
|
|
751
|
-
for (;
|
|
752
|
-
const a =
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
const o = e - n
|
|
756
|
-
return
|
|
831
|
+
let n = 0, s = t - 1;
|
|
832
|
+
if (e <= i[n]) return n;
|
|
833
|
+
if (e >= i[s]) return s;
|
|
834
|
+
for (; s - n > 1; ) {
|
|
835
|
+
const a = n + s >> 1;
|
|
836
|
+
i[a] <= e ? n = a : s = a;
|
|
837
|
+
}
|
|
838
|
+
const o = e - i[n];
|
|
839
|
+
return i[s] - e < o ? s : n;
|
|
840
|
+
}
|
|
841
|
+
function Gt(i, t, e) {
|
|
842
|
+
let n = 0, s = t;
|
|
843
|
+
for (; n < s; ) {
|
|
844
|
+
const o = n + s >> 1;
|
|
845
|
+
i[o] < e ? n = o + 1 : s = o;
|
|
846
|
+
}
|
|
847
|
+
return n;
|
|
848
|
+
}
|
|
849
|
+
function En(i, t, e, n, s, o, r) {
|
|
850
|
+
const a = De(i, e, n);
|
|
851
|
+
if (a < 0) return -1;
|
|
852
|
+
const l = o.toPx(n), u = r.toPx(s);
|
|
853
|
+
let d = -1, f = Number.POSITIVE_INFINITY;
|
|
854
|
+
for (let h = a; h >= 0; h--) {
|
|
855
|
+
const m = o.toPx(i[h]) - l;
|
|
856
|
+
if (m * m > f) break;
|
|
857
|
+
const c = t[h];
|
|
858
|
+
if (Number.isNaN(c)) continue;
|
|
859
|
+
const p = r.toPx(c) - u, y = m * m + p * p;
|
|
860
|
+
y < f && (f = y, d = h);
|
|
861
|
+
}
|
|
862
|
+
for (let h = a + 1; h < e; h++) {
|
|
863
|
+
const m = o.toPx(i[h]) - l;
|
|
864
|
+
if (m * m > f) break;
|
|
865
|
+
const c = t[h];
|
|
866
|
+
if (Number.isNaN(c)) continue;
|
|
867
|
+
const p = r.toPx(c) - u, y = m * m + p * p;
|
|
868
|
+
y < f && (f = y, d = h);
|
|
869
|
+
}
|
|
870
|
+
return d;
|
|
871
|
+
}
|
|
872
|
+
function Pn(i, t, e, n, s, o) {
|
|
873
|
+
const { x: r, y: a, y0: l, length: u } = i, d = Math.max(0, Gt(r, u, t) - 1), f = Math.min(u - 1, Gt(r, u, e));
|
|
874
|
+
if (f < d) return { x: r.subarray(0, 0), y: a.subarray(0, 0), y0: null, length: 0 };
|
|
875
|
+
if (f - d + 1 <= 2 * o)
|
|
876
|
+
return {
|
|
877
|
+
x: r.subarray(d, f + 1),
|
|
878
|
+
y: a.subarray(d, f + 1),
|
|
879
|
+
y0: l === null ? null : l.subarray(d, f + 1),
|
|
880
|
+
length: f - d + 1
|
|
881
|
+
};
|
|
882
|
+
const h = [], m = new Array(6);
|
|
883
|
+
let c = d;
|
|
884
|
+
for (; c <= f; ) {
|
|
885
|
+
const y = Math.floor(r[c] * n + s);
|
|
886
|
+
let g = -1, b = -1, N = -1, A = -1, $ = -1, w = -1;
|
|
887
|
+
for (; c <= f && Math.floor(r[c] * n + s) === y; c++) {
|
|
888
|
+
const L = a[c];
|
|
889
|
+
if (Number.isNaN(L) || l !== null && Number.isNaN(l[c])) {
|
|
890
|
+
$ < 0 && ($ = c), w < 0 && (w = c);
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
w = -1, g < 0 && (g = c), b = c, (N < 0 || L < a[N]) && (N = c), (A < 0 || L > a[A]) && (A = c);
|
|
894
|
+
}
|
|
895
|
+
m[0] = g, m[1] = N, m[2] = A, m[3] = b, m[4] = $, m[5] = w, m.sort((L, S) => L - S);
|
|
896
|
+
let W = -1;
|
|
897
|
+
for (const L of m)
|
|
898
|
+
L < 0 || L === W || (h.push(L), W = L);
|
|
899
|
+
}
|
|
900
|
+
const p = {
|
|
901
|
+
x: new Float64Array(h.length),
|
|
902
|
+
y: new Float64Array(h.length),
|
|
903
|
+
y0: l === null ? null : new Float64Array(h.length),
|
|
904
|
+
length: h.length
|
|
905
|
+
};
|
|
906
|
+
return h.forEach((y, g) => {
|
|
907
|
+
p.x[g] = r[y], p.y[g] = a[y], p.y0 !== null && (p.y0[g] = l[y]);
|
|
908
|
+
}), p;
|
|
757
909
|
}
|
|
758
|
-
function
|
|
910
|
+
function fe(i, t) {
|
|
759
911
|
if (t < 2) return 0;
|
|
760
|
-
const e =
|
|
761
|
-
let
|
|
762
|
-
for (let
|
|
763
|
-
const o = e[
|
|
764
|
-
o > 0 && o <
|
|
765
|
-
}
|
|
766
|
-
return Number.isFinite(
|
|
767
|
-
}
|
|
768
|
-
function
|
|
769
|
-
return
|
|
770
|
-
}
|
|
771
|
-
function
|
|
772
|
-
const a = o / 2, l =
|
|
773
|
-
for (let
|
|
774
|
-
const
|
|
775
|
-
if (!(
|
|
776
|
-
const
|
|
777
|
-
if (
|
|
778
|
-
return
|
|
912
|
+
const e = i.slice(0, t).sort();
|
|
913
|
+
let n = Number.POSITIVE_INFINITY;
|
|
914
|
+
for (let s = 1; s < t; s++) {
|
|
915
|
+
const o = e[s] - e[s - 1];
|
|
916
|
+
o > 0 && o < n && (n = o);
|
|
917
|
+
}
|
|
918
|
+
return Number.isFinite(n) ? n : 0;
|
|
919
|
+
}
|
|
920
|
+
function yt(i, t) {
|
|
921
|
+
return i > 0 ? i : t;
|
|
922
|
+
}
|
|
923
|
+
function Cn(i, t, e, n, s, o, r) {
|
|
924
|
+
const a = o / 2, l = r / 2;
|
|
925
|
+
for (let u = 0; u < e; u++) {
|
|
926
|
+
const d = n - i[u];
|
|
927
|
+
if (!(d >= -a && d < a)) continue;
|
|
928
|
+
const f = s - t[u];
|
|
929
|
+
if (f >= -l && f < l)
|
|
930
|
+
return u;
|
|
779
931
|
}
|
|
780
932
|
return -1;
|
|
781
933
|
}
|
|
782
|
-
const
|
|
934
|
+
const $n = {
|
|
783
935
|
ok: 0,
|
|
784
936
|
unknown: 1,
|
|
785
937
|
warning: 2,
|
|
786
938
|
alarm: 3
|
|
787
939
|
};
|
|
788
|
-
function
|
|
789
|
-
return
|
|
940
|
+
function Fi(i) {
|
|
941
|
+
return $n[i];
|
|
790
942
|
}
|
|
791
|
-
const
|
|
792
|
-
function
|
|
793
|
-
if (
|
|
943
|
+
const me = { warning: 2, alarm: 3 };
|
|
944
|
+
function On(i, t = {}) {
|
|
945
|
+
if (i == null || !Number.isFinite(i))
|
|
794
946
|
return { verdict: "unknown" };
|
|
795
|
-
const e = t.target,
|
|
796
|
-
let
|
|
947
|
+
const e = t.target, n = e !== void 0 && Number.isFinite(e) ? i - e : void 0;
|
|
948
|
+
let s, o = 0;
|
|
797
949
|
for (const a of t.limits ?? []) {
|
|
798
|
-
const l = a.side === "upper" ?
|
|
799
|
-
l > 0 && (
|
|
800
|
-
}
|
|
801
|
-
if (
|
|
802
|
-
return
|
|
803
|
-
const
|
|
804
|
-
verdict:
|
|
805
|
-
limit:
|
|
950
|
+
const l = a.side === "upper" ? i - a.value : a.value - i;
|
|
951
|
+
l > 0 && (s === void 0 || me[a.severity] > me[s.severity] || a.severity === s.severity && l > o) && (s = a, o = l);
|
|
952
|
+
}
|
|
953
|
+
if (s === void 0)
|
|
954
|
+
return n === void 0 ? { verdict: "ok" } : { verdict: "ok", deviation: n };
|
|
955
|
+
const r = {
|
|
956
|
+
verdict: s.severity,
|
|
957
|
+
limit: s,
|
|
806
958
|
excess: o
|
|
807
959
|
};
|
|
808
|
-
return
|
|
809
|
-
}
|
|
810
|
-
function
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
if (a[
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
if (l !== null) {
|
|
828
|
-
const v = N ? null : l(A, I), M = v ?? Number.NaN;
|
|
829
|
-
c[I] = M, M < k && (k = M), M > w && (w = M);
|
|
960
|
+
return n === void 0 ? r : { ...r, deviation: n };
|
|
961
|
+
}
|
|
962
|
+
function Ct(i) {
|
|
963
|
+
return i == null || !Number.isFinite(i) ? Number.NaN : i;
|
|
964
|
+
}
|
|
965
|
+
function Wn(i, t, e, n, s) {
|
|
966
|
+
const o = i.length, r = new Float64Array(o), a = new Float64Array(o), l = typeof n == "function" ? n : null, u = l === null ? null : new Float64Array(o), d = (s == null ? void 0 : s.value) ?? null, f = d === null ? null : new Float64Array(o), h = (s == null ? void 0 : s.xMap) ?? null, m = (s == null ? void 0 : s.xGap) ?? null;
|
|
967
|
+
let c = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY, y = Number.POSITIVE_INFINITY, g = Number.NEGATIVE_INFINITY;
|
|
968
|
+
typeof n == "number" && o > 0 && (y = n, g = n);
|
|
969
|
+
for (let b = 0; b < o; b++) {
|
|
970
|
+
const N = i[b], A = t(N, b), $ = !Number.isFinite(A), w = $ ? b > 0 ? r[b - 1] : Number.NEGATIVE_INFINITY : h === null ? A : h(A);
|
|
971
|
+
r[b] = w;
|
|
972
|
+
const W = $ || m !== null && m(A);
|
|
973
|
+
W || (w < c && (c = w), w > p && (p = w));
|
|
974
|
+
const L = W ? Number.NaN : Ct(e(N, b));
|
|
975
|
+
if (a[b] = L, L < y && (y = L), L > g && (g = L), d !== null && (f[b] = W ? Number.NaN : Ct(d(N, b))), l !== null) {
|
|
976
|
+
const S = W ? Number.NaN : Ct(l(N, b));
|
|
977
|
+
u[b] = S, S < y && (y = S), S > g && (g = S);
|
|
830
978
|
}
|
|
831
979
|
}
|
|
832
|
-
return { series: { x:
|
|
980
|
+
return { series: { x: r, y: a, y0: u, w: f, length: o }, extent: { xMin: c, xMax: p, yMin: y, yMax: g } };
|
|
833
981
|
}
|
|
834
|
-
function
|
|
982
|
+
function Rn(i, t) {
|
|
835
983
|
for (let e = 1; e < t; e++)
|
|
836
|
-
if (
|
|
984
|
+
if (i[e] < i[e - 1]) return e;
|
|
837
985
|
return -1;
|
|
838
986
|
}
|
|
839
|
-
function
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
987
|
+
function Hn(i, t, e) {
|
|
988
|
+
const { x: n, y: s, y0: o, length: r } = i;
|
|
989
|
+
let a = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY;
|
|
990
|
+
for (let u = Gt(n, r, t); u < r && n[u] <= e; u++) {
|
|
991
|
+
const d = s[u];
|
|
992
|
+
if (d < a && (a = d), d > l && (l = d), o !== null) {
|
|
993
|
+
const f = o[u];
|
|
994
|
+
f < a && (a = f), f > l && (l = f);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return [a, l];
|
|
998
|
+
}
|
|
999
|
+
function Vn(i, t, e, n) {
|
|
1000
|
+
let s = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY;
|
|
1001
|
+
for (const r of e) {
|
|
1002
|
+
const a = r.extent;
|
|
1003
|
+
if (a === null || !(i === "x" ? r.xAxisId === t : r.yAxisId === t)) continue;
|
|
1004
|
+
const u = i === "x" ? a.xMin : a.yMin, d = i === "x" ? a.xMax : a.yMax;
|
|
1005
|
+
u < s && (s = u), d > o && (o = d);
|
|
846
1006
|
}
|
|
847
|
-
if (
|
|
848
|
-
for (const
|
|
849
|
-
Number.isFinite(
|
|
850
|
-
return !Number.isFinite(
|
|
1007
|
+
if (n !== void 0)
|
|
1008
|
+
for (const r of n)
|
|
1009
|
+
Number.isFinite(r) && (r < s && (s = r), r > o && (o = r));
|
|
1010
|
+
return !Number.isFinite(s) || !Number.isFinite(o) ? [0, 1] : [s, o];
|
|
851
1011
|
}
|
|
852
|
-
function
|
|
1012
|
+
function _n(i, t) {
|
|
853
1013
|
let e = Number.POSITIVE_INFINITY;
|
|
854
|
-
for (let
|
|
855
|
-
const
|
|
856
|
-
|
|
1014
|
+
for (let n = 1; n < t; n++) {
|
|
1015
|
+
const s = i[n] - i[n - 1];
|
|
1016
|
+
s > 0 && s < e && (e = s);
|
|
857
1017
|
}
|
|
858
1018
|
return Number.isFinite(e) ? e : 0;
|
|
859
1019
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
1020
|
+
function Yn(i, t) {
|
|
1021
|
+
return i > 0 ? i : t;
|
|
862
1022
|
}
|
|
863
|
-
function
|
|
864
|
-
const
|
|
865
|
-
return { offset: -
|
|
1023
|
+
function zn(i, t, e, n) {
|
|
1024
|
+
const s = i * t, o = s / n;
|
|
1025
|
+
return { offset: -s / 2 + e * o, width: o };
|
|
866
1026
|
}
|
|
867
|
-
function
|
|
1027
|
+
function Bn(i) {
|
|
868
1028
|
const t = /* @__PURE__ */ new Map();
|
|
869
|
-
for (const
|
|
870
|
-
if (
|
|
871
|
-
const
|
|
872
|
-
|
|
1029
|
+
for (const n of i) {
|
|
1030
|
+
if (n.kind !== "bar") continue;
|
|
1031
|
+
const s = t.get(n.xAxisId);
|
|
1032
|
+
s === void 0 ? t.set(n.xAxisId, [n]) : s.push(n);
|
|
873
1033
|
}
|
|
874
1034
|
const e = /* @__PURE__ */ new Map();
|
|
875
|
-
for (const
|
|
876
|
-
let
|
|
877
|
-
for (const a of
|
|
878
|
-
a.step > 0 && a.step <
|
|
879
|
-
const o = Number.isFinite(
|
|
880
|
-
|
|
1035
|
+
for (const n of t.values()) {
|
|
1036
|
+
let s = Number.POSITIVE_INFINITY;
|
|
1037
|
+
for (const a of n)
|
|
1038
|
+
a.step > 0 && a.step < s && (s = a.step);
|
|
1039
|
+
const o = Number.isFinite(s) ? s : 0, r = n[0].fraction;
|
|
1040
|
+
n.forEach((a, l) => {
|
|
881
1041
|
e.set(a.order, {
|
|
882
1042
|
index: l,
|
|
883
|
-
size:
|
|
1043
|
+
size: n.length,
|
|
884
1044
|
step: o,
|
|
885
|
-
fraction:
|
|
1045
|
+
fraction: r
|
|
886
1046
|
});
|
|
887
1047
|
});
|
|
888
1048
|
}
|
|
889
1049
|
return e;
|
|
890
1050
|
}
|
|
891
|
-
const
|
|
1051
|
+
const pe = {
|
|
892
1052
|
version: 0,
|
|
893
|
-
layout:
|
|
1053
|
+
layout: Se,
|
|
894
1054
|
legend: null,
|
|
895
1055
|
series: [],
|
|
896
|
-
limits: []
|
|
897
|
-
|
|
1056
|
+
limits: [],
|
|
1057
|
+
// Unknown before the first frame: saying "No data" there would flash.
|
|
1058
|
+
empty: !1
|
|
1059
|
+
}, ye = {
|
|
898
1060
|
version: 0,
|
|
899
1061
|
hover: null,
|
|
900
1062
|
tooltip: null,
|
|
901
|
-
xLabel: ""
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1063
|
+
xLabel: "",
|
|
1064
|
+
rows: []
|
|
1065
|
+
}, Gn = 4, ge = 12;
|
|
1066
|
+
let $t = 0;
|
|
1067
|
+
const lt = /* @__PURE__ */ new Map();
|
|
1068
|
+
function X(i, t) {
|
|
1069
|
+
if (i === t) return !0;
|
|
1070
|
+
if (typeof i != "function" || typeof t != "function") return !1;
|
|
1071
|
+
const e = String(i);
|
|
1072
|
+
return e.includes("[native code]") ? !1 : e === String(t);
|
|
1073
|
+
}
|
|
1074
|
+
function qn(i, t) {
|
|
1075
|
+
var e, n, s, o;
|
|
1076
|
+
if (i === t) return !0;
|
|
1077
|
+
if (i === void 0 || t === void 0 || i.length !== t.length) return !1;
|
|
1078
|
+
for (let r = 0; r < i.length; r++)
|
|
1079
|
+
if (((e = i[r]) == null ? void 0 : e.from) !== ((n = t[r]) == null ? void 0 : n.from) || ((s = i[r]) == null ? void 0 : s.to) !== ((o = t[r]) == null ? void 0 : o.to)) return !1;
|
|
912
1080
|
return !0;
|
|
913
1081
|
}
|
|
914
|
-
function
|
|
915
|
-
return
|
|
916
|
-
ne(n) === ne(t);
|
|
1082
|
+
function gt(i) {
|
|
1083
|
+
return i.kind !== "state" && i.kind !== "matrix";
|
|
917
1084
|
}
|
|
918
|
-
function
|
|
919
|
-
|
|
1085
|
+
function Kn(i) {
|
|
1086
|
+
const t = i.entry.materialized;
|
|
1087
|
+
if (t === null) return !1;
|
|
1088
|
+
const e = t.x[i.index], n = (s) => s > 0 && s < q;
|
|
1089
|
+
return i.index > 0 && n(e - t.x[i.index - 1]) || i.index + 1 < t.length && n(t.x[i.index + 1] - e);
|
|
1090
|
+
}
|
|
1091
|
+
function ft(i, t) {
|
|
1092
|
+
if (i === t) return !0;
|
|
1093
|
+
if (i === void 0 || t === void 0 || i.length !== t.length) return !1;
|
|
1094
|
+
for (let e = 0; e < i.length; e++) if (i[e] !== t[e]) return !1;
|
|
1095
|
+
return !0;
|
|
920
1096
|
}
|
|
921
|
-
function
|
|
922
|
-
return
|
|
1097
|
+
function Un(i, t) {
|
|
1098
|
+
return i.kind === t.kind && X(i.accessor, t.accessor) && i.data === t.data && X(Mt(i), Mt(t)) && X(qt(i), qt(t));
|
|
923
1099
|
}
|
|
924
|
-
function
|
|
925
|
-
return
|
|
1100
|
+
function qt(i) {
|
|
1101
|
+
return i.kind === "matrix" ? i.value : void 0;
|
|
926
1102
|
}
|
|
927
|
-
function
|
|
928
|
-
switch (
|
|
1103
|
+
function Mt(i) {
|
|
1104
|
+
switch (i.kind) {
|
|
929
1105
|
case "line":
|
|
930
1106
|
case "scatter":
|
|
931
1107
|
return;
|
|
932
1108
|
case "area":
|
|
933
|
-
return
|
|
1109
|
+
return i.baseline ?? 0;
|
|
934
1110
|
case "bar":
|
|
935
1111
|
return 0;
|
|
936
1112
|
case "state":
|
|
937
1113
|
case "matrix":
|
|
938
|
-
case "span":
|
|
939
1114
|
return;
|
|
940
1115
|
}
|
|
941
1116
|
}
|
|
942
|
-
function
|
|
943
|
-
if (
|
|
1117
|
+
function Xn(i, t) {
|
|
1118
|
+
if (i.kind !== t.kind) return !1;
|
|
944
1119
|
switch (t.kind) {
|
|
945
1120
|
case "line": {
|
|
946
|
-
const e =
|
|
947
|
-
return e.strokeWidth === t.strokeWidth && e.markers === t.markers && ft(e.dash, t.dash);
|
|
1121
|
+
const e = i;
|
|
1122
|
+
return e.strokeWidth === t.strokeWidth && e.markers === t.markers && e.step === t.step && ft(e.dash, t.dash);
|
|
948
1123
|
}
|
|
949
1124
|
case "area": {
|
|
950
|
-
const e =
|
|
951
|
-
return
|
|
1125
|
+
const e = i;
|
|
1126
|
+
return X(e.baseline, t.baseline) && e.fillOpacity === t.fillOpacity && e.strokeWidth === t.strokeWidth && ft(e.dash, t.dash);
|
|
952
1127
|
}
|
|
953
1128
|
case "bar":
|
|
954
|
-
return
|
|
1129
|
+
return i.barWidth === t.barWidth;
|
|
955
1130
|
case "scatter":
|
|
956
|
-
return
|
|
1131
|
+
return i.radius === t.radius;
|
|
957
1132
|
case "state": {
|
|
958
|
-
const e =
|
|
959
|
-
return e.laneFrom === t.laneFrom && e.laneTo === t.laneTo &&
|
|
1133
|
+
const e = i;
|
|
1134
|
+
return e.laneFrom === t.laneFrom && e.laneTo === t.laneTo && Zn(e.states, t.states);
|
|
960
1135
|
}
|
|
961
1136
|
case "matrix":
|
|
962
|
-
return
|
|
963
|
-
case "span":
|
|
964
|
-
return n.height === t.height;
|
|
1137
|
+
return Jn(i.coloring, t.coloring);
|
|
965
1138
|
}
|
|
966
1139
|
}
|
|
967
|
-
function
|
|
968
|
-
var e,
|
|
969
|
-
if (
|
|
970
|
-
if (
|
|
971
|
-
for (let
|
|
972
|
-
if (((e =
|
|
1140
|
+
function Zn(i, t) {
|
|
1141
|
+
var e, n, s, o;
|
|
1142
|
+
if (i === t) return !0;
|
|
1143
|
+
if (i.length !== t.length) return !1;
|
|
1144
|
+
for (let r = 0; r < i.length; r++)
|
|
1145
|
+
if (((e = i[r]) == null ? void 0 : e.label) !== ((n = t[r]) == null ? void 0 : n.label) || ((s = i[r]) == null ? void 0 : s.color) !== ((o = t[r]) == null ? void 0 : o.color)) return !1;
|
|
973
1146
|
return !0;
|
|
974
1147
|
}
|
|
975
|
-
function
|
|
976
|
-
return
|
|
1148
|
+
function Jn(i, t) {
|
|
1149
|
+
return i === t ? !0 : i.kind !== t.kind ? !1 : i.kind === "assessment" && t.kind === "assessment" ? i.limits === t.limits : i.kind === "gradient" && t.kind === "gradient" ? ft(i.stops, t.stops) && ft(i.range, t.range) : !1;
|
|
977
1150
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
1151
|
+
function Ot(i, t) {
|
|
1152
|
+
return i.kind === "assessment" ? [t.colorOk, t.colorWarning, t.colorAlarm] : i.stops;
|
|
980
1153
|
}
|
|
981
|
-
function
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
let s = (c = t.range) == null ? void 0 : c[0], a = (u = t.range) == null ? void 0 : u[1];
|
|
994
|
-
if (s === void 0 || a === void 0) {
|
|
995
|
-
s = Number.POSITIVE_INFINITY, a = Number.NEGATIVE_INFINITY;
|
|
996
|
-
for (let h = 0; h < i; h++) {
|
|
997
|
-
const p = o[h];
|
|
998
|
-
Number.isFinite(p) && (p < s && (s = p), p > a && (a = p));
|
|
1154
|
+
function Qn(i) {
|
|
1155
|
+
const t = 100 / Math.max(1, i.length);
|
|
1156
|
+
return `linear-gradient(to right, ${i.map((n, s) => `${n} ${s * t}% ${(s + 1) * t}%`).join(", ")})`;
|
|
1157
|
+
}
|
|
1158
|
+
function jn(i, t, e) {
|
|
1159
|
+
let n = e == null ? void 0 : e[0], s = e == null ? void 0 : e[1];
|
|
1160
|
+
if (n === void 0 || s === void 0) {
|
|
1161
|
+
n = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
|
|
1162
|
+
for (let o = 0; o < t; o++) {
|
|
1163
|
+
const r = i[o];
|
|
1164
|
+
Number.isFinite(r) && (r < n && (n = r), r > s && (s = r));
|
|
999
1165
|
}
|
|
1000
1166
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
const d = l > 0 ? (p - s) / l : 0.5, m = Math.floor(d * e);
|
|
1009
|
-
r[h] = m < 0 ? 0 : m >= e ? e - 1 : m;
|
|
1167
|
+
return [n, s];
|
|
1168
|
+
}
|
|
1169
|
+
function ti(i, t, e, n, s) {
|
|
1170
|
+
if (t.kind === "assessment") {
|
|
1171
|
+
const l = On(i, t.limits);
|
|
1172
|
+
return l.verdict === "alarm" ? 2 : l.verdict === "warning" ? 1 : l.verdict === "ok" ? 0 : -1;
|
|
1010
1173
|
}
|
|
1011
|
-
return
|
|
1174
|
+
if (!Number.isFinite(i)) return -1;
|
|
1175
|
+
const o = s - n, r = o > 0 ? (i - n) / o : 0.5, a = Math.floor(r * e);
|
|
1176
|
+
return a < 0 ? 0 : a >= e ? e - 1 : a;
|
|
1012
1177
|
}
|
|
1013
|
-
function
|
|
1014
|
-
|
|
1178
|
+
function xe(i, t, e) {
|
|
1179
|
+
const n = i.length, s = new Int32Array(n), o = i.w;
|
|
1180
|
+
if (o === null || e === 0)
|
|
1181
|
+
return s.fill(-1), s;
|
|
1182
|
+
const [r, a] = t.kind === "gradient" ? jn(o, n, t.range) : [0, 0];
|
|
1183
|
+
for (let l = 0; l < n; l++) s[l] = ti(o[l], t, e, r, a);
|
|
1184
|
+
return s;
|
|
1185
|
+
}
|
|
1186
|
+
function ei(i, t) {
|
|
1187
|
+
return i === t ? !0 : Array.isArray(i) && Array.isArray(t) ? i[0] === t[0] && i[1] === t[1] : !1;
|
|
1015
1188
|
}
|
|
1016
|
-
class
|
|
1189
|
+
class Ee {
|
|
1017
1190
|
constructor() {
|
|
1018
1191
|
/* ---------- Registration ---------- */
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1192
|
+
x(this, "series", /* @__PURE__ */ new Map());
|
|
1193
|
+
x(this, "axes", /* @__PURE__ */ new Map());
|
|
1194
|
+
x(this, "legend", null);
|
|
1195
|
+
x(this, "tooltip", null);
|
|
1196
|
+
x(this, "limits", /* @__PURE__ */ new Map());
|
|
1024
1197
|
/* ---------- Data and layout inputs ---------- */
|
|
1025
|
-
|
|
1026
|
-
|
|
1198
|
+
x(this, "data", []);
|
|
1199
|
+
x(this, "padding", { top: 8, right: 8, bottom: 8, left: 8 });
|
|
1027
1200
|
/* ---------- DOM binding ---------- */
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1201
|
+
x(this, "container", null);
|
|
1202
|
+
x(this, "seriesCanvas", null);
|
|
1203
|
+
x(this, "overlayCanvas", null);
|
|
1204
|
+
x(this, "seriesCtx", null);
|
|
1205
|
+
x(this, "overlayCtx", null);
|
|
1206
|
+
x(this, "tooltipEl", null);
|
|
1207
|
+
x(this, "measurer", null);
|
|
1035
1208
|
/* ---------- Size and DPR ---------- */
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1209
|
+
x(this, "cssWidth", 0);
|
|
1210
|
+
x(this, "cssHeight", 0);
|
|
1211
|
+
x(this, "pendingWidth", null);
|
|
1212
|
+
x(this, "pendingHeight", null);
|
|
1213
|
+
x(this, "dpr", 1);
|
|
1214
|
+
x(this, "dprMedia", null);
|
|
1215
|
+
x(this, "onDprChange", () => {
|
|
1043
1216
|
this.rebindDprWatch(), this.pendingWidth = this.cssWidth, this.pendingHeight = this.cssHeight, this.markLayoutDirty();
|
|
1044
1217
|
});
|
|
1045
1218
|
/* ---------- Scheduling ---------- */
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1219
|
+
x(this, "seriesDirty", !1);
|
|
1220
|
+
x(this, "overlayDirty", !1);
|
|
1221
|
+
x(this, "layoutDirty", !0);
|
|
1222
|
+
x(this, "materialsDirty", !1);
|
|
1223
|
+
x(this, "frameHandle", null);
|
|
1051
1224
|
/* ---------- Theme ---------- */
|
|
1052
|
-
|
|
1053
|
-
|
|
1225
|
+
x(this, "theme", null);
|
|
1226
|
+
x(this, "unsubscribeTheme", null);
|
|
1227
|
+
/** A caller's colours - `color`, a state's, a gradient stop - resolved
|
|
1228
|
+
through the theme's probe, once per colour and theme: a canvas ignores a
|
|
1229
|
+
`var(--…)` or a `light-dark(…)` and keeps the previous fillStyle. */
|
|
1230
|
+
x(this, "painted", /* @__PURE__ */ new Map());
|
|
1054
1231
|
/* ---------- Layout and interaction ---------- */
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1232
|
+
x(this, "layout", Se);
|
|
1233
|
+
x(this, "hysteresis", /* @__PURE__ */ new Map());
|
|
1234
|
+
x(this, "hover", null);
|
|
1235
|
+
x(this, "hoverKey", "");
|
|
1236
|
+
x(this, "hoverXLabel", "");
|
|
1237
|
+
x(this, "hoverRows", []);
|
|
1238
|
+
x(this, "highlight", null);
|
|
1061
1239
|
/* ---------- Snapshots for the HTML layer ---------- */
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1240
|
+
x(this, "layoutSnapshot", pe);
|
|
1241
|
+
x(this, "hoverSnapshot", ye);
|
|
1242
|
+
x(this, "layoutSubscribers", /* @__PURE__ */ new Set());
|
|
1243
|
+
x(this, "hoverSubscribers", /* @__PURE__ */ new Set());
|
|
1066
1244
|
/* ---------- Instrumentation (R-5.1) ---------- */
|
|
1067
|
-
|
|
1245
|
+
x(this, "perf", { materializeMs: 0, seriesDrawMs: 0, points: 0 });
|
|
1068
1246
|
/* The palette follows the name (library-audit 05). The table only grows: a name
|
|
1069
1247
|
that goes away keeps its place, so that it finds it again on its return and
|
|
1070
1248
|
no other name gets it in the meantime. */
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
g(this, "sortednessChecked", !1);
|
|
1076
|
-
g(this, "onFontsLoaded", () => {
|
|
1249
|
+
x(this, "slotsByName", /* @__PURE__ */ new Map());
|
|
1250
|
+
x(this, "nextSlot", 0);
|
|
1251
|
+
x(this, "onPerf", null);
|
|
1252
|
+
x(this, "onFontsLoaded", () => {
|
|
1077
1253
|
var t;
|
|
1078
1254
|
(t = this.measurer) == null || t.clear(), this.markLayoutDirty();
|
|
1079
1255
|
});
|
|
1080
|
-
|
|
1081
|
-
|
|
1256
|
+
x(this, "themeRoot", null);
|
|
1257
|
+
/* ---------- Cursor sync (charts-long-series 04) ----------
|
|
1258
|
+
|
|
1259
|
+
Only the x position travels, in domain units: each chart draws its own
|
|
1260
|
+
crosshair there, on its x axis of the same id - or its first -, and the
|
|
1261
|
+
tooltip stays with the chart under the pointer. Zoom is not shared; the
|
|
1262
|
+
caller gives every chart the same controlled domain. */
|
|
1263
|
+
x(this, "syncId", null);
|
|
1264
|
+
/** Where another chart's pointer stands; null while none does. */
|
|
1265
|
+
x(this, "synced", null);
|
|
1266
|
+
x(this, "sent", null);
|
|
1267
|
+
/* ---------- Zoom and pan (charts-long-series 01) ----------
|
|
1268
|
+
|
|
1269
|
+
The schedule's model, not its code: Ctrl or ⌘ with the wheel zooms - a
|
|
1270
|
+
trackpad pinch arrives as exactly that -, a horizontal wheel or Shift pans,
|
|
1271
|
+
the plain wheel is the page's. A drag pans, two fingers pinch, a double
|
|
1272
|
+
click asks for everything. Nothing here changes a domain: each gesture
|
|
1273
|
+
proposes one to the axis' handler, and the caller passes it back. */
|
|
1274
|
+
/** What was last proposed per axis, until a layout has taken the answer: a
|
|
1275
|
+
second wheel step in the same frame builds on the first, not on the
|
|
1276
|
+
domain still drawn. */
|
|
1277
|
+
x(this, "proposed", /* @__PURE__ */ new Map());
|
|
1278
|
+
x(this, "pointers", /* @__PURE__ */ new Map());
|
|
1279
|
+
x(this, "pinch", 0);
|
|
1280
|
+
x(this, "subscribeLayout", (t) => (this.layoutSubscribers.add(t), () => {
|
|
1082
1281
|
this.layoutSubscribers.delete(t);
|
|
1083
1282
|
}));
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1283
|
+
x(this, "getLayoutSnapshot", () => this.layoutSnapshot);
|
|
1284
|
+
x(this, "getLayoutServerSnapshot", () => pe);
|
|
1285
|
+
x(this, "subscribeHover", (t) => (this.hoverSubscribers.add(t), () => {
|
|
1087
1286
|
this.hoverSubscribers.delete(t);
|
|
1088
1287
|
}));
|
|
1089
|
-
|
|
1090
|
-
|
|
1288
|
+
x(this, "getHoverSnapshot", () => this.hoverSnapshot);
|
|
1289
|
+
x(this, "getHoverServerSnapshot", () => ye);
|
|
1091
1290
|
}
|
|
1092
1291
|
setOnPerf(t) {
|
|
1093
1292
|
this.onPerf = t;
|
|
@@ -1100,57 +1299,59 @@ class he {
|
|
|
1100
1299
|
if (t === void 0) return this.nextSlot++;
|
|
1101
1300
|
const e = this.slotsByName.get(t);
|
|
1102
1301
|
if (e !== void 0 && !this.slotTaken(e)) return e;
|
|
1103
|
-
const
|
|
1104
|
-
return e === void 0 && this.slotsByName.set(t,
|
|
1302
|
+
const n = this.nextSlot++;
|
|
1303
|
+
return e === void 0 && this.slotsByName.set(t, n), n;
|
|
1105
1304
|
}
|
|
1106
1305
|
/** Is a named series currently standing on this palette place? A taken place is
|
|
1107
1306
|
not assigned a second time: two series of the same name standing at once
|
|
1108
1307
|
share no colour, and a name that a rename has left behind does not get the
|
|
1109
1308
|
colour of the renamed series. */
|
|
1110
1309
|
slotTaken(t, e) {
|
|
1111
|
-
for (const
|
|
1112
|
-
if (
|
|
1310
|
+
for (const n of this.series.values())
|
|
1311
|
+
if (n !== e && n.config.name !== void 0 && n.slot === t) return !0;
|
|
1113
1312
|
return !1;
|
|
1114
1313
|
}
|
|
1115
1314
|
registerSeries(t) {
|
|
1116
|
-
const e =
|
|
1315
|
+
const e = $t++;
|
|
1117
1316
|
return this.series.set(e, {
|
|
1118
1317
|
order: e,
|
|
1119
1318
|
config: t,
|
|
1120
|
-
slot: this.slotFor(t.name),
|
|
1319
|
+
slot: gt(t) ? this.slotFor(t.name) : -1,
|
|
1121
1320
|
lastSlot: null,
|
|
1122
1321
|
materialized: null,
|
|
1123
1322
|
extent: null,
|
|
1124
1323
|
step: null,
|
|
1125
1324
|
cellHeight: null,
|
|
1126
|
-
|
|
1325
|
+
buckets: null
|
|
1127
1326
|
}), this.materialsDirty = !0, this.markLayoutDirty(), e;
|
|
1128
1327
|
}
|
|
1129
1328
|
updateSeries(t, e) {
|
|
1130
|
-
const
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1329
|
+
const n = this.series.get(t);
|
|
1330
|
+
if (n === void 0) return;
|
|
1331
|
+
const s = n.config, o = Un(s, e), r = o && s.xAxisId === e.xAxisId && s.yAxisId === e.yAxisId && s.name === e.name && X(s.format, e.format) && s.color === e.color && s.tone === e.tone && s.hidden === e.hidden && Xn(s, e);
|
|
1332
|
+
if (n.slot < 0 && gt(e))
|
|
1333
|
+
n.slot = this.slotFor(e.name);
|
|
1334
|
+
else if (s.name !== e.name && e.name !== void 0 && n.slot >= 0) {
|
|
1134
1335
|
const a = this.slotsByName.get(e.name);
|
|
1135
|
-
a === void 0 ? this.slotsByName.set(e.name,
|
|
1336
|
+
a === void 0 ? this.slotsByName.set(e.name, n.slot) : this.slotTaken(a, n) || (n.slot = a);
|
|
1136
1337
|
}
|
|
1137
|
-
|
|
1338
|
+
n.config = e, !r && (n.buckets = null, o || (n.materialized = null, n.extent = null, n.step = null, n.cellHeight = null, n.buckets = null, this.materialsDirty = !0), this.markLayoutDirty());
|
|
1138
1339
|
}
|
|
1139
1340
|
unregisterSeries(t) {
|
|
1140
1341
|
this.series.delete(t) && (this.materialsDirty = !0, this.markLayoutDirty());
|
|
1141
1342
|
}
|
|
1142
1343
|
registerAxis(t) {
|
|
1143
|
-
const e =
|
|
1344
|
+
const e = $t++;
|
|
1144
1345
|
return this.axes.set(e, { order: e, config: t }), this.materialsDirty = !0, this.markLayoutDirty(), e;
|
|
1145
1346
|
}
|
|
1146
1347
|
updateAxis(t, e) {
|
|
1147
|
-
const
|
|
1148
|
-
if (
|
|
1149
|
-
const
|
|
1150
|
-
if (
|
|
1151
|
-
if (!o ||
|
|
1348
|
+
const n = this.axes.get(t);
|
|
1349
|
+
if (n === void 0) return;
|
|
1350
|
+
const s = n.config, o = X(s.accessor, e.accessor) && qn(s.calendar, e.calendar), r = o && s.id === e.id && s.orientation === e.orientation && s.position === e.position && s.label === e.label && s.tickCount === e.tickCount && s.grid === e.grid && s.time === e.time && s.alignTicks === e.alignTicks && ft(s.ticks, e.ticks) && ei(s.domain, e.domain) && s.onDomainChange === void 0 == (e.onDomainChange === void 0) && X(s.tickFormat, e.tickFormat);
|
|
1351
|
+
if (n.config = e, !r) {
|
|
1352
|
+
if (!o || s.id !== e.id) {
|
|
1152
1353
|
for (const a of this.series.values())
|
|
1153
|
-
a.materialized = null, a.extent = null, a.step = null, a.cellHeight = null, a.
|
|
1354
|
+
a.materialized = null, a.extent = null, a.step = null, a.cellHeight = null, a.buckets = null;
|
|
1154
1355
|
this.materialsDirty = !0;
|
|
1155
1356
|
}
|
|
1156
1357
|
this.markLayoutDirty();
|
|
@@ -1163,14 +1364,14 @@ class he {
|
|
|
1163
1364
|
anything in this library. They are therefore not series: no accessor, no
|
|
1164
1365
|
data, no legend entry, no hit. */
|
|
1165
1366
|
registerLimit(t) {
|
|
1166
|
-
const e =
|
|
1367
|
+
const e = $t++;
|
|
1167
1368
|
return this.limits.set(e, { order: e, config: t }), this.markLayoutDirty(), e;
|
|
1168
1369
|
}
|
|
1169
1370
|
updateLimit(t, e) {
|
|
1170
|
-
const
|
|
1171
|
-
if (
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1371
|
+
const n = this.limits.get(t);
|
|
1372
|
+
if (n === void 0) return;
|
|
1373
|
+
const s = n.config;
|
|
1374
|
+
n.config = e, !(s.kind === e.kind && s.axisId === e.axisId && s.orientation === e.orientation && s.severity === e.severity && s.role === e.role && s.label === e.label && s.color === e.color && s.inExtent === e.inExtent && (s.kind === "line" && e.kind === "line" ? s.value === e.value : s.kind === "band" && e.kind === "band" && s.from === e.from && s.to === e.to)) && this.markLayoutDirty();
|
|
1174
1375
|
}
|
|
1175
1376
|
unregisterLimit(t) {
|
|
1176
1377
|
this.limits.delete(t) && this.markLayoutDirty();
|
|
@@ -1192,7 +1393,7 @@ class he {
|
|
|
1192
1393
|
}
|
|
1193
1394
|
updateTooltip(t) {
|
|
1194
1395
|
const e = this.tooltip;
|
|
1195
|
-
if (e !== null && e.mode === t.mode &&
|
|
1396
|
+
if (e !== null && e.mode === t.mode && X(e.render, t.render)) {
|
|
1196
1397
|
this.tooltip = t;
|
|
1197
1398
|
return;
|
|
1198
1399
|
}
|
|
@@ -1212,9 +1413,9 @@ class he {
|
|
|
1212
1413
|
/* ================= Data and container configuration ================= */
|
|
1213
1414
|
setData(t) {
|
|
1214
1415
|
if (t !== this.data) {
|
|
1215
|
-
this.data = t, this.materialsDirty = !0
|
|
1416
|
+
this.data = t, this.materialsDirty = !0;
|
|
1216
1417
|
for (const e of this.series.values())
|
|
1217
|
-
e.materialized = null, e.extent = null, e.step = null, e.cellHeight = null, e.
|
|
1418
|
+
e.materialized = null, e.extent = null, e.step = null, e.cellHeight = null, e.buckets = null;
|
|
1218
1419
|
this.markLayoutDirty();
|
|
1219
1420
|
}
|
|
1220
1421
|
}
|
|
@@ -1225,14 +1426,14 @@ class he {
|
|
|
1225
1426
|
/* ================= Checks (R-4.12, R-4.13) ================= */
|
|
1226
1427
|
/** Called from the Chart after the child effects; DEV only. */
|
|
1227
1428
|
validate() {
|
|
1228
|
-
if (!
|
|
1429
|
+
if (!ht) return;
|
|
1229
1430
|
const t = /* @__PURE__ */ new Set();
|
|
1230
1431
|
for (const { config: o } of this.axesInOrder()) {
|
|
1231
|
-
const
|
|
1432
|
+
const r = `${o.orientation}:${o.id}`, a = o.orientation === "x" ? "XAxis" : "YAxis";
|
|
1232
1433
|
ut(
|
|
1233
|
-
!t.has(
|
|
1434
|
+
!t.has(r),
|
|
1234
1435
|
`Two <${a}> with the same id "${o.id}". A second ${a} needs an own id (R-4.12).`
|
|
1235
|
-
), t.add(
|
|
1436
|
+
), t.add(r);
|
|
1236
1437
|
}
|
|
1237
1438
|
const e = /* @__PURE__ */ new Set();
|
|
1238
1439
|
for (const { config: o } of this.series.values())
|
|
@@ -1243,122 +1444,122 @@ class he {
|
|
|
1243
1444
|
t.has(`y:${o.yAxisId}`),
|
|
1244
1445
|
`Series "${o.name ?? "?"}" refers to the unknown y axis "${o.yAxisId}" (R-4.12).`
|
|
1245
1446
|
), e.add(`x:${o.xAxisId}`), e.add(`y:${o.yAxisId}`);
|
|
1447
|
+
for (const { config: o } of this.limits.values())
|
|
1448
|
+
ut(
|
|
1449
|
+
t.has(`${o.orientation}:${this.limitAxisId(o)}`),
|
|
1450
|
+
`A limit refers to the unknown ${o.orientation} axis "${this.limitAxisId(o)}" (R-4.12).`
|
|
1451
|
+
);
|
|
1246
1452
|
for (const o of t)
|
|
1247
|
-
!e.has(o) && this.series.size > 0 &&
|
|
1453
|
+
!e.has(o) && this.series.size > 0 && J(
|
|
1248
1454
|
`axis-without-series-${o}`,
|
|
1249
1455
|
`Axis "${o}" has no bound series; it is drawn with the domain [0, 1] (R-4.13).`
|
|
1250
1456
|
);
|
|
1251
|
-
const
|
|
1457
|
+
const n = /* @__PURE__ */ new Map();
|
|
1252
1458
|
for (const { config: o } of this.seriesInOrder()) {
|
|
1253
1459
|
if (o.kind !== "bar") continue;
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1460
|
+
const r = n.get(o.xAxisId);
|
|
1461
|
+
r === void 0 ? n.set(o.xAxisId, o.barWidth) : r !== o.barWidth && J(
|
|
1256
1462
|
`bar-width-${o.xAxisId}`,
|
|
1257
|
-
`Bars on the x axis "${o.xAxisId}" give different barWidth. A group shares one width fraction; that of the first (${
|
|
1463
|
+
`Bars on the x axis "${o.xAxisId}" give different barWidth. A group shares one width fraction; that of the first (${r}) applies (ADR-0002).`
|
|
1258
1464
|
);
|
|
1259
1465
|
}
|
|
1260
|
-
let
|
|
1261
|
-
for (const o of this.axesInOrder()) o.config.grid === !0 &&
|
|
1262
|
-
|
|
1466
|
+
let s = 0;
|
|
1467
|
+
for (const o of this.axesInOrder()) o.config.grid === !0 && s++;
|
|
1468
|
+
s > 1 && J(
|
|
1263
1469
|
"multiple-grids",
|
|
1264
|
-
"More than one axis draws grid. Unaligned grids compete visually;
|
|
1470
|
+
"More than one axis draws grid. Unaligned grids compete visually; `alignTicks` puts a further y axis' ticks on the first one's grid instead (R-4.15)."
|
|
1265
1471
|
);
|
|
1266
1472
|
}
|
|
1267
|
-
|
|
1473
|
+
/* ================= Materialisation (R-2.6, R-2.7) ================= */
|
|
1474
|
+
/** A limit's axis: the one it names, or the first of its orientation. */
|
|
1475
|
+
limitAxisId(t) {
|
|
1476
|
+
if (t.axisId !== void 0) return t.axisId;
|
|
1268
1477
|
for (const { config: e } of this.axes.values())
|
|
1269
|
-
if (e.orientation ===
|
|
1478
|
+
if (e.orientation === t.orientation) return e.id;
|
|
1479
|
+
return t.orientation;
|
|
1480
|
+
}
|
|
1481
|
+
findAxisConfig(t, e) {
|
|
1482
|
+
for (const { config: n } of this.axes.values())
|
|
1483
|
+
if (n.orientation === t && n.id === e) return n;
|
|
1270
1484
|
return null;
|
|
1271
1485
|
}
|
|
1272
1486
|
materialize() {
|
|
1273
1487
|
const t = typeof performance > "u" ? 0 : performance.now();
|
|
1274
1488
|
let e = 0;
|
|
1275
|
-
for (const
|
|
1276
|
-
if (
|
|
1277
|
-
e +=
|
|
1489
|
+
for (const n of this.series.values()) {
|
|
1490
|
+
if (n.materialized !== null) {
|
|
1491
|
+
e += n.materialized.length;
|
|
1278
1492
|
continue;
|
|
1279
1493
|
}
|
|
1280
|
-
const
|
|
1281
|
-
if (
|
|
1282
|
-
const a =
|
|
1494
|
+
const s = n.config, o = s.data ?? this.data, r = this.findAxisConfig("x", s.xAxisId);
|
|
1495
|
+
if (r === null) continue;
|
|
1496
|
+
const a = Wn(
|
|
1283
1497
|
o,
|
|
1284
|
-
s.accessor,
|
|
1285
1498
|
r.accessor,
|
|
1286
|
-
|
|
1499
|
+
s.accessor,
|
|
1500
|
+
Mt(s),
|
|
1287
1501
|
{
|
|
1288
|
-
value:
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
xGap: this.gapFor(s)
|
|
1502
|
+
value: qt(s),
|
|
1503
|
+
xMap: this.mapFor(r),
|
|
1504
|
+
xGap: this.gapFor(r)
|
|
1292
1505
|
}
|
|
1293
1506
|
);
|
|
1294
|
-
if (
|
|
1295
|
-
const l =
|
|
1296
|
-
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1507
|
+
if (n.materialized = a.series, e += a.series.length, s.kind === "bar") {
|
|
1508
|
+
const l = _n(a.series.x, a.series.length);
|
|
1509
|
+
n.step = l;
|
|
1510
|
+
const u = l / 2;
|
|
1511
|
+
n.extent = {
|
|
1299
1512
|
...a.extent,
|
|
1300
|
-
xMin: a.extent.xMin -
|
|
1301
|
-
xMax: a.extent.xMax +
|
|
1513
|
+
xMin: a.extent.xMin - u,
|
|
1514
|
+
xMax: a.extent.xMax + u
|
|
1302
1515
|
};
|
|
1303
|
-
} else if (
|
|
1304
|
-
const l =
|
|
1305
|
-
|
|
1516
|
+
} else if (s.kind === "matrix") {
|
|
1517
|
+
const l = fe(a.series.x, a.series.length), u = fe(a.series.y, a.series.length);
|
|
1518
|
+
n.step = l, n.cellHeight = u, n.extent = {
|
|
1306
1519
|
xMin: a.extent.xMin - l / 2,
|
|
1307
1520
|
xMax: a.extent.xMax + l / 2,
|
|
1308
|
-
yMin: a.extent.yMin -
|
|
1309
|
-
yMax: a.extent.yMax +
|
|
1521
|
+
yMin: a.extent.yMin - u / 2,
|
|
1522
|
+
yMax: a.extent.yMax + u / 2
|
|
1310
1523
|
};
|
|
1311
|
-
} else if (
|
|
1312
|
-
|
|
1524
|
+
} else if (s.kind === "state") {
|
|
1525
|
+
const l = vn(a.series.x, a.series.length);
|
|
1526
|
+
n.step = l, n.extent = {
|
|
1313
1527
|
...a.extent,
|
|
1528
|
+
xMax: a.extent.xMax + l,
|
|
1314
1529
|
yMin: Number.POSITIVE_INFINITY,
|
|
1315
1530
|
yMax: Number.NEGATIVE_INFINITY
|
|
1316
1531
|
};
|
|
1317
|
-
else if (r.kind === "span") {
|
|
1318
|
-
i.depth = qe(
|
|
1319
|
-
a.series.x,
|
|
1320
|
-
a.series.x1 ?? new Float64Array(a.series.length),
|
|
1321
|
-
a.series.length,
|
|
1322
|
-
// The end of the domain is not yet fixed at materialisation time. The
|
|
1323
|
-
// covering of an open span reaches to the end of everything there is -
|
|
1324
|
-
// and that is exactly the value it gets here.
|
|
1325
|
-
a.extent.xMax
|
|
1326
|
-
);
|
|
1327
|
-
const l = (r.height ?? 0.6) / 2;
|
|
1328
|
-
i.step = null, i.extent = {
|
|
1329
|
-
...a.extent,
|
|
1330
|
-
yMin: a.extent.yMin - l,
|
|
1331
|
-
yMax: a.extent.yMax + l
|
|
1332
|
-
};
|
|
1333
1532
|
} else
|
|
1334
|
-
|
|
1335
|
-
if (
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1533
|
+
n.step = null, n.extent = a.extent;
|
|
1534
|
+
if (ht && s.kind !== "matrix") {
|
|
1535
|
+
const l = Rn(a.series.x, a.series.length);
|
|
1536
|
+
if (l >= 0) {
|
|
1537
|
+
const u = s.name ?? "?";
|
|
1538
|
+
J(
|
|
1539
|
+
`x-unsorted-${u}`,
|
|
1540
|
+
`Series "${u}": x values are not sorted ascending (index ${l}). Binary search and path building assume sortedness; there is no automatic sorting (R-2.6).`
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1342
1543
|
}
|
|
1343
1544
|
}
|
|
1344
1545
|
this.materialsDirty = !1, this.perf.materializeMs = (typeof performance > "u" ? 0 : performance.now()) - t, this.perf.points = e;
|
|
1345
1546
|
}
|
|
1346
1547
|
/* ================= DOM binding, DPR, resize ================= */
|
|
1347
|
-
bind(t, e,
|
|
1348
|
-
var
|
|
1349
|
-
this.container = t, this.themeRoot =
|
|
1548
|
+
bind(t, e, n, s) {
|
|
1549
|
+
var r;
|
|
1550
|
+
this.container = t, this.themeRoot = s, this.seriesCanvas = e, this.overlayCanvas = n, this.seriesCtx = e.getContext("2d"), this.overlayCtx = n.getContext("2d"), this.measurer = new Ze(s), this.dpr = typeof devicePixelRatio == "number" ? devicePixelRatio : 1, this.rebindDprWatch(), this.unsubscribeTheme = Ue(() => {
|
|
1350
1551
|
var a;
|
|
1351
|
-
this.theme = null, (a = this.measurer) == null || a.clear(), this.markLayoutDirty();
|
|
1552
|
+
this.theme = null, this.painted.clear(), (a = this.measurer) == null || a.clear(), this.markLayoutDirty();
|
|
1352
1553
|
});
|
|
1353
1554
|
const o = typeof document > "u" ? void 0 : document.fonts;
|
|
1354
|
-
(
|
|
1555
|
+
(r = o == null ? void 0 : o.addEventListener) == null || r.call(o, "loadingdone", this.onFontsLoaded), this.theme = null, this.painted.clear(), this.markLayoutDirty();
|
|
1355
1556
|
}
|
|
1356
1557
|
bindTooltip(t) {
|
|
1357
1558
|
this.tooltipEl = t;
|
|
1358
1559
|
}
|
|
1359
1560
|
unbind() {
|
|
1360
|
-
var t, e,
|
|
1361
|
-
this.frameHandle !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.frameHandle), this.frameHandle = null), (t = this.dprMedia) == null || t.removeEventListener("change", this.onDprChange), this.dprMedia = null, (e = this.unsubscribeTheme) == null || e.call(this), this.unsubscribeTheme = null, typeof document < "u" && ((
|
|
1561
|
+
var t, e, n, s, o;
|
|
1562
|
+
this.frameHandle !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.frameHandle), this.frameHandle = null), (t = this.dprMedia) == null || t.removeEventListener("change", this.onDprChange), this.dprMedia = null, (e = this.unsubscribeTheme) == null || e.call(this), this.unsubscribeTheme = null, typeof document < "u" && ((s = (n = document.fonts) == null ? void 0 : n.removeEventListener) == null || s.call(n, "loadingdone", this.onFontsLoaded)), (o = this.measurer) == null || o.remove(), this.measurer = null, this.container = null, this.themeRoot = null, this.seriesCanvas = null, this.overlayCanvas = null, this.seriesCtx = null, this.overlayCtx = null, this.tooltipEl = null;
|
|
1362
1563
|
}
|
|
1363
1564
|
/** Detect a change of DPR (a change of monitor): rebind matchMedia (R-2.9). */
|
|
1364
1565
|
rebindDprWatch() {
|
|
@@ -1372,12 +1573,12 @@ class he {
|
|
|
1372
1573
|
applyPendingSize() {
|
|
1373
1574
|
if (this.pendingWidth === null || this.pendingHeight === null) return;
|
|
1374
1575
|
this.cssWidth = this.pendingWidth, this.cssHeight = this.pendingHeight, this.pendingWidth = null, this.pendingHeight = null;
|
|
1375
|
-
const { seriesCanvas: t, overlayCanvas: e, seriesCtx:
|
|
1376
|
-
if (!t || !e || !
|
|
1377
|
-
const
|
|
1576
|
+
const { seriesCanvas: t, overlayCanvas: e, seriesCtx: n, overlayCtx: s, dpr: o } = this;
|
|
1577
|
+
if (!t || !e || !n || !s) return;
|
|
1578
|
+
const r = Math.max(0, Math.round(this.cssWidth * o)), a = Math.max(0, Math.round(this.cssHeight * o));
|
|
1378
1579
|
for (const l of [t, e])
|
|
1379
|
-
l.width =
|
|
1380
|
-
|
|
1580
|
+
l.width = r, l.height = a, l.style.width = `${this.cssWidth}px`, l.style.height = `${this.cssHeight}px`;
|
|
1581
|
+
n.setTransform(o, 0, 0, o, 0, 0), s.setTransform(o, 0, 0, o, 0, 0);
|
|
1381
1582
|
}
|
|
1382
1583
|
/* ================= Scheduling (R-2.11) ================= */
|
|
1383
1584
|
markSeriesDirty() {
|
|
@@ -1397,7 +1598,7 @@ class he {
|
|
|
1397
1598
|
}));
|
|
1398
1599
|
}
|
|
1399
1600
|
frame() {
|
|
1400
|
-
if (this.applyPendingSize(), this.theme === null && this.themeRoot !== null && (this.theme =
|
|
1601
|
+
if (this.applyPendingSize(), this.theme === null && this.themeRoot !== null && (this.theme = Ke(this.themeRoot)), this.cssWidth <= 0 || this.cssHeight <= 0) {
|
|
1401
1602
|
this.layoutDirty && this.pushLayoutSnapshot();
|
|
1402
1603
|
return;
|
|
1403
1604
|
}
|
|
@@ -1412,10 +1613,10 @@ class he {
|
|
|
1412
1613
|
(R-4.15). */
|
|
1413
1614
|
gridDefault() {
|
|
1414
1615
|
const t = /* @__PURE__ */ new Map();
|
|
1415
|
-
let e = !0,
|
|
1416
|
-
for (const [
|
|
1417
|
-
const
|
|
1418
|
-
t.set(
|
|
1616
|
+
let e = !0, n = !0;
|
|
1617
|
+
for (const [s, o] of [...this.axes.entries()].sort((r, a) => r[1].order - a[1].order)) {
|
|
1618
|
+
const r = o.config.orientation === "x" ? e : n;
|
|
1619
|
+
t.set(s, o.config.grid ?? r), o.config.orientation === "x" ? e = !1 : n = !1;
|
|
1419
1620
|
}
|
|
1420
1621
|
return t;
|
|
1421
1622
|
}
|
|
@@ -1425,20 +1626,42 @@ class he {
|
|
|
1425
1626
|
which extents across series kinds can be tested without asking a canvas.
|
|
1426
1627
|
The layout path calls extentFor directly. */
|
|
1427
1628
|
axisExtent(t, e) {
|
|
1629
|
+
var o;
|
|
1428
1630
|
this.materialsDirty && this.materialize();
|
|
1429
|
-
const
|
|
1631
|
+
const n = t === "y" && ((o = this.findAxisConfig("y", e)) == null ? void 0 : o.domain) === "visible", s = [...this.series.values()].map((r) => ({
|
|
1430
1632
|
xAxisId: r.config.xAxisId,
|
|
1431
1633
|
yAxisId: r.config.yAxisId,
|
|
1432
|
-
|
|
1634
|
+
// A hidden series has no say: the axis fits what is shown.
|
|
1635
|
+
extent: r.config.hidden === !0 ? null : n ? this.visibleExtentOf(r) : r.extent
|
|
1433
1636
|
}));
|
|
1434
|
-
return
|
|
1637
|
+
return Vn(t, e, s, this.limitValues(t, e));
|
|
1638
|
+
}
|
|
1639
|
+
/** The extent of what a fixed x domain shows. A domain that is not fixed
|
|
1640
|
+
shows every point - "nice" and "data" both contain the data -, and a band
|
|
1641
|
+
and a cell keep theirs: a lane is no value, a cell's edge no point. */
|
|
1642
|
+
visibleExtentOf(t) {
|
|
1643
|
+
var u;
|
|
1644
|
+
const e = (u = this.findAxisConfig("x", t.config.xAxisId)) == null ? void 0 : u.domain, n = t.config.kind;
|
|
1645
|
+
if (!Array.isArray(e) || t.materialized === null || n === "state" || n === "matrix")
|
|
1646
|
+
return t.extent;
|
|
1647
|
+
const [s, o] = e;
|
|
1648
|
+
let [r, a] = Hn(t.materialized, s, o);
|
|
1649
|
+
const l = Mt(t.config);
|
|
1650
|
+
return typeof l == "number" && r <= a && (r = Math.min(r, l), a = Math.max(a, l)), { xMin: s, xMax: o, yMin: r, yMax: a };
|
|
1435
1651
|
}
|
|
1436
1652
|
/** The values of the limits that are to pull this axis along. */
|
|
1437
1653
|
limitValues(t, e) {
|
|
1438
|
-
const
|
|
1439
|
-
for (const { config:
|
|
1440
|
-
|
|
1441
|
-
return
|
|
1654
|
+
const n = [];
|
|
1655
|
+
for (const { config: s } of this.limits.values())
|
|
1656
|
+
s.inExtent && (s.orientation !== t || this.limitAxisId(s) !== e || (s.kind === "line" ? n.push(this.limitAt(s, s.value)) : n.push(this.limitAt(s, s.from), this.limitAt(s, s.to))));
|
|
1657
|
+
return n;
|
|
1658
|
+
}
|
|
1659
|
+
/** A limit's value in the units of its axis. An x limit on an operating-time
|
|
1660
|
+
axis is named on the wall clock, like the data, and mapped as they are. */
|
|
1661
|
+
limitAt(t, e) {
|
|
1662
|
+
if (t.orientation !== "x") return e;
|
|
1663
|
+
const n = this.findAxisConfig("x", this.limitAxisId(t)), s = n === null ? void 0 : this.mapFor(n);
|
|
1664
|
+
return s === void 0 ? e : s(e);
|
|
1442
1665
|
}
|
|
1443
1666
|
/** Pre-mapping of the x values of an axis with an operating calendar. The scale
|
|
1444
1667
|
stays affine; the mapping happens beforehand, once per point, in
|
|
@@ -1447,103 +1670,127 @@ class he {
|
|
|
1447
1670
|
mapFor(t) {
|
|
1448
1671
|
const e = t.calendar;
|
|
1449
1672
|
if (!(e === void 0 || e.length === 0))
|
|
1450
|
-
return (
|
|
1673
|
+
return (n) => nn(n, e);
|
|
1451
1674
|
}
|
|
1452
1675
|
gapFor(t) {
|
|
1453
1676
|
const e = t.calendar;
|
|
1454
1677
|
if (!(e === void 0 || e.length === 0))
|
|
1455
|
-
return (
|
|
1678
|
+
return (n) => sn(n, e);
|
|
1456
1679
|
}
|
|
1457
1680
|
extentFor(t) {
|
|
1458
1681
|
return this.axisExtent(t.orientation, t.id);
|
|
1459
1682
|
}
|
|
1460
1683
|
updateLayout() {
|
|
1461
|
-
const t = this.measurer
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1684
|
+
const t = this.measurer;
|
|
1685
|
+
this.proposed.clear(), this.container !== null && (this.container.style.touchAction = this.hasZoom() ? "pan-y" : "");
|
|
1686
|
+
const e = this.gridDefault(), n = [];
|
|
1687
|
+
for (const [s, o] of [...this.axes.entries()].sort((r, a) => r[1].order - a[1].order)) {
|
|
1688
|
+
const r = o.config;
|
|
1689
|
+
n.push({
|
|
1690
|
+
key: `${r.orientation}:${r.id}`,
|
|
1691
|
+
id: r.id,
|
|
1692
|
+
orientation: r.orientation,
|
|
1693
|
+
position: r.position,
|
|
1694
|
+
label: r.label,
|
|
1695
|
+
grid: e.get(s) ?? !1,
|
|
1696
|
+
extent: this.extentFor(r),
|
|
1697
|
+
domainMode: r.domain,
|
|
1698
|
+
tickCount: r.tickCount,
|
|
1699
|
+
tickFormat: r.tickFormat,
|
|
1700
|
+
tickValues: r.ticks,
|
|
1701
|
+
time: r.time,
|
|
1702
|
+
calendar: r.calendar,
|
|
1703
|
+
alignTicks: r.alignTicks,
|
|
1704
|
+
limitLabels: r.orientation === "y" ? this.limitsInOrder().map((a) => a.config).filter((a) => a.orientation === "y" && this.limitAxisId(a) === r.id && a.label !== void 0 && a.label !== "").map((a) => a.label) : void 0
|
|
1478
1705
|
});
|
|
1479
1706
|
}
|
|
1480
|
-
this.layout =
|
|
1707
|
+
this.layout = xn({
|
|
1481
1708
|
width: this.cssWidth,
|
|
1482
1709
|
height: this.cssHeight,
|
|
1483
1710
|
padding: this.padding,
|
|
1484
|
-
axes:
|
|
1485
|
-
measure: (
|
|
1711
|
+
axes: n,
|
|
1712
|
+
measure: (s, o) => t === null ? { width: 0, height: 0 } : t.measure(s, o),
|
|
1486
1713
|
hysteresis: this.hysteresis
|
|
1487
1714
|
});
|
|
1488
1715
|
}
|
|
1489
1716
|
findAxis(t, e) {
|
|
1490
|
-
for (const
|
|
1491
|
-
if (
|
|
1717
|
+
for (const n of this.layout.axes)
|
|
1718
|
+
if (n.orientation === t && n.id === e) return n;
|
|
1492
1719
|
return null;
|
|
1493
1720
|
}
|
|
1494
1721
|
/* ================= Series colours and legend entries ================= */
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1722
|
+
/** A caller's CSS colour as the canvas can draw it (finding 15). */
|
|
1723
|
+
paint(t) {
|
|
1724
|
+
const e = this.themeRoot;
|
|
1725
|
+
if (e === null) return t;
|
|
1726
|
+
let n = this.painted.get(t);
|
|
1727
|
+
return n === void 0 && (n = qe(e, { color: t }).color, this.painted.set(t, n)), n;
|
|
1728
|
+
}
|
|
1729
|
+
colorFor(t) {
|
|
1730
|
+
var s;
|
|
1731
|
+
if (t.config.color !== void 0) return this.paint(t.config.color);
|
|
1732
|
+
if (!gt(t.config)) return "";
|
|
1733
|
+
const e = t.config.tone;
|
|
1734
|
+
if (e !== void 0) {
|
|
1735
|
+
const o = this.theme ?? O;
|
|
1736
|
+
return e === "alarm" ? o.colorAlarm : e === "warning" ? o.colorWarning : o.colorOk;
|
|
1502
1737
|
}
|
|
1503
|
-
const
|
|
1504
|
-
return
|
|
1505
|
-
}
|
|
1506
|
-
/** Named: the place of the name. Nameless: the
|
|
1507
|
-
before - and a warning as soon as that shifts
|
|
1508
|
-
|
|
1509
|
-
|
|
1738
|
+
const n = ((s = this.theme) == null ? void 0 : s.series) ?? O.series;
|
|
1739
|
+
return n[this.paletteSlot(t) % Math.max(1, n.length)] ?? O.series[0] ?? "#2563eb";
|
|
1740
|
+
}
|
|
1741
|
+
/** Named: the place of the name. Nameless: the position among the series that
|
|
1742
|
+
take a palette place, as before - and a warning as soon as that shifts
|
|
1743
|
+
underneath it. */
|
|
1744
|
+
paletteSlot(t) {
|
|
1745
|
+
if (t.config.name !== void 0) return t.slot;
|
|
1746
|
+
let e = 0;
|
|
1747
|
+
for (const n of this.series.values())
|
|
1748
|
+
n.order < t.order && gt(n.config) && e++;
|
|
1749
|
+
return t.lastSlot !== null && t.lastSlot !== e && J(
|
|
1510
1750
|
"series-without-name-colour",
|
|
1511
1751
|
"a series without a name has changed its colour, because a series before it went away - with `name` it keeps it."
|
|
1512
|
-
), t.lastSlot = e, e
|
|
1752
|
+
), t.lastSlot = e, e;
|
|
1513
1753
|
}
|
|
1514
1754
|
nameFor(t, e) {
|
|
1515
|
-
return t.config.name !== void 0 ? t.config.name : (
|
|
1755
|
+
return t.config.name !== void 0 ? t.config.name : (J(
|
|
1516
1756
|
"series-without-name",
|
|
1517
1757
|
`a series without a name is called "Series ${e + 1}" in the legend and the tooltip - the name belongs in \`name\`.`
|
|
1518
1758
|
), `Series ${e + 1}`);
|
|
1519
1759
|
}
|
|
1520
1760
|
legendItems() {
|
|
1521
|
-
const t = [], e = /* @__PURE__ */ new
|
|
1522
|
-
return this.seriesInOrder().forEach((
|
|
1523
|
-
const o =
|
|
1761
|
+
const t = [], e = /* @__PURE__ */ new Map();
|
|
1762
|
+
return this.seriesInOrder().forEach((n, s) => {
|
|
1763
|
+
const o = n.config;
|
|
1524
1764
|
if (o.kind === "state") {
|
|
1525
|
-
o.states.forEach((
|
|
1526
|
-
const l = `${
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1765
|
+
o.states.forEach((r, a) => {
|
|
1766
|
+
const l = `${r.label}\0${r.color}`, u = e.get(l);
|
|
1767
|
+
if (u !== void 0) {
|
|
1768
|
+
u.seriesIds.includes(n.order) || u.seriesIds.push(n.order), u.hidden && (u.hidden = o.hidden === !0);
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
const d = {
|
|
1772
|
+
id: `${n.order}:${a}`,
|
|
1773
|
+
name: r.label,
|
|
1774
|
+
hidden: o.hidden === !0,
|
|
1775
|
+
color: r.color,
|
|
1776
|
+
seriesIds: [n.order]
|
|
1777
|
+
};
|
|
1778
|
+
e.set(l, d), t.push(d);
|
|
1533
1779
|
});
|
|
1534
1780
|
return;
|
|
1535
1781
|
}
|
|
1536
1782
|
t.push({
|
|
1537
|
-
id: String(
|
|
1538
|
-
name: this.nameFor(
|
|
1539
|
-
|
|
1540
|
-
|
|
1783
|
+
id: String(n.order),
|
|
1784
|
+
name: this.nameFor(n, s),
|
|
1785
|
+
hidden: o.hidden === !0,
|
|
1786
|
+
color: o.kind === "matrix" ? Qn(Ot(o.coloring, this.theme ?? O)) : this.colorFor(n),
|
|
1787
|
+
seriesIds: [n.order]
|
|
1541
1788
|
});
|
|
1542
1789
|
}), t;
|
|
1543
1790
|
}
|
|
1544
1791
|
/* ---------- Limits, ready in pixels ---------- */
|
|
1545
1792
|
limitColor(t, e) {
|
|
1546
|
-
return t.color !== void 0 ? t.color : t.role === "control" ? e.colorAxis : t.role === "zone" ? e.colorGrid : t.severity === "alarm" ? e.colorAlarm : e.colorWarning;
|
|
1793
|
+
return t.color !== void 0 ? this.paint(t.color) : t.role === "control" ? e.colorAxis : t.role === "zone" ? e.colorGrid : t.severity === "alarm" ? e.colorAlarm : e.colorWarning;
|
|
1547
1794
|
}
|
|
1548
1795
|
/** Dash pattern per role. The reader has to be able to see at a glance whether
|
|
1549
1796
|
the problem is the process or the tolerance. */
|
|
@@ -1558,57 +1805,59 @@ class he {
|
|
|
1558
1805
|
}
|
|
1559
1806
|
}
|
|
1560
1807
|
limitItems(t) {
|
|
1561
|
-
const e = this.theme ?? O,
|
|
1562
|
-
for (const { config:
|
|
1563
|
-
if (
|
|
1564
|
-
const o = this.findAxis(
|
|
1808
|
+
const e = this.theme ?? O, n = [];
|
|
1809
|
+
for (const { config: s } of this.limitsInOrder()) {
|
|
1810
|
+
if (s.kind === "band" !== t) continue;
|
|
1811
|
+
const o = this.findAxis(s.orientation, this.limitAxisId(s));
|
|
1565
1812
|
if (o === null) continue;
|
|
1566
|
-
const
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
1569
|
-
orientation:
|
|
1570
|
-
fromPx: o.scale.toPx(
|
|
1571
|
-
toPx: o.scale.toPx(
|
|
1572
|
-
color:
|
|
1813
|
+
const r = this.limitColor(s, e), a = this.limitDash(s);
|
|
1814
|
+
if (s.kind === "band")
|
|
1815
|
+
n.push({
|
|
1816
|
+
orientation: s.orientation,
|
|
1817
|
+
fromPx: o.scale.toPx(this.limitAt(s, s.from)),
|
|
1818
|
+
toPx: o.scale.toPx(this.limitAt(s, s.to)),
|
|
1819
|
+
color: r,
|
|
1573
1820
|
band: !0,
|
|
1574
1821
|
dash: a
|
|
1575
1822
|
});
|
|
1576
1823
|
else {
|
|
1577
|
-
const l = o.scale.toPx(
|
|
1578
|
-
|
|
1579
|
-
orientation:
|
|
1824
|
+
const l = o.scale.toPx(this.limitAt(s, s.value));
|
|
1825
|
+
n.push({
|
|
1826
|
+
orientation: s.orientation,
|
|
1580
1827
|
fromPx: l,
|
|
1581
1828
|
toPx: l,
|
|
1582
|
-
color:
|
|
1829
|
+
color: r,
|
|
1583
1830
|
band: !1,
|
|
1584
1831
|
dash: a
|
|
1585
1832
|
});
|
|
1586
1833
|
}
|
|
1587
1834
|
}
|
|
1588
|
-
return
|
|
1835
|
+
return n;
|
|
1589
1836
|
}
|
|
1590
1837
|
/** Labelled limits for the HTML layer: position and colour, ready. */
|
|
1591
1838
|
limitLabels() {
|
|
1839
|
+
var e;
|
|
1592
1840
|
const t = [];
|
|
1593
|
-
for (const { order:
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
if (
|
|
1597
|
-
const
|
|
1841
|
+
for (const { order: n, config: s } of this.limitsInOrder()) {
|
|
1842
|
+
if (s.label === void 0 || s.label === "") continue;
|
|
1843
|
+
const o = this.findAxis(s.orientation, this.limitAxisId(s));
|
|
1844
|
+
if (o === null) continue;
|
|
1845
|
+
const r = s.kind === "line" ? this.limitAt(s, s.value) : (this.limitAt(s, s.from) + this.limitAt(s, s.to)) / 2, a = o.scale.toPx(r), l = (((e = this.measurer) == null ? void 0 : e.measure(s.label, it).width) ?? 0) + 4;
|
|
1598
1846
|
t.push({
|
|
1599
|
-
id:
|
|
1600
|
-
axisKey:
|
|
1601
|
-
px:
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1847
|
+
id: n,
|
|
1848
|
+
axisKey: o.key,
|
|
1849
|
+
px: a,
|
|
1850
|
+
labelLeft: Le(a, l, this.cssWidth),
|
|
1851
|
+
label: s.label,
|
|
1852
|
+
severity: s.severity,
|
|
1853
|
+
role: s.role
|
|
1605
1854
|
});
|
|
1606
1855
|
}
|
|
1607
1856
|
return t;
|
|
1608
1857
|
}
|
|
1609
1858
|
/* ================= Drawing ================= */
|
|
1610
1859
|
drawItems() {
|
|
1611
|
-
const t = [], e = this.seriesInOrder(),
|
|
1860
|
+
const t = [], e = this.seriesInOrder().filter((r) => r.config.hidden !== !0), n = this.highlight, s = n !== null && e.some((r) => n.includes(r.order)) ? n : null, o = Bn(
|
|
1612
1861
|
e.map((r) => ({
|
|
1613
1862
|
order: r.order,
|
|
1614
1863
|
kind: r.config.kind,
|
|
@@ -1617,124 +1866,125 @@ class he {
|
|
|
1617
1866
|
fraction: r.config.kind === "bar" ? r.config.barWidth : 0
|
|
1618
1867
|
}))
|
|
1619
1868
|
);
|
|
1620
|
-
return e.forEach((r
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1625
|
-
const
|
|
1626
|
-
x:
|
|
1627
|
-
y:
|
|
1628
|
-
length:
|
|
1629
|
-
xScale:
|
|
1630
|
-
yScale:
|
|
1631
|
-
color: this.colorFor(r
|
|
1632
|
-
alpha:
|
|
1633
|
-
}, h = r.config;
|
|
1634
|
-
switch (h.kind) {
|
|
1869
|
+
return e.forEach((r) => {
|
|
1870
|
+
const a = r.materialized;
|
|
1871
|
+
if (a === null) return;
|
|
1872
|
+
const l = this.findAxis("x", r.config.xAxisId), u = this.findAxis("y", r.config.yAxisId);
|
|
1873
|
+
if (l === null || u === null) return;
|
|
1874
|
+
const d = s !== null && !s.includes(r.order), f = {
|
|
1875
|
+
x: a.x,
|
|
1876
|
+
y: a.y,
|
|
1877
|
+
length: a.length,
|
|
1878
|
+
xScale: l.scale,
|
|
1879
|
+
yScale: u.scale,
|
|
1880
|
+
color: this.colorFor(r),
|
|
1881
|
+
alpha: d ? 0.25 : 1
|
|
1882
|
+
}, h = r.config, m = h.kind === "line" || h.kind === "area" ? Pn(a, l.scale.domain[0], l.scale.domain[1], l.scale.m, l.scale.b, this.layout.plot.width) : a;
|
|
1883
|
+
switch (f.x = m.x, f.y = m.y, f.length = m.length, h.kind) {
|
|
1635
1884
|
case "line":
|
|
1636
1885
|
t.push({
|
|
1637
|
-
...
|
|
1886
|
+
...f,
|
|
1638
1887
|
kind: "line",
|
|
1639
1888
|
strokeWidth: h.strokeWidth,
|
|
1640
1889
|
dash: h.dash,
|
|
1641
|
-
|
|
1890
|
+
markers: h.markers,
|
|
1891
|
+
step: h.step
|
|
1642
1892
|
});
|
|
1643
1893
|
break;
|
|
1644
1894
|
case "area":
|
|
1645
1895
|
t.push({
|
|
1646
|
-
...
|
|
1896
|
+
...f,
|
|
1647
1897
|
kind: "area",
|
|
1648
|
-
y0:
|
|
1898
|
+
y0: m.y0,
|
|
1649
1899
|
baseline: 0,
|
|
1650
1900
|
fillOpacity: h.fillOpacity,
|
|
1651
|
-
strokeWidth: h.strokeWidth
|
|
1901
|
+
strokeWidth: h.strokeWidth,
|
|
1902
|
+
dash: h.dash
|
|
1652
1903
|
});
|
|
1653
1904
|
break;
|
|
1654
1905
|
case "bar": {
|
|
1655
|
-
const
|
|
1906
|
+
const c = o.get(r.order) ?? {
|
|
1656
1907
|
index: 0,
|
|
1657
1908
|
size: 1,
|
|
1658
1909
|
step: r.step ?? 0,
|
|
1659
1910
|
fraction: h.barWidth
|
|
1660
|
-
},
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1911
|
+
}, p = l.scale.domain, y = zn(
|
|
1912
|
+
Yn(c.step, p[1] - p[0]),
|
|
1913
|
+
c.fraction,
|
|
1914
|
+
c.index,
|
|
1915
|
+
c.size
|
|
1665
1916
|
);
|
|
1666
1917
|
t.push({
|
|
1667
|
-
...
|
|
1918
|
+
...f,
|
|
1668
1919
|
kind: "bar",
|
|
1669
1920
|
baseline: 0,
|
|
1670
|
-
offset:
|
|
1671
|
-
width:
|
|
1921
|
+
offset: y.offset,
|
|
1922
|
+
width: y.width
|
|
1672
1923
|
});
|
|
1673
1924
|
break;
|
|
1674
1925
|
}
|
|
1675
1926
|
case "scatter":
|
|
1676
|
-
t.push({ ...
|
|
1927
|
+
t.push({ ...f, kind: "scatter", radius: h.radius });
|
|
1677
1928
|
break;
|
|
1678
1929
|
case "state": {
|
|
1679
|
-
const
|
|
1930
|
+
const c = this.lanePx(h, u);
|
|
1680
1931
|
t.push({
|
|
1681
|
-
...
|
|
1932
|
+
...f,
|
|
1682
1933
|
kind: "state",
|
|
1683
|
-
colors: h.states.map((
|
|
1684
|
-
laneTop:
|
|
1685
|
-
laneBottom:
|
|
1686
|
-
|
|
1934
|
+
colors: h.states.map((p) => this.paint(p.color)),
|
|
1935
|
+
laneTop: c.top,
|
|
1936
|
+
laneBottom: c.bottom,
|
|
1937
|
+
lastEnd: this.lastEnd(r, a, l)
|
|
1687
1938
|
});
|
|
1688
1939
|
break;
|
|
1689
1940
|
}
|
|
1690
1941
|
case "matrix": {
|
|
1691
|
-
const
|
|
1942
|
+
const c = Ot(h.coloring, this.theme ?? O).map((p) => this.paint(p));
|
|
1692
1943
|
t.push({
|
|
1693
|
-
...
|
|
1944
|
+
...f,
|
|
1694
1945
|
kind: "matrix",
|
|
1695
|
-
buckets:
|
|
1696
|
-
colors:
|
|
1697
|
-
width:
|
|
1946
|
+
buckets: r.buckets ?? (r.buckets = xe(a, h.coloring, c.length)),
|
|
1947
|
+
colors: c,
|
|
1948
|
+
width: yt(
|
|
1698
1949
|
r.step ?? 0,
|
|
1699
|
-
|
|
1950
|
+
l.scale.domain[1] - l.scale.domain[0]
|
|
1700
1951
|
),
|
|
1701
|
-
height:
|
|
1952
|
+
height: yt(
|
|
1702
1953
|
r.cellHeight ?? 0,
|
|
1703
|
-
|
|
1954
|
+
u.scale.domain[1] - u.scale.domain[0]
|
|
1704
1955
|
)
|
|
1705
1956
|
});
|
|
1706
1957
|
break;
|
|
1707
1958
|
}
|
|
1708
|
-
case "span": {
|
|
1709
|
-
t.push({
|
|
1710
|
-
...u,
|
|
1711
|
-
kind: "span",
|
|
1712
|
-
x1: s.x1 ?? bn,
|
|
1713
|
-
// Computed once per materialisation, not per frame: the calculation
|
|
1714
|
-
// is quadratic, and a schedule with five hundred spans is pushed and
|
|
1715
|
-
// pulled like any other chart.
|
|
1716
|
-
depth: r.depth ?? xn,
|
|
1717
|
-
height: h.height ?? 0.6,
|
|
1718
|
-
domainEnd: a.scale.domain[1]
|
|
1719
|
-
});
|
|
1720
|
-
break;
|
|
1721
|
-
}
|
|
1722
1959
|
}
|
|
1723
1960
|
}), t;
|
|
1724
1961
|
}
|
|
1962
|
+
/** Where a band's last state ends: the latest x of the visible series on its
|
|
1963
|
+
x axis, one step past its own last point where that is the latest, never
|
|
1964
|
+
beyond the domain (lastSegmentEnd). */
|
|
1965
|
+
lastEnd(t, e, n) {
|
|
1966
|
+
let s = Number.NEGATIVE_INFINITY;
|
|
1967
|
+
for (const o of this.series.values()) {
|
|
1968
|
+
const r = o.materialized;
|
|
1969
|
+
if (r === null || r.length === 0 || o.config.hidden === !0 || o.config.xAxisId !== t.config.xAxisId) continue;
|
|
1970
|
+
const a = r.x[r.length - 1];
|
|
1971
|
+
a > s && (s = a);
|
|
1972
|
+
}
|
|
1973
|
+
return bn(e.x, e.length, s, t.step ?? 0, n.scale.domain[1]);
|
|
1974
|
+
}
|
|
1725
1975
|
/** Lane of a state series in pixels. Without a value the whole domain of its y
|
|
1726
1976
|
axis: a single series fills its band, a stack gets a domain with one unit per
|
|
1727
1977
|
machine from the caller. */
|
|
1728
1978
|
lanePx(t, e) {
|
|
1729
|
-
const
|
|
1730
|
-
return { top: Math.min(
|
|
1979
|
+
const n = e.scale.domain, s = e.scale.toPx(t.laneFrom ?? n[0]), o = e.scale.toPx(t.laneTo ?? n[1]);
|
|
1980
|
+
return { top: Math.min(s, o), bottom: Math.max(s, o) };
|
|
1731
1981
|
}
|
|
1732
1982
|
drawSeriesLayer() {
|
|
1733
|
-
var
|
|
1983
|
+
var s;
|
|
1734
1984
|
const t = this.seriesCtx, e = this.theme;
|
|
1735
1985
|
if (!t || !e) return;
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1986
|
+
const n = typeof performance > "u" ? 0 : performance.now();
|
|
1987
|
+
Fn(t, {
|
|
1738
1988
|
width: this.cssWidth,
|
|
1739
1989
|
height: this.cssHeight,
|
|
1740
1990
|
plot: this.layout.plot,
|
|
@@ -1743,16 +1993,17 @@ class he {
|
|
|
1743
1993
|
series: this.drawItems(),
|
|
1744
1994
|
limitBands: this.limitItems(!0),
|
|
1745
1995
|
limitLines: this.limitItems(!1)
|
|
1746
|
-
}), this.perf.seriesDrawMs = (typeof performance > "u" ? 0 : performance.now()) -
|
|
1996
|
+
}), this.perf.seriesDrawMs = (typeof performance > "u" ? 0 : performance.now()) - n, (s = this.onPerf) == null || s.call(this, { ...this.perf });
|
|
1747
1997
|
}
|
|
1748
1998
|
drawOverlayLayer() {
|
|
1749
1999
|
const t = this.overlayCtx, e = this.theme;
|
|
1750
|
-
!t || !e || (
|
|
2000
|
+
!t || !e || (Dn(t, {
|
|
1751
2001
|
width: this.cssWidth,
|
|
1752
2002
|
height: this.cssHeight,
|
|
1753
2003
|
plot: this.layout.plot,
|
|
1754
2004
|
theme: e,
|
|
1755
|
-
hover: this.hover
|
|
2005
|
+
hover: this.hover,
|
|
2006
|
+
syncPx: this.syncedPx()
|
|
1756
2007
|
}), this.positionTooltip());
|
|
1757
2008
|
}
|
|
1758
2009
|
/* ================= Interaction (4.4) ================= */
|
|
@@ -1760,173 +2011,287 @@ class he {
|
|
|
1760
2011
|
this.highlight !== t && (this.highlight = t, this.markSeriesDirty());
|
|
1761
2012
|
}
|
|
1762
2013
|
inPlot(t, e) {
|
|
1763
|
-
const
|
|
1764
|
-
return t >=
|
|
2014
|
+
const n = this.layout.plot;
|
|
2015
|
+
return t >= n.x && t <= n.x + n.width && e >= n.y && e <= n.y + n.height;
|
|
1765
2016
|
}
|
|
1766
2017
|
pointerMove(t, e) {
|
|
1767
|
-
if (this.tooltip === null) return;
|
|
1768
2018
|
if (!this.inPlot(t, e)) {
|
|
1769
2019
|
this.pointerLeave();
|
|
1770
2020
|
return;
|
|
1771
2021
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
2022
|
+
if (this.tooltip === null) {
|
|
2023
|
+
const r = this.layout.axes.find((a) => a.orientation === "x");
|
|
2024
|
+
r !== void 0 && this.share({ axisId: r.id, value: r.scale.fromPx(t) });
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
const n = this.hitTest(t, e);
|
|
2028
|
+
if (n === null) {
|
|
1774
2029
|
this.pointerLeave();
|
|
1775
2030
|
return;
|
|
1776
2031
|
}
|
|
1777
|
-
const
|
|
1778
|
-
this.hover =
|
|
2032
|
+
const s = n.key;
|
|
2033
|
+
this.hover = n.state, this.hover.mouseX = t, this.hover.mouseY = e, this.markOverlayDirty();
|
|
2034
|
+
const o = this.findAxis("x", n.primary.entry.config.xAxisId);
|
|
2035
|
+
if (o !== null && this.share({ axisId: o.id, value: o.scale.fromPx(n.state.hit.xPx) }), s !== this.hoverKey) {
|
|
2036
|
+
const r = n.primary.entry.config.xAxisId;
|
|
2037
|
+
this.hoverKey = s, this.hoverXLabel = this.xLabel(r, n.primary.xValue, Kn(n.primary)), this.hoverRows = n.chosen.map((a) => this.tooltipRow(a, r)), this.pushHoverSnapshot();
|
|
2038
|
+
}
|
|
1779
2039
|
}
|
|
1780
2040
|
pointerLeave() {
|
|
1781
|
-
this.hover === null && this.hoverKey === ""
|
|
2041
|
+
this.share(null), !(this.hover === null && this.hoverKey === "") && (this.hover = null, this.hoverKey = "", this.markOverlayDirty(), this.pushHoverSnapshot());
|
|
1782
2042
|
}
|
|
1783
2043
|
hitTest(t, e) {
|
|
1784
|
-
var
|
|
1785
|
-
const
|
|
1786
|
-
if (this.seriesInOrder().forEach((
|
|
1787
|
-
const
|
|
1788
|
-
if (
|
|
1789
|
-
const
|
|
1790
|
-
if (
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
entry:
|
|
1794
|
-
index:
|
|
1795
|
-
color:
|
|
1796
|
-
name: this.nameFor(
|
|
1797
|
-
px:
|
|
1798
|
-
py:
|
|
1799
|
-
xValue:
|
|
1800
|
-
yValue:
|
|
1801
|
-
marked:
|
|
1802
|
-
areal:
|
|
1803
|
-
value:
|
|
1804
|
-
segment:
|
|
2044
|
+
var m;
|
|
2045
|
+
const n = ((m = this.tooltip) == null ? void 0 : m.mode) ?? "x", s = [];
|
|
2046
|
+
if (this.seriesInOrder().forEach((c, p) => {
|
|
2047
|
+
const y = c.materialized;
|
|
2048
|
+
if (y === null || y.length === 0 || c.config.hidden === !0) return;
|
|
2049
|
+
const g = c.config, b = this.findAxis("x", g.xAxisId), N = this.findAxis("y", g.yAxisId);
|
|
2050
|
+
if (b === null || N === null) return;
|
|
2051
|
+
const A = b.scale.fromPx(t), $ = N.scale.fromPx(e), w = this.hitIn(c, y, b, N, e, A, $, n);
|
|
2052
|
+
w !== null && s.push({
|
|
2053
|
+
entry: c,
|
|
2054
|
+
index: w.index,
|
|
2055
|
+
color: w.color ?? this.colorFor(c),
|
|
2056
|
+
name: this.nameFor(c, p),
|
|
2057
|
+
px: w.px,
|
|
2058
|
+
py: w.py,
|
|
2059
|
+
xValue: w.xValue,
|
|
2060
|
+
yValue: w.yValue,
|
|
2061
|
+
marked: w.marked,
|
|
2062
|
+
areal: w.areal,
|
|
2063
|
+
value: w.value,
|
|
2064
|
+
segment: w.segment
|
|
1805
2065
|
});
|
|
1806
|
-
}),
|
|
1807
|
-
const o =
|
|
1808
|
-
let a =
|
|
1809
|
-
if (
|
|
1810
|
-
let
|
|
1811
|
-
for (const
|
|
1812
|
-
const
|
|
1813
|
-
|
|
2066
|
+
}), s.length === 0) return null;
|
|
2067
|
+
const o = s.filter((c) => !c.areal), r = o.length > 0 ? o : s;
|
|
2068
|
+
let a = r[0];
|
|
2069
|
+
if (n === "nearest") {
|
|
2070
|
+
let c = Number.POSITIVE_INFINITY;
|
|
2071
|
+
for (const p of o) {
|
|
2072
|
+
const y = p.px - t, g = p.py - e, b = y * y + g * g;
|
|
2073
|
+
b < c && (c = b, a = p);
|
|
2074
|
+
}
|
|
2075
|
+
if (c > ge * ge) {
|
|
2076
|
+
for (const p of s)
|
|
2077
|
+
if (p.areal) {
|
|
2078
|
+
a = p;
|
|
2079
|
+
break;
|
|
2080
|
+
}
|
|
1814
2081
|
}
|
|
1815
2082
|
} else {
|
|
1816
|
-
let
|
|
1817
|
-
for (const
|
|
1818
|
-
const
|
|
1819
|
-
|
|
2083
|
+
let c = Number.POSITIVE_INFINITY;
|
|
2084
|
+
for (const p of r) {
|
|
2085
|
+
const y = Math.abs(p.px - t);
|
|
2086
|
+
y < c && (c = y, a = p);
|
|
1820
2087
|
}
|
|
1821
2088
|
}
|
|
1822
|
-
const l =
|
|
2089
|
+
const l = n === "nearest" ? [a] : s.filter(
|
|
1823
2090
|
// An area is always included: it covers the pointer, otherwise it
|
|
1824
2091
|
// would not have reported a hit at all. Only points have to share the
|
|
1825
2092
|
// x position.
|
|
1826
|
-
(
|
|
1827
|
-
),
|
|
1828
|
-
seriesName:
|
|
1829
|
-
color:
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2093
|
+
(c) => c.areal || Math.abs(c.px - a.px) <= Gn
|
|
2094
|
+
), u = l.map((c) => ({
|
|
2095
|
+
seriesName: c.name,
|
|
2096
|
+
color: c.color,
|
|
2097
|
+
xValue: c.xValue,
|
|
2098
|
+
yValue: c.yValue,
|
|
2099
|
+
datum: (c.entry.config.data ?? this.data)[c.index],
|
|
2100
|
+
index: c.index,
|
|
2101
|
+
value: c.value,
|
|
2102
|
+
segment: c.segment
|
|
2103
|
+
})), f = {
|
|
1836
2104
|
hit: {
|
|
1837
2105
|
xValue: a.xValue,
|
|
1838
|
-
points:
|
|
1839
|
-
|
|
2106
|
+
points: u,
|
|
2107
|
+
// An area's px is the beginning of its section; the crosshair and the
|
|
2108
|
+
// tooltip stay with the pointer instead.
|
|
2109
|
+
xPx: a.areal ? t : a.px,
|
|
1840
2110
|
yPx: a.py
|
|
1841
2111
|
},
|
|
1842
|
-
marker: l.filter((
|
|
2112
|
+
marker: l.filter((c) => c.marked).map((c) => ({ x: c.px, y: c.py, color: c.color })),
|
|
1843
2113
|
mouseX: t,
|
|
1844
2114
|
mouseY: e
|
|
1845
|
-
}
|
|
1846
|
-
return { key:
|
|
2115
|
+
};
|
|
2116
|
+
return { key: l.map((c) => `${c.entry.order}:${c.index}`).join("|"), state: f, primary: a, chosen: l };
|
|
2117
|
+
}
|
|
2118
|
+
setSyncId(t) {
|
|
2119
|
+
if (t !== this.syncId) {
|
|
2120
|
+
if (this.syncId !== null) {
|
|
2121
|
+
this.share(null);
|
|
2122
|
+
const e = lt.get(this.syncId);
|
|
2123
|
+
e == null || e.delete(this), (e == null ? void 0 : e.size) === 0 && lt.delete(this.syncId), this.synced = null, this.markOverlayDirty();
|
|
2124
|
+
}
|
|
2125
|
+
if (this.syncId = t, t !== null) {
|
|
2126
|
+
const e = lt.get(t) ?? /* @__PURE__ */ new Set();
|
|
2127
|
+
e.add(this), lt.set(t, e);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
share(t) {
|
|
2132
|
+
var e, n;
|
|
2133
|
+
if (!(this.syncId === null || (t == null ? void 0 : t.value) === ((e = this.sent) == null ? void 0 : e.value) && (t == null ? void 0 : t.axisId) === ((n = this.sent) == null ? void 0 : n.axisId))) {
|
|
2134
|
+
this.sent = t;
|
|
2135
|
+
for (const s of lt.get(this.syncId) ?? [])
|
|
2136
|
+
s !== this && (s.synced = t, s.markOverlayDirty());
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
/** The crosshair a synced position asks for, in this chart's pixels. */
|
|
2140
|
+
syncedPx() {
|
|
2141
|
+
const t = this.synced;
|
|
2142
|
+
if (t === null) return null;
|
|
2143
|
+
const e = this.findAxis("x", t.axisId) ?? this.layout.axes.find((n) => n.orientation === "x") ?? null;
|
|
2144
|
+
return e === null ? null : e.scale.toPx(t.value);
|
|
2145
|
+
}
|
|
2146
|
+
hasZoom() {
|
|
2147
|
+
for (const { config: t } of this.axes.values())
|
|
2148
|
+
if (t.orientation === "x" && t.onDomainChange !== void 0) return !0;
|
|
2149
|
+
return !1;
|
|
2150
|
+
}
|
|
2151
|
+
/** The x axes a gesture speaks to. */
|
|
2152
|
+
zoomAxes() {
|
|
2153
|
+
const t = [];
|
|
2154
|
+
for (const { config: e } of this.axesInOrder()) {
|
|
2155
|
+
if (e.orientation !== "x" || e.onDomainChange === void 0) continue;
|
|
2156
|
+
const n = this.findAxis("x", e.id);
|
|
2157
|
+
n !== null && t.push({ config: e, layout: n });
|
|
2158
|
+
}
|
|
2159
|
+
return t;
|
|
2160
|
+
}
|
|
2161
|
+
propose(t) {
|
|
2162
|
+
var e;
|
|
2163
|
+
for (const { config: n, layout: s } of this.zoomAxes()) {
|
|
2164
|
+
const o = t(this.proposed.get(n.id) ?? s.scale.domain, n.id);
|
|
2165
|
+
!(o[1] - o[0] > 0) || !Number.isFinite(o[1] - o[0]) || (this.proposed.set(n.id, o), (e = n.onDomainChange) == null || e.call(n, o));
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
/** Zoom by `factor` (below 1 is closer) around a pixel, which keeps its
|
|
2169
|
+
value. */
|
|
2170
|
+
zoomAt(t, e) {
|
|
2171
|
+
const n = this.layout.plot, s = n.width > 0 ? Math.min(1, Math.max(0, (t - n.x) / n.width)) : 0.5;
|
|
2172
|
+
this.propose(([o, r]) => {
|
|
2173
|
+
const a = o + s * (r - o), l = (r - o) * e;
|
|
2174
|
+
return [a - s * l, a - s * l + l];
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
/** Pan by a distance in pixels; positive moves the content right. */
|
|
2178
|
+
panBy(t) {
|
|
2179
|
+
const e = this.layout.plot.width;
|
|
2180
|
+
e <= 0 || t === 0 || this.propose(([n, s]) => {
|
|
2181
|
+
const o = -t / e * (s - n);
|
|
2182
|
+
return [n + o, s + o];
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
wheel(t) {
|
|
2186
|
+
if (!this.hasZoom()) return;
|
|
2187
|
+
const e = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? this.layout.plot.width : 1, n = t.deltaX * e, s = t.deltaY * e;
|
|
2188
|
+
t.ctrlKey || t.metaKey ? (t.preventDefault(), this.zoomAt(t.offsetX, Math.exp(s * (Math.abs(s) < 50 ? 0.01 : 15e-4)))) : (Math.abs(n) > Math.abs(s) || t.shiftKey) && (t.preventDefault(), this.panBy(-(t.shiftKey && n === 0 ? s : n)));
|
|
2189
|
+
}
|
|
2190
|
+
pointerDown(t) {
|
|
2191
|
+
var e, n;
|
|
2192
|
+
this.hasZoom() && (t.pointerType !== "touch" && t.button !== 0 || (this.pointers.set(t.pointerId, t.offsetX), (n = (e = this.container) == null ? void 0 : e.setPointerCapture) == null || n.call(e, t.pointerId), this.pointers.size === 2 && (this.pinch = this.pinchWidth())));
|
|
2193
|
+
}
|
|
2194
|
+
/** A drag pans, two fingers pinch. */
|
|
2195
|
+
drag(t) {
|
|
2196
|
+
const e = this.pointers.get(t.pointerId);
|
|
2197
|
+
if (e === void 0) return;
|
|
2198
|
+
if (this.pointers.set(t.pointerId, t.offsetX), this.pointers.size === 1) {
|
|
2199
|
+
this.panBy(t.offsetX - e);
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2202
|
+
const n = this.pinchWidth();
|
|
2203
|
+
if (this.pinch > 0 && n > 0) {
|
|
2204
|
+
const [s = 0, o = 0] = this.pointers.values();
|
|
2205
|
+
this.zoomAt((s + o) / 2, this.pinch / n);
|
|
2206
|
+
}
|
|
2207
|
+
this.pinch = n;
|
|
2208
|
+
}
|
|
2209
|
+
pointerUp(t) {
|
|
2210
|
+
this.pointers.delete(t.pointerId), this.pinch = this.pinchWidth();
|
|
2211
|
+
}
|
|
2212
|
+
pinchWidth() {
|
|
2213
|
+
const [t, e] = this.pointers.values();
|
|
2214
|
+
return t === void 0 || e === void 0 ? 0 : Math.abs(t - e);
|
|
2215
|
+
}
|
|
2216
|
+
/** The whole data range: the extent the axis has without a domain. */
|
|
2217
|
+
doubleClick() {
|
|
2218
|
+
this.propose((t, e) => {
|
|
2219
|
+
const [n, s] = this.axisExtent("x", e);
|
|
2220
|
+
return [n, s];
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
/** An x value in the format of its x axis - the header's, or a point's own. */
|
|
2224
|
+
xLabel(t, e, n = !1) {
|
|
2225
|
+
const s = this.findAxis("x", t);
|
|
2226
|
+
return s === null ? String(e) : s.format(e, n);
|
|
2227
|
+
}
|
|
2228
|
+
/** What the built-in tooltip writes for one hit. A state has a name and no
|
|
2229
|
+
meaningful number; a cell has a number that is not its y position, and so
|
|
2230
|
+
no y axis' format; every other value is read against its y axis and
|
|
2231
|
+
written in its format. A series' own `format` comes before either. */
|
|
2232
|
+
tooltipRow(t, e) {
|
|
2233
|
+
var a, l;
|
|
2234
|
+
const n = t.entry.config, s = (a = t.segment) == null ? void 0 : a.label;
|
|
2235
|
+
let o;
|
|
2236
|
+
if (s !== void 0 && s !== "") o = s;
|
|
2237
|
+
else if (t.value !== void 0) o = (n.format ?? ee)(t.value);
|
|
2238
|
+
else {
|
|
2239
|
+
const u = n.format ?? ((l = this.findAxisConfig("y", n.yAxisId)) == null ? void 0 : l.tickFormat);
|
|
2240
|
+
o = u === void 0 ? ee(t.yValue) : u(t.yValue);
|
|
2241
|
+
}
|
|
2242
|
+
const r = n.xAxisId === e ? "" : this.xLabel(n.xAxisId, t.xValue);
|
|
2243
|
+
return { value: o, x: r };
|
|
1847
2244
|
}
|
|
1848
2245
|
/** The hit of one series - one different question per kind.
|
|
1849
2246
|
|
|
1850
|
-
Every mark that is a point asks "which point lies nearest". A band
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
hitIn(t, e,
|
|
1855
|
-
const
|
|
1856
|
-
if (
|
|
1857
|
-
const
|
|
1858
|
-
if (o <
|
|
1859
|
-
const
|
|
1860
|
-
if (
|
|
1861
|
-
const y = e.y[
|
|
2247
|
+
Every mark that is a point asks "which point lies nearest". A band and a
|
|
2248
|
+
cell ask "what lies under the pointer", and that is not the same question:
|
|
2249
|
+
for the right half of every segment the nearest point gives the wrong
|
|
2250
|
+
answer. */
|
|
2251
|
+
hitIn(t, e, n, s, o, r, a, l) {
|
|
2252
|
+
const u = t.config, d = e.length;
|
|
2253
|
+
if (u.kind === "state") {
|
|
2254
|
+
const c = this.lanePx(u, s);
|
|
2255
|
+
if (o < c.top || o > c.bottom) return null;
|
|
2256
|
+
const p = he(e.x, d, r);
|
|
2257
|
+
if (p < 0) return null;
|
|
2258
|
+
const y = e.y[p];
|
|
1862
2259
|
if (Number.isNaN(y)) return null;
|
|
1863
|
-
const
|
|
2260
|
+
const g = e.x[p], b = Fe(e.x, d, p, this.lastEnd(t, e, n));
|
|
2261
|
+
if (p === d - 1 && !(r < b)) return null;
|
|
2262
|
+
const N = u.states[y | 0];
|
|
1864
2263
|
return {
|
|
1865
|
-
index:
|
|
1866
|
-
px:
|
|
1867
|
-
py: (
|
|
1868
|
-
xValue:
|
|
2264
|
+
index: p,
|
|
2265
|
+
px: n.scale.toPx(g),
|
|
2266
|
+
py: (c.top + c.bottom) / 2,
|
|
2267
|
+
xValue: g,
|
|
1869
2268
|
yValue: y,
|
|
1870
2269
|
marked: !1,
|
|
1871
2270
|
areal: !0,
|
|
1872
|
-
color:
|
|
1873
|
-
segment: { from:
|
|
2271
|
+
color: N == null ? void 0 : N.color,
|
|
2272
|
+
segment: { from: g, to: b, label: (N == null ? void 0 : N.label) ?? "" }
|
|
1874
2273
|
};
|
|
1875
2274
|
}
|
|
1876
|
-
if (
|
|
1877
|
-
const
|
|
1878
|
-
if (d === null) return null;
|
|
1879
|
-
const m = i.scale.domain[1], y = l.height ?? 0.6, f = Ke(
|
|
2275
|
+
if (u.kind === "matrix") {
|
|
2276
|
+
const c = Cn(
|
|
1880
2277
|
e.x,
|
|
1881
|
-
d,
|
|
1882
2278
|
e.y,
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
a,
|
|
1886
|
-
y,
|
|
1887
|
-
m,
|
|
1888
|
-
t.depth,
|
|
1889
|
-
// The drawing moves a covering span down the screen; in lane units that
|
|
1890
|
-
// way carries the sign of the y scale's slope.
|
|
1891
|
-
ce * y * Math.sign(r.scale.m)
|
|
1892
|
-
);
|
|
1893
|
-
if (f < 0) return null;
|
|
1894
|
-
const b = e.x[f], k = e.y[f], w = d[f];
|
|
1895
|
-
return {
|
|
1896
|
-
index: f,
|
|
1897
|
-
px: i.scale.toPx(b),
|
|
1898
|
-
py: r.scale.toPx(k),
|
|
1899
|
-
xValue: b,
|
|
1900
|
-
yValue: k,
|
|
1901
|
-
marked: !1,
|
|
1902
|
-
areal: !0,
|
|
1903
|
-
segment: {
|
|
1904
|
-
from: b,
|
|
1905
|
-
to: ot(w, m),
|
|
1906
|
-
label: "",
|
|
1907
|
-
open: ue(w)
|
|
1908
|
-
}
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
if (l.kind === "matrix") {
|
|
1912
|
-
const d = sn(
|
|
1913
|
-
e.x,
|
|
1914
|
-
e.y,
|
|
1915
|
-
c,
|
|
1916
|
-
s,
|
|
2279
|
+
d,
|
|
2280
|
+
r,
|
|
1917
2281
|
a,
|
|
1918
|
-
|
|
1919
|
-
|
|
2282
|
+
yt(t.step ?? 0, n.scale.domain[1] - n.scale.domain[0]),
|
|
2283
|
+
yt(t.cellHeight ?? 0, s.scale.domain[1] - s.scale.domain[0])
|
|
1920
2284
|
);
|
|
1921
|
-
if (
|
|
1922
|
-
const
|
|
2285
|
+
if (c < 0) return null;
|
|
2286
|
+
const p = e.w, y = p === null ? Number.NaN : p[c];
|
|
1923
2287
|
if (!Number.isFinite(y)) return null;
|
|
1924
|
-
const
|
|
1925
|
-
return {
|
|
1926
|
-
index:
|
|
1927
|
-
px:
|
|
1928
|
-
py:
|
|
1929
|
-
|
|
2288
|
+
const g = e.x[c], b = e.y[c], N = Ot(u.coloring, this.theme ?? O);
|
|
2289
|
+
return t.buckets ?? (t.buckets = xe(e, u.coloring, N.length)), {
|
|
2290
|
+
index: c,
|
|
2291
|
+
px: n.scale.toPx(g),
|
|
2292
|
+
py: s.scale.toPx(b),
|
|
2293
|
+
color: N[t.buckets[c]],
|
|
2294
|
+
xValue: g,
|
|
1930
2295
|
// yValue stays the position on the y axis; the value that carries the
|
|
1931
2296
|
// colour stands in a field of its own. Colour alone can transport no
|
|
1932
2297
|
// number - which is why the tooltip has to carry it.
|
|
@@ -1936,16 +2301,16 @@ class he {
|
|
|
1936
2301
|
areal: !0
|
|
1937
2302
|
};
|
|
1938
2303
|
}
|
|
1939
|
-
const
|
|
1940
|
-
if (
|
|
1941
|
-
const h = e.y[
|
|
2304
|
+
const f = u.kind === "scatter" && l === "nearest" ? En(e.x, e.y, d, r, a, n.scale, s.scale) : u.kind === "line" && u.step === !0 ? he(e.x, d, r) : De(e.x, d, r);
|
|
2305
|
+
if (f < 0) return null;
|
|
2306
|
+
const h = e.y[f];
|
|
1942
2307
|
if (Number.isNaN(h)) return null;
|
|
1943
|
-
const
|
|
2308
|
+
const m = e.x[f];
|
|
1944
2309
|
return {
|
|
1945
|
-
index:
|
|
1946
|
-
px:
|
|
1947
|
-
py:
|
|
1948
|
-
xValue:
|
|
2310
|
+
index: f,
|
|
2311
|
+
px: n.scale.toPx(m),
|
|
2312
|
+
py: s.scale.toPx(h),
|
|
2313
|
+
xValue: m,
|
|
1949
2314
|
yValue: h,
|
|
1950
2315
|
marked: !0,
|
|
1951
2316
|
areal: !1
|
|
@@ -1961,20 +2326,34 @@ class he {
|
|
|
1961
2326
|
t.style.opacity = "0";
|
|
1962
2327
|
return;
|
|
1963
2328
|
}
|
|
1964
|
-
const
|
|
2329
|
+
const n = t.offsetWidth, s = t.offsetHeight;
|
|
1965
2330
|
let o = e.hit.xPx + 12;
|
|
1966
|
-
o +
|
|
1967
|
-
let
|
|
1968
|
-
|
|
2331
|
+
o + n > this.cssWidth && (o = e.hit.xPx - 12 - n), o < 0 && (o = 0);
|
|
2332
|
+
let r = e.mouseY - s / 2;
|
|
2333
|
+
r = Math.min(Math.max(r, 0), Math.max(0, this.cssHeight - s)), t.style.transform = `translate3d(${Math.round(o)}px, ${Math.round(r)}px, 0)`, t.style.opacity = "1";
|
|
1969
2334
|
}
|
|
1970
2335
|
/* ================= Snapshots for the HTML layer ================= */
|
|
2336
|
+
/** Does a visible series have a point to show - a y that is no gap, and for
|
|
2337
|
+
a cell a value? A chart without one says so rather than draw an empty
|
|
2338
|
+
frame on [0, 1]. Stops at the first point found. */
|
|
2339
|
+
showsAPoint() {
|
|
2340
|
+
for (const t of this.series.values()) {
|
|
2341
|
+
const e = t.materialized;
|
|
2342
|
+
if (!(e === null || t.config.hidden === !0)) {
|
|
2343
|
+
for (let n = 0; n < e.length; n++)
|
|
2344
|
+
if (!Number.isNaN(e.y[n]) && (e.w === null || Number.isFinite(e.w[n]))) return !0;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
return !1;
|
|
2348
|
+
}
|
|
1971
2349
|
pushLayoutSnapshot() {
|
|
1972
2350
|
this.layoutSnapshot = {
|
|
1973
2351
|
version: this.layoutSnapshot.version + 1,
|
|
1974
2352
|
layout: this.layout,
|
|
1975
2353
|
legend: this.legend,
|
|
1976
2354
|
series: this.legendItems(),
|
|
1977
|
-
limits: this.limitLabels()
|
|
2355
|
+
limits: this.limitLabels(),
|
|
2356
|
+
empty: !this.showsAPoint()
|
|
1978
2357
|
};
|
|
1979
2358
|
for (const t of this.layoutSubscribers) t();
|
|
1980
2359
|
}
|
|
@@ -1983,121 +2362,122 @@ class he {
|
|
|
1983
2362
|
version: this.hoverSnapshot.version + 1,
|
|
1984
2363
|
hover: this.hover,
|
|
1985
2364
|
tooltip: this.tooltip,
|
|
1986
|
-
xLabel: this.hoverXLabel
|
|
2365
|
+
xLabel: this.hoverXLabel,
|
|
2366
|
+
rows: this.hoverRows
|
|
1987
2367
|
};
|
|
1988
2368
|
for (const t of this.hoverSubscribers) t();
|
|
1989
2369
|
}
|
|
1990
2370
|
}
|
|
1991
2371
|
/** Class name of the measuring span for tick labels - keeps the CSS and the
|
|
1992
2372
|
layout in step. */
|
|
1993
|
-
|
|
1994
|
-
const
|
|
1995
|
-
function
|
|
1996
|
-
const t =
|
|
1997
|
-
if (t === null &&
|
|
2373
|
+
x(Ee, "classTick", it);
|
|
2374
|
+
const Pe = _e(null);
|
|
2375
|
+
function rt(i) {
|
|
2376
|
+
const t = Ye(Pe);
|
|
2377
|
+
if (t === null && ht)
|
|
1998
2378
|
throw new Error(
|
|
1999
|
-
`@umriss-ui/charts: <${
|
|
2379
|
+
`@umriss-ui/charts: <${i}> must be used inside a <Chart>.`
|
|
2000
2380
|
);
|
|
2001
2381
|
return t;
|
|
2002
2382
|
}
|
|
2003
|
-
function
|
|
2004
|
-
const e =
|
|
2005
|
-
|
|
2383
|
+
function at(i, t) {
|
|
2384
|
+
const e = rt(i), n = Q(null);
|
|
2385
|
+
C(() => {
|
|
2006
2386
|
if (e !== null)
|
|
2007
|
-
return
|
|
2008
|
-
|
|
2387
|
+
return n.current = e.registerSeries(t), () => {
|
|
2388
|
+
n.current !== null && e.unregisterSeries(n.current), n.current = null;
|
|
2009
2389
|
};
|
|
2010
|
-
}, [e]),
|
|
2011
|
-
e !== null &&
|
|
2390
|
+
}, [e]), C(() => {
|
|
2391
|
+
e !== null && n.current !== null && e.updateSeries(n.current, t);
|
|
2012
2392
|
});
|
|
2013
2393
|
}
|
|
2014
|
-
function
|
|
2015
|
-
const e =
|
|
2016
|
-
|
|
2394
|
+
function Ce(i, t) {
|
|
2395
|
+
const e = rt(i), n = Q(null);
|
|
2396
|
+
C(() => {
|
|
2017
2397
|
if (e !== null)
|
|
2018
|
-
return
|
|
2019
|
-
|
|
2398
|
+
return n.current = e.registerAxis(t), () => {
|
|
2399
|
+
n.current !== null && e.unregisterAxis(n.current), n.current = null;
|
|
2020
2400
|
};
|
|
2021
|
-
}, [e]),
|
|
2022
|
-
e !== null &&
|
|
2401
|
+
}, [e]), C(() => {
|
|
2402
|
+
e !== null && n.current !== null && e.updateAxis(n.current, t);
|
|
2023
2403
|
});
|
|
2024
2404
|
}
|
|
2025
|
-
function
|
|
2026
|
-
const e =
|
|
2027
|
-
|
|
2405
|
+
function $e(i, t) {
|
|
2406
|
+
const e = rt(i), n = Q(null);
|
|
2407
|
+
C(() => {
|
|
2028
2408
|
if (e !== null)
|
|
2029
|
-
return
|
|
2030
|
-
|
|
2409
|
+
return n.current = e.registerLimit(t), () => {
|
|
2410
|
+
n.current !== null && e.unregisterLimit(n.current), n.current = null;
|
|
2031
2411
|
};
|
|
2032
|
-
}, [e]),
|
|
2033
|
-
e !== null &&
|
|
2412
|
+
}, [e]), C(() => {
|
|
2413
|
+
e !== null && n.current !== null && e.updateLimit(n.current, t);
|
|
2034
2414
|
});
|
|
2035
2415
|
}
|
|
2036
|
-
function
|
|
2037
|
-
const e =
|
|
2038
|
-
|
|
2416
|
+
function ni(i, t) {
|
|
2417
|
+
const e = rt(i);
|
|
2418
|
+
C(() => {
|
|
2039
2419
|
if (e !== null)
|
|
2040
2420
|
return e.registerLegend(t), () => e.unregisterLegend();
|
|
2041
|
-
}, [e]),
|
|
2421
|
+
}, [e]), C(() => {
|
|
2042
2422
|
e == null || e.updateLegend(t);
|
|
2043
2423
|
});
|
|
2044
2424
|
}
|
|
2045
|
-
function
|
|
2046
|
-
const e =
|
|
2047
|
-
|
|
2425
|
+
function ii(i, t) {
|
|
2426
|
+
const e = rt(i);
|
|
2427
|
+
C(() => {
|
|
2048
2428
|
if (e !== null)
|
|
2049
2429
|
return e.registerTooltip(t), () => e.unregisterTooltip();
|
|
2050
|
-
}, [e]),
|
|
2430
|
+
}, [e]), C(() => {
|
|
2051
2431
|
e == null || e.updateTooltip(t);
|
|
2052
2432
|
});
|
|
2053
2433
|
}
|
|
2054
|
-
function
|
|
2055
|
-
const { band: e, position:
|
|
2434
|
+
function si(i, t) {
|
|
2435
|
+
const { band: e, position: n, orientation: s } = i, o = {
|
|
2056
2436
|
left: `${e.x}px`,
|
|
2057
2437
|
top: `${e.y}px`,
|
|
2058
2438
|
width: `${e.width}px`,
|
|
2059
2439
|
height: `${e.height}px`
|
|
2060
|
-
},
|
|
2061
|
-
return /* @__PURE__ */
|
|
2440
|
+
}, r = zt + Bt;
|
|
2441
|
+
return /* @__PURE__ */ G(
|
|
2062
2442
|
"div",
|
|
2063
2443
|
{
|
|
2064
|
-
className: `uc-axis uc-axis-${
|
|
2444
|
+
className: `uc-axis uc-axis-${s} uc-axis-${n}`,
|
|
2065
2445
|
style: o,
|
|
2066
|
-
"data-axis":
|
|
2446
|
+
"data-axis": i.id,
|
|
2067
2447
|
children: [
|
|
2068
|
-
/* @__PURE__ */
|
|
2069
|
-
|
|
2070
|
-
if (
|
|
2071
|
-
const
|
|
2072
|
-
return /* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ I("span", { className: "uc-axis-line" }),
|
|
2449
|
+
i.ticks.map((a) => {
|
|
2450
|
+
if (s === "y") {
|
|
2451
|
+
const u = Math.round(a.px - e.y);
|
|
2452
|
+
return /* @__PURE__ */ G("span", { className: "uc-tick", style: { top: `${u}px` }, children: [
|
|
2453
|
+
/* @__PURE__ */ I("span", { className: "uc-tick-mark" }),
|
|
2454
|
+
/* @__PURE__ */ I(
|
|
2075
2455
|
"span",
|
|
2076
2456
|
{
|
|
2077
2457
|
className: "uc-tick-label",
|
|
2078
|
-
style: { [
|
|
2458
|
+
style: { [n === "left" ? "right" : "left"]: `${r}px` },
|
|
2079
2459
|
children: a.label
|
|
2080
2460
|
}
|
|
2081
2461
|
)
|
|
2082
2462
|
] }, a.value);
|
|
2083
2463
|
}
|
|
2084
2464
|
const l = Math.round(a.px - e.x);
|
|
2085
|
-
return /* @__PURE__ */
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2465
|
+
return /* @__PURE__ */ G("span", { className: "uc-tick", style: { left: `${l}px` }, children: [
|
|
2466
|
+
/* @__PURE__ */ I("span", { className: "uc-tick-mark" }),
|
|
2467
|
+
/* @__PURE__ */ I(
|
|
2088
2468
|
"span",
|
|
2089
2469
|
{
|
|
2090
2470
|
className: "uc-tick-label",
|
|
2091
2471
|
style: {
|
|
2092
2472
|
left: `${Math.round(a.labelLeft - e.x) - l}px`,
|
|
2093
|
-
[
|
|
2473
|
+
[n === "top" ? "bottom" : "top"]: `${r}px`
|
|
2094
2474
|
},
|
|
2095
2475
|
children: a.label
|
|
2096
2476
|
}
|
|
2097
2477
|
)
|
|
2098
2478
|
] }, a.value);
|
|
2099
2479
|
}),
|
|
2100
|
-
|
|
2480
|
+
i.breaks.map((a, l) => /* @__PURE__ */ I(
|
|
2101
2481
|
"span",
|
|
2102
2482
|
{
|
|
2103
2483
|
className: "uc-break",
|
|
@@ -2107,7 +2487,7 @@ function An(n, t) {
|
|
|
2107
2487
|
`break-${l}`
|
|
2108
2488
|
)),
|
|
2109
2489
|
t.map(
|
|
2110
|
-
(a) =>
|
|
2490
|
+
(a) => s === "y" ? /* @__PURE__ */ I(
|
|
2111
2491
|
"span",
|
|
2112
2492
|
{
|
|
2113
2493
|
className: "uc-limit-label",
|
|
@@ -2117,297 +2497,345 @@ function An(n, t) {
|
|
|
2117
2497
|
children: a.label
|
|
2118
2498
|
},
|
|
2119
2499
|
`limit-${a.id}`
|
|
2120
|
-
) : /* @__PURE__ */
|
|
2500
|
+
) : /* @__PURE__ */ I(
|
|
2121
2501
|
"span",
|
|
2122
2502
|
{
|
|
2123
2503
|
className: "uc-limit-label",
|
|
2124
2504
|
"data-severity": a.severity,
|
|
2125
2505
|
"data-role": a.role,
|
|
2126
2506
|
style: {
|
|
2127
|
-
left: `${Math.round(a.
|
|
2128
|
-
[
|
|
2507
|
+
left: `${Math.round(a.labelLeft - e.x)}px`,
|
|
2508
|
+
[n === "top" ? "bottom" : "top"]: `${r}px`
|
|
2129
2509
|
},
|
|
2130
2510
|
children: a.label
|
|
2131
2511
|
},
|
|
2132
2512
|
`limit-${a.id}`
|
|
2133
2513
|
)
|
|
2134
2514
|
),
|
|
2135
|
-
|
|
2515
|
+
i.label !== void 0 && i.label !== "" && /* @__PURE__ */ I("span", { className: "uc-axis-title", children: i.label })
|
|
2136
2516
|
]
|
|
2137
2517
|
},
|
|
2138
|
-
|
|
2518
|
+
i.key
|
|
2139
2519
|
);
|
|
2140
2520
|
}
|
|
2141
|
-
function
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
), { layout:
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2521
|
+
function oi({ scene: i, empty: t }) {
|
|
2522
|
+
const e = Kt(
|
|
2523
|
+
i.subscribeLayout,
|
|
2524
|
+
i.getLayoutSnapshot,
|
|
2525
|
+
i.getLayoutServerSnapshot
|
|
2526
|
+
), { layout: n } = e;
|
|
2527
|
+
if (n.plot.width <= 0 || n.plot.height <= 0) return null;
|
|
2528
|
+
const { plot: s } = n;
|
|
2529
|
+
return /* @__PURE__ */ G("div", { className: "uc-axes", children: [
|
|
2530
|
+
e.empty && /* @__PURE__ */ I(
|
|
2531
|
+
"div",
|
|
2532
|
+
{
|
|
2533
|
+
className: "uc-empty",
|
|
2534
|
+
style: { left: `${s.x}px`, top: `${s.y}px`, width: `${s.width}px`, height: `${s.height}px` },
|
|
2535
|
+
children: t
|
|
2536
|
+
}
|
|
2537
|
+
),
|
|
2538
|
+
n.axes.map(
|
|
2539
|
+
(o) => si(
|
|
2540
|
+
o,
|
|
2541
|
+
e.limits.filter((r) => r.axisKey === o.key)
|
|
2542
|
+
)
|
|
2151
2543
|
)
|
|
2152
|
-
|
|
2544
|
+
] });
|
|
2153
2545
|
}
|
|
2154
|
-
function
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
n.getHoverSnapshot,
|
|
2163
|
-
n.getHoverServerSnapshot
|
|
2164
|
-
), e = Ne(
|
|
2165
|
-
(r) => {
|
|
2166
|
-
n.bindTooltip(r);
|
|
2546
|
+
function ri({ scene: i }) {
|
|
2547
|
+
const t = Kt(
|
|
2548
|
+
i.subscribeHover,
|
|
2549
|
+
i.getHoverSnapshot,
|
|
2550
|
+
i.getHoverServerSnapshot
|
|
2551
|
+
), e = ze(
|
|
2552
|
+
(s) => {
|
|
2553
|
+
i.bindTooltip(s);
|
|
2167
2554
|
},
|
|
2168
|
-
[
|
|
2555
|
+
[i]
|
|
2169
2556
|
);
|
|
2170
|
-
if (
|
|
2171
|
-
|
|
2172
|
-
}, [
|
|
2173
|
-
const
|
|
2174
|
-
return /* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
|
|
2180
|
-
|
|
2557
|
+
if (C(() => {
|
|
2558
|
+
i.markOverlayDirty();
|
|
2559
|
+
}, [i, t.version]), t.tooltip === null) return null;
|
|
2560
|
+
const n = t.hover;
|
|
2561
|
+
return /* @__PURE__ */ I("div", { className: "uc-tooltip", ref: e, role: "presentation", children: n === null ? null : t.tooltip.render !== void 0 ? t.tooltip.render(n.hit) : /* @__PURE__ */ G(bt, { children: [
|
|
2562
|
+
/* @__PURE__ */ I("div", { className: "uc-tooltip-head", children: t.xLabel }),
|
|
2563
|
+
/* @__PURE__ */ I("div", { className: "uc-tooltip-list", children: n.hit.points.map((s, o) => {
|
|
2564
|
+
const r = t.rows[o];
|
|
2565
|
+
return /* @__PURE__ */ G("div", { className: "uc-tooltip-row", children: [
|
|
2566
|
+
/* @__PURE__ */ I("span", { className: "uc-tooltip-chip", style: { background: s.color } }),
|
|
2567
|
+
/* @__PURE__ */ G("span", { className: "uc-tooltip-name", children: [
|
|
2568
|
+
s.seriesName,
|
|
2569
|
+
r !== void 0 && r.x !== "" ? /* @__PURE__ */ I("span", { className: "uc-tooltip-x", children: r.x }) : null
|
|
2570
|
+
] }),
|
|
2571
|
+
/* @__PURE__ */ I("span", { className: "uc-tooltip-value", children: r == null ? void 0 : r.value })
|
|
2572
|
+
] }, `${s.seriesName}-${s.index}`);
|
|
2573
|
+
}) })
|
|
2181
2574
|
] }) });
|
|
2182
2575
|
}
|
|
2183
|
-
function
|
|
2576
|
+
function Di(i) {
|
|
2184
2577
|
const {
|
|
2185
2578
|
data: t,
|
|
2186
2579
|
width: e = "100%",
|
|
2187
|
-
height:
|
|
2188
|
-
padding:
|
|
2580
|
+
height: n = 300,
|
|
2581
|
+
padding: s = 8,
|
|
2189
2582
|
ariaLabel: o,
|
|
2190
|
-
className:
|
|
2583
|
+
className: r,
|
|
2191
2584
|
style: a,
|
|
2192
2585
|
onPerf: l,
|
|
2193
|
-
|
|
2194
|
-
|
|
2586
|
+
syncId: u,
|
|
2587
|
+
empty: d = "No data",
|
|
2588
|
+
children: f
|
|
2589
|
+
} = i, [h] = be(() => new Ee()), m = Q(null), c = Q(null), p = Q(null), y = Q(null), g = typeof s == "number" ? void 0 : s, b = typeof s == "number" ? s : void 0, N = b ?? (g == null ? void 0 : g.top), A = b ?? (g == null ? void 0 : g.right), $ = b ?? (g == null ? void 0 : g.bottom), w = b ?? (g == null ? void 0 : g.left), W = P(
|
|
2195
2590
|
() => ({
|
|
2196
|
-
top:
|
|
2197
|
-
right:
|
|
2198
|
-
bottom:
|
|
2199
|
-
left:
|
|
2591
|
+
top: N ?? 8,
|
|
2592
|
+
right: A ?? 8,
|
|
2593
|
+
bottom: $ ?? 8,
|
|
2594
|
+
left: w ?? 8
|
|
2200
2595
|
}),
|
|
2201
|
-
[
|
|
2596
|
+
[N, A, $, w]
|
|
2202
2597
|
);
|
|
2203
|
-
o === void 0 &&
|
|
2598
|
+
o === void 0 && J(
|
|
2204
2599
|
"chart-arialabel",
|
|
2205
2600
|
"Chart without ariaLabel - please set a meaningful description (R-7.6)."
|
|
2206
|
-
),
|
|
2207
|
-
const
|
|
2208
|
-
if (!
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2212
|
-
const
|
|
2213
|
-
var
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2216
|
-
const
|
|
2217
|
-
|
|
2601
|
+
), C(() => {
|
|
2602
|
+
const T = m.current, H = c.current, k = p.current, D = y.current;
|
|
2603
|
+
if (!T || !H || !k || !D) return;
|
|
2604
|
+
h.bind(H, k, D, T);
|
|
2605
|
+
const v = H.getBoundingClientRect();
|
|
2606
|
+
h.requestResize(v.width, v.height);
|
|
2607
|
+
const F = new ResizeObserver((E) => {
|
|
2608
|
+
var U;
|
|
2609
|
+
const z = E[E.length - 1];
|
|
2610
|
+
if (z === void 0) return;
|
|
2611
|
+
const B = (U = z.contentBoxSize) == null ? void 0 : U[0];
|
|
2612
|
+
B !== void 0 ? h.requestResize(B.inlineSize, B.blockSize) : h.requestResize(z.contentRect.width, z.contentRect.height);
|
|
2218
2613
|
});
|
|
2219
|
-
|
|
2220
|
-
const
|
|
2221
|
-
window.addEventListener("blur",
|
|
2222
|
-
const
|
|
2223
|
-
H.contains(
|
|
2614
|
+
F.observe(H);
|
|
2615
|
+
const R = () => h.pointerLeave();
|
|
2616
|
+
window.addEventListener("blur", R);
|
|
2617
|
+
const M = (E) => {
|
|
2618
|
+
H.contains(E.target) || h.pointerLeave();
|
|
2224
2619
|
};
|
|
2225
|
-
|
|
2226
|
-
|
|
2620
|
+
document.addEventListener("pointerdown", M);
|
|
2621
|
+
const V = (E) => h.wheel(E);
|
|
2622
|
+
return H.addEventListener("wheel", V, { passive: !1 }), () => {
|
|
2623
|
+
H.removeEventListener("wheel", V), window.removeEventListener("blur", R), document.removeEventListener("pointerdown", M), F.disconnect(), h.unbind();
|
|
2227
2624
|
};
|
|
2228
|
-
}, [
|
|
2229
|
-
|
|
2230
|
-
}, [
|
|
2231
|
-
|
|
2232
|
-
}, [
|
|
2233
|
-
|
|
2234
|
-
}, [
|
|
2235
|
-
|
|
2625
|
+
}, [h]), C(() => {
|
|
2626
|
+
h.setData(t);
|
|
2627
|
+
}, [h, t]), C(() => {
|
|
2628
|
+
h.setPadding(W);
|
|
2629
|
+
}, [h, W]), C(() => {
|
|
2630
|
+
h.setOnPerf(l ?? null);
|
|
2631
|
+
}, [h, l]), C(() => (h.setSyncId(u ?? null), () => h.setSyncId(null)), [h, u]), C(() => {
|
|
2632
|
+
h.validate();
|
|
2236
2633
|
});
|
|
2237
|
-
const
|
|
2634
|
+
const L = {
|
|
2238
2635
|
width: e === "100%" ? "100%" : `${e}px`,
|
|
2239
|
-
height: `${
|
|
2636
|
+
height: `${n}px`,
|
|
2240
2637
|
...a
|
|
2241
|
-
},
|
|
2242
|
-
|
|
2638
|
+
}, S = (T) => {
|
|
2639
|
+
h.drag(T.nativeEvent), h.pointerMove(T.nativeEvent.offsetX, T.nativeEvent.offsetY);
|
|
2243
2640
|
};
|
|
2244
|
-
return /* @__PURE__ */
|
|
2641
|
+
return /* @__PURE__ */ I(Pe.Provider, { value: h, children: /* @__PURE__ */ G(
|
|
2245
2642
|
"div",
|
|
2246
2643
|
{
|
|
2247
|
-
ref:
|
|
2248
|
-
className:
|
|
2249
|
-
style:
|
|
2644
|
+
ref: m,
|
|
2645
|
+
className: r ? `uc-root ${r}` : "uc-root",
|
|
2646
|
+
style: L,
|
|
2250
2647
|
children: [
|
|
2251
|
-
/* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ G(
|
|
2252
2649
|
"div",
|
|
2253
2650
|
{
|
|
2254
|
-
ref:
|
|
2651
|
+
ref: c,
|
|
2255
2652
|
className: "uc-plot",
|
|
2256
2653
|
role: "img",
|
|
2257
2654
|
"aria-label": o,
|
|
2258
|
-
onPointerMove:
|
|
2259
|
-
onPointerDown:
|
|
2260
|
-
|
|
2261
|
-
|
|
2655
|
+
onPointerMove: S,
|
|
2656
|
+
onPointerDown: (T) => {
|
|
2657
|
+
h.pointerDown(T.nativeEvent), S(T);
|
|
2658
|
+
},
|
|
2659
|
+
onPointerUp: (T) => h.pointerUp(T.nativeEvent),
|
|
2660
|
+
onPointerCancel: (T) => h.pointerUp(T.nativeEvent),
|
|
2661
|
+
onDoubleClick: () => h.doubleClick(),
|
|
2662
|
+
onPointerLeave: (T) => {
|
|
2663
|
+
T.pointerType !== "touch" && h.pointerLeave();
|
|
2262
2664
|
},
|
|
2263
2665
|
children: [
|
|
2264
|
-
/* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
/* @__PURE__ */
|
|
2267
|
-
/* @__PURE__ */
|
|
2666
|
+
/* @__PURE__ */ I("canvas", { ref: p, className: "uc-layer-series", "aria-hidden": "true" }),
|
|
2667
|
+
/* @__PURE__ */ I("canvas", { ref: y, className: "uc-layer-overlay", "aria-hidden": "true" }),
|
|
2668
|
+
/* @__PURE__ */ I(oi, { scene: h, empty: d }),
|
|
2669
|
+
/* @__PURE__ */ I(ri, { scene: h })
|
|
2268
2670
|
]
|
|
2269
2671
|
}
|
|
2270
2672
|
),
|
|
2271
|
-
|
|
2673
|
+
f
|
|
2272
2674
|
]
|
|
2273
2675
|
}
|
|
2274
2676
|
) });
|
|
2275
2677
|
}
|
|
2276
|
-
function
|
|
2678
|
+
function Ei(i) {
|
|
2277
2679
|
const {
|
|
2278
2680
|
accessor: t,
|
|
2279
2681
|
baseline: e,
|
|
2280
|
-
xAxisId:
|
|
2281
|
-
yAxisId:
|
|
2682
|
+
xAxisId: n = "x",
|
|
2683
|
+
yAxisId: s = "y",
|
|
2282
2684
|
data: o,
|
|
2283
|
-
name:
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2685
|
+
name: r,
|
|
2686
|
+
hidden: a,
|
|
2687
|
+
format: l,
|
|
2688
|
+
color: u,
|
|
2689
|
+
tone: d,
|
|
2690
|
+
fillOpacity: f = 0.18,
|
|
2691
|
+
strokeWidth: h = 1.5,
|
|
2692
|
+
dash: m
|
|
2693
|
+
} = i, c = P(
|
|
2288
2694
|
() => ({
|
|
2289
2695
|
kind: "area",
|
|
2290
2696
|
accessor: t,
|
|
2291
2697
|
baseline: e,
|
|
2292
|
-
xAxisId:
|
|
2293
|
-
yAxisId:
|
|
2698
|
+
xAxisId: n,
|
|
2699
|
+
yAxisId: s,
|
|
2294
2700
|
data: o,
|
|
2295
|
-
name:
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2701
|
+
name: r,
|
|
2702
|
+
hidden: a,
|
|
2703
|
+
format: l,
|
|
2704
|
+
color: u,
|
|
2705
|
+
tone: d,
|
|
2706
|
+
fillOpacity: f,
|
|
2707
|
+
strokeWidth: h,
|
|
2708
|
+
dash: m
|
|
2299
2709
|
}),
|
|
2300
|
-
[t, e,
|
|
2710
|
+
[t, e, n, s, o, r, a, l, u, d, f, h, m]
|
|
2301
2711
|
);
|
|
2302
|
-
return
|
|
2712
|
+
return at("Area", c), null;
|
|
2303
2713
|
}
|
|
2304
|
-
function
|
|
2714
|
+
function Pi(i) {
|
|
2305
2715
|
const {
|
|
2306
2716
|
accessor: t,
|
|
2307
2717
|
xAxisId: e = "x",
|
|
2308
|
-
yAxisId:
|
|
2309
|
-
data:
|
|
2718
|
+
yAxisId: n = "y",
|
|
2719
|
+
data: s,
|
|
2310
2720
|
name: o,
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2721
|
+
hidden: r,
|
|
2722
|
+
format: a,
|
|
2723
|
+
color: l,
|
|
2724
|
+
tone: u,
|
|
2725
|
+
barWidth: d = 0.8
|
|
2726
|
+
} = i, f = P(
|
|
2314
2727
|
() => ({
|
|
2315
2728
|
kind: "bar",
|
|
2316
2729
|
accessor: t,
|
|
2317
2730
|
xAxisId: e,
|
|
2318
|
-
yAxisId:
|
|
2319
|
-
data:
|
|
2731
|
+
yAxisId: n,
|
|
2732
|
+
data: s,
|
|
2320
2733
|
name: o,
|
|
2321
|
-
|
|
2322
|
-
|
|
2734
|
+
hidden: r,
|
|
2735
|
+
format: a,
|
|
2736
|
+
color: l,
|
|
2737
|
+
tone: u,
|
|
2738
|
+
barWidth: d
|
|
2323
2739
|
}),
|
|
2324
|
-
[t, e,
|
|
2740
|
+
[t, e, n, s, o, r, a, l, u, d]
|
|
2325
2741
|
);
|
|
2326
|
-
return
|
|
2742
|
+
return at("Bar", f), null;
|
|
2327
2743
|
}
|
|
2328
|
-
function
|
|
2744
|
+
function ai(i) {
|
|
2329
2745
|
const {
|
|
2330
2746
|
accessor: t,
|
|
2331
2747
|
xAxisId: e = "x",
|
|
2332
|
-
yAxisId:
|
|
2333
|
-
data:
|
|
2748
|
+
yAxisId: n = "y",
|
|
2749
|
+
data: s,
|
|
2334
2750
|
name: o,
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2751
|
+
hidden: r,
|
|
2752
|
+
format: a,
|
|
2753
|
+
color: l,
|
|
2754
|
+
tone: u,
|
|
2755
|
+
strokeWidth: d = 1.5,
|
|
2756
|
+
dash: f,
|
|
2757
|
+
markers: h = "auto",
|
|
2758
|
+
step: m
|
|
2759
|
+
} = i, c = P(
|
|
2341
2760
|
() => ({
|
|
2342
2761
|
kind: "line",
|
|
2343
2762
|
accessor: t,
|
|
2344
2763
|
xAxisId: e,
|
|
2345
|
-
yAxisId:
|
|
2346
|
-
data:
|
|
2764
|
+
yAxisId: n,
|
|
2765
|
+
data: s,
|
|
2347
2766
|
name: o,
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2767
|
+
hidden: r,
|
|
2768
|
+
format: a,
|
|
2769
|
+
color: l,
|
|
2770
|
+
tone: u,
|
|
2771
|
+
strokeWidth: d,
|
|
2772
|
+
dash: f,
|
|
2773
|
+
markers: h,
|
|
2774
|
+
step: m
|
|
2353
2775
|
}),
|
|
2354
|
-
[t, e,
|
|
2776
|
+
[t, e, n, s, o, r, a, l, u, d, f, h, m]
|
|
2355
2777
|
);
|
|
2356
|
-
return
|
|
2778
|
+
return at("Line", c), null;
|
|
2357
2779
|
}
|
|
2358
|
-
function
|
|
2780
|
+
function li(i) {
|
|
2359
2781
|
const {
|
|
2360
2782
|
accessor: t,
|
|
2361
2783
|
xAxisId: e = "x",
|
|
2362
|
-
yAxisId:
|
|
2363
|
-
data:
|
|
2784
|
+
yAxisId: n = "y",
|
|
2785
|
+
data: s,
|
|
2364
2786
|
name: o,
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2787
|
+
hidden: r,
|
|
2788
|
+
format: a,
|
|
2789
|
+
color: l,
|
|
2790
|
+
tone: u,
|
|
2791
|
+
radius: d = 3
|
|
2792
|
+
} = i, f = P(
|
|
2369
2793
|
() => ({
|
|
2370
2794
|
kind: "scatter",
|
|
2371
2795
|
accessor: t,
|
|
2372
2796
|
xAxisId: e,
|
|
2373
|
-
yAxisId:
|
|
2374
|
-
data:
|
|
2797
|
+
yAxisId: n,
|
|
2798
|
+
data: s,
|
|
2375
2799
|
name: o,
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2800
|
+
hidden: r,
|
|
2801
|
+
format: a,
|
|
2802
|
+
color: l,
|
|
2803
|
+
tone: u,
|
|
2804
|
+
radius: d
|
|
2379
2805
|
}),
|
|
2380
|
-
[t, e,
|
|
2806
|
+
[t, e, n, s, o, r, a, l, u, d]
|
|
2381
2807
|
);
|
|
2382
|
-
return
|
|
2808
|
+
return at("Scatter", f), null;
|
|
2383
2809
|
}
|
|
2384
|
-
function
|
|
2810
|
+
function Ci(i) {
|
|
2385
2811
|
const {
|
|
2386
2812
|
accessor: t,
|
|
2387
2813
|
states: e,
|
|
2388
|
-
xAxisId:
|
|
2389
|
-
yAxisId:
|
|
2814
|
+
xAxisId: n = "x",
|
|
2815
|
+
yAxisId: s = "y",
|
|
2390
2816
|
data: o,
|
|
2391
|
-
name:
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2817
|
+
name: r,
|
|
2818
|
+
hidden: a,
|
|
2819
|
+
laneFrom: l,
|
|
2820
|
+
laneTo: u
|
|
2821
|
+
} = i, d = P(
|
|
2395
2822
|
() => ({
|
|
2396
2823
|
kind: "state",
|
|
2397
2824
|
accessor: t,
|
|
2398
2825
|
states: e,
|
|
2399
|
-
xAxisId:
|
|
2400
|
-
yAxisId:
|
|
2826
|
+
xAxisId: n,
|
|
2827
|
+
yAxisId: s,
|
|
2401
2828
|
data: o,
|
|
2402
|
-
name:
|
|
2403
|
-
|
|
2404
|
-
|
|
2829
|
+
name: r,
|
|
2830
|
+
hidden: a,
|
|
2831
|
+
laneFrom: l,
|
|
2832
|
+
laneTo: u
|
|
2405
2833
|
}),
|
|
2406
|
-
[t, e,
|
|
2834
|
+
[t, e, n, s, o, r, a, l, u]
|
|
2407
2835
|
);
|
|
2408
|
-
return
|
|
2836
|
+
return at("StateBand", d), null;
|
|
2409
2837
|
}
|
|
2410
|
-
const
|
|
2838
|
+
const ci = [
|
|
2411
2839
|
"#eef2ff",
|
|
2412
2840
|
"#c7d2fe",
|
|
2413
2841
|
"#a5b4fc",
|
|
@@ -2416,167 +2844,145 @@ const Cn = [
|
|
|
2416
2844
|
"#4f46e5",
|
|
2417
2845
|
"#4338ca"
|
|
2418
2846
|
];
|
|
2419
|
-
function
|
|
2847
|
+
function $i(i) {
|
|
2420
2848
|
const {
|
|
2421
2849
|
accessor: t,
|
|
2422
2850
|
value: e,
|
|
2423
|
-
coloring:
|
|
2424
|
-
xAxisId:
|
|
2851
|
+
coloring: n,
|
|
2852
|
+
xAxisId: s = "x",
|
|
2425
2853
|
yAxisId: o = "y",
|
|
2426
|
-
data:
|
|
2427
|
-
name: a
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2854
|
+
data: r,
|
|
2855
|
+
name: a,
|
|
2856
|
+
hidden: l,
|
|
2857
|
+
format: u
|
|
2858
|
+
} = i, d = P(
|
|
2859
|
+
() => n ?? { kind: "gradient", stops: ci },
|
|
2860
|
+
[n]
|
|
2861
|
+
), f = P(
|
|
2432
2862
|
() => ({
|
|
2433
2863
|
kind: "matrix",
|
|
2434
2864
|
accessor: t,
|
|
2435
2865
|
value: e,
|
|
2436
|
-
coloring:
|
|
2437
|
-
xAxisId:
|
|
2866
|
+
coloring: d,
|
|
2867
|
+
xAxisId: s,
|
|
2438
2868
|
yAxisId: o,
|
|
2439
|
-
data:
|
|
2440
|
-
name: a
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
);
|
|
2444
|
-
return j("Matrix", c), null;
|
|
2445
|
-
}
|
|
2446
|
-
function oi(n) {
|
|
2447
|
-
const {
|
|
2448
|
-
accessor: t,
|
|
2449
|
-
to: e,
|
|
2450
|
-
xAxisId: i = "x",
|
|
2451
|
-
yAxisId: r = "y",
|
|
2452
|
-
data: o,
|
|
2453
|
-
name: s,
|
|
2454
|
-
color: a,
|
|
2455
|
-
height: l = 0.6
|
|
2456
|
-
} = n, c = E(
|
|
2457
|
-
() => ({
|
|
2458
|
-
kind: "span",
|
|
2459
|
-
accessor: t,
|
|
2460
|
-
to: e,
|
|
2461
|
-
xAxisId: i,
|
|
2462
|
-
yAxisId: r,
|
|
2463
|
-
data: o,
|
|
2464
|
-
name: s,
|
|
2465
|
-
color: a,
|
|
2466
|
-
height: l
|
|
2869
|
+
data: r,
|
|
2870
|
+
name: a,
|
|
2871
|
+
hidden: l,
|
|
2872
|
+
format: u
|
|
2467
2873
|
}),
|
|
2468
|
-
[t, e,
|
|
2874
|
+
[t, e, d, s, o, r, a, l, u]
|
|
2469
2875
|
);
|
|
2470
|
-
return
|
|
2876
|
+
return at("Matrix", f), null;
|
|
2471
2877
|
}
|
|
2472
|
-
function
|
|
2878
|
+
function ct(i) {
|
|
2473
2879
|
const {
|
|
2474
2880
|
value: t,
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
severity:
|
|
2881
|
+
orientation: e = "y",
|
|
2882
|
+
axisId: n,
|
|
2883
|
+
severity: s = "alarm",
|
|
2478
2884
|
label: o,
|
|
2479
|
-
color:
|
|
2885
|
+
color: r,
|
|
2480
2886
|
inExtent: a = !0,
|
|
2481
2887
|
role: l = "specification"
|
|
2482
|
-
} =
|
|
2888
|
+
} = i, u = P(
|
|
2483
2889
|
() => ({
|
|
2484
2890
|
kind: "line",
|
|
2485
2891
|
value: t,
|
|
2486
|
-
axisId:
|
|
2487
|
-
orientation:
|
|
2488
|
-
severity:
|
|
2892
|
+
axisId: n,
|
|
2893
|
+
orientation: e,
|
|
2894
|
+
severity: s,
|
|
2489
2895
|
role: l,
|
|
2490
2896
|
label: o,
|
|
2491
|
-
color:
|
|
2897
|
+
color: r,
|
|
2492
2898
|
inExtent: a
|
|
2493
2899
|
}),
|
|
2494
|
-
[t,
|
|
2900
|
+
[t, n, e, s, l, o, r, a]
|
|
2495
2901
|
);
|
|
2496
|
-
return
|
|
2902
|
+
return $e("LimitLine", u), null;
|
|
2497
2903
|
}
|
|
2498
|
-
function
|
|
2904
|
+
function Oi(i) {
|
|
2499
2905
|
const {
|
|
2500
2906
|
from: t,
|
|
2501
2907
|
to: e,
|
|
2502
|
-
|
|
2503
|
-
|
|
2908
|
+
orientation: n = "y",
|
|
2909
|
+
axisId: s,
|
|
2504
2910
|
severity: o = "warning",
|
|
2505
|
-
label:
|
|
2911
|
+
label: r,
|
|
2506
2912
|
color: a,
|
|
2507
2913
|
inExtent: l = !0,
|
|
2508
|
-
role:
|
|
2509
|
-
} =
|
|
2914
|
+
role: u = "specification"
|
|
2915
|
+
} = i, d = P(
|
|
2510
2916
|
() => ({
|
|
2511
2917
|
kind: "band",
|
|
2512
2918
|
from: t,
|
|
2513
2919
|
to: e,
|
|
2514
|
-
axisId:
|
|
2515
|
-
orientation:
|
|
2920
|
+
axisId: s,
|
|
2921
|
+
orientation: n,
|
|
2516
2922
|
severity: o,
|
|
2517
|
-
role:
|
|
2518
|
-
label:
|
|
2923
|
+
role: u,
|
|
2924
|
+
label: r,
|
|
2519
2925
|
color: a,
|
|
2520
2926
|
inExtent: l
|
|
2521
2927
|
}),
|
|
2522
|
-
[t, e,
|
|
2928
|
+
[t, e, s, n, o, u, r, a, l]
|
|
2523
2929
|
);
|
|
2524
|
-
return
|
|
2930
|
+
return $e("LimitBand", d), null;
|
|
2525
2931
|
}
|
|
2526
|
-
const
|
|
2527
|
-
function
|
|
2932
|
+
const ui = 1.128;
|
|
2933
|
+
function Wt(i, t) {
|
|
2528
2934
|
return {
|
|
2529
|
-
center:
|
|
2935
|
+
center: i,
|
|
2530
2936
|
sigma: t,
|
|
2531
|
-
upper:
|
|
2532
|
-
lower:
|
|
2937
|
+
upper: i + 3 * t,
|
|
2938
|
+
lower: i - 3 * t
|
|
2533
2939
|
};
|
|
2534
2940
|
}
|
|
2535
|
-
function
|
|
2536
|
-
return (t -
|
|
2941
|
+
function Wi(i, t) {
|
|
2942
|
+
return (t - i) / 3;
|
|
2537
2943
|
}
|
|
2538
|
-
function
|
|
2944
|
+
function hi(i, t) {
|
|
2539
2945
|
if (t.kind === "given")
|
|
2540
|
-
return
|
|
2541
|
-
const e = Math.max(0, Math.trunc(t.from)),
|
|
2542
|
-
let
|
|
2543
|
-
for (let
|
|
2544
|
-
const
|
|
2545
|
-
if (!Number.isFinite(
|
|
2946
|
+
return Wt(t.center, t.sigma);
|
|
2947
|
+
const e = Math.max(0, Math.trunc(t.from)), n = Math.min(i.length, Math.trunc(t.to));
|
|
2948
|
+
let s = 0, o = 0, r = 0, a = 0, l = Number.NaN;
|
|
2949
|
+
for (let d = e; d < n; d++) {
|
|
2950
|
+
const f = i[d];
|
|
2951
|
+
if (!Number.isFinite(f)) {
|
|
2546
2952
|
l = Number.NaN;
|
|
2547
2953
|
continue;
|
|
2548
2954
|
}
|
|
2549
|
-
|
|
2955
|
+
s += f, o++, Number.isFinite(l) && (r += Math.abs(f - l), a++), l = f;
|
|
2550
2956
|
}
|
|
2551
|
-
if (o === 0) return
|
|
2552
|
-
const
|
|
2553
|
-
return
|
|
2957
|
+
if (o === 0) return Wt(Number.NaN, Number.NaN);
|
|
2958
|
+
const u = a === 0 ? 0 : r / a / ui;
|
|
2959
|
+
return Wt(s / o, u);
|
|
2554
2960
|
}
|
|
2555
|
-
function
|
|
2961
|
+
function di(i, t = [1, 2]) {
|
|
2556
2962
|
return t.map((e) => ({
|
|
2557
2963
|
k: e,
|
|
2558
|
-
upper:
|
|
2559
|
-
lower:
|
|
2964
|
+
upper: i.center + e * i.sigma,
|
|
2965
|
+
lower: i.center - e * i.sigma
|
|
2560
2966
|
}));
|
|
2561
2967
|
}
|
|
2562
|
-
function
|
|
2563
|
-
return Number.isFinite(
|
|
2968
|
+
function fi(i, t) {
|
|
2969
|
+
return Number.isFinite(i) ? i > t ? 1 : i < t ? -1 : 0 : 0;
|
|
2564
2970
|
}
|
|
2565
|
-
function
|
|
2971
|
+
function Oe(i, t) {
|
|
2566
2972
|
const e = [];
|
|
2567
2973
|
if (t < 1) return e;
|
|
2568
|
-
let
|
|
2569
|
-
for (let
|
|
2570
|
-
const o =
|
|
2571
|
-
if (o !==
|
|
2572
|
-
if (
|
|
2573
|
-
for (let a =
|
|
2574
|
-
|
|
2974
|
+
let n = 0;
|
|
2975
|
+
for (let s = 1; s <= i.length; s++) {
|
|
2976
|
+
const o = s < i.length ? i[s] : Number.NaN, r = i[n];
|
|
2977
|
+
if (o !== r) {
|
|
2978
|
+
if (r !== 0 && s - n >= t)
|
|
2979
|
+
for (let a = n; a < s; a++) e.push(a);
|
|
2980
|
+
n = s;
|
|
2575
2981
|
}
|
|
2576
2982
|
}
|
|
2577
2983
|
return e;
|
|
2578
2984
|
}
|
|
2579
|
-
const
|
|
2985
|
+
const Ut = {
|
|
2580
2986
|
outlier: !0,
|
|
2581
2987
|
run: !0,
|
|
2582
2988
|
trend: !0,
|
|
@@ -2584,299 +2990,342 @@ const $t = {
|
|
|
2584
2990
|
runLength: 9,
|
|
2585
2991
|
trendLength: 6
|
|
2586
2992
|
};
|
|
2587
|
-
function
|
|
2993
|
+
function mi(i, t) {
|
|
2588
2994
|
const e = [];
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2995
|
+
if (!(t.sigma > 0)) return e;
|
|
2996
|
+
for (let n = 0; n < i.length; n++) {
|
|
2997
|
+
const s = i[n];
|
|
2998
|
+
(s > t.upper || s < t.lower) && e.push(n);
|
|
2592
2999
|
}
|
|
2593
3000
|
return e;
|
|
2594
3001
|
}
|
|
2595
|
-
function
|
|
2596
|
-
return
|
|
2597
|
-
|
|
3002
|
+
function pi(i, t, e = Ut.runLength) {
|
|
3003
|
+
return Oe(
|
|
3004
|
+
i.map((n) => fi(n, t.center)),
|
|
2598
3005
|
e
|
|
2599
3006
|
);
|
|
2600
3007
|
}
|
|
2601
|
-
function
|
|
3008
|
+
function yi(i, t = Ut.trendLength) {
|
|
2602
3009
|
const e = [];
|
|
2603
|
-
for (let
|
|
2604
|
-
const o =
|
|
2605
|
-
e.push(Number.isFinite(o) && Number.isFinite(
|
|
2606
|
-
}
|
|
2607
|
-
const
|
|
2608
|
-
for (const
|
|
2609
|
-
|
|
2610
|
-
return
|
|
2611
|
-
}
|
|
2612
|
-
function
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
[o, o + 1, o + 2].filter((a) =>
|
|
3010
|
+
for (let s = 1; s < i.length; s++) {
|
|
3011
|
+
const o = i[s - 1], r = i[s];
|
|
3012
|
+
e.push(Number.isFinite(o) && Number.isFinite(r) ? Math.sign(r - o) : 0);
|
|
3013
|
+
}
|
|
3014
|
+
const n = [];
|
|
3015
|
+
for (const s of Oe(e, Math.max(1, t - 1)))
|
|
3016
|
+
n[n.length - 1] !== s && n.push(s), n.push(s + 1);
|
|
3017
|
+
return n;
|
|
3018
|
+
}
|
|
3019
|
+
function gi(i, t) {
|
|
3020
|
+
if (!(t.sigma > 0)) return [];
|
|
3021
|
+
const e = t.center + 2 * t.sigma, n = t.center - 2 * t.sigma, s = /* @__PURE__ */ new Set();
|
|
3022
|
+
for (let o = 0; o + 2 < i.length; o++)
|
|
3023
|
+
for (const r of [
|
|
3024
|
+
[o, o + 1, o + 2].filter((a) => i[a] > e),
|
|
3025
|
+
[o, o + 1, o + 2].filter((a) => i[a] < n)
|
|
2618
3026
|
])
|
|
2619
|
-
if (
|
|
2620
|
-
return [...
|
|
2621
|
-
}
|
|
2622
|
-
function
|
|
2623
|
-
const
|
|
2624
|
-
|
|
3027
|
+
if (r.length >= 2) for (const a of r) s.add(a);
|
|
3028
|
+
return [...s].sort((o, r) => o - r);
|
|
3029
|
+
}
|
|
3030
|
+
function xi(i, t, e = {}) {
|
|
3031
|
+
const n = { ...Ut, ...e };
|
|
3032
|
+
t.sigma > 0 || J(
|
|
3033
|
+
"control-sigma-zero",
|
|
3034
|
+
`control limits with sigma ${t.sigma} span no band - a constant reference window, or a given sigma not above 0. Rules 1 and 4 find nothing there; take a window with spread, or a positive given sigma.`
|
|
3035
|
+
);
|
|
3036
|
+
const s = [], o = (r, a) => {
|
|
3037
|
+
a.length > 0 && s.push({ rule: r, indices: a });
|
|
2625
3038
|
};
|
|
2626
|
-
return
|
|
3039
|
+
return n.outlier && o("outlier", mi(i, t)), n.run && o("run", pi(i, t, n.runLength)), n.trend && o("trend", yi(i, n.trendLength)), n.twoOfThree && o("twoOfThree", gi(i, t)), s;
|
|
2627
3040
|
}
|
|
2628
|
-
function
|
|
3041
|
+
function bi(i) {
|
|
2629
3042
|
const t = /* @__PURE__ */ new Set();
|
|
2630
|
-
for (const e of
|
|
2631
|
-
return [...t].sort((e,
|
|
3043
|
+
for (const e of i) for (const n of e.indices) t.add(n);
|
|
3044
|
+
return [...t].sort((e, n) => e - n);
|
|
3045
|
+
}
|
|
3046
|
+
function Rt(i, t) {
|
|
3047
|
+
const [e, n] = be({ value: i });
|
|
3048
|
+
return e.value === i || t(e.value, i) ? e.value : (n({ value: i }), i);
|
|
3049
|
+
}
|
|
3050
|
+
function vi(i, t) {
|
|
3051
|
+
return i.kind === "given" && t.kind === "given" ? i.center === t.center && i.sigma === t.sigma : i.kind === "referenceWindow" && t.kind === "referenceWindow" ? i.from === t.from && i.to === t.to : !1;
|
|
3052
|
+
}
|
|
3053
|
+
function Ni(i, t) {
|
|
3054
|
+
if (i.length !== t.length) return !1;
|
|
3055
|
+
for (let e = 0; e < i.length; e++) {
|
|
3056
|
+
const n = i[e], s = t[e];
|
|
3057
|
+
if (n.rule !== s.rule || n.indices.length !== s.indices.length) return !1;
|
|
3058
|
+
for (let o = 0; o < n.indices.length; o++) if (n.indices[o] !== s.indices[o]) return !1;
|
|
3059
|
+
}
|
|
3060
|
+
return !0;
|
|
2632
3061
|
}
|
|
2633
|
-
function
|
|
3062
|
+
function Ri(i) {
|
|
2634
3063
|
const {
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
xAxisId: r = "x",
|
|
2639
|
-
yAxisId: o = "y",
|
|
3064
|
+
data: t,
|
|
3065
|
+
xAxisId: e = "x",
|
|
3066
|
+
yAxisId: n = "y",
|
|
2640
3067
|
name: s,
|
|
2641
|
-
|
|
3068
|
+
format: o,
|
|
3069
|
+
color: r,
|
|
3070
|
+
tone: a,
|
|
2642
3071
|
rules: l,
|
|
2643
|
-
zoneLines:
|
|
2644
|
-
labelUpper:
|
|
2645
|
-
labelLower:
|
|
2646
|
-
violationName:
|
|
2647
|
-
onViolations:
|
|
2648
|
-
} =
|
|
2649
|
-
const
|
|
2650
|
-
for (let
|
|
2651
|
-
const
|
|
2652
|
-
|
|
3072
|
+
zoneLines: u = !0,
|
|
3073
|
+
labelUpper: d,
|
|
3074
|
+
labelLower: f,
|
|
3075
|
+
violationName: h,
|
|
3076
|
+
onViolations: m
|
|
3077
|
+
} = i, c = Rt(i.accessor, X), p = Rt(i.origin, vi), y = P(() => {
|
|
3078
|
+
const S = [];
|
|
3079
|
+
for (let T = 0; T < t.length; T++) {
|
|
3080
|
+
const H = c(t[T], T);
|
|
3081
|
+
S.push(H ?? Number.NaN);
|
|
2653
3082
|
}
|
|
2654
|
-
return
|
|
2655
|
-
}, [
|
|
2656
|
-
() =>
|
|
2657
|
-
|
|
2658
|
-
),
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
}, [
|
|
2662
|
-
|
|
2663
|
-
(
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
() =>
|
|
2667
|
-
[
|
|
2668
|
-
),
|
|
2669
|
-
() =>
|
|
2670
|
-
[
|
|
2671
|
-
),
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
3083
|
+
return S;
|
|
3084
|
+
}, [t, c]), g = P(() => hi(y, p), [y, p]), b = Rt(
|
|
3085
|
+
P(() => xi(y, g, l ?? {}), [y, g, l]),
|
|
3086
|
+
Ni
|
|
3087
|
+
), N = P(() => new Set(bi(b)), [b]), A = Q(m);
|
|
3088
|
+
C(() => {
|
|
3089
|
+
A.current = m;
|
|
3090
|
+
}, [m]), C(() => {
|
|
3091
|
+
var S;
|
|
3092
|
+
(S = A.current) == null || S.call(A, b);
|
|
3093
|
+
}, [b]);
|
|
3094
|
+
const $ = P(
|
|
3095
|
+
() => (S, T) => N.has(T) ? c(S, T) : null,
|
|
3096
|
+
[N, c]
|
|
3097
|
+
), w = P(
|
|
3098
|
+
() => N.size === 0 ? t : t.slice(),
|
|
3099
|
+
[t, N]
|
|
3100
|
+
), W = P(
|
|
3101
|
+
() => u ? di(g, [1, 2]) : [],
|
|
3102
|
+
[u, g]
|
|
3103
|
+
), L = Number.isFinite(g.center);
|
|
3104
|
+
return /* @__PURE__ */ G(bt, { children: [
|
|
3105
|
+
/* @__PURE__ */ I(ai, { accessor: c, data: t, xAxisId: e, yAxisId: n, name: s, format: o, color: r, tone: a }),
|
|
3106
|
+
L && /* @__PURE__ */ G(bt, { children: [
|
|
3107
|
+
W.map((S) => /* @__PURE__ */ I(
|
|
3108
|
+
ct,
|
|
2677
3109
|
{
|
|
2678
|
-
value:
|
|
2679
|
-
axisId:
|
|
3110
|
+
value: S.upper,
|
|
3111
|
+
axisId: n,
|
|
2680
3112
|
role: "zone",
|
|
2681
3113
|
inExtent: !1
|
|
2682
3114
|
},
|
|
2683
|
-
`zone-${
|
|
3115
|
+
`zone-${S.k}-upper`
|
|
2684
3116
|
)),
|
|
2685
|
-
|
|
2686
|
-
|
|
3117
|
+
W.map((S) => /* @__PURE__ */ I(
|
|
3118
|
+
ct,
|
|
2687
3119
|
{
|
|
2688
|
-
value:
|
|
2689
|
-
axisId:
|
|
3120
|
+
value: S.lower,
|
|
3121
|
+
axisId: n,
|
|
2690
3122
|
role: "zone",
|
|
2691
3123
|
inExtent: !1
|
|
2692
3124
|
},
|
|
2693
|
-
`zone-${
|
|
3125
|
+
`zone-${S.k}-lower`
|
|
2694
3126
|
)),
|
|
2695
|
-
/* @__PURE__ */
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ I(ct, { value: g.center, axisId: n, role: "control" }),
|
|
3128
|
+
/* @__PURE__ */ I(ct, { value: g.upper, axisId: n, role: "control", label: d }),
|
|
3129
|
+
/* @__PURE__ */ I(ct, { value: g.lower, axisId: n, role: "control", label: f })
|
|
2698
3130
|
] }),
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
|
|
3131
|
+
/* @__PURE__ */ I(
|
|
3132
|
+
li,
|
|
2701
3133
|
{
|
|
2702
|
-
accessor:
|
|
3134
|
+
accessor: $,
|
|
2703
3135
|
data: w,
|
|
2704
|
-
xAxisId:
|
|
2705
|
-
yAxisId:
|
|
2706
|
-
name:
|
|
3136
|
+
xAxisId: e,
|
|
3137
|
+
yAxisId: n,
|
|
3138
|
+
name: h,
|
|
3139
|
+
format: o,
|
|
2707
3140
|
tone: "alarm",
|
|
2708
3141
|
radius: 4
|
|
2709
3142
|
}
|
|
2710
3143
|
)
|
|
2711
3144
|
] });
|
|
2712
3145
|
}
|
|
2713
|
-
function
|
|
3146
|
+
function Hi(i) {
|
|
2714
3147
|
const {
|
|
2715
3148
|
id: t = "x",
|
|
2716
3149
|
position: e = "bottom",
|
|
2717
|
-
accessor:
|
|
2718
|
-
label:
|
|
3150
|
+
accessor: n,
|
|
3151
|
+
label: s,
|
|
2719
3152
|
tickCount: o,
|
|
2720
|
-
tickFormat:
|
|
3153
|
+
tickFormat: r,
|
|
2721
3154
|
domain: a = "nice",
|
|
2722
3155
|
grid: l,
|
|
2723
|
-
ticks:
|
|
2724
|
-
|
|
2725
|
-
|
|
3156
|
+
ticks: u,
|
|
3157
|
+
time: d,
|
|
3158
|
+
calendar: f,
|
|
3159
|
+
onDomainChange: h
|
|
3160
|
+
} = i, m = P(
|
|
2726
3161
|
() => ({
|
|
2727
3162
|
id: t,
|
|
2728
3163
|
orientation: "x",
|
|
2729
3164
|
position: e,
|
|
2730
|
-
accessor:
|
|
2731
|
-
label:
|
|
3165
|
+
accessor: n,
|
|
3166
|
+
label: s,
|
|
2732
3167
|
tickCount: o,
|
|
2733
|
-
tickFormat:
|
|
3168
|
+
tickFormat: r,
|
|
2734
3169
|
domain: a,
|
|
2735
3170
|
grid: l,
|
|
2736
|
-
ticks:
|
|
2737
|
-
|
|
3171
|
+
ticks: u,
|
|
3172
|
+
time: d,
|
|
3173
|
+
calendar: f,
|
|
3174
|
+
onDomainChange: h
|
|
2738
3175
|
}),
|
|
2739
|
-
[t, e,
|
|
3176
|
+
[t, e, n, s, o, r, a, l, u, d, f, h]
|
|
2740
3177
|
);
|
|
2741
|
-
return
|
|
3178
|
+
return Ce("XAxis", m), null;
|
|
2742
3179
|
}
|
|
2743
|
-
function
|
|
3180
|
+
function Vi(i) {
|
|
2744
3181
|
const {
|
|
2745
3182
|
id: t = "y",
|
|
2746
3183
|
position: e = "left",
|
|
2747
|
-
accessor:
|
|
2748
|
-
label:
|
|
3184
|
+
accessor: n,
|
|
3185
|
+
label: s,
|
|
2749
3186
|
tickCount: o,
|
|
2750
|
-
tickFormat:
|
|
3187
|
+
tickFormat: r,
|
|
2751
3188
|
domain: a = "nice",
|
|
2752
3189
|
grid: l,
|
|
2753
|
-
ticks:
|
|
2754
|
-
|
|
3190
|
+
ticks: u,
|
|
3191
|
+
alignTicks: d
|
|
3192
|
+
} = i, f = P(
|
|
2755
3193
|
() => ({
|
|
2756
3194
|
id: t,
|
|
2757
3195
|
orientation: "y",
|
|
2758
3196
|
position: e,
|
|
2759
|
-
accessor:
|
|
2760
|
-
label:
|
|
3197
|
+
accessor: n,
|
|
3198
|
+
label: s,
|
|
2761
3199
|
tickCount: o,
|
|
2762
|
-
tickFormat:
|
|
3200
|
+
tickFormat: r,
|
|
2763
3201
|
domain: a,
|
|
2764
3202
|
grid: l,
|
|
2765
|
-
ticks:
|
|
3203
|
+
ticks: u,
|
|
3204
|
+
alignTicks: d
|
|
2766
3205
|
}),
|
|
2767
|
-
[t, e,
|
|
3206
|
+
[t, e, n, s, o, r, a, l, u, d]
|
|
2768
3207
|
);
|
|
2769
|
-
return
|
|
3208
|
+
return Ce("YAxis", f), null;
|
|
2770
3209
|
}
|
|
2771
|
-
function
|
|
2772
|
-
scene:
|
|
2773
|
-
placement: t
|
|
3210
|
+
function ki({
|
|
3211
|
+
scene: i,
|
|
3212
|
+
placement: t,
|
|
3213
|
+
onToggle: e
|
|
2774
3214
|
}) {
|
|
2775
|
-
|
|
2776
|
-
const
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
3215
|
+
ni("Legend", { placement: t });
|
|
3216
|
+
const n = Kt(
|
|
3217
|
+
i.subscribeLayout,
|
|
3218
|
+
i.getLayoutSnapshot,
|
|
3219
|
+
i.getLayoutServerSnapshot
|
|
2780
3220
|
);
|
|
2781
|
-
return
|
|
2782
|
-
|
|
2783
|
-
{
|
|
3221
|
+
return n.series.length === 0 ? null : /* @__PURE__ */ I("div", { className: `uc-legend uc-legend-${t}`, children: n.series.map((s) => {
|
|
3222
|
+
const o = {
|
|
2784
3223
|
className: "uc-legend-item",
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
|
|
3224
|
+
"data-hidden": s.hidden ? "" : void 0,
|
|
3225
|
+
onPointerEnter: () => i.setHighlight(s.seriesIds),
|
|
3226
|
+
onPointerLeave: () => i.setHighlight(null)
|
|
3227
|
+
}, r = /* @__PURE__ */ G(bt, { children: [
|
|
3228
|
+
/* @__PURE__ */ I("span", { className: "uc-legend-chip", style: { background: s.color } }),
|
|
3229
|
+
s.name
|
|
3230
|
+
] });
|
|
3231
|
+
return e === void 0 ? /* @__PURE__ */ I("span", { ...o, children: r }, s.id) : /* @__PURE__ */ I(
|
|
3232
|
+
"button",
|
|
3233
|
+
{
|
|
3234
|
+
type: "button",
|
|
3235
|
+
"aria-pressed": !s.hidden,
|
|
3236
|
+
onClick: () => e(s.name),
|
|
3237
|
+
...o,
|
|
3238
|
+
children: r
|
|
3239
|
+
},
|
|
3240
|
+
s.id
|
|
3241
|
+
);
|
|
3242
|
+
}) });
|
|
2794
3243
|
}
|
|
2795
|
-
function
|
|
2796
|
-
const
|
|
2797
|
-
return
|
|
3244
|
+
function _i({ placement: i = "top", onToggle: t }) {
|
|
3245
|
+
const e = rt("Legend");
|
|
3246
|
+
return e === null ? null : /* @__PURE__ */ I(ki, { scene: e, placement: i, onToggle: t });
|
|
2798
3247
|
}
|
|
2799
|
-
function
|
|
2800
|
-
const { mode: t = "x", render: e } =
|
|
3248
|
+
function Yi(i) {
|
|
3249
|
+
const { mode: t = "x", render: e } = i, n = P(
|
|
2801
3250
|
() => ({ mode: t, render: e }),
|
|
2802
3251
|
[t, e]
|
|
2803
3252
|
);
|
|
2804
|
-
return
|
|
3253
|
+
return ii("Tooltip", n), null;
|
|
2805
3254
|
}
|
|
2806
|
-
const
|
|
3255
|
+
const wi = {
|
|
2807
3256
|
cutoff: 0.8,
|
|
2808
3257
|
collectRank: Number.POSITIVE_INFINITY
|
|
2809
3258
|
};
|
|
2810
|
-
function
|
|
2811
|
-
const e = { ...
|
|
3259
|
+
function zi(i, t = {}) {
|
|
3260
|
+
const e = { ...wi, ...t };
|
|
2812
3261
|
ut(
|
|
2813
3262
|
!Number.isFinite(e.collectRank) || e.remainderName !== void 0,
|
|
2814
3263
|
"pareto: a collect rank needs `remainderName` - the package brings no name for the remainder."
|
|
2815
3264
|
);
|
|
2816
|
-
const
|
|
2817
|
-
let
|
|
2818
|
-
for (let
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2821
|
-
name:
|
|
2822
|
-
value:
|
|
2823
|
-
index:
|
|
2824
|
-
share: l === 0 ? 0 :
|
|
2825
|
-
cumulative: l === 0 ? 0 :
|
|
2826
|
-
remainder:
|
|
3265
|
+
const n = i.map((m, c) => ({ item: m, inputIndex: c })).sort((m, c) => c.item.value - m.item.value || m.inputIndex - c.inputIndex).map(({ item: m }) => m), s = Math.max(0, Math.min(n.length, Math.floor(e.collectRank))), o = n.slice(0, s), r = n.slice(s), a = r.length === 0 ? o : [...o, { name: e.remainderName ?? "", value: r.reduce((m, c) => m + c.value, 0) }], l = a.reduce((m, c) => m + c.value, 0), u = [];
|
|
3266
|
+
let d = 0;
|
|
3267
|
+
for (let m = 0; m < a.length; m++) {
|
|
3268
|
+
const c = a[m];
|
|
3269
|
+
d += c.value, u.push({
|
|
3270
|
+
name: c.name,
|
|
3271
|
+
value: c.value,
|
|
3272
|
+
index: m,
|
|
3273
|
+
share: l === 0 ? 0 : c.value / l,
|
|
3274
|
+
cumulative: l === 0 ? 0 : d / l,
|
|
3275
|
+
remainder: r.length > 0 && m === a.length - 1
|
|
2827
3276
|
});
|
|
2828
3277
|
}
|
|
2829
|
-
const
|
|
2830
|
-
return { entries:
|
|
3278
|
+
const f = Math.abs(e.cutoff) * 1e-12, h = u.findIndex((m) => m.cumulative >= e.cutoff - f);
|
|
3279
|
+
return { entries: u, total: l, cutoffIndex: h };
|
|
2831
3280
|
}
|
|
2832
3281
|
export {
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
3282
|
+
Ei as Area,
|
|
3283
|
+
Pi as Bar,
|
|
3284
|
+
Di as Chart,
|
|
3285
|
+
Ri as ControlChart,
|
|
3286
|
+
K as DAY,
|
|
3287
|
+
ci as DEFAULT_GRADIENT,
|
|
3288
|
+
tt as HOUR,
|
|
3289
|
+
_i as Legend,
|
|
3290
|
+
Oi as LimitBand,
|
|
3291
|
+
ct as LimitLine,
|
|
3292
|
+
ai as Line,
|
|
3293
|
+
te as LinearScale,
|
|
3294
|
+
q as MINUTE,
|
|
3295
|
+
$i as Matrix,
|
|
3296
|
+
j as SECOND,
|
|
3297
|
+
li as Scatter,
|
|
3298
|
+
Ci as StateBand,
|
|
3299
|
+
Yi as Tooltip,
|
|
3300
|
+
Hi as XAxis,
|
|
3301
|
+
Vi as YAxis,
|
|
3302
|
+
On as assess,
|
|
3303
|
+
rn as breaks,
|
|
3304
|
+
Z as calendarFrom,
|
|
3305
|
+
hi as controlLimits,
|
|
3306
|
+
Ut as defaultRules,
|
|
3307
|
+
jt as invalidateTheme,
|
|
3308
|
+
Ti as localOffset,
|
|
3309
|
+
Si as mapSeries,
|
|
3310
|
+
tn as operatingCalendar,
|
|
3311
|
+
Li as operatingTicks,
|
|
3312
|
+
ln as operatingTimeTicks,
|
|
3313
|
+
zi as pareto,
|
|
3314
|
+
wi as paretoDefaults,
|
|
3315
|
+
on as removedIntervals,
|
|
3316
|
+
qe as resolveColours,
|
|
3317
|
+
mi as ruleOutlier,
|
|
3318
|
+
pi as ruleRun,
|
|
3319
|
+
yi as ruleTrend,
|
|
3320
|
+
gi as ruleTwoOfThree,
|
|
3321
|
+
Wi as sigmaFromLimit,
|
|
3322
|
+
Ue as subscribeTheme,
|
|
3323
|
+
an as timeStep,
|
|
3324
|
+
st as toOperatingTime,
|
|
3325
|
+
nn as toOperatingTimeClamped,
|
|
3326
|
+
ot as toWallClock,
|
|
3327
|
+
Fi as verdictWeight,
|
|
3328
|
+
bi as violatedIndices,
|
|
3329
|
+
xi as violations,
|
|
3330
|
+
di as zones
|
|
2882
3331
|
};
|