velo-plot 1.19.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ChartCore-DQ691eXH.js → ChartCore-ivzLqxVb.js} +1376 -1153
- package/dist/ChartCore-ivzLqxVb.js.map +1 -0
- package/dist/SciPlot-CEU4ApgD.js +463 -0
- package/dist/SciPlot-CEU4ApgD.js.map +1 -0
- package/dist/axisFormat-CzumxpCL.js +200 -0
- package/dist/axisFormat-CzumxpCL.js.map +1 -0
- package/dist/core/InteractionManager.d.ts +1 -0
- package/dist/core/OverlayRenderer.d.ts +11 -0
- package/dist/core/chart/ChartAxisManager.d.ts +2 -0
- package/dist/core/chart/ChartCore.d.ts +20 -0
- package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +7 -0
- package/dist/core/chart/ChartRenderer.d.ts +5 -0
- package/dist/core/chart/ChartStateManager.d.ts +2 -0
- package/dist/core/chart/positionLines.d.ts +12 -0
- package/dist/core/chart/types.d.ts +7 -0
- package/dist/core/format/axisFormat.d.ts +2 -1
- package/dist/core/indicator/addIndicator.d.ts +1 -1
- package/dist/core/indicator/indicatorPresets.d.ts +10 -2
- package/dist/core/sync/index.d.ts +0 -1
- package/dist/core/time/TimeScale.d.ts +2 -2
- package/dist/core/time/applyTimeScale.d.ts +10 -0
- package/dist/createStackedChart-DxNW0VkF.js +705 -0
- package/dist/createStackedChart-DxNW0VkF.js.map +1 -0
- package/dist/{index-D7dTq6VB.js → index-BBpJwOct.js} +17 -19
- package/dist/index-BBpJwOct.js.map +1 -0
- package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
- package/dist/index-CaXWSOTk.js.map +1 -0
- package/dist/{index-DjeWClO9.js → index-qunX30Xu.js} +2 -2
- package/dist/{index-DjeWClO9.js.map → index-qunX30Xu.js.map} +1 -1
- package/dist/{index.core-BtGFYMOu.js → index.core-COREBDNq.js} +25 -24
- package/dist/{index.core-BtGFYMOu.js.map → index.core-COREBDNq.js.map} +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/mockDatafeed-927foCM4.js +511 -0
- package/dist/mockDatafeed-927foCM4.js.map +1 -0
- package/dist/plugins/analysis/contours.d.ts +31 -0
- package/dist/plugins/analysis.js +494 -407
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/broken-axis.js +170 -181
- package/dist/plugins/broken-axis.js.map +1 -1
- package/dist/plugins/drawing-tools/index.d.ts +14 -1
- package/dist/plugins/drawing-tools/measure.d.ts +21 -0
- package/dist/plugins/drawing-tools/snapToCandle.d.ts +21 -0
- package/dist/plugins/forecasting/algorithms.d.ts +7 -2
- package/dist/plugins/forecasting/types.d.ts +13 -3
- package/dist/plugins/forecasting.js +355 -175
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/latex/symbols.d.ts +50 -0
- package/dist/plugins/latex/types.d.ts +13 -1
- package/dist/plugins/latex.js +351 -331
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
- package/dist/plugins/ml-integration/types.d.ts +19 -0
- package/dist/plugins/ml-integration.js +191 -140
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/pattern-recognition/types.d.ts +28 -1
- package/dist/plugins/pattern-recognition.js +416 -343
- package/dist/plugins/pattern-recognition.js.map +1 -1
- package/dist/plugins/snapshot.js +36 -36
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/sync.js +1 -1
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/virtualization.js +1 -1
- package/dist/react.js +5 -5
- package/dist/symbols-DT0eLlpW.js +568 -0
- package/dist/symbols-DT0eLlpW.js.map +1 -0
- package/dist/trading/datafeed.d.ts +48 -0
- package/dist/trading/index.d.ts +29 -0
- package/dist/trading/mockDatafeed.d.ts +9 -0
- package/dist/trading/ohlcvGenerator.d.ts +25 -0
- package/dist/trading.d.ts +1 -0
- package/dist/trading.js +95 -0
- package/dist/trading.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/velo-plot.full.js +835 -1054
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +13 -13
- package/dist/workers/indicatorsAsync.d.ts +24 -0
- package/package.json +13 -1
- package/dist/ChartCore-DQ691eXH.js.map +0 -1
- package/dist/axisFormat-B7o_uIEA.js +0 -127
- package/dist/axisFormat-B7o_uIEA.js.map +0 -1
- package/dist/createStackedChart-BPooTQ9z.js +0 -1164
- package/dist/createStackedChart-BPooTQ9z.js.map +0 -1
- package/dist/index-CUGS98p4.js.map +0 -1
- package/dist/index-D7dTq6VB.js.map +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { G as
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var ut = (i, e, t) => e in i ? ct(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var m = (i, e, t) => ut(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { g as qe, h as Ge, a as je, c as Qe, E as dt } from "./axisFormat-CzumxpCL.js";
|
|
5
|
+
import { G as ft } from "./gpuRenderer-BpaMYz-k.js";
|
|
6
6
|
import "./index-x4stH3jD.js";
|
|
7
|
-
import { P as
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import { P as gt } from "./index-qhscKTDy.js";
|
|
8
|
+
import "./symbols-DT0eLlpW.js";
|
|
9
|
+
import { f as yt, m as mt, e as pt, s as xt, r as bt, a as vt } from "./indicators--eJGmVox.js";
|
|
10
|
+
import { n as St, W as wt } from "./pool-15HMCNv8.js";
|
|
10
11
|
const ae = { top: 20, right: 30, bottom: 55, left: 75 };
|
|
11
|
-
class
|
|
12
|
+
class Mt {
|
|
12
13
|
constructor(e) {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
m(this, "buffers", /* @__PURE__ */ new Map());
|
|
15
|
+
m(this, "bufferSizes", /* @__PURE__ */ new Map());
|
|
15
16
|
this.gl = e;
|
|
16
17
|
}
|
|
17
18
|
createBuffer(e, t) {
|
|
@@ -40,7 +41,7 @@ class vt {
|
|
|
40
41
|
this.buffers.forEach((e) => this.gl.deleteBuffer(e)), this.buffers.clear(), this.bufferSizes.clear();
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
+
const Ct = `
|
|
44
45
|
precision highp float;
|
|
45
46
|
attribute vec2 position;
|
|
46
47
|
uniform vec2 uScale;
|
|
@@ -50,14 +51,14 @@ void main() {
|
|
|
50
51
|
vec2 pos = position * uScale + uTranslate;
|
|
51
52
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
52
53
|
}
|
|
53
|
-
`,
|
|
54
|
+
`, At = `
|
|
54
55
|
precision highp float;
|
|
55
56
|
uniform vec4 uColor;
|
|
56
57
|
|
|
57
58
|
void main() {
|
|
58
59
|
gl_FragColor = uColor;
|
|
59
60
|
}
|
|
60
|
-
`,
|
|
61
|
+
`, Pt = `
|
|
61
62
|
precision highp float;
|
|
62
63
|
attribute vec2 position;
|
|
63
64
|
uniform vec2 uScale;
|
|
@@ -69,7 +70,7 @@ void main() {
|
|
|
69
70
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
70
71
|
gl_PointSize = uPointSize;
|
|
71
72
|
}
|
|
72
|
-
`,
|
|
73
|
+
`, kt = `
|
|
73
74
|
precision highp float;
|
|
74
75
|
uniform vec4 uColor;
|
|
75
76
|
uniform int uSymbol;
|
|
@@ -150,7 +151,7 @@ void main() {
|
|
|
150
151
|
float alpha = 1.0 - smoothstep(0.0, 0.02, d);
|
|
151
152
|
gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
|
|
152
153
|
}
|
|
153
|
-
`,
|
|
154
|
+
`, Bt = `
|
|
154
155
|
precision highp float;
|
|
155
156
|
attribute vec2 aPosition;
|
|
156
157
|
attribute float aValue;
|
|
@@ -162,7 +163,7 @@ void main() {
|
|
|
162
163
|
gl_Position = vec4(aPosition * uScale + uTranslate, 0.0, 1.0);
|
|
163
164
|
vValue = aValue;
|
|
164
165
|
}
|
|
165
|
-
`,
|
|
166
|
+
`, Tt = `
|
|
166
167
|
precision highp float;
|
|
167
168
|
varying float vValue;
|
|
168
169
|
uniform float uMinValue;
|
|
@@ -213,11 +214,11 @@ function Ce(i, e, t, n) {
|
|
|
213
214
|
}
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
+
function It(i) {
|
|
217
218
|
return {
|
|
218
|
-
lineProgram: Ce(i,
|
|
219
|
-
pointProgram: Ce(i,
|
|
220
|
-
heatmapProgram: Ce(i,
|
|
219
|
+
lineProgram: Ce(i, Ct, At, "line"),
|
|
220
|
+
pointProgram: Ce(i, Pt, kt, "point"),
|
|
221
|
+
heatmapProgram: Ce(i, Bt, Tt, "heatmap")
|
|
221
222
|
};
|
|
222
223
|
}
|
|
223
224
|
function _(i) {
|
|
@@ -244,14 +245,14 @@ function _(i) {
|
|
|
244
245
|
}
|
|
245
246
|
return [1, 0, 1, 1];
|
|
246
247
|
}
|
|
247
|
-
function
|
|
248
|
-
const [t, n, s, o] = _(i), [r, a, l] =
|
|
248
|
+
function Et(i, e = !0) {
|
|
249
|
+
const [t, n, s, o] = _(i), [r, a, l] = Rt(t, n, s), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
|
|
249
250
|
let c;
|
|
250
251
|
e ? c = l < 0.4 ? 0.8 : Math.min(0.95, l + 0.2) : c = l > 0.6 ? 0.25 : Math.max(0.1, l - 0.2), c = Math.max(0.15, Math.min(0.9, c));
|
|
251
|
-
const [f, u, g] =
|
|
252
|
-
return o < 1 ? `rgba(${y}, ${
|
|
252
|
+
const [f, u, g] = Ft(h, d, c), y = Math.round(f * 255), x = Math.round(u * 255), b = Math.round(g * 255);
|
|
253
|
+
return o < 1 ? `rgba(${y}, ${x}, ${b}, ${o})` : `rgb(${y}, ${x}, ${b})`;
|
|
253
254
|
}
|
|
254
|
-
function
|
|
255
|
+
function Rt(i, e, t) {
|
|
255
256
|
const n = Math.max(i, e, t), s = Math.min(i, e, t);
|
|
256
257
|
let o = 0, r = 0, a = (n + s) / 2;
|
|
257
258
|
if (n !== s) {
|
|
@@ -271,7 +272,7 @@ function Tt(i, e, t) {
|
|
|
271
272
|
}
|
|
272
273
|
return [o, r, a];
|
|
273
274
|
}
|
|
274
|
-
function
|
|
275
|
+
function Ft(i, e, t) {
|
|
275
276
|
let n, s, o;
|
|
276
277
|
if (e === 0)
|
|
277
278
|
n = s = o = t;
|
|
@@ -281,16 +282,16 @@ function It(i, e, t) {
|
|
|
281
282
|
}
|
|
282
283
|
return [n, s, o];
|
|
283
284
|
}
|
|
284
|
-
function
|
|
285
|
+
function Ze(i, e) {
|
|
285
286
|
const t = Math.min(i.length, e.length), n = new Float32Array(t * 2);
|
|
286
287
|
for (let s = 0; s < t; s++)
|
|
287
288
|
n[s * 2] = i[s], n[s * 2 + 1] = e[s];
|
|
288
289
|
return n;
|
|
289
290
|
}
|
|
290
|
-
function
|
|
291
|
+
function Dt(i, e, t = "after") {
|
|
291
292
|
const n = Math.min(i.length, e.length);
|
|
292
293
|
if (n < 2)
|
|
293
|
-
return
|
|
294
|
+
return Ze(i, e);
|
|
294
295
|
const s = t === "center" ? 1 + (n - 1) * 3 : n * 2 - 1, o = new Float32Array(s * 2);
|
|
295
296
|
let r = 0;
|
|
296
297
|
for (let a = 0; a < n; a++)
|
|
@@ -309,7 +310,7 @@ function Et(i, e, t = "after") {
|
|
|
309
310
|
}
|
|
310
311
|
return o.subarray(0, r);
|
|
311
312
|
}
|
|
312
|
-
function
|
|
313
|
+
function Je(i, e, t) {
|
|
313
314
|
const n = Math.min(i.length, e.length, t.length), s = new Float32Array(n * 2 * 2);
|
|
314
315
|
for (let o = 0; o < n; o++) {
|
|
315
316
|
const r = o * 4, a = i[o];
|
|
@@ -317,7 +318,7 @@ function Qe(i, e, t) {
|
|
|
317
318
|
}
|
|
318
319
|
return s;
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
+
function Lt(i, e, t, n) {
|
|
321
322
|
const s = i.length;
|
|
322
323
|
let o = 0;
|
|
323
324
|
t && o++, n && o++;
|
|
@@ -336,24 +337,24 @@ function Rt(i, e, t, n) {
|
|
|
336
337
|
}
|
|
337
338
|
return r.subarray(0, a);
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function zt(i, e, t, n, s, o, r) {
|
|
340
341
|
const a = i.length, l = r / 2, h = new Float32Array(a * 20), d = new Float32Array(a * 12);
|
|
341
342
|
let c = 0, f = 0;
|
|
342
343
|
for (let u = 0; u < a; u++) {
|
|
343
|
-
const g = i[u], y = e[u],
|
|
344
|
-
h[c++] = g, h[c++] = y, h[c++] = g, h[c++] =
|
|
344
|
+
const g = i[u], y = e[u], x = t[u], b = n[u], S = s[u], p = o[u];
|
|
345
|
+
h[c++] = g, h[c++] = y, h[c++] = g, h[c++] = x, h[c++] = g, h[c++] = S, h[c++] = g, h[c++] = p, h[c++] = g - l, h[c++] = b, h[c++] = g + l, h[c++] = b, h[c++] = g - l, h[c++] = x, h[c++] = g + l, h[c++] = x, h[c++] = g - l, h[c++] = S, h[c++] = g + l, h[c++] = S, d[f++] = g - l, d[f++] = x, d[f++] = g + l, d[f++] = x, d[f++] = g + l, d[f++] = S, d[f++] = g - l, d[f++] = x, d[f++] = g + l, d[f++] = S, d[f++] = g - l, d[f++] = S;
|
|
345
346
|
}
|
|
346
347
|
return { lines: h, boxes: d };
|
|
347
348
|
}
|
|
348
|
-
function
|
|
349
|
+
function Ot(i, e, t, n) {
|
|
349
350
|
const s = i.length, o = t / 2, r = new Float32Array(s * 12), a = new Float32Array(s * 12), l = new Float32Array(s * 12), h = new Float32Array((s - 1) * 4);
|
|
350
351
|
let d = 0, c = 0, f = 0, u = 0, g = 0;
|
|
351
352
|
for (let y = 0; y < s; y++) {
|
|
352
|
-
const
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
353
|
+
const x = i[y], b = e[y], S = (n == null ? void 0 : n[y]) ?? !1;
|
|
354
|
+
let p, v;
|
|
355
|
+
if (S ? (p = 0, v = g, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = v) : (p = g, v = g + b, g = v, b >= 0 ? (r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = v) : (a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = p)), y < s - 1) {
|
|
355
356
|
const w = i[y + 1];
|
|
356
|
-
h[u++] =
|
|
357
|
+
h[u++] = x + o, h[u++] = v, h[u++] = w - o, h[u++] = v;
|
|
357
358
|
}
|
|
358
359
|
}
|
|
359
360
|
return {
|
|
@@ -366,21 +367,21 @@ function Dt(i, e, t, n) {
|
|
|
366
367
|
subtotalCount: f / 2
|
|
367
368
|
};
|
|
368
369
|
}
|
|
369
|
-
function
|
|
370
|
+
function $t(i, e = !1) {
|
|
370
371
|
const t = i.xMax - i.xMin, n = i.yMax - i.yMin, s = t > 0 ? (e ? -2 : 2) / t : 1, o = n > 0 ? 2 / n : 1, r = e ? 1 - i.xMin * s : -1 - i.xMin * s, a = -1 - i.yMin * o;
|
|
371
372
|
return {
|
|
372
373
|
scale: [s, o],
|
|
373
374
|
translate: [r, a]
|
|
374
375
|
};
|
|
375
376
|
}
|
|
376
|
-
function
|
|
377
|
+
function ye(i, e, t, n, s, o, r = 1) {
|
|
377
378
|
i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
|
|
378
379
|
e.uniforms.uTranslate,
|
|
379
380
|
s.translate[0],
|
|
380
381
|
s.translate[1]
|
|
381
382
|
), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINE_STRIP, 0, n), i.disableVertexAttribArray(e.attributes.position);
|
|
382
383
|
}
|
|
383
|
-
function
|
|
384
|
+
function Yt(i, e, t, n, s, o) {
|
|
384
385
|
i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
|
|
385
386
|
e.uniforms.uTranslate,
|
|
386
387
|
s.translate[0],
|
|
@@ -409,28 +410,28 @@ function Ae(i, e, t, n, s, o, r, a = "circle") {
|
|
|
409
410
|
}
|
|
410
411
|
i.drawArrays(i.POINTS, 0, n), i.disableVertexAttribArray(e.attributes.position);
|
|
411
412
|
}
|
|
412
|
-
function
|
|
413
|
+
function _t(i, e, t, n, s, o = { min: 0, max: 1 }, r) {
|
|
413
414
|
i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 12, 0), e.attributes.value !== void 0 && e.attributes.value !== -1 && (i.enableVertexAttribArray(e.attributes.value), i.vertexAttribPointer(e.attributes.value, 1, i.FLOAT, !1, 12, 8)), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
|
|
414
415
|
e.uniforms.uTranslate,
|
|
415
416
|
s.translate[0],
|
|
416
417
|
s.translate[1]
|
|
417
418
|
), e.uniforms.uMinValue && i.uniform1f(e.uniforms.uMinValue, o.min), e.uniforms.uMaxValue && i.uniform1f(e.uniforms.uMaxValue, o.max), r && e.uniforms.uColormap ? (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, r), i.uniform1i(e.uniforms.uColormap, 0)) : e.uniforms.uColormap && (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, null)), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position), e.attributes.value !== void 0 && e.attributes.value !== -1 && i.disableVertexAttribArray(e.attributes.value);
|
|
418
419
|
}
|
|
419
|
-
function
|
|
420
|
+
function Vt(i, e, t, n, s, o) {
|
|
420
421
|
i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
|
|
421
422
|
e.uniforms.uTranslate,
|
|
422
423
|
s.translate[0],
|
|
423
424
|
s.translate[1]
|
|
424
425
|
), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position);
|
|
425
426
|
}
|
|
426
|
-
function
|
|
427
|
+
function Xt(i, e, t, n, s, o, r = 1) {
|
|
427
428
|
i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
|
|
428
429
|
e.uniforms.uTranslate,
|
|
429
430
|
s.translate[0],
|
|
430
431
|
s.translate[1]
|
|
431
432
|
), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINES, 0, n), i.disableVertexAttribArray(e.attributes.position);
|
|
432
433
|
}
|
|
433
|
-
function
|
|
434
|
+
function Wt(i, e, t, n, s) {
|
|
434
435
|
const o = Be(s);
|
|
435
436
|
i.useProgram(e.line.program), i.bindBuffer(i.ARRAY_BUFFER, t.boxBuffer), i.enableVertexAttribArray(e.line.attributes.position), i.vertexAttribPointer(e.line.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.line.uniforms.uScale, n.scale[0], n.scale[1]), i.uniform2f(
|
|
436
437
|
e.line.uniforms.uTranslate,
|
|
@@ -444,7 +445,7 @@ function Be(i) {
|
|
|
444
445
|
const e = _(i.color ?? "#ff0055");
|
|
445
446
|
return e[3] = i.opacity ?? 1, e;
|
|
446
447
|
}
|
|
447
|
-
function
|
|
448
|
+
function Nt(i, e, t, n, s, o) {
|
|
448
449
|
const { bounds: r, backgroundColor: a = [0.1, 0.1, 0.18, 1], plotArea: l } = o, h = e.height, d = e.width, c = l ? {
|
|
449
450
|
x: l.x * t,
|
|
450
451
|
y: h - (l.y + l.height) * t,
|
|
@@ -467,110 +468,110 @@ function Vt(i, e, t, n, s, o) {
|
|
|
467
468
|
o.plotAreaBackground[2],
|
|
468
469
|
o.plotAreaBackground[3]
|
|
469
470
|
), i.clear(i.COLOR_BUFFER_BIT));
|
|
470
|
-
const f =
|
|
471
|
+
const f = $t(r, o.invertX);
|
|
471
472
|
for (const u of s) {
|
|
472
473
|
if (!u.visible || u.count === 0 && u.type !== "boxplot" && u.type !== "waterfall") continue;
|
|
473
|
-
const g = u.yBounds ? u.yBounds.min : r.yMin,
|
|
474
|
+
const g = u.yBounds ? u.yBounds.min : r.yMin, x = (u.yBounds ? u.yBounds.max : r.yMax) - g, b = x > 0 ? 2 / x : 1, S = -1 - g * b, p = {
|
|
474
475
|
scale: [f.scale[0], b],
|
|
475
|
-
translate: [f.translate[0],
|
|
476
|
-
},
|
|
476
|
+
translate: [f.translate[0], S]
|
|
477
|
+
}, v = Be(u.style);
|
|
477
478
|
if (u.type === "scatter")
|
|
478
479
|
Ae(
|
|
479
480
|
i,
|
|
480
481
|
n.pointProgram,
|
|
481
482
|
u.buffer,
|
|
482
483
|
u.count,
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
p,
|
|
485
|
+
v,
|
|
485
486
|
(u.style.pointSize ?? 4) * t,
|
|
486
487
|
u.style.symbol
|
|
487
488
|
);
|
|
488
489
|
else if (u.type === "line")
|
|
489
|
-
|
|
490
|
+
ye(
|
|
490
491
|
i,
|
|
491
492
|
n.lineProgram,
|
|
492
493
|
u.buffer,
|
|
493
494
|
u.count,
|
|
494
|
-
|
|
495
|
-
|
|
495
|
+
p,
|
|
496
|
+
v,
|
|
496
497
|
(u.style.width ?? 1) * t
|
|
497
498
|
);
|
|
498
499
|
else if (u.type === "line+scatter")
|
|
499
|
-
|
|
500
|
+
ye(
|
|
500
501
|
i,
|
|
501
502
|
n.lineProgram,
|
|
502
503
|
u.buffer,
|
|
503
504
|
u.count,
|
|
504
|
-
|
|
505
|
-
|
|
505
|
+
p,
|
|
506
|
+
v,
|
|
506
507
|
(u.style.width ?? 1) * t
|
|
507
508
|
), Ae(
|
|
508
509
|
i,
|
|
509
510
|
n.pointProgram,
|
|
510
511
|
u.buffer,
|
|
511
512
|
u.count,
|
|
512
|
-
|
|
513
|
-
|
|
513
|
+
p,
|
|
514
|
+
v,
|
|
514
515
|
(u.style.pointSize ?? 4) * t,
|
|
515
516
|
u.style.symbol
|
|
516
517
|
);
|
|
517
518
|
else if (u.type === "step" || u.type === "step+scatter")
|
|
518
|
-
u.stepBuffer && u.stepCount ?
|
|
519
|
+
u.stepBuffer && u.stepCount ? ye(
|
|
519
520
|
i,
|
|
520
521
|
n.lineProgram,
|
|
521
522
|
u.stepBuffer,
|
|
522
523
|
u.stepCount,
|
|
523
|
-
|
|
524
|
-
|
|
524
|
+
p,
|
|
525
|
+
v,
|
|
525
526
|
(u.style.width ?? 1) * t
|
|
526
|
-
) :
|
|
527
|
+
) : ye(
|
|
527
528
|
i,
|
|
528
529
|
n.lineProgram,
|
|
529
530
|
u.buffer,
|
|
530
531
|
u.count,
|
|
531
|
-
|
|
532
|
-
|
|
532
|
+
p,
|
|
533
|
+
v,
|
|
533
534
|
(u.style.width ?? 1) * t
|
|
534
535
|
), u.type === "step+scatter" && Ae(
|
|
535
536
|
i,
|
|
536
537
|
n.pointProgram,
|
|
537
538
|
u.buffer,
|
|
538
539
|
u.count,
|
|
539
|
-
|
|
540
|
-
|
|
540
|
+
p,
|
|
541
|
+
v,
|
|
541
542
|
(u.style.pointSize ?? 4) * t,
|
|
542
543
|
u.style.symbol
|
|
543
544
|
);
|
|
544
545
|
else if (u.type === "band")
|
|
545
|
-
|
|
546
|
+
Yt(
|
|
546
547
|
i,
|
|
547
548
|
n.lineProgram,
|
|
548
549
|
u.buffer,
|
|
549
550
|
u.count,
|
|
550
|
-
|
|
551
|
-
|
|
551
|
+
p,
|
|
552
|
+
v
|
|
552
553
|
);
|
|
553
554
|
else if (u.type === "heatmap")
|
|
554
|
-
|
|
555
|
+
_t(
|
|
555
556
|
i,
|
|
556
557
|
n.heatmapProgram,
|
|
557
558
|
u.buffer,
|
|
558
559
|
u.count,
|
|
559
|
-
|
|
560
|
+
p,
|
|
560
561
|
u.zBounds,
|
|
561
562
|
u.colormapTexture
|
|
562
563
|
);
|
|
563
564
|
else if (u.type === "bar")
|
|
564
|
-
|
|
565
|
+
Vt(
|
|
565
566
|
i,
|
|
566
567
|
n.lineProgram,
|
|
567
568
|
u.buffer,
|
|
568
569
|
u.count,
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
p,
|
|
571
|
+
v
|
|
571
572
|
);
|
|
572
573
|
else if (u.type === "boxplot")
|
|
573
|
-
u.boxBuffer && u.boxLinesBuffer &&
|
|
574
|
+
u.boxBuffer && u.boxLinesBuffer && Wt(
|
|
574
575
|
i,
|
|
575
576
|
{ line: n.lineProgram, point: n.pointProgram },
|
|
576
577
|
{
|
|
@@ -579,30 +580,30 @@ function Vt(i, e, t, n, s, o) {
|
|
|
579
580
|
linesBuffer: u.boxLinesBuffer,
|
|
580
581
|
linesCount: u.boxLinesCount || 0
|
|
581
582
|
},
|
|
582
|
-
|
|
583
|
+
p,
|
|
583
584
|
u.style
|
|
584
585
|
);
|
|
585
586
|
else if (u.type === "waterfall") {
|
|
586
587
|
const w = _(u.style.positiveColor || "#22c55e"), M = _(u.style.negativeColor || "#ef4444"), A = _(u.style.subtotalColor || "#3b82f6"), k = _(u.style.connectorColor || "#64748b");
|
|
587
|
-
u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale,
|
|
588
|
+
u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, w[0], w[1], w[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfPositiveCount)), u.wfNegativeBuffer && u.wfNegativeCount && u.wfNegativeCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfNegativeBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, M[0], M[1], M[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfNegativeCount)), u.wfSubtotalBuffer && u.wfSubtotalCount && u.wfSubtotalCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfSubtotalBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, A[0], A[1], A[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfSubtotalCount)), u.style.showConnectors !== !1 && u.wfConnectorBuffer && u.wfConnectorCount && u.wfConnectorCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfConnectorBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, k[0], k[1], k[2], 0.6), i.lineWidth(1), i.drawArrays(i.LINES, 0, u.wfConnectorCount)), i.disableVertexAttribArray(n.lineProgram.attributes.position);
|
|
588
589
|
}
|
|
589
590
|
if (u.errorBuffer && u.errorCount) {
|
|
590
|
-
const w = u.style.errorBars || {}, M = w.color ? Be({ color: w.color, opacity: w.opacity ?? 0.7 }) :
|
|
591
|
-
|
|
591
|
+
const w = u.style.errorBars || {}, M = w.color ? Be({ color: w.color, opacity: w.opacity ?? 0.7 }) : v;
|
|
592
|
+
Xt(
|
|
592
593
|
i,
|
|
593
594
|
n.lineProgram,
|
|
594
595
|
u.errorBuffer,
|
|
595
596
|
u.errorCount,
|
|
596
|
-
|
|
597
|
+
p,
|
|
597
598
|
M,
|
|
598
599
|
w.width ?? 1
|
|
599
600
|
);
|
|
600
601
|
}
|
|
601
602
|
}
|
|
602
603
|
}
|
|
603
|
-
class
|
|
604
|
+
class Ht {
|
|
604
605
|
constructor(e) {
|
|
605
|
-
|
|
606
|
+
m(this, "textures", /* @__PURE__ */ new Map());
|
|
606
607
|
this.gl = e;
|
|
607
608
|
}
|
|
608
609
|
createColormapTexture(e, t) {
|
|
@@ -629,13 +630,13 @@ class Wt {
|
|
|
629
630
|
}
|
|
630
631
|
class Pe {
|
|
631
632
|
constructor(e) {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
633
|
+
m(this, "canvas");
|
|
634
|
+
m(this, "gl");
|
|
635
|
+
m(this, "dpr");
|
|
636
|
+
m(this, "programs");
|
|
637
|
+
m(this, "buffers");
|
|
638
|
+
m(this, "textures");
|
|
639
|
+
m(this, "isInitialized", !1);
|
|
639
640
|
this.canvas = e, this.dpr = window.devicePixelRatio || 1;
|
|
640
641
|
const t = e.getContext("webgl", {
|
|
641
642
|
alpha: !0,
|
|
@@ -644,10 +645,10 @@ class Pe {
|
|
|
644
645
|
powerPreference: "high-performance"
|
|
645
646
|
});
|
|
646
647
|
if (!t) throw new Error("WebGL not supported");
|
|
647
|
-
this.gl = t, this.programs =
|
|
648
|
+
this.gl = t, this.programs = It(t), this.buffers = new Mt(t), this.textures = new Ht(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
|
|
648
649
|
}
|
|
649
650
|
setDPR(e) {
|
|
650
|
-
this.dpr = e
|
|
651
|
+
this.dpr = e;
|
|
651
652
|
}
|
|
652
653
|
get available() {
|
|
653
654
|
return this.isInitialized;
|
|
@@ -674,7 +675,7 @@ class Pe {
|
|
|
674
675
|
return this.textures.getTexture(e);
|
|
675
676
|
}
|
|
676
677
|
render(e, t) {
|
|
677
|
-
this.isInitialized &&
|
|
678
|
+
this.isInitialized && Nt(this.gl, this.canvas, this.dpr, this.programs, e, t);
|
|
678
679
|
}
|
|
679
680
|
resize() {
|
|
680
681
|
const e = this.canvas.getBoundingClientRect(), t = Math.round(e.width * this.dpr), n = Math.round(e.height * this.dpr);
|
|
@@ -695,11 +696,11 @@ class Pe {
|
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
698
|
const ze = {};
|
|
698
|
-
class
|
|
699
|
+
class Ut {
|
|
699
700
|
constructor(e, t) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
701
|
+
m(this, "gpu");
|
|
702
|
+
m(this, "dpr");
|
|
703
|
+
m(this, "canvas");
|
|
703
704
|
this.gpu = e, this.canvas = t, this.dpr = window.devicePixelRatio || 1;
|
|
704
705
|
}
|
|
705
706
|
get available() {
|
|
@@ -756,9 +757,9 @@ class Xt {
|
|
|
756
757
|
this.gpu.destroy();
|
|
757
758
|
}
|
|
758
759
|
}
|
|
759
|
-
async function
|
|
760
|
-
const t = new
|
|
761
|
-
return await t.init() ? new
|
|
760
|
+
async function qt(i, e = {}) {
|
|
761
|
+
const t = new ft(i, e);
|
|
762
|
+
return await t.init() ? new Ut(t, i) : null;
|
|
762
763
|
}
|
|
763
764
|
const Ee = {
|
|
764
765
|
name: "vibrant",
|
|
@@ -807,7 +808,7 @@ const Ee = {
|
|
|
807
808
|
],
|
|
808
809
|
highlightColor: "#FFFFFF"
|
|
809
810
|
// Pure White
|
|
810
|
-
},
|
|
811
|
+
}, Ke = {
|
|
811
812
|
name: "pastel",
|
|
812
813
|
isDark: !1,
|
|
813
814
|
colors: [
|
|
@@ -854,7 +855,7 @@ const Ee = {
|
|
|
854
855
|
],
|
|
855
856
|
highlightColor: "#1A1A1A"
|
|
856
857
|
// Near Black
|
|
857
|
-
},
|
|
858
|
+
}, Gt = {
|
|
858
859
|
name: "neon",
|
|
859
860
|
isDark: !0,
|
|
860
861
|
colors: [
|
|
@@ -901,7 +902,7 @@ const Ee = {
|
|
|
901
902
|
],
|
|
902
903
|
highlightColor: "#FFFFFF"
|
|
903
904
|
// Pure White
|
|
904
|
-
},
|
|
905
|
+
}, jt = {
|
|
905
906
|
name: "earth",
|
|
906
907
|
isDark: !1,
|
|
907
908
|
colors: [
|
|
@@ -948,7 +949,7 @@ const Ee = {
|
|
|
948
949
|
],
|
|
949
950
|
highlightColor: "#000000"
|
|
950
951
|
// Pure Black
|
|
951
|
-
},
|
|
952
|
+
}, Qt = {
|
|
952
953
|
name: "ocean",
|
|
953
954
|
isDark: !0,
|
|
954
955
|
colors: [
|
|
@@ -995,21 +996,21 @@ const Ee = {
|
|
|
995
996
|
],
|
|
996
997
|
highlightColor: "#FFD700"
|
|
997
998
|
// Gold
|
|
998
|
-
},
|
|
999
|
+
}, Zt = [
|
|
999
1000
|
Ee,
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1001
|
+
Ke,
|
|
1002
|
+
Gt,
|
|
1003
|
+
jt,
|
|
1004
|
+
Qt
|
|
1004
1005
|
];
|
|
1005
1006
|
function Oe(i) {
|
|
1006
|
-
const e =
|
|
1007
|
+
const e = Zt.find((t) => t.name === i);
|
|
1007
1008
|
return e || (console.warn(`[ColorScheme] Unknown scheme "${i}", using vibrant`), Ee);
|
|
1008
1009
|
}
|
|
1009
1010
|
function $e(i) {
|
|
1010
|
-
return i ? Ee :
|
|
1011
|
+
return i ? Ee : Ke;
|
|
1011
1012
|
}
|
|
1012
|
-
const
|
|
1013
|
+
const H = {
|
|
1013
1014
|
lineColor: "#666666",
|
|
1014
1015
|
// Brighter
|
|
1015
1016
|
lineWidth: 1,
|
|
@@ -1073,14 +1074,14 @@ const U = {
|
|
|
1073
1074
|
minorColor: "rgba(255, 255, 255, 0.04)"
|
|
1074
1075
|
},
|
|
1075
1076
|
xAxis: {
|
|
1076
|
-
...
|
|
1077
|
+
...H,
|
|
1077
1078
|
labelColor: "#adbac7",
|
|
1078
1079
|
titleColor: "#cdd9e5",
|
|
1079
1080
|
lineColor: "#444c56",
|
|
1080
1081
|
tickColor: "#444c56"
|
|
1081
1082
|
},
|
|
1082
1083
|
yAxis: {
|
|
1083
|
-
...
|
|
1084
|
+
...H,
|
|
1084
1085
|
labelColor: "#adbac7",
|
|
1085
1086
|
titleColor: "#cdd9e5",
|
|
1086
1087
|
lineColor: "#444c56",
|
|
@@ -1089,7 +1090,7 @@ const U = {
|
|
|
1089
1090
|
legend: be,
|
|
1090
1091
|
cursor: ve,
|
|
1091
1092
|
toolbar: Re
|
|
1092
|
-
},
|
|
1093
|
+
}, Jt = {
|
|
1093
1094
|
name: "midnight",
|
|
1094
1095
|
isDark: !0,
|
|
1095
1096
|
backgroundColor: "#05050a",
|
|
@@ -1101,14 +1102,14 @@ const U = {
|
|
|
1101
1102
|
minorColor: "rgba(150, 150, 255, 0.08)"
|
|
1102
1103
|
},
|
|
1103
1104
|
xAxis: {
|
|
1104
|
-
...
|
|
1105
|
+
...H,
|
|
1105
1106
|
lineColor: "#5a5a8a",
|
|
1106
1107
|
labelColor: "#b0b0e0",
|
|
1107
1108
|
titleColor: "#d0d0f0",
|
|
1108
1109
|
tickColor: "#5a5a8a"
|
|
1109
1110
|
},
|
|
1110
1111
|
yAxis: {
|
|
1111
|
-
...
|
|
1112
|
+
...H,
|
|
1112
1113
|
lineColor: "#5a5a8a",
|
|
1113
1114
|
labelColor: "#b0b0e0",
|
|
1114
1115
|
titleColor: "#d0d0f0",
|
|
@@ -1128,7 +1129,7 @@ const U = {
|
|
|
1128
1129
|
...ve,
|
|
1129
1130
|
lineColor: "rgba(150, 150, 255, 0.7)"
|
|
1130
1131
|
}
|
|
1131
|
-
},
|
|
1132
|
+
}, Kt = {
|
|
1132
1133
|
name: "light",
|
|
1133
1134
|
isDark: !1,
|
|
1134
1135
|
backgroundColor: "#ffffff",
|
|
@@ -1140,14 +1141,14 @@ const U = {
|
|
|
1140
1141
|
minorColor: "rgba(0, 0, 0, 0.04)"
|
|
1141
1142
|
},
|
|
1142
1143
|
xAxis: {
|
|
1143
|
-
...
|
|
1144
|
+
...H,
|
|
1144
1145
|
lineColor: "#888888",
|
|
1145
1146
|
tickColor: "#888888",
|
|
1146
1147
|
labelColor: "#444444",
|
|
1147
1148
|
titleColor: "#222222"
|
|
1148
1149
|
},
|
|
1149
1150
|
yAxis: {
|
|
1150
|
-
...
|
|
1151
|
+
...H,
|
|
1151
1152
|
lineColor: "#888888",
|
|
1152
1153
|
tickColor: "#888888",
|
|
1153
1154
|
labelColor: "#444444",
|
|
@@ -1169,7 +1170,7 @@ const U = {
|
|
|
1169
1170
|
lineColor: "rgba(0, 0, 0, 0.4)",
|
|
1170
1171
|
tooltipBackground: "rgba(50, 50, 60, 0.95)"
|
|
1171
1172
|
}
|
|
1172
|
-
},
|
|
1173
|
+
}, ei = {
|
|
1173
1174
|
name: "electrochemistry",
|
|
1174
1175
|
isDark: !0,
|
|
1175
1176
|
backgroundColor: "#0a1628",
|
|
@@ -1183,14 +1184,14 @@ const U = {
|
|
|
1183
1184
|
minorDivisions: 2
|
|
1184
1185
|
},
|
|
1185
1186
|
xAxis: {
|
|
1186
|
-
...
|
|
1187
|
+
...H,
|
|
1187
1188
|
lineColor: "#1e88e5",
|
|
1188
1189
|
tickColor: "#42a5f5",
|
|
1189
1190
|
labelColor: "#90caf9",
|
|
1190
1191
|
titleColor: "#bbdefb"
|
|
1191
1192
|
},
|
|
1192
1193
|
yAxis: {
|
|
1193
|
-
...
|
|
1194
|
+
...H,
|
|
1194
1195
|
lineColor: "#1e88e5",
|
|
1195
1196
|
tickColor: "#42a5f5",
|
|
1196
1197
|
labelColor: "#90caf9",
|
|
@@ -1211,7 +1212,7 @@ const U = {
|
|
|
1211
1212
|
lineColor: "rgba(100, 180, 255, 0.6)"
|
|
1212
1213
|
}
|
|
1213
1214
|
};
|
|
1214
|
-
function
|
|
1215
|
+
function os(i, e) {
|
|
1215
1216
|
return {
|
|
1216
1217
|
...i,
|
|
1217
1218
|
...e,
|
|
@@ -1223,35 +1224,56 @@ function Gn(i, e) {
|
|
|
1223
1224
|
toolbar: { ...i.toolbar, ...e.toolbar }
|
|
1224
1225
|
};
|
|
1225
1226
|
}
|
|
1226
|
-
function
|
|
1227
|
+
function et(i) {
|
|
1227
1228
|
switch (i) {
|
|
1228
1229
|
case "dark":
|
|
1229
1230
|
return Te;
|
|
1230
1231
|
case "midnight":
|
|
1231
|
-
return
|
|
1232
|
+
return Jt;
|
|
1232
1233
|
case "light":
|
|
1233
|
-
return
|
|
1234
|
+
return Kt;
|
|
1234
1235
|
case "electrochemistry":
|
|
1235
1236
|
case "electrochem":
|
|
1236
|
-
return
|
|
1237
|
+
return ei;
|
|
1237
1238
|
default:
|
|
1238
1239
|
return console.warn(`[Theme] Unknown theme "${i}", using dark`), Te;
|
|
1239
1240
|
}
|
|
1240
1241
|
}
|
|
1241
|
-
const
|
|
1242
|
+
const ti = Te;
|
|
1242
1243
|
function Y(i) {
|
|
1243
1244
|
return Math.floor(i) + 0.5;
|
|
1244
1245
|
}
|
|
1245
|
-
function
|
|
1246
|
+
function he(i) {
|
|
1246
1247
|
return Math.round(i);
|
|
1247
1248
|
}
|
|
1248
|
-
class
|
|
1249
|
+
class ii {
|
|
1249
1250
|
constructor(e, t) {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1251
|
+
m(this, "ctx");
|
|
1252
|
+
m(this, "theme");
|
|
1253
|
+
m(this, "latexAPI", null);
|
|
1254
|
+
m(this, "businessDayMapping", null);
|
|
1253
1255
|
this.ctx = e, this.theme = t;
|
|
1254
1256
|
}
|
|
1257
|
+
setBusinessDayMapping(e) {
|
|
1258
|
+
this.businessDayMapping = e;
|
|
1259
|
+
}
|
|
1260
|
+
/** Filter X ticks to valid business-day indices (unique integers in range). */
|
|
1261
|
+
filterBusinessDayXTicks(e) {
|
|
1262
|
+
const t = this.businessDayMapping;
|
|
1263
|
+
if (!t) return e;
|
|
1264
|
+
const n = t.timeByIndex.length - 1;
|
|
1265
|
+
if (n < 0) return [];
|
|
1266
|
+
const s = /* @__PURE__ */ new Set(), o = [];
|
|
1267
|
+
for (const r of e) {
|
|
1268
|
+
const a = Math.round(r);
|
|
1269
|
+
a >= 0 && a <= n && !s.has(a) && (s.add(a), o.push(a));
|
|
1270
|
+
}
|
|
1271
|
+
return o;
|
|
1272
|
+
}
|
|
1273
|
+
resolveXTicks(e, t) {
|
|
1274
|
+
const n = e.ticks(t);
|
|
1275
|
+
return this.filterBusinessDayXTicks(n);
|
|
1276
|
+
}
|
|
1255
1277
|
/**
|
|
1256
1278
|
* Set LaTeX API for rendering mathematical expressions
|
|
1257
1279
|
*/
|
|
@@ -1300,7 +1322,7 @@ class Kt {
|
|
|
1300
1322
|
*/
|
|
1301
1323
|
drawGrid(e, t, n, s, o) {
|
|
1302
1324
|
if (!this.theme.grid.visible) return;
|
|
1303
|
-
const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d =
|
|
1325
|
+
const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = this.resolveXTicks(t, l), c = n.ticks(h);
|
|
1304
1326
|
if (r.strokeStyle = a.majorColor, r.lineWidth = a.majorWidth, r.setLineDash(a.majorDash), r.beginPath(), d.forEach((f) => {
|
|
1305
1327
|
const u = Y(t.transform(f));
|
|
1306
1328
|
u >= e.x && u <= e.x + e.width && (r.moveTo(u, e.y), r.lineTo(u, e.y + e.height));
|
|
@@ -1356,22 +1378,44 @@ class Kt {
|
|
|
1356
1378
|
* Draw X axis with ticks and labels
|
|
1357
1379
|
*/
|
|
1358
1380
|
drawXAxis(e, t, n, s) {
|
|
1359
|
-
const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l =
|
|
1360
|
-
if (c && (o.strokeStyle = r.lineColor, o.lineWidth = r.lineWidth, o.beginPath(), o.moveTo(e.x, h), o.lineTo(e.x + e.width, h), o.stroke()),
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
fontFamily: r.fontFamily,
|
|
1369
|
-
color: r.labelColor,
|
|
1370
|
-
align: "center",
|
|
1371
|
-
baseline: "top"
|
|
1381
|
+
const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l = this.resolveXTicks(t, a), h = Y(e.y + e.height), d = n == null ? void 0 : n.label, c = (n == null ? void 0 : n.showLine) !== !1, f = (n == null ? void 0 : n.showTicks) !== !1, u = (n == null ? void 0 : n.showLabels) !== !1, g = t.domain[1] - t.domain[0];
|
|
1382
|
+
if (c && (o.strokeStyle = r.lineColor, o.lineWidth = r.lineWidth, o.beginPath(), o.moveTo(e.x, h), o.lineTo(e.x + e.width, h), o.stroke()), f || u) {
|
|
1383
|
+
o.fillStyle = r.labelColor, o.font = `${r.labelSize}px ${r.fontFamily}`;
|
|
1384
|
+
const y = [];
|
|
1385
|
+
for (const p of l) {
|
|
1386
|
+
const v = he(t.transform(p));
|
|
1387
|
+
if (v >= e.x && v <= e.x + e.width) {
|
|
1388
|
+
const w = u ? this.formatXTick(p, n, g) : "";
|
|
1389
|
+
(!u || w) && y.push({ tick: p, x: v, label: w });
|
|
1372
1390
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1391
|
+
}
|
|
1392
|
+
let x = !1;
|
|
1393
|
+
if (u && y.length > 1) {
|
|
1394
|
+
let p = 0;
|
|
1395
|
+
for (const w of y)
|
|
1396
|
+
p = Math.max(p, o.measureText(w.label).width);
|
|
1397
|
+
let v = 1 / 0;
|
|
1398
|
+
for (let w = 1; w < y.length; w++)
|
|
1399
|
+
v = Math.min(v, y[w].x - y[w - 1].x);
|
|
1400
|
+
x = p + 8 > v;
|
|
1401
|
+
}
|
|
1402
|
+
const b = h + r.tickLength + (x ? 6 : 3), S = x ? -Math.PI / 4 : void 0;
|
|
1403
|
+
for (const p of y)
|
|
1404
|
+
f && (o.strokeStyle = r.tickColor, o.beginPath(), o.moveTo(p.x, h), o.lineTo(p.x, h + r.tickLength), o.stroke()), u && p.label && this.drawLatexOrText(
|
|
1405
|
+
p.label,
|
|
1406
|
+
p.x,
|
|
1407
|
+
b,
|
|
1408
|
+
{
|
|
1409
|
+
fontSize: r.labelSize,
|
|
1410
|
+
fontFamily: r.fontFamily,
|
|
1411
|
+
color: r.labelColor,
|
|
1412
|
+
align: x ? "right" : "center",
|
|
1413
|
+
baseline: x ? "middle" : "top",
|
|
1414
|
+
rotation: S
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
if (d) {
|
|
1375
1419
|
const y = (s == null ? void 0 : s.titleGap) ?? 45;
|
|
1376
1420
|
this.drawLatexOrText(d, e.x + e.width / 2, e.y + e.height + y, {
|
|
1377
1421
|
fontSize: r.titleSize,
|
|
@@ -1386,12 +1430,12 @@ class Kt {
|
|
|
1386
1430
|
* Draw Y axis with ticks and labels
|
|
1387
1431
|
*/
|
|
1388
1432
|
drawYAxis(e, t, n, s = "left", o = 0, r) {
|
|
1389
|
-
const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = Y(s === "left" ? e.x - o : e.x + e.width + o),
|
|
1433
|
+
const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = Y(s === "left" ? e.x - o : e.x + e.width + o), x = s === "left" ? -1 : 1;
|
|
1390
1434
|
if (f && (a.strokeStyle = l.lineColor, a.lineWidth = l.lineWidth, a.beginPath(), a.moveTo(y, e.y), a.lineTo(y, e.y + e.height), a.stroke()), (u || g) && (a.fillStyle = l.labelColor, a.font = `${l.labelSize}px ${l.fontFamily}`, a.textAlign = s === "left" ? "right" : "left", a.textBaseline = "middle", d.forEach((b) => {
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1393
|
-
const
|
|
1394
|
-
this.drawLatexOrText(this.formatYTick(b, n),
|
|
1435
|
+
const S = he(t.transform(b));
|
|
1436
|
+
if (S >= e.y && S <= e.y + e.height && (u && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(y, S), a.lineTo(y + l.tickLength * x, S), a.stroke()), g)) {
|
|
1437
|
+
const p = y + (l.tickLength + 3) * x;
|
|
1438
|
+
this.drawLatexOrText(this.formatYTick(b, n), p, S, {
|
|
1395
1439
|
fontSize: l.labelSize,
|
|
1396
1440
|
fontFamily: l.fontFamily,
|
|
1397
1441
|
color: l.labelColor,
|
|
@@ -1400,8 +1444,8 @@ class Kt {
|
|
|
1400
1444
|
});
|
|
1401
1445
|
}
|
|
1402
1446
|
})), c) {
|
|
1403
|
-
const b = (r == null ? void 0 : r.titleGap) ?? 50,
|
|
1404
|
-
this.drawLatexOrText(c,
|
|
1447
|
+
const b = (r == null ? void 0 : r.titleGap) ?? 50, S = s === "left" ? y - b : y + b, p = e.y + e.height / 2;
|
|
1448
|
+
this.drawLatexOrText(c, S, p, {
|
|
1405
1449
|
fontSize: l.titleSize,
|
|
1406
1450
|
fontFamily: l.fontFamily,
|
|
1407
1451
|
color: l.titleColor,
|
|
@@ -1448,8 +1492,8 @@ class Kt {
|
|
|
1448
1492
|
let o = 0;
|
|
1449
1493
|
const r = t.map((f) => {
|
|
1450
1494
|
const u = f.getId(), g = f.getStyle(), y = this.latexAPI && (u.includes("\\") || u.includes("^") || u.includes("_"));
|
|
1451
|
-
let
|
|
1452
|
-
return y ?
|
|
1495
|
+
let x = 0;
|
|
1496
|
+
return y ? x = this.latexAPI.measure(u, { fontSize: s.fontSize }).width : x = n.measureText(u).width, o = Math.max(o, x), {
|
|
1453
1497
|
id: f.getId(),
|
|
1454
1498
|
color: g.color ?? "#ff0055",
|
|
1455
1499
|
label: u,
|
|
@@ -1477,10 +1521,10 @@ class Kt {
|
|
|
1477
1521
|
n.fillStyle = s.backgroundColor, n.strokeStyle = s.borderColor, n.lineWidth = 1, n.beginPath();
|
|
1478
1522
|
const c = s.borderRadius;
|
|
1479
1523
|
n.moveTo(h + c, d), n.lineTo(h + a - c, d), n.arcTo(h + a, d, h + a, d + c, c), n.lineTo(h + a, d + l - c), n.arcTo(h + a, d + l, h + a - c, d + l, c), n.lineTo(h + c, d + l), n.arcTo(h, d + l, h, d + l - c, c), n.lineTo(h, d + c), n.arcTo(h, d, h + c, d, c), n.closePath(), n.fill(), n.stroke(), n.textAlign = "left", n.textBaseline = "middle", r.forEach((f, u) => {
|
|
1480
|
-
const g = d + s.padding + u * (s.swatchSize + s.itemGap), y = h + s.padding,
|
|
1524
|
+
const g = d + s.padding + u * (s.swatchSize + s.itemGap), y = h + s.padding, x = g + s.swatchSize / 2, b = y + s.swatchSize / 2;
|
|
1481
1525
|
n.save(), n.globalAlpha = f.opacity, n.fillStyle = f.color, n.strokeStyle = f.color, n.lineWidth = 2;
|
|
1482
|
-
const
|
|
1483
|
-
w ? this.drawLegendSymbol(n, f.symbol ?? "circle", b,
|
|
1526
|
+
const S = s.swatchSize, p = String(f.type).toLowerCase(), v = !!f.symbol && f.symbol !== "circle", w = p === "scatter" || p === "1" || p === "line" && v, M = p.includes("scatter") || p === "2";
|
|
1527
|
+
w ? this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, S * 0.9) : M ? (n.beginPath(), n.moveTo(y, x), n.lineTo(y + S, x), n.stroke(), this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, S * 0.6)) : (n.beginPath(), n.moveTo(y, x), n.lineTo(y + S, x), n.stroke()), n.restore(), this.drawLatexOrText(f.label, h + s.padding + s.swatchSize + 8, x, {
|
|
1484
1528
|
fontSize: s.fontSize,
|
|
1485
1529
|
fontFamily: s.fontFamily,
|
|
1486
1530
|
color: s.textColor,
|
|
@@ -1554,29 +1598,29 @@ class Kt {
|
|
|
1554
1598
|
let d = 0;
|
|
1555
1599
|
const c = [];
|
|
1556
1600
|
let f = 0;
|
|
1557
|
-
a.forEach((
|
|
1558
|
-
if (!!this.latexAPI && (
|
|
1559
|
-
const w = this.latexAPI.measure(
|
|
1601
|
+
a.forEach((p) => {
|
|
1602
|
+
if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
|
|
1603
|
+
const w = this.latexAPI.measure(p, { fontSize: r.tooltipSize });
|
|
1560
1604
|
d = Math.max(d, w.width);
|
|
1561
1605
|
const M = Math.max(l, w.height);
|
|
1562
1606
|
c.push(M), f += M;
|
|
1563
1607
|
} else
|
|
1564
|
-
d = Math.max(d, o.measureText(
|
|
1608
|
+
d = Math.max(d, o.measureText(p).width), c.push(l), f += l;
|
|
1565
1609
|
});
|
|
1566
1610
|
const u = d + h * 2, g = f + h * 2 - 4;
|
|
1567
|
-
let y = e + 15,
|
|
1568
|
-
y + u > s.x + s.width && (y = e - u - 15),
|
|
1611
|
+
let y = e + 15, x = t - g - 10;
|
|
1612
|
+
y + u > s.x + s.width && (y = e - u - 15), x < s.y && (x = t + 15), o.fillStyle = r.tooltipBackground, o.strokeStyle = r.tooltipBorder, o.lineWidth = 1, o.beginPath();
|
|
1569
1613
|
const b = 4;
|
|
1570
|
-
o.moveTo(y + b,
|
|
1571
|
-
let
|
|
1572
|
-
a.forEach((
|
|
1573
|
-
this.drawLatexOrText(
|
|
1614
|
+
o.moveTo(y + b, x), o.lineTo(y + u - b, x), o.arcTo(y + u, x, y + u, x + b, b), o.lineTo(y + u, x + g - b), o.arcTo(y + u, x + g, y + u - b, x + g, b), o.lineTo(y + b, x + g), o.arcTo(y, x + g, y, x + g - b, b), o.lineTo(y, x + b), o.arcTo(y, x, y + b, x, b), o.closePath(), o.fill(), o.stroke();
|
|
1615
|
+
let S = x + h;
|
|
1616
|
+
a.forEach((p, v) => {
|
|
1617
|
+
this.drawLatexOrText(p, y + h, S, {
|
|
1574
1618
|
fontSize: r.tooltipSize,
|
|
1575
1619
|
fontFamily: this.theme.xAxis.fontFamily,
|
|
1576
1620
|
color: r.tooltipColor,
|
|
1577
1621
|
align: "left",
|
|
1578
1622
|
baseline: "top"
|
|
1579
|
-
}),
|
|
1623
|
+
}), S += c[v];
|
|
1580
1624
|
});
|
|
1581
1625
|
}
|
|
1582
1626
|
/**
|
|
@@ -1588,43 +1632,43 @@ class Kt {
|
|
|
1588
1632
|
let d = 0;
|
|
1589
1633
|
const c = [];
|
|
1590
1634
|
let f = 0;
|
|
1591
|
-
r.forEach((
|
|
1592
|
-
if (!!this.latexAPI && (
|
|
1593
|
-
const w = this.latexAPI.measure(
|
|
1635
|
+
r.forEach((p) => {
|
|
1636
|
+
if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
|
|
1637
|
+
const w = this.latexAPI.measure(p, { fontSize: o.tooltipSize });
|
|
1594
1638
|
d = Math.max(d, w.width);
|
|
1595
1639
|
const M = Math.max(a, w.height);
|
|
1596
1640
|
c.push(M), f += M;
|
|
1597
1641
|
} else
|
|
1598
|
-
d = Math.max(d, s.measureText(
|
|
1642
|
+
d = Math.max(d, s.measureText(p).width), c.push(a), f += a;
|
|
1599
1643
|
});
|
|
1600
1644
|
const u = d + l * 2, g = f + l * 2 - 4;
|
|
1601
|
-
let y,
|
|
1645
|
+
let y, x;
|
|
1602
1646
|
switch (n) {
|
|
1603
1647
|
case "top-left":
|
|
1604
|
-
y = t.x + h,
|
|
1648
|
+
y = t.x + h, x = t.y + h;
|
|
1605
1649
|
break;
|
|
1606
1650
|
case "top-right":
|
|
1607
|
-
y = t.x + t.width - u - h,
|
|
1651
|
+
y = t.x + t.width - u - h, x = t.y + h;
|
|
1608
1652
|
break;
|
|
1609
1653
|
case "bottom-left":
|
|
1610
|
-
y = t.x + h,
|
|
1654
|
+
y = t.x + h, x = t.y + t.height - g - h;
|
|
1611
1655
|
break;
|
|
1612
1656
|
case "bottom-right":
|
|
1613
|
-
y = t.x + t.width - u - h,
|
|
1657
|
+
y = t.x + t.width - u - h, x = t.y + t.height - g - h;
|
|
1614
1658
|
break;
|
|
1615
1659
|
}
|
|
1616
1660
|
s.fillStyle = o.tooltipBackground, s.strokeStyle = o.tooltipBorder, s.lineWidth = 1, s.beginPath();
|
|
1617
1661
|
const b = 4;
|
|
1618
|
-
s.moveTo(y + b,
|
|
1619
|
-
let
|
|
1620
|
-
r.forEach((
|
|
1621
|
-
this.drawLatexOrText(
|
|
1662
|
+
s.moveTo(y + b, x), s.lineTo(y + u - b, x), s.arcTo(y + u, x, y + u, x + b, b), s.lineTo(y + u, x + g - b), s.arcTo(y + u, x + g, y + u - b, x + g, b), s.lineTo(y + b, x + g), s.arcTo(y, x + g, y, x + g - b, b), s.lineTo(y, x + b), s.arcTo(y, x, y + b, x, b), s.closePath(), s.fill(), s.stroke();
|
|
1663
|
+
let S = x + l;
|
|
1664
|
+
r.forEach((p, v) => {
|
|
1665
|
+
this.drawLatexOrText(p, y + l, S, {
|
|
1622
1666
|
fontSize: o.tooltipSize,
|
|
1623
1667
|
fontFamily: this.theme.xAxis.fontFamily,
|
|
1624
1668
|
color: o.tooltipColor,
|
|
1625
1669
|
align: "left",
|
|
1626
1670
|
baseline: "top"
|
|
1627
|
-
}),
|
|
1671
|
+
}), S += c[v];
|
|
1628
1672
|
});
|
|
1629
1673
|
}
|
|
1630
1674
|
/**
|
|
@@ -1644,17 +1688,17 @@ class Kt {
|
|
|
1644
1688
|
const h = l.color ?? a.color ?? "#ff0055", d = l.width ?? 1, c = l.capWidth ?? 6, f = l.showCaps !== !1, u = l.opacity ?? 0.7, g = l.direction ?? "both";
|
|
1645
1689
|
o.save(), o.beginPath(), o.rect(e.x, e.y, e.width, e.height), o.clip(), o.strokeStyle = h, o.lineWidth = d, o.globalAlpha = u;
|
|
1646
1690
|
for (let y = 0; y < r.x.length; y++) {
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1649
|
-
const
|
|
1650
|
-
if (
|
|
1651
|
-
const [
|
|
1652
|
-
o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(
|
|
1691
|
+
const x = n.transform(r.x[y]), b = s.transform(r.y[y]);
|
|
1692
|
+
if (x < e.x || x > e.x + e.width || b < e.y || b > e.y + e.height) continue;
|
|
1693
|
+
const S = t.getYError(y);
|
|
1694
|
+
if (S) {
|
|
1695
|
+
const [v, w] = S, M = r.y[y], A = s.transform(M + w), k = s.transform(M - v);
|
|
1696
|
+
o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(x, A), f && (o.moveTo(x - c / 2, A), o.lineTo(x + c / 2, A))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(x, k), f && (o.moveTo(x - c / 2, k), o.lineTo(x + c / 2, k))), o.stroke();
|
|
1653
1697
|
}
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
const [
|
|
1657
|
-
o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(
|
|
1698
|
+
const p = t.getXError(y);
|
|
1699
|
+
if (p) {
|
|
1700
|
+
const [v, w] = p, M = r.x[y], A = n.transform(M + w), k = n.transform(M - v);
|
|
1701
|
+
o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(A, b), f && (o.moveTo(A, b - c / 2), o.lineTo(A, b + c / 2))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(k, b), f && (o.moveTo(k, b - c / 2), o.lineTo(k, b + c / 2))), o.stroke();
|
|
1658
1702
|
}
|
|
1659
1703
|
}
|
|
1660
1704
|
o.restore();
|
|
@@ -1673,7 +1717,7 @@ class Kt {
|
|
|
1673
1717
|
return n;
|
|
1674
1718
|
}
|
|
1675
1719
|
formatXTick(e, t, n) {
|
|
1676
|
-
return qe(e, t, n);
|
|
1720
|
+
return qe(e, t, n, this.businessDayMapping);
|
|
1677
1721
|
}
|
|
1678
1722
|
formatYTick(e, t) {
|
|
1679
1723
|
return Ge(e, t);
|
|
@@ -1692,34 +1736,46 @@ class Kt {
|
|
|
1692
1736
|
k < M && (M = k, w = A);
|
|
1693
1737
|
}
|
|
1694
1738
|
return w;
|
|
1695
|
-
})(), y = u.position ?? "aboveBar",
|
|
1696
|
-
a.save(), a.fillStyle =
|
|
1739
|
+
})(), y = u.position ?? "aboveBar", x = y === "belowBar" ? d[g] : y === "inBar" ? c[g] : h[g], b = e.x + n.transform(l[g]), S = e.y + s.transform(x), p = u.color ?? "#22c55e", v = y === "belowBar" ? 10 : -10;
|
|
1740
|
+
a.save(), a.fillStyle = p, a.strokeStyle = p, a.lineWidth = 1.5, u.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, S - v), a.lineTo(b - 5, S - v - 8), a.lineTo(b + 5, S - v - 8), a.closePath(), a.fill()) : u.shape === "circle" ? (a.beginPath(), a.arc(b, S + v, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, S + v), a.lineTo(b - 5, S + v + 8), a.lineTo(b + 5, S + v + 8), a.closePath(), a.fill()), u.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(u.text, b, S + v + (y === "belowBar" ? 20 : -14))), a.restore();
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
/** Horizontal dashed lines for active price alerts (Stage 2.19). */
|
|
1744
|
+
drawPriceAlertLines(e, t, n) {
|
|
1745
|
+
if (!t.length) return;
|
|
1746
|
+
const { ctx: s } = this;
|
|
1747
|
+
s.save();
|
|
1748
|
+
for (const o of t) {
|
|
1749
|
+
const r = he(n.transform(o.price));
|
|
1750
|
+
r < e.y || r > e.y + e.height || (s.strokeStyle = o.direction === "below" ? "rgba(239, 68, 68, 0.7)" : o.direction === "above" ? "rgba(34, 197, 94, 0.7)" : "rgba(250, 204, 21, 0.8)", s.lineWidth = 1, s.setLineDash([5, 4]), s.beginPath(), s.moveTo(e.x, r), s.lineTo(e.x + e.width, r), s.stroke());
|
|
1697
1751
|
}
|
|
1752
|
+
s.setLineDash([]), s.restore();
|
|
1698
1753
|
}
|
|
1699
1754
|
}
|
|
1700
|
-
class
|
|
1755
|
+
class ni {
|
|
1701
1756
|
constructor(e, t, n, s, o) {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1757
|
+
m(this, "container");
|
|
1758
|
+
m(this, "callbacks");
|
|
1759
|
+
m(this, "getPlotArea");
|
|
1760
|
+
m(this, "getBounds");
|
|
1761
|
+
m(this, "getAxesLayout");
|
|
1762
|
+
m(this, "isDragging", !1);
|
|
1763
|
+
m(this, "panningAxisId");
|
|
1764
|
+
m(this, "isBoxSelecting", !1);
|
|
1765
|
+
m(this, "isBoxZooming", !1);
|
|
1766
|
+
m(this, "selectionStart", { x: 0, y: 0 });
|
|
1767
|
+
m(this, "lastMousePos", { x: 0, y: 0 });
|
|
1768
|
+
m(this, "mouseDownPos", { x: 0, y: 0 });
|
|
1769
|
+
m(this, "mode", "pan");
|
|
1714
1770
|
// Bound handlers for cleanup
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1771
|
+
m(this, "boundWheel");
|
|
1772
|
+
m(this, "boundMouseDown");
|
|
1773
|
+
m(this, "boundMouseMove");
|
|
1774
|
+
m(this, "boundMouseUp");
|
|
1775
|
+
m(this, "boundMouseLeave");
|
|
1776
|
+
m(this, "boundTouchStart");
|
|
1777
|
+
m(this, "boundTouchMove");
|
|
1778
|
+
m(this, "boundTouchEnd");
|
|
1723
1779
|
this.container = e, this.callbacks = t, this.getPlotArea = n, this.getBounds = s, this.getAxesLayout = o, this.boundWheel = this.handleWheel.bind(this), this.boundMouseDown = this.handleMouseDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.attachListeners();
|
|
1724
1780
|
}
|
|
1725
1781
|
attachListeners() {
|
|
@@ -1772,23 +1828,25 @@ class ei {
|
|
|
1772
1828
|
a = !0, l = !0;
|
|
1773
1829
|
else
|
|
1774
1830
|
return;
|
|
1775
|
-
const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, f = (s - t.x) / t.width, u = 1 - (o - t.y) / t.height, g = d.xMin + f * (d.xMax - d.xMin), y = d.yMin + u * (d.yMax - d.yMin),
|
|
1776
|
-
let
|
|
1777
|
-
const M =
|
|
1778
|
-
(M <
|
|
1831
|
+
const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, f = (s - t.x) / t.width, u = 1 - (o - t.y) / t.height, g = d.xMin + f * (d.xMax - d.xMin), y = d.yMin + u * (d.yMax - d.yMin), x = 1e-12, b = 1e15;
|
|
1832
|
+
let S = a ? g - (g - d.xMin) * c : d.xMin, p = a ? g + (d.xMax - g) * c : d.xMax, v = l ? y - (y - d.yMin) * c : d.yMin, w = l ? y + (d.yMax - y) * c : d.yMax;
|
|
1833
|
+
const M = p - S, A = w - v;
|
|
1834
|
+
(M < x || M > b) && (S = d.xMin, p = d.xMax), (A < x || A > b) && (v = d.yMin, w = d.yMax);
|
|
1779
1835
|
const k = {
|
|
1780
|
-
xMin:
|
|
1781
|
-
xMax:
|
|
1782
|
-
yMin:
|
|
1836
|
+
xMin: S,
|
|
1837
|
+
xMax: p,
|
|
1838
|
+
yMin: v,
|
|
1783
1839
|
yMax: w
|
|
1784
1840
|
};
|
|
1785
1841
|
this.callbacks.onZoom(k, h);
|
|
1786
1842
|
}
|
|
1787
1843
|
handleMouseDown(e) {
|
|
1788
|
-
var l, h, d, c, f, u, g, y,
|
|
1844
|
+
var l, h, d, c, f, u, g, y, x, b;
|
|
1789
1845
|
const t = this.getPlotArea();
|
|
1790
1846
|
if (t.width <= 1 || t.height <= 1) return;
|
|
1791
|
-
const n = this.container.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top
|
|
1847
|
+
const n = this.container.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top;
|
|
1848
|
+
this.mouseDownPos = { x: s, y: o };
|
|
1849
|
+
const r = s >= t.x && s <= t.x + t.width && o >= t.y && o <= t.y + t.height;
|
|
1792
1850
|
if ((h = (l = this.callbacks).onInteraction) == null || h.call(l, {
|
|
1793
1851
|
type: "mousedown",
|
|
1794
1852
|
pixelX: s,
|
|
@@ -1799,10 +1857,10 @@ class ei {
|
|
|
1799
1857
|
defaultPrevented: e.defaultPrevented
|
|
1800
1858
|
}), e.defaultPrevented) return;
|
|
1801
1859
|
const a = this.getAxesLayout();
|
|
1802
|
-
for (const
|
|
1803
|
-
let
|
|
1804
|
-
if (
|
|
1805
|
-
this.isDragging = !0, this.panningAxisId =
|
|
1860
|
+
for (const S of a) {
|
|
1861
|
+
let v;
|
|
1862
|
+
if (S.position === "left" ? v = t.x - 65 - S.offset : v = t.x + t.width + S.offset, s >= v && s <= v + 65 && o >= t.y && o <= t.y + t.height) {
|
|
1863
|
+
this.isDragging = !0, this.panningAxisId = S.id, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "ns-resize", (c = (d = this.callbacks).onDragStart) == null || c.call(d);
|
|
1806
1864
|
return;
|
|
1807
1865
|
}
|
|
1808
1866
|
}
|
|
@@ -1815,7 +1873,7 @@ class ei {
|
|
|
1815
1873
|
this.isBoxZooming = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxZoom({ x: s, y: o, width: 0, height: 0 }), (y = (g = this.callbacks).onDragStart) == null || y.call(g);
|
|
1816
1874
|
break;
|
|
1817
1875
|
case "select":
|
|
1818
|
-
this.isBoxSelecting = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(s, o), (b = (
|
|
1876
|
+
this.isBoxSelecting = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(s, o), (b = (x = this.callbacks).onDragStart) == null || b.call(x);
|
|
1819
1877
|
break;
|
|
1820
1878
|
case "delta":
|
|
1821
1879
|
case "peak":
|
|
@@ -1845,9 +1903,9 @@ class ei {
|
|
|
1845
1903
|
} else this.isBoxSelecting && this.callbacks.onBoxSelectUpdate && this.callbacks.onBoxSelectUpdate(n, s);
|
|
1846
1904
|
}
|
|
1847
1905
|
handleMouseUp(e) {
|
|
1848
|
-
var
|
|
1906
|
+
var h, d, c, f, u, g;
|
|
1849
1907
|
const t = this.container.getBoundingClientRect(), n = e.clientX - t.left, s = e.clientY - t.top;
|
|
1850
|
-
if ((
|
|
1908
|
+
if ((d = (h = this.callbacks).onInteraction) == null || d.call(h, {
|
|
1851
1909
|
type: "mouseup",
|
|
1852
1910
|
pixelX: n,
|
|
1853
1911
|
pixelY: s,
|
|
@@ -1861,14 +1919,17 @@ class ei {
|
|
|
1861
1919
|
return;
|
|
1862
1920
|
}
|
|
1863
1921
|
if (this.isBoxZooming) {
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1922
|
+
const y = Math.min(this.selectionStart.x, n), x = Math.min(this.selectionStart.y, s), b = Math.abs(n - this.selectionStart.x), S = Math.abs(s - this.selectionStart.y);
|
|
1923
|
+
b > 5 && S > 5 && this.callbacks.onBoxZoom({ x: y, y: x, width: b, height: S }), this.callbacks.onBoxZoom(null);
|
|
1866
1924
|
} else if (this.isBoxSelecting) {
|
|
1867
|
-
const
|
|
1868
|
-
this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x:
|
|
1925
|
+
const y = Math.min(this.selectionStart.x, n), x = Math.min(this.selectionStart.y, s), b = Math.abs(n - this.selectionStart.x), S = Math.abs(s - this.selectionStart.y);
|
|
1926
|
+
this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x: y, y: x, width: b, height: S }, e.shiftKey);
|
|
1869
1927
|
}
|
|
1870
|
-
const o = this.isDragging || this.isBoxSelecting || this.isBoxZooming
|
|
1871
|
-
|
|
1928
|
+
const o = this.isDragging || this.isBoxSelecting || this.isBoxZooming, r = Math.hypot(
|
|
1929
|
+
n - this.mouseDownPos.x,
|
|
1930
|
+
s - this.mouseDownPos.y
|
|
1931
|
+
), a = this.getPlotArea(), l = n >= a.x && n <= a.x + a.width && s >= a.y && s <= a.y + a.height;
|
|
1932
|
+
r < 4 && l && !this.isBoxZooming && ((f = (c = this.callbacks).onPointClick) == null || f.call(c, n, s, e.ctrlKey, e.shiftKey)), this.isDragging = !1, this.panningAxisId = void 0, this.isBoxSelecting = !1, this.isBoxZooming = !1, this.container.style.cursor = "", o && ((g = (u = this.callbacks).onDragEnd) == null || g.call(u));
|
|
1872
1933
|
}
|
|
1873
1934
|
handleMouseLeave() {
|
|
1874
1935
|
this.isDragging = !1, this.panningAxisId = void 0, this.container.style.cursor = "", this.callbacks.onCursorLeave();
|
|
@@ -1898,7 +1959,7 @@ class ei {
|
|
|
1898
1959
|
this.detachListeners();
|
|
1899
1960
|
}
|
|
1900
1961
|
}
|
|
1901
|
-
const
|
|
1962
|
+
const si = {
|
|
1902
1963
|
enabled: !0,
|
|
1903
1964
|
hitRadius: 20,
|
|
1904
1965
|
multiSelect: !0,
|
|
@@ -1909,16 +1970,16 @@ const ti = {
|
|
|
1909
1970
|
ringWidth: 3
|
|
1910
1971
|
}
|
|
1911
1972
|
};
|
|
1912
|
-
class
|
|
1973
|
+
class oi {
|
|
1913
1974
|
constructor(e, t) {
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1975
|
+
m(this, "ctx");
|
|
1976
|
+
m(this, "config");
|
|
1977
|
+
m(this, "selected", /* @__PURE__ */ new Map());
|
|
1917
1978
|
// seriesId -> Set of indices
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
this.ctx = e, this.config = { ...
|
|
1979
|
+
m(this, "isBoxSelecting", !1);
|
|
1980
|
+
m(this, "boxStart", null);
|
|
1981
|
+
m(this, "boxEnd", null);
|
|
1982
|
+
this.ctx = e, this.config = { ...si, ...t };
|
|
1922
1983
|
}
|
|
1923
1984
|
// ============================================
|
|
1924
1985
|
// Configuration
|
|
@@ -1952,11 +2013,11 @@ class ii {
|
|
|
1952
2013
|
if (!f.isVisible()) return;
|
|
1953
2014
|
const g = f.getData();
|
|
1954
2015
|
if (g.x.length === 0) return;
|
|
1955
|
-
const y = f.getYAxisId() || this.ctx.getPrimaryYAxisId(),
|
|
1956
|
-
if (!
|
|
1957
|
-
const b = o.invert(e),
|
|
1958
|
-
for (let M =
|
|
1959
|
-
const A = o.transform(g.x[M]), k =
|
|
2016
|
+
const y = f.getYAxisId() || this.ctx.getPrimaryYAxisId(), x = r.get(y);
|
|
2017
|
+
if (!x) return;
|
|
2018
|
+
const b = o.invert(e), S = this.findNearestIndex(g.x, b), p = 50, v = Math.max(0, S - p), w = Math.min(g.x.length, S + p);
|
|
2019
|
+
for (let M = v; M < w; M++) {
|
|
2020
|
+
const A = o.transform(g.x[M]), k = x.transform(g.y[M]), B = A - e, F = k - t, I = B * B + F * F;
|
|
1960
2021
|
I < c && I <= h && (c = I, d = {
|
|
1961
2022
|
seriesId: u,
|
|
1962
2023
|
index: M,
|
|
@@ -2144,20 +2205,20 @@ class ii {
|
|
|
2144
2205
|
yMax: o.invert(f)
|
|
2145
2206
|
}, y = this.hitTestRegion(g);
|
|
2146
2207
|
if (y.length > 0) {
|
|
2147
|
-
const
|
|
2148
|
-
y.forEach((
|
|
2149
|
-
let
|
|
2150
|
-
|
|
2208
|
+
const x = /* @__PURE__ */ new Map();
|
|
2209
|
+
y.forEach((p) => {
|
|
2210
|
+
let v = x.get(p.seriesId);
|
|
2211
|
+
v || (v = [], x.set(p.seriesId, v)), v.push(p.index);
|
|
2151
2212
|
});
|
|
2152
|
-
const b = Array.from(
|
|
2153
|
-
seriesId:
|
|
2154
|
-
indices:
|
|
2213
|
+
const b = Array.from(x.entries()).map(([p, v]) => ({
|
|
2214
|
+
seriesId: p,
|
|
2215
|
+
indices: v
|
|
2155
2216
|
}));
|
|
2156
2217
|
this.selectPoints(b, e ? "add" : "single");
|
|
2157
|
-
const
|
|
2218
|
+
const S = this.getSelectedPoints();
|
|
2158
2219
|
this.ctx.events.emit("regionSelect", {
|
|
2159
2220
|
bounds: g,
|
|
2160
|
-
containedPoints:
|
|
2221
|
+
containedPoints: S
|
|
2161
2222
|
});
|
|
2162
2223
|
} else e || this.clearSelection();
|
|
2163
2224
|
this.cancelBoxSelection();
|
|
@@ -2202,8 +2263,8 @@ class ii {
|
|
|
2202
2263
|
const g = d.getStyle().color || "#ff0055";
|
|
2203
2264
|
l.forEach((y) => {
|
|
2204
2265
|
if (y >= c.x.length) return;
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2266
|
+
const x = n.transform(c.x[y]), b = u.transform(c.y[y]);
|
|
2267
|
+
x < t.x || x > t.x + t.width || b < t.y || b > t.y + t.height || (e.beginPath(), e.arc(x, b, r.size / 2, 0, Math.PI * 2), e.strokeStyle = r.color, e.lineWidth = r.ringWidth, e.stroke(), e.beginPath(), e.arc(x, b, r.size / 2 - r.ringWidth, 0, Math.PI * 2), e.fillStyle = g, e.fill());
|
|
2207
2268
|
});
|
|
2208
2269
|
});
|
|
2209
2270
|
const a = this.getBoxSelectionRect();
|
|
@@ -2285,15 +2346,15 @@ const ee = {
|
|
|
2285
2346
|
reducedMotion: "auto",
|
|
2286
2347
|
resizeDebounce: 100
|
|
2287
2348
|
};
|
|
2288
|
-
class
|
|
2349
|
+
class ri {
|
|
2289
2350
|
constructor(e, t) {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2351
|
+
m(this, "ctx");
|
|
2352
|
+
m(this, "config");
|
|
2353
|
+
m(this, "state");
|
|
2354
|
+
m(this, "resizeObserver", null);
|
|
2355
|
+
m(this, "debounceTimer", null);
|
|
2356
|
+
m(this, "destroyed", !1);
|
|
2357
|
+
m(this, "handleResize", () => {
|
|
2297
2358
|
this.destroyed || (this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.debounceTimer = window.setTimeout(() => {
|
|
2298
2359
|
this.update(), this.debounceTimer = null;
|
|
2299
2360
|
}, this.config.resizeDebounce));
|
|
@@ -2466,7 +2527,7 @@ class ni {
|
|
|
2466
2527
|
this.destroyed = !0, this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.resizeObserver ? (this.resizeObserver.disconnect(), this.resizeObserver = null) : window.removeEventListener("resize", this.handleResize);
|
|
2467
2528
|
}
|
|
2468
2529
|
}
|
|
2469
|
-
function
|
|
2530
|
+
function ai(i, e) {
|
|
2470
2531
|
const {
|
|
2471
2532
|
seriesIds: t,
|
|
2472
2533
|
includeHeaders: n = !0,
|
|
@@ -2492,7 +2553,7 @@ function si(i, e) {
|
|
|
2492
2553
|
return a.join(`
|
|
2493
2554
|
`);
|
|
2494
2555
|
}
|
|
2495
|
-
function
|
|
2556
|
+
function li(i, e, t) {
|
|
2496
2557
|
const { seriesIds: n, precision: s = 6 } = t ?? {}, o = n ? i.filter((a) => n.includes(a.getId())) : i, r = {};
|
|
2497
2558
|
return o.forEach((a) => {
|
|
2498
2559
|
const l = a.getData();
|
|
@@ -2512,7 +2573,7 @@ function oi(i, e, t) {
|
|
|
2512
2573
|
series: r
|
|
2513
2574
|
}, null, 2);
|
|
2514
2575
|
}
|
|
2515
|
-
function
|
|
2576
|
+
function hi(i, e, t, n, s, o, r = "png") {
|
|
2516
2577
|
const a = document.createElement("canvas");
|
|
2517
2578
|
a.width = e.width, a.height = e.height;
|
|
2518
2579
|
const l = a.getContext("2d");
|
|
@@ -2525,11 +2586,11 @@ function ri(i, e, t, n, s, o, r = "png") {
|
|
|
2525
2586
|
function Ye(i) {
|
|
2526
2587
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2527
2588
|
}
|
|
2528
|
-
function
|
|
2589
|
+
function tt(i, e) {
|
|
2529
2590
|
return e && i.has(e) ? i.get(e) : i.get("default") ?? i.values().next().value;
|
|
2530
2591
|
}
|
|
2531
|
-
function
|
|
2532
|
-
const h =
|
|
2592
|
+
function ci(i, e, t, n, s, o, r, a, l = {}) {
|
|
2593
|
+
const h = tt(s, l.primaryYAxisId);
|
|
2533
2594
|
if (!h)
|
|
2534
2595
|
throw new Error("SVG export requires at least one Y scale");
|
|
2535
2596
|
const d = [
|
|
@@ -2537,13 +2598,13 @@ function ai(i, e, t, n, s, o, r, a, l = {}) {
|
|
|
2537
2598
|
`<rect width="100%" height="100%" fill="${o.backgroundColor}" />`,
|
|
2538
2599
|
'<g transform="translate(0,0)">'
|
|
2539
2600
|
];
|
|
2540
|
-
return
|
|
2601
|
+
return gi(d, t, n, h, o), ui(d, i, t, n, s, l.primaryYAxisId), di(d, t, n, h, o), fi(d, t, n, h, o, l), d.push("</g>"), d.push("</svg>"), d.join(`
|
|
2541
2602
|
`);
|
|
2542
2603
|
}
|
|
2543
|
-
function
|
|
2604
|
+
function ui(i, e, t, n, s, o) {
|
|
2544
2605
|
for (const r of e) {
|
|
2545
2606
|
if (!r.isVisible()) continue;
|
|
2546
|
-
const a = s.get(r.getYAxisId() || o || "default") ??
|
|
2607
|
+
const a = s.get(r.getYAxisId() || o || "default") ?? tt(s, o);
|
|
2547
2608
|
if (!a) continue;
|
|
2548
2609
|
const l = r.getData();
|
|
2549
2610
|
if (!l || l.x.length === 0) continue;
|
|
@@ -2553,12 +2614,12 @@ function li(i, e, t, n, s, o) {
|
|
|
2553
2614
|
for (let u = 0; u < l.x.length; u++) {
|
|
2554
2615
|
const g = n.transform(l.x[u]), y = a.transform(l.y[u]);
|
|
2555
2616
|
if (u > 0 && d === "step") {
|
|
2556
|
-
const
|
|
2617
|
+
const x = n.transform(l.x[u - 1]), b = a.transform(l.y[u - 1]);
|
|
2557
2618
|
if (f === "after") c.push(`${g.toFixed(1)},${b.toFixed(1)}`);
|
|
2558
|
-
else if (f === "before") c.push(`${
|
|
2619
|
+
else if (f === "before") c.push(`${x.toFixed(1)},${y.toFixed(1)}`);
|
|
2559
2620
|
else if (f === "center") {
|
|
2560
|
-
const
|
|
2561
|
-
c.push(`${
|
|
2621
|
+
const S = (x + g) / 2;
|
|
2622
|
+
c.push(`${S.toFixed(1)},${b.toFixed(1)}`), c.push(`${S.toFixed(1)},${y.toFixed(1)}`);
|
|
2562
2623
|
}
|
|
2563
2624
|
}
|
|
2564
2625
|
c.push(`${g.toFixed(1)},${y.toFixed(1)}`);
|
|
@@ -2576,9 +2637,9 @@ function li(i, e, t, n, s, o) {
|
|
|
2576
2637
|
else if (d === "bar") {
|
|
2577
2638
|
const c = (h.barWidth || 5) * (t.width / (n.domain[1] - n.domain[0]));
|
|
2578
2639
|
for (let f = 0; f < l.x.length; f++) {
|
|
2579
|
-
const u = n.transform(l.x[f]), g = a.transform(l.y[f]), y = a.transform(0),
|
|
2640
|
+
const u = n.transform(l.x[f]), g = a.transform(l.y[f]), y = a.transform(0), x = Math.min(g, y), b = Math.abs(g - y);
|
|
2580
2641
|
i.push(
|
|
2581
|
-
`<rect x="${(u - c / 2).toFixed(1)}" y="${
|
|
2642
|
+
`<rect x="${(u - c / 2).toFixed(1)}" y="${x.toFixed(1)}" width="${c.toFixed(1)}" height="${b.toFixed(1)}" fill="${h.color}" fill-opacity="${h.opacity || 1}" />`
|
|
2582
2643
|
);
|
|
2583
2644
|
}
|
|
2584
2645
|
} else if (d === "band" || d === "area") {
|
|
@@ -2598,19 +2659,19 @@ function li(i, e, t, n, s, o) {
|
|
|
2598
2659
|
const c = (h.barWidth || 5) * (t.width / (n.domain[1] - n.domain[0])), f = h.bullishColor || "#26a69a", u = h.bearishColor || "#ef5350";
|
|
2599
2660
|
if (l.open && l.high && l.low && l.close)
|
|
2600
2661
|
for (let g = 0; g < l.x.length; g++) {
|
|
2601
|
-
const y = l.close[g] >= l.open[g],
|
|
2662
|
+
const y = l.close[g] >= l.open[g], x = n.transform(l.x[g]), b = a.transform(l.open[g]), S = a.transform(l.close[g]), p = a.transform(l.high[g]), v = a.transform(l.low[g]), w = y ? f : u;
|
|
2602
2663
|
i.push(
|
|
2603
|
-
`<line x1="${
|
|
2664
|
+
`<line x1="${x.toFixed(1)}" y1="${p.toFixed(1)}" x2="${x.toFixed(1)}" y2="${v.toFixed(1)}" stroke="${w}" stroke-width="1" />`
|
|
2604
2665
|
);
|
|
2605
|
-
const M = Math.min(b,
|
|
2666
|
+
const M = Math.min(b, S), A = Math.max(1, Math.abs(b - S));
|
|
2606
2667
|
i.push(
|
|
2607
|
-
`<rect x="${(
|
|
2668
|
+
`<rect x="${(x - c / 2).toFixed(1)}" y="${M.toFixed(1)}" width="${c.toFixed(1)}" height="${A.toFixed(1)}" fill="${w}" />`
|
|
2608
2669
|
);
|
|
2609
2670
|
}
|
|
2610
2671
|
}
|
|
2611
2672
|
}
|
|
2612
2673
|
}
|
|
2613
|
-
function
|
|
2674
|
+
function di(i, e, t, n, s) {
|
|
2614
2675
|
const o = Y(e.y + e.height), r = Y(e.x);
|
|
2615
2676
|
i.push(
|
|
2616
2677
|
`<line x1="${e.x}" y1="${o}" x2="${e.x + e.width}" y2="${o}" stroke="${s.xAxis.lineColor}" stroke-width="${s.xAxis.lineWidth || 2}" />`
|
|
@@ -2618,25 +2679,25 @@ function hi(i, e, t, n, s) {
|
|
|
2618
2679
|
`<line x1="${r}" y1="${e.y}" x2="${r}" y2="${e.y + e.height}" stroke="${s.yAxis.lineColor}" stroke-width="${s.yAxis.lineWidth || 2}" />`
|
|
2619
2680
|
);
|
|
2620
2681
|
}
|
|
2621
|
-
function
|
|
2682
|
+
function fi(i, e, t, n, s, o) {
|
|
2622
2683
|
const r = o.xAxis, a = o.yAxis, l = (r == null ? void 0 : r.tickCount) ?? 8, h = (a == null ? void 0 : a.tickCount) ?? 6, d = t.domain[1] - t.domain[0], c = e.y + e.height, f = e.x, u = s.xAxis, g = s.yAxis;
|
|
2623
2684
|
(r == null ? void 0 : r.showLabels) !== !1 && t.ticks(l).forEach((y) => {
|
|
2624
|
-
const
|
|
2625
|
-
if (
|
|
2626
|
-
const b = qe(y, r, d),
|
|
2685
|
+
const x = he(t.transform(y));
|
|
2686
|
+
if (x < e.x || x > e.x + e.width) return;
|
|
2687
|
+
const b = qe(y, r, d), S = c + (u.tickLength ?? 4) + u.labelSize * 0.75;
|
|
2627
2688
|
i.push(
|
|
2628
|
-
`<text x="${
|
|
2689
|
+
`<text x="${x.toFixed(1)}" y="${S.toFixed(1)}" fill="${u.labelColor}" font-size="${u.labelSize}" text-anchor="middle">${Ye(b)}</text>`
|
|
2629
2690
|
);
|
|
2630
2691
|
}), (a == null ? void 0 : a.showLabels) !== !1 && n.ticks(h).forEach((y) => {
|
|
2631
|
-
const
|
|
2632
|
-
if (
|
|
2633
|
-
const b = Ge(y, a),
|
|
2692
|
+
const x = he(n.transform(y));
|
|
2693
|
+
if (x < e.y || x > e.y + e.height) return;
|
|
2694
|
+
const b = Ge(y, a), S = f - (g.tickLength ?? 4) - 4;
|
|
2634
2695
|
i.push(
|
|
2635
|
-
`<text x="${
|
|
2696
|
+
`<text x="${S.toFixed(1)}" y="${(x + g.labelSize * 0.35).toFixed(1)}" fill="${g.labelColor}" font-size="${g.labelSize}" text-anchor="end">${Ye(b)}</text>`
|
|
2636
2697
|
);
|
|
2637
2698
|
});
|
|
2638
2699
|
}
|
|
2639
|
-
function
|
|
2700
|
+
function gi(i, e, t, n, s) {
|
|
2640
2701
|
s.grid.visible && (t.ticks(10).forEach((o) => {
|
|
2641
2702
|
const r = Y(t.transform(o));
|
|
2642
2703
|
r >= e.x && r <= e.x + e.width && i.push(
|
|
@@ -2649,7 +2710,7 @@ function ui(i, e, t, n, s) {
|
|
|
2649
2710
|
);
|
|
2650
2711
|
}));
|
|
2651
2712
|
}
|
|
2652
|
-
const
|
|
2713
|
+
const yi = /* @__PURE__ */ new Set([
|
|
2653
2714
|
"line",
|
|
2654
2715
|
"band",
|
|
2655
2716
|
"scatter",
|
|
@@ -2660,9 +2721,9 @@ const di = /* @__PURE__ */ new Set([
|
|
|
2660
2721
|
]);
|
|
2661
2722
|
function pe(i) {
|
|
2662
2723
|
const e = Array.from(i).filter((n) => n.isVisible());
|
|
2663
|
-
return e.some((n) => n.getType() === "bar") ? !e.some((n) =>
|
|
2724
|
+
return e.some((n) => n.getType() === "bar") ? !e.some((n) => yi.has(n.getType())) : !1;
|
|
2664
2725
|
}
|
|
2665
|
-
function
|
|
2726
|
+
function mi(i, e) {
|
|
2666
2727
|
e.x && (i.viewBounds.xMin = e.x[0], i.viewBounds.xMax = e.x[1]);
|
|
2667
2728
|
const t = pe(i.series.values()), n = e.y ? [...e.y] : null;
|
|
2668
2729
|
if (n && t && (n[0] = 0), n)
|
|
@@ -2682,7 +2743,7 @@ function fi(i, e) {
|
|
|
2682
2743
|
y: [i.viewBounds.yMin, i.viewBounds.yMax]
|
|
2683
2744
|
}), i.requestRender();
|
|
2684
2745
|
}
|
|
2685
|
-
function
|
|
2746
|
+
function pi(i, e, t, n) {
|
|
2686
2747
|
const s = i.getPlotArea(), o = e / s.width * (i.viewBounds.xMax - i.viewBounds.xMin);
|
|
2687
2748
|
if (i.viewBounds.xMin -= o, i.viewBounds.xMax -= o, n) {
|
|
2688
2749
|
const a = i.yScales.get(n);
|
|
@@ -2702,7 +2763,7 @@ function gi(i, e, t, n) {
|
|
|
2702
2763
|
const r = t / s.height * (i.viewBounds.yMax - i.viewBounds.yMin);
|
|
2703
2764
|
i.events.emit("pan", { deltaX: o, deltaY: r }), i.requestRender();
|
|
2704
2765
|
}
|
|
2705
|
-
function
|
|
2766
|
+
function xi(i) {
|
|
2706
2767
|
if (i.series.size === 0) return;
|
|
2707
2768
|
let e = 1 / 0, t = -1 / 0;
|
|
2708
2769
|
const n = /* @__PURE__ */ new Map();
|
|
@@ -2739,7 +2800,7 @@ function yi(i) {
|
|
|
2739
2800
|
}
|
|
2740
2801
|
}), i.requestRender();
|
|
2741
2802
|
}
|
|
2742
|
-
function
|
|
2803
|
+
function bi(i, e = {}) {
|
|
2743
2804
|
var l, h;
|
|
2744
2805
|
const t = typeof e.padding == "object" ? e.padding.x ?? 0.02 : e.padding ?? 0.02, n = typeof e.padding == "object" ? e.padding.y ?? 0.05 : e.padding ?? 0.05;
|
|
2745
2806
|
let s = (l = e.x) == null ? void 0 : l[0], o = (h = e.x) == null ? void 0 : h[1], r = s !== void 0 && o !== void 0;
|
|
@@ -2762,19 +2823,16 @@ function mi(i, e = {}) {
|
|
|
2762
2823
|
if (e.y) {
|
|
2763
2824
|
const d = i.yScales.get(i.primaryYAxisId);
|
|
2764
2825
|
d && d.setDomain(e.y[0], e.y[1]), i.viewBounds.yMin = e.y[0], i.viewBounds.yMax = e.y[1];
|
|
2765
|
-
} else
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
(
|
|
2774
|
-
|
|
2775
|
-
m.setDomain(x, S), g === i.primaryYAxisId && (i.viewBounds.yMin = x, i.viewBounds.yMax = S);
|
|
2776
|
-
}), !e.y && !f && !r) return !1;
|
|
2777
|
-
}
|
|
2826
|
+
} else
|
|
2827
|
+
a.forEach((f, u) => {
|
|
2828
|
+
if (f.min === 1 / 0) return;
|
|
2829
|
+
const g = i.yAxisOptionsMap.get(u), y = i.yScales.get(u);
|
|
2830
|
+
if (!g || !y) return;
|
|
2831
|
+
let x = f.max - f.min;
|
|
2832
|
+
(x <= 0 || !isFinite(x)) && (x = Math.abs(f.min) * 0.1 || 1);
|
|
2833
|
+
const b = x * n, S = Math.max(-1e15, f.min - b), p = Math.min(1e15, f.max + b);
|
|
2834
|
+
y.setDomain(S, p), u === i.primaryYAxisId && (i.viewBounds.yMin = S, i.viewBounds.yMax = p);
|
|
2835
|
+
});
|
|
2778
2836
|
if (r && s !== void 0 && o !== void 0) {
|
|
2779
2837
|
let f = o - s;
|
|
2780
2838
|
(f <= 0 || !isFinite(f)) && (f = Math.abs(s) * 0.1 || 1);
|
|
@@ -2783,7 +2841,7 @@ function mi(i, e = {}) {
|
|
|
2783
2841
|
}
|
|
2784
2842
|
return i.requestRender(), !0;
|
|
2785
2843
|
}
|
|
2786
|
-
function
|
|
2844
|
+
function vi(i) {
|
|
2787
2845
|
if (i.series.size === 0) return;
|
|
2788
2846
|
const e = /* @__PURE__ */ new Map();
|
|
2789
2847
|
i.yScales.forEach((o, r) => {
|
|
@@ -2812,7 +2870,7 @@ function pi(i) {
|
|
|
2812
2870
|
}
|
|
2813
2871
|
}), i.requestRender();
|
|
2814
2872
|
}
|
|
2815
|
-
function
|
|
2873
|
+
function Si(i, e, t, n) {
|
|
2816
2874
|
if (e === null) {
|
|
2817
2875
|
if (t && t.width > 5 && t.height > 5) {
|
|
2818
2876
|
const s = i.getPlotArea(), o = i.viewBounds, r = (t.x - s.x) / s.width, a = (t.x + t.width - s.x) / s.width, l = 1 - (t.y - s.y) / s.height, h = 1 - (t.y + t.height - s.y) / s.height, d = o.xMin + r * (o.xMax - o.xMin), c = o.xMin + a * (o.xMax - o.xMin), f = o.yMin + h * (o.yMax - o.yMin), u = o.yMin + l * (o.yMax - o.yMin);
|
|
@@ -2822,7 +2880,7 @@ function xi(i, e, t, n) {
|
|
|
2822
2880
|
}
|
|
2823
2881
|
return e;
|
|
2824
2882
|
}
|
|
2825
|
-
const
|
|
2883
|
+
const wi = {
|
|
2826
2884
|
/** Linear easing - constant speed */
|
|
2827
2885
|
linear: (i) => i,
|
|
2828
2886
|
/** Ease in - starts slow, accelerates */
|
|
@@ -2848,18 +2906,18 @@ const bi = {
|
|
|
2848
2906
|
/** Bounce effect */
|
|
2849
2907
|
bounce: (i) => i < 1 / 2.75 ? 7.5625 * i * i : i < 2 / 2.75 ? 7.5625 * (i -= 1.5 / 2.75) * i + 0.75 : i < 2.5 / 2.75 ? 7.5625 * (i -= 2.25 / 2.75) * i + 0.9375 : 7.5625 * (i -= 2.625 / 2.75) * i + 0.984375
|
|
2850
2908
|
};
|
|
2851
|
-
class
|
|
2909
|
+
class it {
|
|
2852
2910
|
constructor() {
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2911
|
+
m(this, "animations", /* @__PURE__ */ new Map());
|
|
2912
|
+
m(this, "frameId", null);
|
|
2913
|
+
m(this, "idCounter", 0);
|
|
2914
|
+
m(this, "isDestroyed", !1);
|
|
2857
2915
|
}
|
|
2858
2916
|
/**
|
|
2859
2917
|
* Start a new animation
|
|
2860
2918
|
*/
|
|
2861
2919
|
animate(e) {
|
|
2862
|
-
const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing :
|
|
2920
|
+
const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing : wi[e.easing || "easeOutCubic"];
|
|
2863
2921
|
let s, o;
|
|
2864
2922
|
const r = new Promise((a, l) => {
|
|
2865
2923
|
s = a, o = l;
|
|
@@ -2990,7 +3048,7 @@ class et {
|
|
|
2990
3048
|
}), this.animations.size > 0 ? this.frameId = requestAnimationFrame(() => this.tick()) : this.frameId = null;
|
|
2991
3049
|
}
|
|
2992
3050
|
}
|
|
2993
|
-
const
|
|
3051
|
+
const W = {
|
|
2994
3052
|
enabled: !0,
|
|
2995
3053
|
zoom: {
|
|
2996
3054
|
enabled: !1,
|
|
@@ -3026,20 +3084,20 @@ const X = {
|
|
|
3026
3084
|
};
|
|
3027
3085
|
function _e(i) {
|
|
3028
3086
|
return i ? {
|
|
3029
|
-
enabled: i.enabled ??
|
|
3030
|
-
zoom: { ...
|
|
3031
|
-
pan: { ...
|
|
3032
|
-
dataUpdate: { ...
|
|
3033
|
-
seriesEntry: { ...
|
|
3034
|
-
autoScale: { ...
|
|
3035
|
-
} : { ...
|
|
3087
|
+
enabled: i.enabled ?? W.enabled,
|
|
3088
|
+
zoom: { ...W.zoom, ...i.zoom },
|
|
3089
|
+
pan: { ...W.pan, ...i.pan },
|
|
3090
|
+
dataUpdate: { ...W.dataUpdate, ...i.dataUpdate },
|
|
3091
|
+
seriesEntry: { ...W.seriesEntry, ...i.seriesEntry },
|
|
3092
|
+
autoScale: { ...W.autoScale, ...i.autoScale }
|
|
3093
|
+
} : { ...W };
|
|
3036
3094
|
}
|
|
3037
3095
|
let ke = null;
|
|
3038
|
-
function
|
|
3039
|
-
return ke || (ke = new
|
|
3096
|
+
function rs() {
|
|
3097
|
+
return ke || (ke = new it()), ke;
|
|
3040
3098
|
}
|
|
3041
3099
|
let G = null, j = null;
|
|
3042
|
-
function
|
|
3100
|
+
function Mi(i, e) {
|
|
3043
3101
|
const t = e.animate !== !1 && i.animationConfig.enabled && i.animationConfig.zoom.enabled;
|
|
3044
3102
|
G != null && G.isRunning() && G.cancel();
|
|
3045
3103
|
const n = pe(i.series.values()), s = e.x ? e.x[0] : i.viewBounds.xMin, o = e.x ? e.x[1] : i.viewBounds.xMax;
|
|
@@ -3053,10 +3111,10 @@ function vi(i, e) {
|
|
|
3053
3111
|
c && (c.setDomain(r, a), l === i.primaryYAxisId && (i.viewBounds.yMin = r, i.viewBounds.yMax = a));
|
|
3054
3112
|
} else {
|
|
3055
3113
|
const c = i.viewBounds.yMax - i.viewBounds.yMin, f = a - r, u = c > 0 ? f / c : 1, g = c > 0 ? (r - i.viewBounds.yMin) / c : 0;
|
|
3056
|
-
i.yScales.forEach((
|
|
3114
|
+
i.yScales.forEach((x, b) => {
|
|
3057
3115
|
if (b === i.primaryYAxisId) return;
|
|
3058
|
-
const
|
|
3059
|
-
|
|
3116
|
+
const S = x.domain[1] - x.domain[0], p = n ? 0 : x.domain[0] + g * S, v = n ? x.domain[0] + u * S : p + u * S;
|
|
3117
|
+
x.setDomain(p, v);
|
|
3060
3118
|
}), i.viewBounds.yMin = r, i.viewBounds.yMax = a;
|
|
3061
3119
|
const y = i.yScales.get(i.primaryYAxisId);
|
|
3062
3120
|
y && y.setDomain(r, a);
|
|
@@ -3085,8 +3143,8 @@ function vi(i, e) {
|
|
|
3085
3143
|
if (u === i.primaryYAxisId)
|
|
3086
3144
|
f.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
|
|
3087
3145
|
else {
|
|
3088
|
-
const g = d.get(u), y = h.yMax - h.yMin,
|
|
3089
|
-
f.setDomain(
|
|
3146
|
+
const g = d.get(u), y = h.yMax - h.yMin, x = i.viewBounds.yMax - i.viewBounds.yMin, b = y > 0 ? x / y : 1, S = y > 0 ? (i.viewBounds.yMin - h.yMin) / y : 0, p = g[1] - g[0], v = g[0] + S * p, w = v + b * p;
|
|
3147
|
+
f.setDomain(v, w);
|
|
3090
3148
|
}
|
|
3091
3149
|
});
|
|
3092
3150
|
i.requestRender();
|
|
@@ -3099,78 +3157,78 @@ function vi(i, e) {
|
|
|
3099
3157
|
}
|
|
3100
3158
|
}), G;
|
|
3101
3159
|
}
|
|
3102
|
-
function
|
|
3160
|
+
function Ci(i, e = !0) {
|
|
3103
3161
|
if (i.series.size === 0) return null;
|
|
3104
3162
|
let t = 1 / 0, n = -1 / 0;
|
|
3105
3163
|
const s = /* @__PURE__ */ new Map();
|
|
3106
|
-
i.yScales.forEach((
|
|
3107
|
-
s.set(
|
|
3164
|
+
i.yScales.forEach((S, p) => {
|
|
3165
|
+
s.set(p, { min: 1 / 0, max: -1 / 0 });
|
|
3108
3166
|
});
|
|
3109
3167
|
let o = !1;
|
|
3110
|
-
if (i.series.forEach((
|
|
3111
|
-
if (!
|
|
3112
|
-
const
|
|
3113
|
-
if (
|
|
3114
|
-
t = Math.min(t,
|
|
3115
|
-
const
|
|
3116
|
-
w && (w.min = Math.min(w.min,
|
|
3168
|
+
if (i.series.forEach((S) => {
|
|
3169
|
+
if (!S.isVisible()) return;
|
|
3170
|
+
const p = S.getBounds();
|
|
3171
|
+
if (p && isFinite(p.xMin) && isFinite(p.xMax) && isFinite(p.yMin) && isFinite(p.yMax)) {
|
|
3172
|
+
t = Math.min(t, p.xMin), n = Math.max(n, p.xMax);
|
|
3173
|
+
const v = S.getYAxisId() || i.primaryYAxisId, w = s.get(v);
|
|
3174
|
+
w && (w.min = Math.min(w.min, p.yMin), w.max = Math.max(w.max, p.yMax)), o = !0;
|
|
3117
3175
|
}
|
|
3118
3176
|
}), !o) return null;
|
|
3119
3177
|
const r = 1e15, a = -1e15;
|
|
3120
3178
|
let l = i.viewBounds.xMin, h = i.viewBounds.xMax, d = i.viewBounds.yMin, c = i.viewBounds.yMax;
|
|
3121
3179
|
if (i.xAxisOptions.auto) {
|
|
3122
|
-
let
|
|
3123
|
-
(
|
|
3124
|
-
const
|
|
3125
|
-
l = Math.max(a, t -
|
|
3180
|
+
let S = n - t;
|
|
3181
|
+
(S <= 0 || !isFinite(S)) && (S = Math.abs(t) * 0.1 || 1);
|
|
3182
|
+
const p = Math.min(S * 5e-3, 1e10);
|
|
3183
|
+
l = Math.max(a, t - p), h = Math.min(r, n + p);
|
|
3126
3184
|
}
|
|
3127
3185
|
const f = s.get(i.primaryYAxisId), u = i.yAxisOptionsMap.get(i.primaryYAxisId);
|
|
3128
3186
|
if (f && (u != null && u.auto) && f.min !== 1 / 0) {
|
|
3129
|
-
let
|
|
3130
|
-
(
|
|
3131
|
-
const
|
|
3132
|
-
d = Math.max(a, f.min -
|
|
3187
|
+
let S = f.max - f.min;
|
|
3188
|
+
(S <= 0 || !isFinite(S)) && (S = Math.abs(f.min) * 0.1 || 1);
|
|
3189
|
+
const p = Math.min(S * 5e-3, 1e10);
|
|
3190
|
+
d = Math.max(a, f.min - p), c = Math.min(r, f.max + p);
|
|
3133
3191
|
}
|
|
3134
3192
|
const g = e && i.animationConfig.enabled && i.animationConfig.autoScale.enabled;
|
|
3135
3193
|
if (j != null && j.isRunning() && j.cancel(), !g)
|
|
3136
|
-
return i.viewBounds.xMin = l, i.viewBounds.xMax = h, i.viewBounds.yMin = d, i.viewBounds.yMax = c, i.yScales.forEach((
|
|
3137
|
-
const
|
|
3138
|
-
if (
|
|
3139
|
-
let M =
|
|
3140
|
-
(M <= 0 || !isFinite(M)) && (M = Math.abs(
|
|
3194
|
+
return i.viewBounds.xMin = l, i.viewBounds.xMax = h, i.viewBounds.yMin = d, i.viewBounds.yMax = c, i.yScales.forEach((S, p) => {
|
|
3195
|
+
const v = s.get(p), w = i.yAxisOptionsMap.get(p);
|
|
3196
|
+
if (v && (w != null && w.auto) && v.min !== 1 / 0) {
|
|
3197
|
+
let M = v.max - v.min;
|
|
3198
|
+
(M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
|
|
3141
3199
|
const A = Math.min(M * 5e-3, 1e10);
|
|
3142
|
-
|
|
3143
|
-
Math.max(a,
|
|
3144
|
-
Math.min(r,
|
|
3200
|
+
S.setDomain(
|
|
3201
|
+
Math.max(a, v.min - A),
|
|
3202
|
+
Math.min(r, v.max + A)
|
|
3145
3203
|
);
|
|
3146
3204
|
}
|
|
3147
3205
|
}), i.events.emit("autoScale", void 0), i.requestRender(), null;
|
|
3148
|
-
const y = { ...i.viewBounds },
|
|
3149
|
-
i.yScales.forEach((
|
|
3150
|
-
|
|
3206
|
+
const y = { ...i.viewBounds }, x = /* @__PURE__ */ new Map();
|
|
3207
|
+
i.yScales.forEach((S, p) => {
|
|
3208
|
+
x.set(p, [...S.domain]);
|
|
3151
3209
|
});
|
|
3152
3210
|
const b = /* @__PURE__ */ new Map();
|
|
3153
|
-
return i.yScales.forEach((
|
|
3154
|
-
const
|
|
3155
|
-
if (
|
|
3156
|
-
let M =
|
|
3157
|
-
(M <= 0 || !isFinite(M)) && (M = Math.abs(
|
|
3211
|
+
return i.yScales.forEach((S, p) => {
|
|
3212
|
+
const v = s.get(p), w = i.yAxisOptionsMap.get(p);
|
|
3213
|
+
if (v && (w != null && w.auto) && v.min !== 1 / 0) {
|
|
3214
|
+
let M = v.max - v.min;
|
|
3215
|
+
(M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
|
|
3158
3216
|
const A = Math.min(M * 5e-3, 1e10);
|
|
3159
|
-
b.set(
|
|
3160
|
-
Math.max(a,
|
|
3161
|
-
Math.min(r,
|
|
3217
|
+
b.set(p, [
|
|
3218
|
+
Math.max(a, v.min - A),
|
|
3219
|
+
Math.min(r, v.max + A)
|
|
3162
3220
|
]);
|
|
3163
3221
|
} else
|
|
3164
|
-
b.set(
|
|
3222
|
+
b.set(p, [...S.domain]);
|
|
3165
3223
|
}), j = i.animationEngine.animate({
|
|
3166
3224
|
duration: i.animationConfig.autoScale.duration,
|
|
3167
3225
|
easing: i.animationConfig.autoScale.easing,
|
|
3168
|
-
onUpdate: (
|
|
3169
|
-
i.viewBounds.xMin = y.xMin + (l - y.xMin) *
|
|
3170
|
-
const w =
|
|
3171
|
-
|
|
3172
|
-
w[0] + (M[0] - w[0]) *
|
|
3173
|
-
w[1] + (M[1] - w[1]) *
|
|
3226
|
+
onUpdate: (S) => {
|
|
3227
|
+
i.viewBounds.xMin = y.xMin + (l - y.xMin) * S, i.viewBounds.xMax = y.xMax + (h - y.xMax) * S, i.viewBounds.yMin = y.yMin + (d - y.yMin) * S, i.viewBounds.yMax = y.yMax + (c - y.yMax) * S, i.yScales.forEach((p, v) => {
|
|
3228
|
+
const w = x.get(v), M = b.get(v);
|
|
3229
|
+
p.setDomain(
|
|
3230
|
+
w[0] + (M[0] - w[0]) * S,
|
|
3231
|
+
w[1] + (M[1] - w[1]) * S
|
|
3174
3232
|
);
|
|
3175
3233
|
}), i.requestRender();
|
|
3176
3234
|
},
|
|
@@ -3179,7 +3237,7 @@ function Si(i, e = !0) {
|
|
|
3179
3237
|
}
|
|
3180
3238
|
}), j;
|
|
3181
3239
|
}
|
|
3182
|
-
function
|
|
3240
|
+
function Ai(i, e, t) {
|
|
3183
3241
|
const n = { ...i.viewBounds }, s = {
|
|
3184
3242
|
xMin: e.xMin ?? i.viewBounds.xMin,
|
|
3185
3243
|
xMax: e.xMax ?? i.viewBounds.xMax,
|
|
@@ -3202,7 +3260,7 @@ function wi(i, e, t) {
|
|
|
3202
3260
|
}
|
|
3203
3261
|
});
|
|
3204
3262
|
}
|
|
3205
|
-
function
|
|
3263
|
+
function nt(i, e, t = "degrees") {
|
|
3206
3264
|
const n = Math.min(i.length, e.length), s = new Float32Array(n * 2), o = t === "degrees" ? Math.PI / 180 : 1;
|
|
3207
3265
|
for (let r = 0; r < n; r++) {
|
|
3208
3266
|
const a = i[r], l = e[r] * o;
|
|
@@ -3210,22 +3268,22 @@ function tt(i, e, t = "degrees") {
|
|
|
3210
3268
|
}
|
|
3211
3269
|
return s;
|
|
3212
3270
|
}
|
|
3213
|
-
function
|
|
3214
|
-
const n =
|
|
3271
|
+
function Pi(i, e = "degrees", t = !1) {
|
|
3272
|
+
const n = nt(i.r, i.theta, e);
|
|
3215
3273
|
if (!t)
|
|
3216
3274
|
return n;
|
|
3217
3275
|
const s = n.length / 2, o = new Float32Array((s + 1) * 2);
|
|
3218
3276
|
return o.set(n), o[s * 2] = n[0], o[s * 2 + 1] = n[1], o;
|
|
3219
3277
|
}
|
|
3220
|
-
function
|
|
3221
|
-
const n =
|
|
3278
|
+
function ki(i, e = "degrees", t = !0) {
|
|
3279
|
+
const n = nt(i.r, i.theta, e), s = n.length / 2, o = t ? s : s - 1, r = new Float32Array(o * 3 * 2);
|
|
3222
3280
|
for (let a = 0; a < o; a++) {
|
|
3223
3281
|
const l = a * 6, h = a, d = (a + 1) % s;
|
|
3224
3282
|
r[l + 0] = 0, r[l + 1] = 0, r[l + 2] = n[h * 2], r[l + 3] = n[h * 2 + 1], r[l + 4] = n[d * 2], r[l + 5] = n[d * 2 + 1];
|
|
3225
3283
|
}
|
|
3226
3284
|
return r;
|
|
3227
3285
|
}
|
|
3228
|
-
function
|
|
3286
|
+
function Bi(i) {
|
|
3229
3287
|
const e = Math.min(i.r.length, i.theta.length);
|
|
3230
3288
|
let t = 0;
|
|
3231
3289
|
for (let n = 0; n < e; n++)
|
|
@@ -3238,44 +3296,44 @@ function Ai(i) {
|
|
|
3238
3296
|
maxRadius: t
|
|
3239
3297
|
};
|
|
3240
3298
|
}
|
|
3241
|
-
function
|
|
3299
|
+
function Ti(i, e, t, n) {
|
|
3242
3300
|
if (i === "heatmap" && t) {
|
|
3243
|
-
const { xValues: y, yValues:
|
|
3244
|
-
let b = 1 / 0,
|
|
3301
|
+
const { xValues: y, yValues: x } = t;
|
|
3302
|
+
let b = 1 / 0, S = -1 / 0, p = 1 / 0, v = -1 / 0;
|
|
3245
3303
|
for (let w = 0; w < y.length; w++) {
|
|
3246
3304
|
const M = y[w];
|
|
3247
|
-
M < b && (b = M), M >
|
|
3305
|
+
M < b && (b = M), M > S && (S = M);
|
|
3248
3306
|
}
|
|
3249
|
-
for (let w = 0; w <
|
|
3250
|
-
const M =
|
|
3251
|
-
M <
|
|
3307
|
+
for (let w = 0; w < x.length; w++) {
|
|
3308
|
+
const M = x[w];
|
|
3309
|
+
M < p && (p = M), M > v && (v = M);
|
|
3252
3310
|
}
|
|
3253
|
-
return b === 1 / 0 ||
|
|
3311
|
+
return b === 1 / 0 || p === 1 / 0 ? null : { xMin: b, xMax: S, yMin: p, yMax: v };
|
|
3254
3312
|
}
|
|
3255
3313
|
if (i === "polar" && n)
|
|
3256
|
-
return
|
|
3314
|
+
return Bi(n);
|
|
3257
3315
|
const { x: s, y: o, y2: r, open: a, high: l, low: h, close: d } = e;
|
|
3258
3316
|
if (s.length === 0) return null;
|
|
3259
3317
|
let c = 1 / 0, f = -1 / 0, u = 1 / 0, g = -1 / 0;
|
|
3260
3318
|
for (let y = 0; y < s.length; y++) {
|
|
3261
|
-
const
|
|
3262
|
-
if (!isFinite(
|
|
3263
|
-
|
|
3319
|
+
const x = s[y];
|
|
3320
|
+
if (!isFinite(x)) continue;
|
|
3321
|
+
x < c && (c = x), x > f && (f = x);
|
|
3264
3322
|
const b = [];
|
|
3265
3323
|
o.length > y && isFinite(o[y]) && b.push(o[y]), r && isFinite(r[y]) && b.push(r[y]), a && isFinite(a[y]) && b.push(a[y]), l && isFinite(l[y]) && b.push(l[y]), h && isFinite(h[y]) && b.push(h[y]), d && isFinite(d[y]) && b.push(d[y]);
|
|
3266
|
-
for (const
|
|
3267
|
-
|
|
3324
|
+
for (const S of b)
|
|
3325
|
+
S < u && (u = S), S > g && (g = S);
|
|
3268
3326
|
}
|
|
3269
3327
|
return c === 1 / 0 || u === 1 / 0 ? null : { xMin: c, xMax: f, yMin: u, yMax: g };
|
|
3270
3328
|
}
|
|
3271
3329
|
function P(i) {
|
|
3272
3330
|
return i ? i instanceof Float32Array || i instanceof Float64Array ? i : new Float32Array(i) : new Float32Array(0);
|
|
3273
3331
|
}
|
|
3274
|
-
function
|
|
3332
|
+
function X(i, e) {
|
|
3275
3333
|
const t = new i.constructor(i.length + e.length);
|
|
3276
3334
|
return t.set(i, 0), t.set(e, i.length), t;
|
|
3277
3335
|
}
|
|
3278
|
-
function
|
|
3336
|
+
function Ii(i, e) {
|
|
3279
3337
|
const { x: t, y: n } = i, s = t.length;
|
|
3280
3338
|
if (s < e) return { ...i };
|
|
3281
3339
|
const o = new Float32Array(s), r = Math.floor(e / 2);
|
|
@@ -3287,7 +3345,7 @@ function ki(i, e) {
|
|
|
3287
3345
|
}
|
|
3288
3346
|
return { x: t, y: o };
|
|
3289
3347
|
}
|
|
3290
|
-
function
|
|
3348
|
+
function Ei(i, e) {
|
|
3291
3349
|
var s, o;
|
|
3292
3350
|
if (e < 0 || e >= i.x.length) return null;
|
|
3293
3351
|
if (i.yError && e < i.yError.length) {
|
|
@@ -3297,7 +3355,7 @@ function Bi(i, e) {
|
|
|
3297
3355
|
const t = ((s = i.yErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.yErrorPlus) == null ? void 0 : o[e]) ?? 0;
|
|
3298
3356
|
return t > 0 || n > 0 ? [t, n] : null;
|
|
3299
3357
|
}
|
|
3300
|
-
function
|
|
3358
|
+
function Ri(i, e) {
|
|
3301
3359
|
var s, o;
|
|
3302
3360
|
if (e < 0 || e >= i.x.length) return null;
|
|
3303
3361
|
if (i.xError && e < i.xError.length) {
|
|
@@ -3307,72 +3365,72 @@ function Ti(i, e) {
|
|
|
3307
3365
|
const t = ((s = i.xErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.xErrorPlus) == null ? void 0 : o[e]) ?? 0;
|
|
3308
3366
|
return t > 0 || n > 0 ? [t, n] : null;
|
|
3309
3367
|
}
|
|
3310
|
-
const
|
|
3368
|
+
const Fi = {
|
|
3311
3369
|
color: "#ff0055",
|
|
3312
3370
|
width: 1.5,
|
|
3313
3371
|
opacity: 1,
|
|
3314
3372
|
pointSize: 4
|
|
3315
3373
|
};
|
|
3316
|
-
class
|
|
3374
|
+
class Di {
|
|
3317
3375
|
constructor(e) {
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3376
|
+
m(this, "id");
|
|
3377
|
+
m(this, "type");
|
|
3378
|
+
m(this, "yAxisId");
|
|
3379
|
+
m(this, "data");
|
|
3380
|
+
m(this, "style");
|
|
3381
|
+
m(this, "visible");
|
|
3382
|
+
m(this, "name");
|
|
3383
|
+
m(this, "stackId");
|
|
3384
|
+
m(this, "cycle");
|
|
3385
|
+
m(this, "maxPoints");
|
|
3386
|
+
m(this, "markers", []);
|
|
3387
|
+
m(this, "bullishCount", 0);
|
|
3388
|
+
m(this, "bearishCount", 0);
|
|
3389
|
+
m(this, "waterfallCounts");
|
|
3390
|
+
m(this, "heatmapData");
|
|
3391
|
+
m(this, "heatmapStyle");
|
|
3392
|
+
m(this, "polarData");
|
|
3393
|
+
m(this, "gaugeData");
|
|
3394
|
+
m(this, "gaugeStyle");
|
|
3395
|
+
m(this, "sankeyData");
|
|
3396
|
+
m(this, "sankeyStyle");
|
|
3397
|
+
m(this, "lastAppendCount", 0);
|
|
3398
|
+
m(this, "cachedBounds", null);
|
|
3399
|
+
m(this, "boundsNeedsUpdate", !0);
|
|
3400
|
+
m(this, "_needsBufferUpdate", !0);
|
|
3401
|
+
m(this, "smoothedData", null);
|
|
3402
|
+
m(this, "smoothingNeedsUpdate", !0);
|
|
3403
|
+
m(this, "getId", () => this.id);
|
|
3404
|
+
m(this, "getName", () => this.name || this.id);
|
|
3405
|
+
m(this, "getType", () => this.type);
|
|
3406
|
+
m(this, "getYAxisId", () => this.yAxisId);
|
|
3407
|
+
m(this, "setYAxisId", (e) => {
|
|
3350
3408
|
this.yAxisId = e;
|
|
3351
3409
|
});
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3410
|
+
m(this, "getStackId", () => this.stackId);
|
|
3411
|
+
m(this, "getVisible", () => this.visible);
|
|
3412
|
+
m(this, "isVisible", () => this.visible);
|
|
3413
|
+
m(this, "getStyle", () => this.style);
|
|
3414
|
+
m(this, "getMarkers", () => this.markers);
|
|
3415
|
+
m(this, "setMarkers", (e) => {
|
|
3358
3416
|
this.markers = e, this._needsBufferUpdate = !0;
|
|
3359
3417
|
});
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3418
|
+
m(this, "getHeatmapData", () => this.heatmapData);
|
|
3419
|
+
m(this, "getHeatmapStyle", () => this.heatmapStyle);
|
|
3420
|
+
m(this, "getPolarData", () => this.polarData);
|
|
3421
|
+
m(this, "getGaugeData", () => this.gaugeData);
|
|
3422
|
+
m(this, "getGaugeStyle", () => this.gaugeStyle);
|
|
3423
|
+
m(this, "getSankeyData", () => this.sankeyData);
|
|
3424
|
+
m(this, "getSankeyStyle", () => this.sankeyStyle);
|
|
3425
|
+
m(this, "getCycle", () => this.cycle);
|
|
3426
|
+
m(this, "getPointCount", () => this.type === "heatmap" ? this.heatmapData.xValues.length * this.heatmapData.yValues.length : this.type === "polar" ? this.polarData ? this.polarData.r.length : 0 : this.type === "gauge" ? 1 : this.type === "sankey" ? this.sankeyData ? this.sankeyData.links.length : 0 : this.data.x.length);
|
|
3427
|
+
m(this, "getLastAppendCount", () => this.lastAppendCount);
|
|
3428
|
+
m(this, "resetLastAppendCount", () => {
|
|
3371
3429
|
this.lastAppendCount = 0;
|
|
3372
3430
|
});
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3431
|
+
m(this, "hasErrorData", () => !!(this.data.yError || this.data.yErrorPlus || this.data.yErrorMinus || this.data.xError || this.data.xErrorPlus || this.data.xErrorMinus));
|
|
3432
|
+
m(this, "getYError", (e) => Ei(this.data, e));
|
|
3433
|
+
m(this, "getXError", (e) => Ri(this.data, e));
|
|
3376
3434
|
if (this.id = e.id, this.name = e.name, this.type = e.type, this.yAxisId = e.yAxisId, this.visible = e.visible ?? !0, this.stackId = e.stackId, this.cycle = e.cycle, this.maxPoints = e.maxPoints, this.markers = e.markers ?? [], this.type === "heatmap") {
|
|
3377
3435
|
const t = e;
|
|
3378
3436
|
this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.heatmapData = {
|
|
@@ -3411,19 +3469,19 @@ class Ei {
|
|
|
3411
3469
|
median: t != null && t.median ? P(t.median) : void 0
|
|
3412
3470
|
}, this.type === "candlestick" && this.data.close && this.data.y.length !== this.data.x.length && (this.data.y = this.data.close);
|
|
3413
3471
|
}
|
|
3414
|
-
this.style = { ...
|
|
3472
|
+
this.style = { ...Fi, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
|
|
3415
3473
|
}
|
|
3416
3474
|
getData() {
|
|
3417
|
-
return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData =
|
|
3475
|
+
return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Ii(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
|
|
3418
3476
|
}
|
|
3419
3477
|
getBounds() {
|
|
3420
|
-
return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds =
|
|
3478
|
+
return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Ti(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
|
|
3421
3479
|
}
|
|
3422
3480
|
updateData(e) {
|
|
3423
3481
|
if (e) {
|
|
3424
3482
|
if (e.append) {
|
|
3425
3483
|
const t = P(e.x), n = P(e.y);
|
|
3426
|
-
if (t.length > 0 && (this.data.x =
|
|
3484
|
+
if (t.length > 0 && (this.data.x = X(this.data.x, t), this.data.y = X(this.data.y, n), e.y2 && (this.data.y2 = this.data.y2 ? X(this.data.y2, P(e.y2)) : P(e.y2)), e.open && (this.data.open = this.data.open ? X(this.data.open, P(e.open)) : P(e.open)), e.high && (this.data.high = this.data.high ? X(this.data.high, P(e.high)) : P(e.high)), e.low && (this.data.low = this.data.low ? X(this.data.low, P(e.low)) : P(e.low)), e.close && (this.data.close = this.data.close ? X(this.data.close, P(e.close)) : P(e.close)), e.median && (this.data.median = this.data.median ? X(this.data.median, P(e.median)) : P(e.median)), this.lastAppendCount += t.length, this.maxPoints && this.data.x.length > this.maxPoints)) {
|
|
3427
3485
|
const s = this.data.x.length - this.maxPoints;
|
|
3428
3486
|
this.data.x = this.data.x.slice(s), this.data.y = this.data.y.slice(s), this.data.y2 && (this.data.y2 = this.data.y2.slice(s)), this.data.open && (this.data.open = this.data.open.slice(s)), this.data.high && (this.data.high = this.data.high.slice(s)), this.data.low && (this.data.low = this.data.low.slice(s)), this.data.close && (this.data.close = this.data.close.slice(s)), this.lastAppendCount = 0;
|
|
3429
3487
|
}
|
|
@@ -3464,7 +3522,7 @@ class Ei {
|
|
|
3464
3522
|
this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.cachedBounds = null;
|
|
3465
3523
|
}
|
|
3466
3524
|
}
|
|
3467
|
-
function
|
|
3525
|
+
function Li(i, e, t) {
|
|
3468
3526
|
const n = Math.min(i.length, e.length), s = new Float32Array(n * 6 * 2), o = t * 0.5;
|
|
3469
3527
|
for (let r = 0; r < n; r++) {
|
|
3470
3528
|
const a = i[r], l = e[r], h = r * 12, d = a - o, c = a + o, f = 0, u = l;
|
|
@@ -3472,7 +3530,7 @@ function Ri(i, e, t) {
|
|
|
3472
3530
|
}
|
|
3473
3531
|
return s;
|
|
3474
3532
|
}
|
|
3475
|
-
function
|
|
3533
|
+
function me(i) {
|
|
3476
3534
|
if (i.length < 2) return 1;
|
|
3477
3535
|
let e = 1 / 0;
|
|
3478
3536
|
for (let t = 1; t < i.length; t++) {
|
|
@@ -3481,19 +3539,19 @@ function ye(i) {
|
|
|
3481
3539
|
}
|
|
3482
3540
|
return e === 1 / 0 ? 1 : e * 0.8;
|
|
3483
3541
|
}
|
|
3484
|
-
function
|
|
3542
|
+
function zi(i, e, t) {
|
|
3485
3543
|
const n = i.length, s = e.length;
|
|
3486
3544
|
n * s > t.length && console.warn("[Heatmap] Z array is too small for the specified grid dimensions");
|
|
3487
3545
|
const o = (n - 1) * (s - 1), r = new Float32Array(o * 6 * 3);
|
|
3488
3546
|
let a = 0;
|
|
3489
3547
|
for (let l = 0; l < s - 1; l++)
|
|
3490
3548
|
for (let h = 0; h < n - 1; h++) {
|
|
3491
|
-
const d = i[h], c = i[h + 1], f = e[l], u = e[l + 1], g = t[l * n + h], y = t[l * n + (h + 1)],
|
|
3492
|
-
r[a++] = d, r[a++] = f, r[a++] = g, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = d, r[a++] = u, r[a++] =
|
|
3549
|
+
const d = i[h], c = i[h + 1], f = e[l], u = e[l + 1], g = t[l * n + h], y = t[l * n + (h + 1)], x = t[(l + 1) * n + h], b = t[(l + 1) * n + (h + 1)];
|
|
3550
|
+
r[a++] = d, r[a++] = f, r[a++] = g, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = d, r[a++] = u, r[a++] = x, r[a++] = d, r[a++] = u, r[a++] = x, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = c, r[a++] = u, r[a++] = b;
|
|
3493
3551
|
}
|
|
3494
3552
|
return r;
|
|
3495
3553
|
}
|
|
3496
|
-
function
|
|
3554
|
+
function Oi(i = "viridis") {
|
|
3497
3555
|
const t = new Uint8Array(1024);
|
|
3498
3556
|
for (let n = 0; n < 256; n++) {
|
|
3499
3557
|
const s = n / 255;
|
|
@@ -3502,11 +3560,12 @@ function Di(i = "viridis") {
|
|
|
3502
3560
|
}
|
|
3503
3561
|
return t;
|
|
3504
3562
|
}
|
|
3505
|
-
function
|
|
3563
|
+
function $i(i, e, t, n, s, o, r = !1) {
|
|
3506
3564
|
const a = i.length, l = [], h = [], d = o / 2, f = o / 10 / 2;
|
|
3507
3565
|
for (let u = 0; u < a; u++) {
|
|
3508
|
-
|
|
3509
|
-
|
|
3566
|
+
if (!Number.isFinite(i[u])) continue;
|
|
3567
|
+
const g = s[u] >= e[u], y = g ? l : h, x = Math.max(e[u], s[u]), b = Math.min(e[u], s[u]);
|
|
3568
|
+
r && g || Ve(y, i[u] - d, b, i[u] + d, x), Ve(y, i[u] - f, n[u], i[u] + f, t[u]);
|
|
3510
3569
|
}
|
|
3511
3570
|
return {
|
|
3512
3571
|
bullish: new Float32Array(l),
|
|
@@ -3516,11 +3575,11 @@ function Li(i, e, t, n, s, o, r = !1) {
|
|
|
3516
3575
|
function Ve(i, e, t, n, s) {
|
|
3517
3576
|
i.push(e, t, n, t, e, s), i.push(n, t, n, s, e, s);
|
|
3518
3577
|
}
|
|
3519
|
-
function
|
|
3578
|
+
function ce(i, e) {
|
|
3520
3579
|
if (!i.renderer) return;
|
|
3521
3580
|
const t = e.getStackId();
|
|
3522
3581
|
if (t) {
|
|
3523
|
-
|
|
3582
|
+
Vi(i, t);
|
|
3524
3583
|
return;
|
|
3525
3584
|
}
|
|
3526
3585
|
const n = e.getData(), s = e.getType();
|
|
@@ -3528,16 +3587,16 @@ function he(i, e) {
|
|
|
3528
3587
|
const o = e.getId();
|
|
3529
3588
|
if (s === "band" || s === "area") {
|
|
3530
3589
|
const r = s === "area" ? new Float32Array(n.x.length).fill(0) : n.y2 || new Float32Array(n.x.length).fill(0);
|
|
3531
|
-
i.renderer.createBuffer(o,
|
|
3590
|
+
i.renderer.createBuffer(o, Je(n.x, n.y, r));
|
|
3532
3591
|
} else if (s === "bar") {
|
|
3533
|
-
const r = e.getStyle().barWidth ??
|
|
3534
|
-
i.renderer.createBuffer(o,
|
|
3592
|
+
const r = e.getStyle().barWidth ?? me(n.x);
|
|
3593
|
+
i.renderer.createBuffer(o, Li(n.x, n.y, r));
|
|
3535
3594
|
} else if (s === "heatmap")
|
|
3536
|
-
|
|
3595
|
+
_i(i, e);
|
|
3537
3596
|
else if (s === "candlestick") {
|
|
3538
3597
|
const r = e.getData();
|
|
3539
3598
|
if (r.open && r.high && r.low && r.close) {
|
|
3540
|
-
const a = e.getStyle().barWidth ??
|
|
3599
|
+
const a = e.getStyle().barWidth ?? me(r.x), l = !!e.getStyle().hollow, { bullish: h, bearish: d } = $i(
|
|
3541
3600
|
r.x,
|
|
3542
3601
|
r.open,
|
|
3543
3602
|
r.high,
|
|
@@ -3551,20 +3610,20 @@ function he(i, e) {
|
|
|
3551
3610
|
} else if (s === "boxplot") {
|
|
3552
3611
|
const r = e.getData();
|
|
3553
3612
|
if (r.low && r.open && r.median && r.close && r.high) {
|
|
3554
|
-
const a = e.getStyle().barWidth ??
|
|
3613
|
+
const a = e.getStyle().barWidth ?? me(r.x), { lines: l, boxes: h } = zt(r.x, r.low, r.open, r.median, r.close, r.high, a);
|
|
3555
3614
|
i.renderer.createBuffer(`${o}_box_lines`, l), i.renderer.createBuffer(`${o}_box_faces`, h);
|
|
3556
3615
|
}
|
|
3557
3616
|
} else if (s === "waterfall") {
|
|
3558
|
-
const r = e.getData(), a = e.getStyle().barWidth ??
|
|
3617
|
+
const r = e.getData(), a = e.getStyle().barWidth ?? me(r.x), l = e.getStyle().isSubtotal, h = Ot(r.x, r.y, a, l);
|
|
3559
3618
|
i.renderer.createBuffer(`${o}_wf_positive`, h.positiveData), i.renderer.createBuffer(`${o}_wf_negative`, h.negativeData), i.renderer.createBuffer(`${o}_wf_subtotal`, h.subtotalData), i.renderer.createBuffer(`${o}_wf_connectors`, h.connectorData), e.waterfallCounts = {
|
|
3560
3619
|
positive: h.positiveCount,
|
|
3561
3620
|
negative: h.negativeCount,
|
|
3562
3621
|
subtotal: h.subtotalCount,
|
|
3563
3622
|
connectors: h.connectorData.length / 2
|
|
3564
3623
|
};
|
|
3565
|
-
} else s === "polar" ?
|
|
3624
|
+
} else s === "polar" ? Yi(i, e) : i.renderer.createBuffer(o, Ze(n.x, n.y));
|
|
3566
3625
|
if (e.hasErrorData()) {
|
|
3567
|
-
const r = e.getData(), a =
|
|
3626
|
+
const r = e.getData(), a = Lt(
|
|
3568
3627
|
r.x,
|
|
3569
3628
|
r.y,
|
|
3570
3629
|
{ yError: r.yError, yErrorMinus: r.yErrorMinus, yErrorPlus: r.yErrorPlus },
|
|
@@ -3574,31 +3633,31 @@ function he(i, e) {
|
|
|
3574
3633
|
}
|
|
3575
3634
|
if (s === "step" || s === "step+scatter") {
|
|
3576
3635
|
const r = e.getStyle().stepMode ?? "after";
|
|
3577
|
-
i.renderer.createBuffer(`${o}_step`,
|
|
3636
|
+
i.renderer.createBuffer(`${o}_step`, Dt(n.x, n.y, r));
|
|
3578
3637
|
}
|
|
3579
3638
|
e.resetLastAppendCount();
|
|
3580
3639
|
}
|
|
3581
|
-
function
|
|
3640
|
+
function Yi(i, e) {
|
|
3582
3641
|
const t = e.getPolarData();
|
|
3583
3642
|
if (!t || t.r.length === 0) return;
|
|
3584
3643
|
const n = e.getStyle(), s = n.angleMode || "degrees", o = n.closePath !== !1;
|
|
3585
3644
|
if (n.fill || !1) {
|
|
3586
|
-
const a =
|
|
3645
|
+
const a = ki(t, s, o);
|
|
3587
3646
|
i.renderer.createBuffer(e.getId(), a);
|
|
3588
3647
|
} else {
|
|
3589
|
-
const a =
|
|
3648
|
+
const a = Pi(t, s, o);
|
|
3590
3649
|
i.renderer.createBuffer(e.getId(), a);
|
|
3591
3650
|
}
|
|
3592
3651
|
}
|
|
3593
|
-
function
|
|
3652
|
+
function _i(i, e) {
|
|
3594
3653
|
var o;
|
|
3595
3654
|
const t = e.getHeatmapData(), n = e.getHeatmapStyle();
|
|
3596
3655
|
if (!t || t.xValues.length < 2) return;
|
|
3597
|
-
i.renderer.createBuffer(e.getId(),
|
|
3656
|
+
i.renderer.createBuffer(e.getId(), zi(t.xValues, t.yValues, t.zValues));
|
|
3598
3657
|
const s = ((o = n == null ? void 0 : n.colorScale) == null ? void 0 : o.name) || "viridis";
|
|
3599
|
-
i.renderer.createColormapTexture(`${e.getId()}_colormap`,
|
|
3658
|
+
i.renderer.createColormapTexture(`${e.getId()}_colormap`, Oi(s));
|
|
3600
3659
|
}
|
|
3601
|
-
function
|
|
3660
|
+
function Vi(i, e) {
|
|
3602
3661
|
const t = Array.from(i.series.values()).filter((s) => s.getStackId() === e);
|
|
3603
3662
|
let n = null;
|
|
3604
3663
|
for (const s of t) {
|
|
@@ -3607,13 +3666,13 @@ function $i(i, e) {
|
|
|
3607
3666
|
n || (n = new Float32Array(o.y.length).fill(0));
|
|
3608
3667
|
const r = new Float32Array(n);
|
|
3609
3668
|
for (let a = 0; a < o.y.length; a++) n[a] += o.y[a];
|
|
3610
|
-
i.renderer.createBuffer(s.getId(),
|
|
3669
|
+
i.renderer.createBuffer(s.getId(), Je(o.x, n, r)), s.resetLastAppendCount();
|
|
3611
3670
|
}
|
|
3612
3671
|
}
|
|
3613
3672
|
function N(i) {
|
|
3614
3673
|
return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
|
|
3615
3674
|
}
|
|
3616
|
-
function
|
|
3675
|
+
function Xi(i) {
|
|
3617
3676
|
const e = new Float32Array(i.length), t = new Float32Array(i.length);
|
|
3618
3677
|
for (let n = 0; n < i.length; n++) {
|
|
3619
3678
|
const s = i[n];
|
|
@@ -3621,13 +3680,13 @@ function Yi(i) {
|
|
|
3621
3680
|
}
|
|
3622
3681
|
return { positive: e, negative: t };
|
|
3623
3682
|
}
|
|
3624
|
-
function
|
|
3683
|
+
function Wi(i, e, t) {
|
|
3625
3684
|
if (i === void 0 || i === "zero") return 0;
|
|
3626
3685
|
if (typeof i == "number") return i;
|
|
3627
3686
|
const n = t.find((o) => o.id === i);
|
|
3628
3687
|
return n ? N(n.y)[e] ?? 0 : 0;
|
|
3629
3688
|
}
|
|
3630
|
-
function
|
|
3689
|
+
function Ni(i, e, t, n, s) {
|
|
3631
3690
|
const o = i.length;
|
|
3632
3691
|
if (o === 0) return [];
|
|
3633
3692
|
if (o === 1) {
|
|
@@ -3643,26 +3702,21 @@ function Vi(i, e, t, n, s) {
|
|
|
3643
3702
|
};
|
|
3644
3703
|
h(i[0], e[0], l(0));
|
|
3645
3704
|
for (let c = 1; c < o; c++) {
|
|
3646
|
-
const f = e[c - 1], u = e[c], g = t(c - 1), y = t(c),
|
|
3647
|
-
if (
|
|
3705
|
+
const f = e[c - 1], u = e[c], g = t(c - 1), y = t(c), x = f >= g, b = u >= y;
|
|
3706
|
+
if (x === b) {
|
|
3648
3707
|
h(i[c], e[c], l(c));
|
|
3649
3708
|
continue;
|
|
3650
3709
|
}
|
|
3651
|
-
const
|
|
3652
|
-
|
|
3653
|
-
x = Math.max(0, Math.min(1, x));
|
|
3654
|
-
const S = i[c - 1] + x * (i[c] - i[c - 1]), w = f + x * (u - f), M = m ? n : s, A = b ? n : s;
|
|
3655
|
-
h(S, w, M), d(), h(S, w, A), h(i[c], e[c], l(c));
|
|
3710
|
+
const S = u - f - (y - g), p = Math.max(0, Math.min(1, (g - f) / S)), v = i[c - 1] + p * (i[c] - i[c - 1]), w = f + p * (u - f), M = x ? n : s, A = b ? n : s;
|
|
3711
|
+
h(v, w, M), d(), h(v, w, A), h(i[c], e[c], l(c));
|
|
3656
3712
|
}
|
|
3657
3713
|
return d(), r;
|
|
3658
3714
|
}
|
|
3659
|
-
function
|
|
3660
|
-
const l = s.colorZones
|
|
3661
|
-
if (!l) return;
|
|
3662
|
-
const d = Vi(
|
|
3715
|
+
function Hi(i, e, t, n, s, o, r, a) {
|
|
3716
|
+
const l = s.colorZones, d = Ni(
|
|
3663
3717
|
t,
|
|
3664
3718
|
n,
|
|
3665
|
-
(c) =>
|
|
3719
|
+
(c) => Wi(l.ref, c, o),
|
|
3666
3720
|
l.aboveColor,
|
|
3667
3721
|
l.belowColor
|
|
3668
3722
|
);
|
|
@@ -3684,7 +3738,7 @@ function Wi(i, e, t, n, s, o, r, a) {
|
|
|
3684
3738
|
});
|
|
3685
3739
|
}
|
|
3686
3740
|
}
|
|
3687
|
-
const
|
|
3741
|
+
const Ui = {
|
|
3688
3742
|
baselineColor: "rgba(255,255,255,0.35)",
|
|
3689
3743
|
baselineWidth: 1,
|
|
3690
3744
|
baselineDash: [4, 4],
|
|
@@ -3694,125 +3748,128 @@ const Xi = {
|
|
|
3694
3748
|
troughSize: 6
|
|
3695
3749
|
};
|
|
3696
3750
|
function Se(i) {
|
|
3697
|
-
var d, c, f
|
|
3698
|
-
const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...
|
|
3699
|
-
if ((
|
|
3700
|
-
for (let
|
|
3701
|
-
const
|
|
3751
|
+
var h, d, c, f;
|
|
3752
|
+
const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...Ui, ...n }, r = N(t.x), a = r.length, l = [];
|
|
3753
|
+
if ((h = t.fills) != null && h.length)
|
|
3754
|
+
for (let u = 0; u < t.fills.length; u++) {
|
|
3755
|
+
const g = t.fills[u], y = g.id ?? `${e}-fill-${u}`;
|
|
3702
3756
|
l.push({
|
|
3703
|
-
id:
|
|
3757
|
+
id: y,
|
|
3704
3758
|
type: "band",
|
|
3705
3759
|
visible: s,
|
|
3706
3760
|
data: {
|
|
3707
3761
|
x: r,
|
|
3708
|
-
y: N(
|
|
3709
|
-
y2: N(
|
|
3762
|
+
y: N(g.upper),
|
|
3763
|
+
y2: N(g.lower)
|
|
3710
3764
|
},
|
|
3711
3765
|
style: {
|
|
3712
|
-
color:
|
|
3713
|
-
opacity:
|
|
3766
|
+
color: g.color ?? "rgba(100, 80, 180, 0.25)",
|
|
3767
|
+
opacity: g.opacity ?? 0.35
|
|
3714
3768
|
}
|
|
3715
3769
|
});
|
|
3716
3770
|
}
|
|
3717
3771
|
if (t.histogram) {
|
|
3718
|
-
const
|
|
3772
|
+
const u = N(t.histogram.y), { positive: g, negative: y } = Xi(u), x = t.histogram.barWidth, b = x !== void 0 ? { barWidth: x } : {};
|
|
3719
3773
|
l.push({
|
|
3720
3774
|
id: `${e}-hist-pos`,
|
|
3721
3775
|
type: "bar",
|
|
3722
3776
|
visible: s,
|
|
3723
|
-
data: { x: r, y },
|
|
3777
|
+
data: { x: r, y: g },
|
|
3724
3778
|
style: {
|
|
3725
3779
|
color: t.histogram.positiveColor ?? "#26a69a",
|
|
3726
3780
|
opacity: t.histogram.opacity ?? 0.85,
|
|
3727
|
-
...
|
|
3781
|
+
...b
|
|
3728
3782
|
}
|
|
3729
3783
|
}), l.push({
|
|
3730
3784
|
id: `${e}-hist-neg`,
|
|
3731
3785
|
type: "bar",
|
|
3732
3786
|
visible: s,
|
|
3733
|
-
data: { x: r, y
|
|
3787
|
+
data: { x: r, y },
|
|
3734
3788
|
style: {
|
|
3735
3789
|
color: t.histogram.negativeColor ?? "#ef5350",
|
|
3736
3790
|
opacity: t.histogram.opacity ?? 0.85,
|
|
3737
|
-
...
|
|
3791
|
+
...b
|
|
3738
3792
|
}
|
|
3739
3793
|
});
|
|
3740
3794
|
}
|
|
3741
|
-
if ((
|
|
3742
|
-
for (let
|
|
3743
|
-
const
|
|
3744
|
-
if (
|
|
3745
|
-
|
|
3795
|
+
if ((d = t.lines) != null && d.length)
|
|
3796
|
+
for (let u = 0; u < t.lines.length; u++) {
|
|
3797
|
+
const g = t.lines[u], y = g.id ?? `${e}-line-${u}`, x = N(g.y);
|
|
3798
|
+
if (g.colorZones) {
|
|
3799
|
+
Hi(l, y, r, x, g, t.lines, s, "zone");
|
|
3746
3800
|
continue;
|
|
3747
3801
|
}
|
|
3748
3802
|
l.push({
|
|
3749
|
-
id:
|
|
3803
|
+
id: y,
|
|
3750
3804
|
type: "line",
|
|
3751
3805
|
visible: s,
|
|
3752
|
-
data: { x: r, y:
|
|
3806
|
+
data: { x: r, y: x },
|
|
3753
3807
|
style: {
|
|
3754
|
-
color:
|
|
3755
|
-
width:
|
|
3756
|
-
opacity:
|
|
3808
|
+
color: g.color ?? (u === 0 ? "#00e5ff" : "#e040fb"),
|
|
3809
|
+
width: g.width ?? 2,
|
|
3810
|
+
opacity: g.opacity ?? 1
|
|
3757
3811
|
}
|
|
3758
3812
|
});
|
|
3759
3813
|
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3814
|
+
if (t.baseline !== void 0 && a >= 2) {
|
|
3815
|
+
const u = t.baseline;
|
|
3816
|
+
l.push({
|
|
3817
|
+
id: `${e}-baseline`,
|
|
3818
|
+
type: "line",
|
|
3819
|
+
visible: s,
|
|
3820
|
+
data: {
|
|
3821
|
+
x: Float32Array.from([r[0], r[a - 1]]),
|
|
3822
|
+
y: Float32Array.from([u, u])
|
|
3823
|
+
},
|
|
3824
|
+
style: {
|
|
3825
|
+
color: o.baselineColor,
|
|
3826
|
+
width: o.baselineWidth,
|
|
3827
|
+
lineDash: o.baselineDash,
|
|
3828
|
+
opacity: 1
|
|
3829
|
+
}
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
if ((c = t.referenceLines) != null && c.length)
|
|
3833
|
+
for (let u = 0; u < t.referenceLines.length; u++) {
|
|
3834
|
+
const g = t.referenceLines[u];
|
|
3778
3835
|
l.push({
|
|
3779
|
-
id: `${e}-ref-${
|
|
3836
|
+
id: `${e}-ref-${u}`,
|
|
3780
3837
|
type: "line",
|
|
3781
3838
|
visible: s,
|
|
3782
3839
|
data: {
|
|
3783
3840
|
x: Float32Array.from([r[0], r[a - 1]]),
|
|
3784
|
-
y: Float32Array.from([
|
|
3841
|
+
y: Float32Array.from([g.y, g.y])
|
|
3785
3842
|
},
|
|
3786
3843
|
style: {
|
|
3787
|
-
color:
|
|
3788
|
-
width:
|
|
3789
|
-
lineDash:
|
|
3844
|
+
color: g.color ?? "rgba(255,255,255,0.2)",
|
|
3845
|
+
width: g.width ?? 1,
|
|
3846
|
+
lineDash: g.dash ?? [2, 4],
|
|
3790
3847
|
opacity: 0.8
|
|
3791
3848
|
}
|
|
3792
3849
|
});
|
|
3793
3850
|
}
|
|
3794
|
-
if ((
|
|
3795
|
-
const
|
|
3796
|
-
|
|
3851
|
+
if ((f = t.markers) != null && f.length) {
|
|
3852
|
+
const u = t.markers.filter((y) => y.kind === "peak"), g = t.markers.filter((y) => y.kind === "trough");
|
|
3853
|
+
u.length && l.push({
|
|
3797
3854
|
id: `${e}-peaks`,
|
|
3798
3855
|
type: "scatter",
|
|
3799
3856
|
visible: s,
|
|
3800
3857
|
data: {
|
|
3801
|
-
x: Float32Array.from(
|
|
3802
|
-
y: Float32Array.from(
|
|
3858
|
+
x: Float32Array.from(u.map((y) => y.x)),
|
|
3859
|
+
y: Float32Array.from(u.map((y) => y.y))
|
|
3803
3860
|
},
|
|
3804
3861
|
style: {
|
|
3805
3862
|
color: o.peakColor,
|
|
3806
3863
|
pointSize: o.peakSize,
|
|
3807
3864
|
opacity: 1
|
|
3808
3865
|
}
|
|
3809
|
-
}),
|
|
3866
|
+
}), g.length && l.push({
|
|
3810
3867
|
id: `${e}-troughs`,
|
|
3811
3868
|
type: "scatter",
|
|
3812
3869
|
visible: s,
|
|
3813
3870
|
data: {
|
|
3814
|
-
x: Float32Array.from(
|
|
3815
|
-
y: Float32Array.from(
|
|
3871
|
+
x: Float32Array.from(g.map((y) => y.x)),
|
|
3872
|
+
y: Float32Array.from(g.map((y) => y.y))
|
|
3816
3873
|
},
|
|
3817
3874
|
style: {
|
|
3818
3875
|
color: o.troughColor,
|
|
@@ -3823,10 +3880,10 @@ function Se(i) {
|
|
|
3823
3880
|
}
|
|
3824
3881
|
return l;
|
|
3825
3882
|
}
|
|
3826
|
-
function
|
|
3883
|
+
function as(i) {
|
|
3827
3884
|
return Se(i);
|
|
3828
3885
|
}
|
|
3829
|
-
function
|
|
3886
|
+
function ls(i, e, t = 3) {
|
|
3830
3887
|
const n = N(i), s = N(e), o = [], r = Math.max(1, t);
|
|
3831
3888
|
for (let a = r; a < s.length - r; a++) {
|
|
3832
3889
|
let l = !0, h = !0;
|
|
@@ -3836,37 +3893,83 @@ function Zn(i, e, t = 3) {
|
|
|
3836
3893
|
}
|
|
3837
3894
|
return o;
|
|
3838
3895
|
}
|
|
3839
|
-
function
|
|
3896
|
+
function qi(i) {
|
|
3897
|
+
const e = i.close.length, t = new Float32Array(e), n = new Float32Array(e), s = new Float32Array(e), o = new Float32Array(e);
|
|
3898
|
+
for (let r = 0; r < e; r++) {
|
|
3899
|
+
const a = i.open[r], l = i.high[r], h = i.low[r], d = i.close[r];
|
|
3900
|
+
o[r] = (a + l + h + d) / 4, t[r] = r === 0 ? (a + d) / 2 : (t[r - 1] + o[r - 1]) / 2, n[r] = Math.max(l, t[r], o[r]), s[r] = Math.min(h, t[r], o[r]);
|
|
3901
|
+
}
|
|
3902
|
+
return { open: t, high: n, low: s, close: o };
|
|
3903
|
+
}
|
|
3904
|
+
function Gi(i, e) {
|
|
3905
|
+
var n, s;
|
|
3906
|
+
if (e.type === "heatmap" || e.type === "indicator")
|
|
3907
|
+
return e;
|
|
3908
|
+
let t = { ...e };
|
|
3909
|
+
if (t.type === "heikin-ashi") {
|
|
3910
|
+
const o = t.data;
|
|
3911
|
+
if (o != null && o.open && o.high && o.low && o.close) {
|
|
3912
|
+
const r = qi({
|
|
3913
|
+
open: o.open,
|
|
3914
|
+
high: o.high,
|
|
3915
|
+
low: o.low,
|
|
3916
|
+
close: o.close
|
|
3917
|
+
});
|
|
3918
|
+
t = {
|
|
3919
|
+
...t,
|
|
3920
|
+
type: "candlestick",
|
|
3921
|
+
data: { ...o, ...r }
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
if (je(i.xAxisOptions) && ((s = (n = t.data) == null ? void 0 : n.x) != null && s.length)) {
|
|
3926
|
+
const { displayX: o, mapping: r } = Qe(t.data.x, i.xAxisOptions);
|
|
3927
|
+
i.timeScaleMapping = r, t = {
|
|
3928
|
+
...t,
|
|
3929
|
+
data: { ...t.data, x: o }
|
|
3930
|
+
};
|
|
3931
|
+
}
|
|
3932
|
+
return t;
|
|
3933
|
+
}
|
|
3934
|
+
function ji(i) {
|
|
3840
3935
|
return i.type === "indicator" ? Se(i) : [i];
|
|
3841
3936
|
}
|
|
3842
|
-
function
|
|
3843
|
-
for (const t of
|
|
3844
|
-
|
|
3937
|
+
function Qi(i, e) {
|
|
3938
|
+
for (const t of ji(e))
|
|
3939
|
+
Zi(i, t);
|
|
3845
3940
|
}
|
|
3846
|
-
function
|
|
3847
|
-
var
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3941
|
+
function Zi(i, e) {
|
|
3942
|
+
var s, o;
|
|
3943
|
+
const t = Gi(i, e);
|
|
3944
|
+
if (t.type !== "heatmap" && !((s = t.style) != null && s.color) && !t.color && i.colorScheme) {
|
|
3945
|
+
const r = i.series.size, a = i.colorScheme.colors[r % i.colorScheme.colors.length];
|
|
3946
|
+
t.style || (t.style = {}), t.style.color = a;
|
|
3851
3947
|
}
|
|
3852
|
-
const
|
|
3853
|
-
i.series.set(
|
|
3948
|
+
const n = new Di(t);
|
|
3949
|
+
i.series.set(n.getId(), n), ce(i, n), (i.xAxisOptions.auto || Array.from(i.yAxisOptionsMap.values()).some((r) => r.auto)) && i.autoScale(!1), (o = i.updateLegend) == null || o.call(i), i.requestRender();
|
|
3854
3950
|
}
|
|
3855
|
-
function
|
|
3951
|
+
function Ji(i, e) {
|
|
3856
3952
|
var n;
|
|
3857
3953
|
const t = i.series.get(e);
|
|
3858
3954
|
t && (i.renderer.deleteBuffer(e), i.renderer.deleteBuffer(`${e}_step`), t.destroy(), i.series.delete(e), (n = i.updateLegend) == null || n.call(i), i.requestRender());
|
|
3859
3955
|
}
|
|
3860
|
-
function
|
|
3956
|
+
function Ki(i, e, t) {
|
|
3861
3957
|
const n = i.series.get(e);
|
|
3862
|
-
|
|
3958
|
+
if (n) {
|
|
3959
|
+
let s = t;
|
|
3960
|
+
if (t.x && je(i.xAxisOptions)) {
|
|
3961
|
+
const { displayX: o, mapping: r } = Qe(t.x, i.xAxisOptions);
|
|
3962
|
+
i.timeScaleMapping = r, s = { ...t, x: o };
|
|
3963
|
+
}
|
|
3964
|
+
n.updateData(s), ce(i, n), i.requestRender();
|
|
3965
|
+
}
|
|
3863
3966
|
}
|
|
3864
|
-
function
|
|
3967
|
+
function en(i, e, t, n) {
|
|
3865
3968
|
var r;
|
|
3866
3969
|
const s = i.series.get(e);
|
|
3867
3970
|
if (!s) return;
|
|
3868
3971
|
const o = ((r = s.getBounds()) == null ? void 0 : r.xMax) ?? -1 / 0;
|
|
3869
|
-
if (s.updateData({ x: t, y: n, append: !0 }),
|
|
3972
|
+
if (s.updateData({ x: t, y: n, append: !0 }), ce(i, s), i.autoScrollEnabled) {
|
|
3870
3973
|
const a = s.getBounds();
|
|
3871
3974
|
if (a) {
|
|
3872
3975
|
const l = i.viewBounds.xMax - i.viewBounds.xMin;
|
|
@@ -3885,15 +3988,15 @@ function ji(i, e, t, n) {
|
|
|
3885
3988
|
}
|
|
3886
3989
|
i.requestRender();
|
|
3887
3990
|
}
|
|
3888
|
-
function
|
|
3991
|
+
function tn(i, e, t) {
|
|
3889
3992
|
const n = i.series.get(e);
|
|
3890
3993
|
n && (n.setMaxPoints(t), i.requestRender());
|
|
3891
3994
|
}
|
|
3892
3995
|
class te {
|
|
3893
3996
|
constructor() {
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3997
|
+
m(this, "domain", [0, 1]);
|
|
3998
|
+
m(this, "range", [0, 100]);
|
|
3999
|
+
m(this, "type", "linear");
|
|
3897
4000
|
}
|
|
3898
4001
|
setDomain(e, t) {
|
|
3899
4002
|
if (!isFinite(e) || !isFinite(t)) {
|
|
@@ -3920,7 +4023,7 @@ class te {
|
|
|
3920
4023
|
ticks(e = 10) {
|
|
3921
4024
|
const [t, n] = this.domain;
|
|
3922
4025
|
if (!isFinite(t) || !isFinite(n) || t === n) return [];
|
|
3923
|
-
const s =
|
|
4026
|
+
const s = nn(t, n, e), o = Math.ceil(t / s) * s, r = [], a = 100;
|
|
3924
4027
|
let l = o;
|
|
3925
4028
|
for (; l <= n + s * 0.5 && r.length < a; )
|
|
3926
4029
|
r.push(Math.round(l * 1e12) / 1e12), l += s;
|
|
@@ -3929,10 +4032,10 @@ class te {
|
|
|
3929
4032
|
}
|
|
3930
4033
|
class ie {
|
|
3931
4034
|
constructor() {
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4035
|
+
m(this, "domain", [1, 1e3]);
|
|
4036
|
+
m(this, "range", [0, 100]);
|
|
4037
|
+
m(this, "type", "log");
|
|
4038
|
+
m(this, "base", 10);
|
|
3936
4039
|
}
|
|
3937
4040
|
setDomain(e, t) {
|
|
3938
4041
|
const n = Math.max(e, 1e-12), s = Math.max(t, 1e-12 * 10);
|
|
@@ -3964,14 +4067,14 @@ class ie {
|
|
|
3964
4067
|
return r;
|
|
3965
4068
|
}
|
|
3966
4069
|
}
|
|
3967
|
-
function
|
|
4070
|
+
function nn(i, e, t) {
|
|
3968
4071
|
const n = e - i;
|
|
3969
4072
|
if (n <= 0 || !isFinite(n)) return 1;
|
|
3970
4073
|
const s = n / t, o = Math.pow(10, Math.floor(Math.log10(s))), r = s / o;
|
|
3971
4074
|
let a;
|
|
3972
4075
|
return r < 1.5 ? a = 1 : r < 3 ? a = 2 : r < 7 ? a = 5 : a = 10, a * o;
|
|
3973
4076
|
}
|
|
3974
|
-
function
|
|
4077
|
+
function hs(i) {
|
|
3975
4078
|
return i === "log" ? new ie() : new te();
|
|
3976
4079
|
}
|
|
3977
4080
|
const O = {
|
|
@@ -4040,7 +4143,7 @@ const O = {
|
|
|
4040
4143
|
},
|
|
4041
4144
|
autoMargins: !0
|
|
4042
4145
|
};
|
|
4043
|
-
function
|
|
4146
|
+
function st(i) {
|
|
4044
4147
|
var e;
|
|
4045
4148
|
return i ? {
|
|
4046
4149
|
title: { ...O.title, ...i.title },
|
|
@@ -4061,22 +4164,22 @@ function it(i) {
|
|
|
4061
4164
|
autoMargins: i.autoMargins ?? O.autoMargins
|
|
4062
4165
|
} : { ...O };
|
|
4063
4166
|
}
|
|
4064
|
-
function
|
|
4167
|
+
function sn(i, e) {
|
|
4065
4168
|
var M;
|
|
4066
4169
|
if (!i) throw new Error("[SciPlot] Container element is required");
|
|
4067
|
-
const t = e.devicePixelRatio ?? window.devicePixelRatio, n =
|
|
4170
|
+
const t = e.devicePixelRatio ?? window.devicePixelRatio, n = st(e.layout), s = typeof e.theme == "string" ? et(e.theme) : e.theme ?? ti, o = _(e.background ?? s.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = _(s.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.showLegend ?? s.legend.visible, d = ((M = e.toolbar) == null ? void 0 : M.show) ?? e.showControls ?? !1, c = e.autoScroll ?? !1, f = e.showStatistics ?? !1, u = { scale: "linear", auto: !0, ...e.xAxis }, g = u.scale === "log" ? new ie() : new te(), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
4068
4171
|
let b = "default";
|
|
4069
4172
|
(e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((A, k) => {
|
|
4070
4173
|
const B = k === 0, F = B ? "default" : `y${k}`, I = A.id || F;
|
|
4071
4174
|
B && (b = I);
|
|
4072
|
-
const
|
|
4073
|
-
y.set(I,
|
|
4175
|
+
const U = { scale: "linear", auto: !0, position: A.position || (B ? "left" : "right"), ...A, id: I };
|
|
4176
|
+
y.set(I, U), x.set(I, U.scale === "log" ? new ie() : new te());
|
|
4074
4177
|
}), i.style.position = "relative", i.style.overflow = "hidden", i.style.backgroundColor = e.background ?? s.backgroundColor;
|
|
4075
|
-
const
|
|
4178
|
+
const p = Xe("webgl"), v = Xe("overlay");
|
|
4076
4179
|
for (; i.firstChild; )
|
|
4077
4180
|
i.removeChild(i.firstChild);
|
|
4078
|
-
i.appendChild(
|
|
4079
|
-
const w =
|
|
4181
|
+
i.appendChild(p), i.appendChild(v);
|
|
4182
|
+
const w = v.getContext("2d");
|
|
4080
4183
|
if (!w) throw new Error("Failed to get 2D context");
|
|
4081
4184
|
return {
|
|
4082
4185
|
theme: s,
|
|
@@ -4090,19 +4193,19 @@ function Ji(i, e) {
|
|
|
4090
4193
|
xAxisOptions: u,
|
|
4091
4194
|
xScale: g,
|
|
4092
4195
|
yAxisOptionsMap: y,
|
|
4093
|
-
yScales:
|
|
4196
|
+
yScales: x,
|
|
4094
4197
|
primaryYAxisId: b,
|
|
4095
|
-
webglCanvas:
|
|
4096
|
-
overlayCanvas:
|
|
4198
|
+
webglCanvas: p,
|
|
4199
|
+
overlayCanvas: v,
|
|
4097
4200
|
overlayCtx: w,
|
|
4098
4201
|
layout: n
|
|
4099
4202
|
};
|
|
4100
4203
|
}
|
|
4101
|
-
function
|
|
4204
|
+
function Xe(i) {
|
|
4102
4205
|
const e = document.createElement("canvas");
|
|
4103
4206
|
return e.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;", i === "overlay" && (e.style.pointerEvents = "none"), e;
|
|
4104
4207
|
}
|
|
4105
|
-
function
|
|
4208
|
+
function on(i, e, t) {
|
|
4106
4209
|
const n = i.getBoundingClientRect(), s = Array.from(e.values()).filter((c) => c.position !== "right").length, o = Array.from(e.values()).filter((c) => c.position === "right").length, r = (t == null ? void 0 : t.margins) || ae, a = (r.left ?? ae.left) + Math.max(0, s - 1) * 65, l = (r.right ?? ae.right) + o * 65, h = r.top ?? ae.top, d = r.bottom ?? ae.bottom;
|
|
4107
4210
|
return {
|
|
4108
4211
|
x: a,
|
|
@@ -4111,7 +4214,7 @@ function Ki(i, e, t) {
|
|
|
4111
4214
|
height: Math.max(1, n.height - h - d)
|
|
4112
4215
|
};
|
|
4113
4216
|
}
|
|
4114
|
-
function
|
|
4217
|
+
function rn(i) {
|
|
4115
4218
|
const e = [];
|
|
4116
4219
|
let t = 0, n = 0;
|
|
4117
4220
|
return i.forEach((s, o) => {
|
|
@@ -4119,18 +4222,16 @@ function en(i) {
|
|
|
4119
4222
|
r === "left" ? t++ : n++, e.push({ id: o, position: r, offset: a });
|
|
4120
4223
|
}), e;
|
|
4121
4224
|
}
|
|
4122
|
-
function
|
|
4225
|
+
function an(i, e, t, n, s) {
|
|
4123
4226
|
const o = i.getBoundingClientRect();
|
|
4124
4227
|
if (o.width === 0 || o.height === 0) return !1;
|
|
4125
|
-
const r = Math.max(1, Math.round(o.width * s)), a = Math.max(1, Math.round(o.height * s)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px
|
|
4126
|
-
return e.width
|
|
4127
|
-
c.width = r, c.height = a, c.style.width = l, c.style.height = h;
|
|
4128
|
-
}), n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !0);
|
|
4228
|
+
const r = Math.max(1, Math.round(o.width * s)), a = Math.max(1, Math.round(o.height * s)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px`, d = e.width !== r || e.height !== a || e.style.width !== l || e.style.height !== h, c = t.width !== r || t.height !== a;
|
|
4229
|
+
return !d && !c ? (n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !1) : (d && (e.width = r, e.height = a, e.style.width = l, e.style.height = h), c && (t.width = r, t.height = a), t.style.width = l, t.style.height = h, n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !0);
|
|
4129
4230
|
}
|
|
4130
|
-
class
|
|
4231
|
+
class ln {
|
|
4131
4232
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4132
4233
|
constructor(e) {
|
|
4133
|
-
|
|
4234
|
+
m(this, "data", /* @__PURE__ */ new Map());
|
|
4134
4235
|
}
|
|
4135
4236
|
get(e) {
|
|
4136
4237
|
return this.data.get(e);
|
|
@@ -4161,10 +4262,10 @@ class nn {
|
|
|
4161
4262
|
});
|
|
4162
4263
|
}
|
|
4163
4264
|
}
|
|
4164
|
-
class
|
|
4265
|
+
class hn {
|
|
4165
4266
|
constructor(e, t = !0) {
|
|
4166
|
-
|
|
4167
|
-
|
|
4267
|
+
m(this, "prefix");
|
|
4268
|
+
m(this, "enabled");
|
|
4168
4269
|
this.prefix = `[SciPlot:${e}]`, this.enabled = t;
|
|
4169
4270
|
}
|
|
4170
4271
|
debug(e, ...t) {
|
|
@@ -4180,11 +4281,11 @@ class sn {
|
|
|
4180
4281
|
console.error(this.prefix, e, ...t);
|
|
4181
4282
|
}
|
|
4182
4283
|
}
|
|
4183
|
-
class
|
|
4284
|
+
class cn {
|
|
4184
4285
|
constructor(e) {
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4286
|
+
m(this, "chart");
|
|
4287
|
+
m(this, "subscriptions", []);
|
|
4288
|
+
m(this, "customListeners", /* @__PURE__ */ new Map());
|
|
4188
4289
|
this.chart = e;
|
|
4189
4290
|
}
|
|
4190
4291
|
on(e, t) {
|
|
@@ -4219,12 +4320,12 @@ class on {
|
|
|
4219
4320
|
this.subscriptions.forEach((e) => e()), this.subscriptions = [], this.customListeners.clear();
|
|
4220
4321
|
}
|
|
4221
4322
|
}
|
|
4222
|
-
class
|
|
4323
|
+
class un {
|
|
4223
4324
|
constructor(e, t) {
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4325
|
+
m(this, "_container");
|
|
4326
|
+
m(this, "_theme");
|
|
4327
|
+
m(this, "overlays", /* @__PURE__ */ new Map());
|
|
4328
|
+
m(this, "notifications", null);
|
|
4228
4329
|
this._container = e, this._theme = t;
|
|
4229
4330
|
}
|
|
4230
4331
|
get container() {
|
|
@@ -4306,8 +4407,8 @@ class rn {
|
|
|
4306
4407
|
this.overlays.forEach((t) => t.remove()), this.overlays.clear(), (e = this.notifications) == null || e.remove(), this.notifications = null;
|
|
4307
4408
|
}
|
|
4308
4409
|
}
|
|
4309
|
-
function
|
|
4310
|
-
const t = new
|
|
4410
|
+
function dn(i, e) {
|
|
4411
|
+
const t = new ln(i), n = new hn(i), s = new cn(e.chart), o = new un(e.container, e.theme), r = {
|
|
4311
4412
|
get gl() {
|
|
4312
4413
|
var c;
|
|
4313
4414
|
return (c = e.getGL) == null ? void 0 : c.call(e);
|
|
@@ -4378,26 +4479,26 @@ function an(i, e) {
|
|
|
4378
4479
|
}
|
|
4379
4480
|
};
|
|
4380
4481
|
}
|
|
4381
|
-
class
|
|
4482
|
+
class fn {
|
|
4382
4483
|
constructor(e) {
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4484
|
+
m(this, "plugins", /* @__PURE__ */ new Map());
|
|
4485
|
+
m(this, "deps");
|
|
4486
|
+
m(this, "destroyed", !1);
|
|
4386
4487
|
// Hook caches for performance
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4488
|
+
m(this, "hooksBeforeRender", []);
|
|
4489
|
+
m(this, "hooksAfterRender", []);
|
|
4490
|
+
m(this, "hooksRenderWebGL", []);
|
|
4491
|
+
m(this, "hooksRenderOverlay", []);
|
|
4492
|
+
m(this, "hooksInteraction", []);
|
|
4493
|
+
m(this, "hooksViewChange", []);
|
|
4494
|
+
m(this, "hooksDataUpdate", []);
|
|
4495
|
+
m(this, "hooksSeriesAdd", []);
|
|
4496
|
+
m(this, "hooksSeriesRemove", []);
|
|
4497
|
+
m(this, "hooksSeriesChange", []);
|
|
4498
|
+
m(this, "hooksResize", []);
|
|
4499
|
+
m(this, "hooksThemeChange", []);
|
|
4500
|
+
m(this, "hooksSelectionChange", []);
|
|
4501
|
+
m(this, "hooksSerialize", []);
|
|
4401
4502
|
this.deps = e;
|
|
4402
4503
|
}
|
|
4403
4504
|
/**
|
|
@@ -4421,7 +4522,7 @@ class ln {
|
|
|
4421
4522
|
);
|
|
4422
4523
|
return;
|
|
4423
4524
|
}
|
|
4424
|
-
const r =
|
|
4525
|
+
const r = dn(s, {
|
|
4425
4526
|
...this.deps,
|
|
4426
4527
|
getPlugin: (h) => this.get(h)
|
|
4427
4528
|
}), a = {
|
|
@@ -4817,20 +4918,20 @@ const E = {
|
|
|
4817
4918
|
PIN: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"></line><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6a3 3 0 0 0-6 0v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17z"></path></svg>',
|
|
4818
4919
|
PIN_OFF: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="2" y1="2" x2="22" y2="22"></line><line x1="12" y1="17" x2="12" y2="22"></line><path d="M9 10.76V6a3 3 0 0 1 1.43-2.54m2.68.74A3 3 0 0 1 15 6v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V17h-2"></path><path d="M5 17h8"></path></svg>'
|
|
4819
4920
|
};
|
|
4820
|
-
class
|
|
4921
|
+
class gn {
|
|
4821
4922
|
constructor(e, t, n, s) {
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4923
|
+
m(this, "container");
|
|
4924
|
+
m(this, "toolbar");
|
|
4925
|
+
m(this, "buttonsWrapper");
|
|
4926
|
+
m(this, "callbacks");
|
|
4927
|
+
m(this, "theme");
|
|
4928
|
+
m(this, "options");
|
|
4929
|
+
m(this, "isSmoothing", !1);
|
|
4930
|
+
m(this, "currentMode", "pan");
|
|
4931
|
+
m(this, "isLegendVisible", !0);
|
|
4932
|
+
m(this, "currentType", "line");
|
|
4933
|
+
m(this, "isPinned", !1);
|
|
4934
|
+
m(this, "isExpanded", !1);
|
|
4834
4935
|
this.callbacks = n, this.theme = t, this.options = s || {}, this.isPinned = this.options.pinnable === !1, this.isExpanded = this.isPinned, this.callbacks = n, this.theme = t, this.container = document.createElement("div"), this.container.style.cssText = `
|
|
4835
4936
|
position: absolute;
|
|
4836
4937
|
top: 2px;
|
|
@@ -5032,21 +5133,21 @@ class hn {
|
|
|
5032
5133
|
this.container.remove();
|
|
5033
5134
|
}
|
|
5034
5135
|
}
|
|
5035
|
-
class
|
|
5136
|
+
class yn {
|
|
5036
5137
|
constructor(e, t, n, s) {
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5138
|
+
m(this, "container");
|
|
5139
|
+
m(this, "visualContainer");
|
|
5140
|
+
m(this, "header");
|
|
5141
|
+
m(this, "content");
|
|
5142
|
+
m(this, "theme");
|
|
5143
|
+
m(this, "series", []);
|
|
5144
|
+
m(this, "callbacks");
|
|
5145
|
+
m(this, "swatchCanvases", /* @__PURE__ */ new Map());
|
|
5146
|
+
m(this, "options");
|
|
5147
|
+
m(this, "isDragging", !1);
|
|
5148
|
+
m(this, "isResizing", !1);
|
|
5149
|
+
m(this, "dragOffsetX", 0);
|
|
5150
|
+
m(this, "dragOffsetY", 0);
|
|
5050
5151
|
this.theme = t, this.callbacks = s, this.options = {
|
|
5051
5152
|
x: n.x ?? e.clientWidth - 150,
|
|
5052
5153
|
y: n.y ?? 55,
|
|
@@ -5203,16 +5304,16 @@ class cn {
|
|
|
5203
5304
|
r.clearRect(0, 0, e.width, e.height), r.scale(s, s);
|
|
5204
5305
|
const a = t.getStyle(), l = t.isVisible(), h = l ? a.color || "#ff0055" : "#888888", d = t.getType(), c = a.symbol || "circle";
|
|
5205
5306
|
r.fillStyle = h, r.strokeStyle = h, r.globalAlpha = l ? 1 : 0.6, r.lineWidth = 2;
|
|
5206
|
-
const f = o / 2, u = o / 2, g = String(d).toLowerCase(), y = g === "scatter" || g === "1" || g === "line" && !!a.symbol,
|
|
5307
|
+
const f = o / 2, u = o / 2, g = String(d).toLowerCase(), y = g === "scatter" || g === "1" || g === "line" && !!a.symbol, x = g.includes("scatter") || g === "2", b = g === "area" || g === "band";
|
|
5207
5308
|
if (y)
|
|
5208
5309
|
this.drawSymbol(r, c, f, u, o * 0.8);
|
|
5209
|
-
else if (
|
|
5310
|
+
else if (x)
|
|
5210
5311
|
r.beginPath(), r.moveTo(0, u), r.lineTo(o, u), r.stroke(), this.drawSymbol(r, c, f, u, o * 0.6);
|
|
5211
5312
|
else if (b)
|
|
5212
5313
|
r.globalAlpha = 0.6, r.fillRect(0, o * 0.2, o, o * 0.6), r.globalAlpha = 1, r.strokeRect(0, o * 0.2, o, o * 0.6);
|
|
5213
5314
|
else if (g === "candlestick") {
|
|
5214
|
-
const
|
|
5215
|
-
r.fillStyle =
|
|
5315
|
+
const S = a.bullishColor || "#26a69a";
|
|
5316
|
+
r.fillStyle = S, r.fillRect(o * 0.3, o * 0.2, o * 0.4, o * 0.6), r.beginPath(), r.moveTo(o * 0.5, 0), r.lineTo(o * 0.5, o), r.strokeStyle = S, r.stroke();
|
|
5216
5317
|
} else
|
|
5217
5318
|
r.beginPath(), r.moveTo(0, u), r.lineTo(o, u), r.stroke();
|
|
5218
5319
|
}
|
|
@@ -5265,10 +5366,10 @@ class cn {
|
|
|
5265
5366
|
e.fillStyle = f ? n.backgroundColor : "rgba(255, 255, 255, 0.85)", e.strokeStyle = n.borderColor, e.lineWidth = 1 * t;
|
|
5266
5367
|
const u = n.borderRadius * t;
|
|
5267
5368
|
e.beginPath(), e.moveTo(l + u, h), e.lineTo(l + d - u, h), e.arcTo(l + d, h, l + d, h + u, u), e.lineTo(l + d, h + c - u), e.arcTo(l + d, h + c, l + d - u, h + c, u), e.lineTo(l + u, h + c), e.arcTo(l, h + c, l, h + c - u, u), e.lineTo(l, h + u), e.arcTo(l, h, l + u, h, u), e.closePath(), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "middle", e.font = `${n.fontSize * t}px ${n.fontFamily}`, this.series.forEach((g, y) => {
|
|
5268
|
-
const
|
|
5269
|
-
e.fillStyle =
|
|
5270
|
-
const M = String(
|
|
5271
|
-
A ? this.drawSymbol(e, w, b,
|
|
5369
|
+
const x = h + a + s + y * (r + o) + r / 2, b = l + s + r / 2, S = x, p = g.getStyle(), v = g.getType(), w = p.symbol || "circle";
|
|
5370
|
+
e.fillStyle = p.color || "#ff0055", e.strokeStyle = p.color || "#ff0055", e.lineWidth = 2 * t;
|
|
5371
|
+
const M = String(v).toLowerCase(), A = M === "scatter" || M === "1" || M === "line" && !!p.symbol, k = M.includes("scatter") || M === "2";
|
|
5372
|
+
A ? this.drawSymbol(e, w, b, S, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + s, S), e.lineTo(l + s + r, S), e.stroke(), this.drawSymbol(e, w, b, S, r * 0.6)) : (e.beginPath(), e.moveTo(l + s, S), e.lineTo(l + s + r, S), e.stroke()), e.fillStyle = n.textColor, e.fillText(g.getName(), l + s + r + 8 * t, x);
|
|
5272
5373
|
}), e.restore();
|
|
5273
5374
|
}
|
|
5274
5375
|
updateTheme(e) {
|
|
@@ -5284,8 +5385,8 @@ class cn {
|
|
|
5284
5385
|
this.container.remove();
|
|
5285
5386
|
}
|
|
5286
5387
|
}
|
|
5287
|
-
function
|
|
5288
|
-
return i.showControls ? new
|
|
5388
|
+
function mn(i) {
|
|
5389
|
+
return i.showControls ? new gn(i.container, i.theme, {
|
|
5289
5390
|
onResetZoom: () => i.resetZoom(),
|
|
5290
5391
|
onSetType: (e) => {
|
|
5291
5392
|
i.series.forEach((t) => {
|
|
@@ -5324,14 +5425,14 @@ function un(i) {
|
|
|
5324
5425
|
}
|
|
5325
5426
|
}, i.toolbar) : null;
|
|
5326
5427
|
}
|
|
5327
|
-
function
|
|
5428
|
+
function pn(i, e) {
|
|
5328
5429
|
var s, o, r, a, l, h;
|
|
5329
5430
|
if (!i.showLegend) return null;
|
|
5330
5431
|
const t = {
|
|
5331
5432
|
...e.legendPosition,
|
|
5332
5433
|
highlightOnHover: ((s = i.legendOptions) == null ? void 0 : s.highlightOnHover) ?? ((r = (o = e.layout) == null ? void 0 : o.legend) == null ? void 0 : r.highlightOnHover) ?? !1,
|
|
5333
5434
|
bringToFrontOnHover: ((a = i.legendOptions) == null ? void 0 : a.bringToFrontOnHover) ?? ((h = (l = e.layout) == null ? void 0 : l.legend) == null ? void 0 : h.bringToFrontOnHover) ?? !0
|
|
5334
|
-
}, n = new
|
|
5435
|
+
}, n = new yn(
|
|
5335
5436
|
i.container,
|
|
5336
5437
|
i.theme,
|
|
5337
5438
|
t,
|
|
@@ -5369,15 +5470,15 @@ function dn(i, e) {
|
|
|
5369
5470
|
);
|
|
5370
5471
|
return n.update(Array.from(i.series.values())), n;
|
|
5371
5472
|
}
|
|
5372
|
-
class
|
|
5473
|
+
class xn {
|
|
5373
5474
|
constructor() {
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5475
|
+
m(this, "queue", []);
|
|
5476
|
+
m(this, "isProcessing", !1);
|
|
5477
|
+
m(this, "completedCount", 0);
|
|
5478
|
+
m(this, "currentChartId", null);
|
|
5479
|
+
m(this, "idCounter", 0);
|
|
5379
5480
|
// Delay between chart initializations (ms)
|
|
5380
|
-
|
|
5481
|
+
m(this, "INIT_DELAY", 30);
|
|
5381
5482
|
}
|
|
5382
5483
|
/**
|
|
5383
5484
|
* Generate a unique chart ID
|
|
@@ -5441,17 +5542,17 @@ class fn {
|
|
|
5441
5542
|
this.clear(), this.completedCount = 0, this.idCounter = 0;
|
|
5442
5543
|
}
|
|
5443
5544
|
}
|
|
5444
|
-
const Z = new
|
|
5445
|
-
function
|
|
5545
|
+
const Z = new xn();
|
|
5546
|
+
function bn() {
|
|
5446
5547
|
return Z.enqueue();
|
|
5447
5548
|
}
|
|
5448
5549
|
function Ie(i) {
|
|
5449
5550
|
Z.markComplete(i);
|
|
5450
5551
|
}
|
|
5451
|
-
function
|
|
5552
|
+
function cs() {
|
|
5452
5553
|
return Z.getStatus();
|
|
5453
5554
|
}
|
|
5454
|
-
class
|
|
5555
|
+
class vn {
|
|
5455
5556
|
static getStatus() {
|
|
5456
5557
|
return this.instance.getStatus();
|
|
5457
5558
|
}
|
|
@@ -5459,23 +5560,23 @@ class yn {
|
|
|
5459
5560
|
this.instance.reset();
|
|
5460
5561
|
}
|
|
5461
5562
|
}
|
|
5462
|
-
|
|
5463
|
-
function
|
|
5563
|
+
m(vn, "instance", Z);
|
|
5564
|
+
function us() {
|
|
5464
5565
|
return {
|
|
5465
5566
|
getStatus: () => Z.getStatus(),
|
|
5466
5567
|
reset: () => Z.reset()
|
|
5467
5568
|
};
|
|
5468
5569
|
}
|
|
5469
|
-
async function
|
|
5570
|
+
async function ds(i, e) {
|
|
5470
5571
|
await e();
|
|
5471
5572
|
}
|
|
5472
|
-
function
|
|
5573
|
+
function fs(i = 200) {
|
|
5473
5574
|
return new Promise((e) => setTimeout(e, i));
|
|
5474
5575
|
}
|
|
5475
|
-
function
|
|
5576
|
+
function gs() {
|
|
5476
5577
|
Z.reset();
|
|
5477
5578
|
}
|
|
5478
|
-
class
|
|
5579
|
+
class Sn {
|
|
5479
5580
|
constructor(e) {
|
|
5480
5581
|
this.pluginManager = e;
|
|
5481
5582
|
}
|
|
@@ -5590,6 +5691,9 @@ class mn {
|
|
|
5590
5691
|
get forecasting() {
|
|
5591
5692
|
return this.getAPI("velo-plot-forecasting");
|
|
5592
5693
|
}
|
|
5694
|
+
get patterns() {
|
|
5695
|
+
return this.getAPI("pattern-recognition");
|
|
5696
|
+
}
|
|
5593
5697
|
get latex() {
|
|
5594
5698
|
return this.getAPI("velo-plot-latex");
|
|
5595
5699
|
}
|
|
@@ -5606,10 +5710,14 @@ class mn {
|
|
|
5606
5710
|
return this.pluginManager.getNames();
|
|
5607
5711
|
}
|
|
5608
5712
|
}
|
|
5609
|
-
class
|
|
5713
|
+
class wn {
|
|
5610
5714
|
constructor(e) {
|
|
5611
5715
|
this.ctx = e;
|
|
5612
5716
|
}
|
|
5717
|
+
/** Swap the X scale (e.g. broken-axis plugin) so tick generation uses it. */
|
|
5718
|
+
setXScale(e) {
|
|
5719
|
+
this.ctx.xScale = e;
|
|
5720
|
+
}
|
|
5613
5721
|
/**
|
|
5614
5722
|
* Add a new Y axis dynamically
|
|
5615
5723
|
*/
|
|
@@ -5707,8 +5815,8 @@ class pn {
|
|
|
5707
5815
|
return this.ctx.yScales;
|
|
5708
5816
|
}
|
|
5709
5817
|
}
|
|
5710
|
-
const
|
|
5711
|
-
function
|
|
5818
|
+
const ot = 1;
|
|
5819
|
+
function We(i) {
|
|
5712
5820
|
const e = i instanceof Float32Array ? i : new Float32Array(i), t = new Uint8Array(e.buffer);
|
|
5713
5821
|
let n = "";
|
|
5714
5822
|
for (let s = 0; s < t.length; s++)
|
|
@@ -5721,7 +5829,7 @@ function Ne(i) {
|
|
|
5721
5829
|
t[n] = e.charCodeAt(n);
|
|
5722
5830
|
return new Float32Array(t.buffer);
|
|
5723
5831
|
}
|
|
5724
|
-
function
|
|
5832
|
+
function Mn(i) {
|
|
5725
5833
|
try {
|
|
5726
5834
|
new TextEncoder().encode(i);
|
|
5727
5835
|
let t = "";
|
|
@@ -5736,7 +5844,7 @@ function xn(i) {
|
|
|
5736
5844
|
return btoa(i);
|
|
5737
5845
|
}
|
|
5738
5846
|
}
|
|
5739
|
-
function
|
|
5847
|
+
function Cn(i) {
|
|
5740
5848
|
try {
|
|
5741
5849
|
const e = atob(i);
|
|
5742
5850
|
let t = "";
|
|
@@ -5751,28 +5859,28 @@ function bn(i) {
|
|
|
5751
5859
|
return atob(i);
|
|
5752
5860
|
}
|
|
5753
5861
|
}
|
|
5754
|
-
function
|
|
5862
|
+
function An(i, e = !0) {
|
|
5755
5863
|
const t = JSON.stringify(i);
|
|
5756
|
-
return e ?
|
|
5864
|
+
return e ? Mn(t) : btoa(t);
|
|
5757
5865
|
}
|
|
5758
|
-
function
|
|
5866
|
+
function Pn(i, e = !0) {
|
|
5759
5867
|
try {
|
|
5760
|
-
const t = e ?
|
|
5761
|
-
return typeof n.version != "number" ? (console.warn("[SciPlot] Invalid state: missing version"), null) : (n.version >
|
|
5868
|
+
const t = e ? Cn(i) : atob(i), n = JSON.parse(t);
|
|
5869
|
+
return typeof n.version != "number" ? (console.warn("[SciPlot] Invalid state: missing version"), null) : (n.version > ot && console.warn("[SciPlot] State version is newer than supported"), n);
|
|
5762
5870
|
} catch (t) {
|
|
5763
5871
|
return console.error("[SciPlot] Failed to parse URL hash:", t), null;
|
|
5764
5872
|
}
|
|
5765
5873
|
}
|
|
5766
|
-
function
|
|
5874
|
+
function ys(i) {
|
|
5767
5875
|
if (!i || typeof i != "object") return !1;
|
|
5768
5876
|
const e = i;
|
|
5769
5877
|
return !(typeof e.version != "number" || !e.viewBounds || typeof e.viewBounds != "object" || !Array.isArray(e.series));
|
|
5770
5878
|
}
|
|
5771
|
-
class
|
|
5879
|
+
class ms {
|
|
5772
5880
|
constructor(e = 50) {
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5881
|
+
m(this, "history", []);
|
|
5882
|
+
m(this, "currentIndex", -1);
|
|
5883
|
+
m(this, "maxSize");
|
|
5776
5884
|
this.maxSize = e;
|
|
5777
5885
|
}
|
|
5778
5886
|
/**
|
|
@@ -5824,17 +5932,21 @@ class os {
|
|
|
5824
5932
|
return this.history.length;
|
|
5825
5933
|
}
|
|
5826
5934
|
}
|
|
5827
|
-
class
|
|
5935
|
+
class kn {
|
|
5828
5936
|
constructor(e) {
|
|
5829
5937
|
this.ctx = e;
|
|
5830
5938
|
}
|
|
5939
|
+
/** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
|
|
5940
|
+
setXScale(e) {
|
|
5941
|
+
this.ctx.xScale = e;
|
|
5942
|
+
}
|
|
5831
5943
|
/**
|
|
5832
5944
|
* Export complete chart state
|
|
5833
5945
|
*/
|
|
5834
5946
|
serialize(e = {}) {
|
|
5835
5947
|
const { includeData: t = !0, includeAnnotations: n = !0 } = e;
|
|
5836
5948
|
return {
|
|
5837
|
-
version:
|
|
5949
|
+
version: ot,
|
|
5838
5950
|
timestamp: Date.now(),
|
|
5839
5951
|
viewBounds: { ...this.ctx.viewBounds },
|
|
5840
5952
|
xAxis: {
|
|
@@ -5869,8 +5981,8 @@ class wn {
|
|
|
5869
5981
|
style: o.getStyle(),
|
|
5870
5982
|
visible: o.isVisible(),
|
|
5871
5983
|
data: t ? {
|
|
5872
|
-
x:
|
|
5873
|
-
y:
|
|
5984
|
+
x: We(o.getData().x),
|
|
5985
|
+
y: We(o.getData().y)
|
|
5874
5986
|
} : { x: "", y: "" }
|
|
5875
5987
|
})),
|
|
5876
5988
|
annotations: n ? this.ctx.getAnnotations() : [],
|
|
@@ -5924,17 +6036,17 @@ class wn {
|
|
|
5924
6036
|
* Convert current state to URL-safe hash
|
|
5925
6037
|
*/
|
|
5926
6038
|
toUrlHash(e = !0) {
|
|
5927
|
-
return
|
|
6039
|
+
return An(this.serialize({ includeData: !0 }), e);
|
|
5928
6040
|
}
|
|
5929
6041
|
/**
|
|
5930
6042
|
* Load state from URL hash
|
|
5931
6043
|
*/
|
|
5932
6044
|
fromUrlHash(e, t = !0) {
|
|
5933
|
-
const n =
|
|
6045
|
+
const n = Pn(e, t);
|
|
5934
6046
|
n && this.deserialize(n);
|
|
5935
6047
|
}
|
|
5936
6048
|
}
|
|
5937
|
-
function
|
|
6049
|
+
function Bn(i, e, t, n) {
|
|
5938
6050
|
const { value: s, min: o, max: r } = e, {
|
|
5939
6051
|
needleColor: a = "#333",
|
|
5940
6052
|
needleWidth: l = 3,
|
|
@@ -5945,27 +6057,27 @@ function Mn(i, e, t, n) {
|
|
|
5945
6057
|
showValue: u = !0,
|
|
5946
6058
|
valueColor: g = "#fff",
|
|
5947
6059
|
valueSize: y = 24,
|
|
5948
|
-
label:
|
|
5949
|
-
} = t, b = n.x + n.width / 2,
|
|
5950
|
-
i.save(), i.beginPath(), i.arc(b,
|
|
6060
|
+
label: x
|
|
6061
|
+
} = t, b = n.x + n.width / 2, S = n.y + n.height / 2, p = Math.min(n.width, n.height) / 2 * d, v = f - c, w = Math.max(0, Math.min(1, (s - o) / (r - o))), M = (c + w * v) * (Math.PI / 180);
|
|
6062
|
+
i.save(), i.beginPath(), i.arc(b, S, p, c * (Math.PI / 180), f * (Math.PI / 180)), i.strokeStyle = "rgba(255, 255, 255, 0.1)", i.lineWidth = p * 0.2, i.lineCap = "round", i.stroke();
|
|
5951
6063
|
for (const k of h) {
|
|
5952
6064
|
const B = Math.max(0, Math.min(1, (k.from - o) / (r - o))), F = Math.max(0, Math.min(1, (k.to - o) / (r - o)));
|
|
5953
6065
|
i.beginPath(), i.arc(
|
|
5954
6066
|
b,
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
(c + B *
|
|
5958
|
-
(c + F *
|
|
5959
|
-
), i.strokeStyle = k.color, i.lineWidth =
|
|
6067
|
+
S,
|
|
6068
|
+
p,
|
|
6069
|
+
(c + B * v) * (Math.PI / 180),
|
|
6070
|
+
(c + F * v) * (Math.PI / 180)
|
|
6071
|
+
), i.strokeStyle = k.color, i.lineWidth = p * 0.2, i.stroke();
|
|
5960
6072
|
}
|
|
5961
6073
|
const A = 11;
|
|
5962
6074
|
for (let k = 0; k < A; k++) {
|
|
5963
|
-
const B = (c + k / (A - 1) *
|
|
5964
|
-
i.beginPath(), i.moveTo(b + F * Math.cos(B),
|
|
6075
|
+
const B = (c + k / (A - 1) * v) * (Math.PI / 180), F = p * 0.85, I = p * 0.95;
|
|
6076
|
+
i.beginPath(), i.moveTo(b + F * Math.cos(B), S + F * Math.sin(B)), i.lineTo(b + I * Math.cos(B), S + I * Math.sin(B)), i.strokeStyle = "rgba(255, 255, 255, 0.5)", i.lineWidth = 2, i.stroke();
|
|
5965
6077
|
}
|
|
5966
|
-
i.beginPath(), i.moveTo(b,
|
|
6078
|
+
i.beginPath(), i.moveTo(b, S), i.lineTo(b + p * 0.9 * Math.cos(M), S + p * 0.9 * Math.sin(M)), i.strokeStyle = a, i.lineWidth = l, i.lineCap = "round", i.shadowColor = a, i.shadowBlur = 10, i.stroke(), i.shadowBlur = 0, i.beginPath(), i.arc(b, S, 8, 0, Math.PI * 2), i.fillStyle = a, i.fill(), i.strokeStyle = "#fff", i.lineWidth = 2, i.stroke(), u && (i.textAlign = "center", i.textBaseline = "middle", i.font = `bold ${y}px Inter, sans-serif`, i.fillStyle = g, i.fillText(s.toFixed(1), b, S + p * 0.4), x && (i.font = `${y * 0.5}px Inter, sans-serif`, i.fillStyle = "rgba(255, 255, 255, 0.6)", i.fillText(x, b, S + p * 0.6))), i.restore();
|
|
5967
6079
|
}
|
|
5968
|
-
function
|
|
6080
|
+
function Tn(i, e, t, n) {
|
|
5969
6081
|
const { nodes: s, links: o } = e, {
|
|
5970
6082
|
nodeWidth: r = 18,
|
|
5971
6083
|
nodePadding: a = 12,
|
|
@@ -5979,42 +6091,42 @@ function Cn(i, e, t, n) {
|
|
|
5979
6091
|
y: n.y + y,
|
|
5980
6092
|
width: f,
|
|
5981
6093
|
height: u
|
|
5982
|
-
},
|
|
6094
|
+
}, S = /* @__PURE__ */ new Set();
|
|
5983
6095
|
o.forEach((C) => {
|
|
5984
|
-
|
|
6096
|
+
S.add(C.source), S.add(C.target);
|
|
5985
6097
|
});
|
|
5986
|
-
const
|
|
5987
|
-
|
|
6098
|
+
const p = Array.from(S), v = /* @__PURE__ */ new Map(), w = new Set(o.map((C) => C.target));
|
|
6099
|
+
p.filter((C) => !w.has(C)).forEach((C) => v.set(C, 0));
|
|
5988
6100
|
let A = !0;
|
|
5989
6101
|
for (; A; )
|
|
5990
6102
|
A = !1, o.forEach((C) => {
|
|
5991
|
-
const T =
|
|
6103
|
+
const T = v.get(C.source);
|
|
5992
6104
|
if (T !== void 0) {
|
|
5993
|
-
const R =
|
|
5994
|
-
(R === void 0 || D > R) && (
|
|
6105
|
+
const R = v.get(C.target), D = T + 1;
|
|
6106
|
+
(R === void 0 || D > R) && (v.set(C.target, D), A = !0);
|
|
5995
6107
|
}
|
|
5996
6108
|
});
|
|
5997
|
-
|
|
5998
|
-
|
|
6109
|
+
p.forEach((C) => {
|
|
6110
|
+
v.get(C) === void 0 && v.set(C, 0);
|
|
5999
6111
|
});
|
|
6000
|
-
const k = Math.max(...Array.from(
|
|
6001
|
-
|
|
6112
|
+
const k = Math.max(...Array.from(v.values())), B = Array.from({ length: k + 1 }, () => []);
|
|
6113
|
+
p.forEach((C) => B[v.get(C)].push(C));
|
|
6002
6114
|
const F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
6003
6115
|
o.forEach((C) => {
|
|
6004
6116
|
I.set(C.source, (I.get(C.source) || 0) + C.value), F.set(C.target, (F.get(C.target) || 0) + C.value);
|
|
6005
6117
|
});
|
|
6006
|
-
const
|
|
6007
|
-
let
|
|
6118
|
+
const fe = (C) => Math.max(F.get(C) || 0, I.get(C) || 0);
|
|
6119
|
+
let U = 0;
|
|
6008
6120
|
B.forEach((C) => {
|
|
6009
6121
|
let T = 0;
|
|
6010
|
-
C.forEach((R) => T +=
|
|
6122
|
+
C.forEach((R) => T += fe(R)), T > U && (U = T);
|
|
6011
6123
|
});
|
|
6012
|
-
const ne = /* @__PURE__ */ new Map(),
|
|
6124
|
+
const ne = /* @__PURE__ */ new Map(), lt = B.length, ht = (b.width - r) / Math.max(1, lt - 1);
|
|
6013
6125
|
B.forEach((C, T) => {
|
|
6014
|
-
const R = b.x + T *
|
|
6126
|
+
const R = b.x + T * ht, D = [];
|
|
6015
6127
|
let q = 0;
|
|
6016
6128
|
C.forEach((V) => {
|
|
6017
|
-
const L =
|
|
6129
|
+
const L = fe(V), $ = U > 0 ? L / U * (b.height * 0.9) : 20;
|
|
6018
6130
|
D.push($), q += $;
|
|
6019
6131
|
});
|
|
6020
6132
|
const se = (C.length - 1) * a, oe = q + se;
|
|
@@ -6026,15 +6138,15 @@ function Cn(i, e, t, n) {
|
|
|
6026
6138
|
const z = s.find((K) => K.id === V);
|
|
6027
6139
|
z != null && z.color && (J = z.color);
|
|
6028
6140
|
}
|
|
6029
|
-
ne.set(V, { x: R, y: re, width: r, height: $, color: J, value:
|
|
6141
|
+
ne.set(V, { x: R, y: re, width: r, height: $, color: J, value: fe(V) }), re += $ + a;
|
|
6030
6142
|
});
|
|
6031
6143
|
}), i.save();
|
|
6032
6144
|
const Fe = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ new Map();
|
|
6033
6145
|
o.forEach((C) => {
|
|
6034
6146
|
const T = ne.get(C.source), R = ne.get(C.target);
|
|
6035
6147
|
if (!T || !R) return;
|
|
6036
|
-
const D = Fe.get(C.source) || 0, q = De.get(C.target) || 0, se = I.get(C.source) || 1, oe = F.get(C.target) || 1, re = C.value / se * T.height, V = C.value / oe * R.height, L = T.x + T.width, $ = T.y + D, J = $ + re, z = R.x, K = R.y + q, we = K + V,
|
|
6037
|
-
Me.addColorStop(0, T.color), Me.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, $), i.bezierCurveTo(L +
|
|
6148
|
+
const D = Fe.get(C.source) || 0, q = De.get(C.target) || 0, se = I.get(C.source) || 1, oe = F.get(C.target) || 1, re = C.value / se * T.height, V = C.value / oe * R.height, L = T.x + T.width, $ = T.y + D, J = $ + re, z = R.x, K = R.y + q, we = K + V, ge = (z - L) * 0.5, Me = i.createLinearGradient(L, ($ + J) / 2, z, (K + we) / 2);
|
|
6149
|
+
Me.addColorStop(0, T.color), Me.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, $), i.bezierCurveTo(L + ge, $, z - ge, K, z, K), i.lineTo(z, we), i.bezierCurveTo(z - ge, we, L + ge, J, L, J), i.closePath(), i.fillStyle = Me, i.globalAlpha = h, i.fill(), i.strokeStyle = T.color, i.globalAlpha = h * 0.3, i.lineWidth = 0.5, i.stroke(), Fe.set(C.source, D + re), De.set(C.target, q + V);
|
|
6038
6150
|
}), i.restore(), i.save(), i.globalAlpha = 1, ne.forEach((C) => {
|
|
6039
6151
|
i.fillStyle = C.color, i.fillRect(C.x, C.y, C.width, C.height);
|
|
6040
6152
|
const T = i.createLinearGradient(C.x, C.y, C.x + C.width, C.y);
|
|
@@ -6047,7 +6159,7 @@ function Cn(i, e, t, n) {
|
|
|
6047
6159
|
i.shadowBlur = 3, i.shadowColor = "rgba(0, 0, 0, 0.7)", i.fillStyle = "#ffffff", q ? (i.textAlign = "right", i.fillText(R, C.x - 10, C.y + C.height / 2)) : se ? (i.textAlign = "left", i.fillText(R, C.x + C.width + 10, C.y + C.height / 2)) : (i.textAlign = "center", i.fillText(R, C.x + C.width / 2, C.y - 10));
|
|
6048
6160
|
}), i.restore());
|
|
6049
6161
|
}
|
|
6050
|
-
function
|
|
6162
|
+
function He(i, e, t, n, s) {
|
|
6051
6163
|
const o = (s == null ? void 0 : s.left) ?? 0, r = (s == null ? void 0 : s.right) ?? 0, a = (s == null ? void 0 : s.top) ?? 0, l = (s == null ? void 0 : s.bottom) ?? 0;
|
|
6052
6164
|
if (n === "x") {
|
|
6053
6165
|
const f = e.x + o, u = e.x + e.width - r, g = (t == null ? void 0 : t.invertAxis) ?? !1;
|
|
@@ -6057,9 +6169,9 @@ function Ue(i, e, t, n, s) {
|
|
|
6057
6169
|
const h = e.y + a, d = e.y + e.height - l, c = (t == null ? void 0 : t.invertAxis) ?? !1;
|
|
6058
6170
|
i.setRange(c ? h : d, c ? d : h);
|
|
6059
6171
|
}
|
|
6060
|
-
function
|
|
6172
|
+
function In(i, e) {
|
|
6061
6173
|
const t = [], n = i.layout.plotPadding;
|
|
6062
|
-
if (
|
|
6174
|
+
if (He(
|
|
6063
6175
|
i.xScale,
|
|
6064
6176
|
e,
|
|
6065
6177
|
i.xAxisOptions,
|
|
@@ -6067,7 +6179,7 @@ function An(i, e) {
|
|
|
6067
6179
|
n
|
|
6068
6180
|
), i.xScale.setDomain(i.viewBounds.xMin, i.viewBounds.xMax), i.yScales.forEach((s, o) => {
|
|
6069
6181
|
const r = i.yAxisOptionsMap.get(o);
|
|
6070
|
-
|
|
6182
|
+
He(s, e, r, "y", n), o === i.primaryYAxisId && s.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
|
|
6071
6183
|
}), i.series.forEach((s) => {
|
|
6072
6184
|
var a, l;
|
|
6073
6185
|
s.needsBufferUpdate && (i.updateSeriesBuffer(s), s.needsBufferUpdate = !1);
|
|
@@ -6108,8 +6220,8 @@ function An(i, e) {
|
|
|
6108
6220
|
const g = i.renderer.getBuffer(`${s.getId()}_step`);
|
|
6109
6221
|
if (g) {
|
|
6110
6222
|
u.stepBuffer = g;
|
|
6111
|
-
const y = s.getStyle().stepMode ?? "after",
|
|
6112
|
-
y === "center" ? u.stepCount = 1 + (
|
|
6223
|
+
const y = s.getStyle().stepMode ?? "after", x = s.getPointCount();
|
|
6224
|
+
y === "center" ? u.stepCount = 1 + (x - 1) * 3 : u.stepCount = x * 2 - 1;
|
|
6113
6225
|
}
|
|
6114
6226
|
}
|
|
6115
6227
|
if (r === "boxplot") {
|
|
@@ -6120,9 +6232,9 @@ function An(i, e) {
|
|
|
6120
6232
|
if (r === "boxplot" && !u) {
|
|
6121
6233
|
const g = i.renderer.getBuffer(`${s.getId()}_box_lines`), y = i.renderer.getBuffer(`${s.getId()}_box_faces`);
|
|
6122
6234
|
if (g && y) {
|
|
6123
|
-
const
|
|
6124
|
-
let
|
|
6125
|
-
b && (
|
|
6235
|
+
const x = s.getYAxisId() || i.primaryYAxisId, b = i.yScales.get(x);
|
|
6236
|
+
let S;
|
|
6237
|
+
b && (S = { min: b.domain[0], max: b.domain[1] }), u = {
|
|
6126
6238
|
id: s.getId(),
|
|
6127
6239
|
buffer: g,
|
|
6128
6240
|
// Use lines buffer as main buffer for reference
|
|
@@ -6131,7 +6243,7 @@ function An(i, e) {
|
|
|
6131
6243
|
style: s.getStyle(),
|
|
6132
6244
|
visible: s.isVisible(),
|
|
6133
6245
|
type: "boxplot",
|
|
6134
|
-
yBounds:
|
|
6246
|
+
yBounds: S,
|
|
6135
6247
|
boxLinesBuffer: g,
|
|
6136
6248
|
boxLinesCount: s.getPointCount() * 10,
|
|
6137
6249
|
boxBuffer: y,
|
|
@@ -6140,27 +6252,27 @@ function An(i, e) {
|
|
|
6140
6252
|
}
|
|
6141
6253
|
}
|
|
6142
6254
|
if (r === "waterfall" && !u) {
|
|
6143
|
-
const g = i.renderer.getBuffer(`${s.getId()}_wf_positive`), y = i.renderer.getBuffer(`${s.getId()}_wf_negative`),
|
|
6144
|
-
if (g || y ||
|
|
6145
|
-
const
|
|
6146
|
-
let
|
|
6147
|
-
|
|
6255
|
+
const g = i.renderer.getBuffer(`${s.getId()}_wf_positive`), y = i.renderer.getBuffer(`${s.getId()}_wf_negative`), x = i.renderer.getBuffer(`${s.getId()}_wf_subtotal`), b = i.renderer.getBuffer(`${s.getId()}_wf_connectors`);
|
|
6256
|
+
if (g || y || x) {
|
|
6257
|
+
const S = s.getYAxisId() || i.primaryYAxisId, p = i.yScales.get(S);
|
|
6258
|
+
let v;
|
|
6259
|
+
p && (v = { min: p.domain[0], max: p.domain[1] });
|
|
6148
6260
|
const w = s.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
|
|
6149
6261
|
u = {
|
|
6150
6262
|
id: s.getId(),
|
|
6151
|
-
buffer: g || y ||
|
|
6263
|
+
buffer: g || y || x,
|
|
6152
6264
|
// Use any available buffer as reference
|
|
6153
6265
|
count: 0,
|
|
6154
6266
|
// No main buffer rendering
|
|
6155
6267
|
style: s.getStyle(),
|
|
6156
6268
|
visible: s.isVisible(),
|
|
6157
6269
|
type: "waterfall",
|
|
6158
|
-
yBounds:
|
|
6270
|
+
yBounds: v,
|
|
6159
6271
|
wfPositiveBuffer: g,
|
|
6160
6272
|
wfPositiveCount: w.positive,
|
|
6161
6273
|
wfNegativeBuffer: y,
|
|
6162
6274
|
wfNegativeCount: w.negative,
|
|
6163
|
-
wfSubtotalBuffer:
|
|
6275
|
+
wfSubtotalBuffer: x,
|
|
6164
6276
|
wfSubtotalCount: w.subtotal,
|
|
6165
6277
|
wfConnectorBuffer: b,
|
|
6166
6278
|
wfConnectorCount: w.connectors
|
|
@@ -6172,22 +6284,22 @@ function An(i, e) {
|
|
|
6172
6284
|
if (g) {
|
|
6173
6285
|
u.errorBuffer = g;
|
|
6174
6286
|
const y = s.getData();
|
|
6175
|
-
let
|
|
6176
|
-
(y.yError || y.yErrorMinus || y.yErrorPlus) &&
|
|
6287
|
+
let x = 0;
|
|
6288
|
+
(y.yError || y.yErrorMinus || y.yErrorPlus) && x++, (y.xError || y.xErrorMinus || y.xErrorPlus) && x++, u.errorCount = s.getPointCount() * x * 2;
|
|
6177
6289
|
}
|
|
6178
6290
|
if (r === "heatmap") {
|
|
6179
|
-
const y = s.getHeatmapData(),
|
|
6291
|
+
const y = s.getHeatmapData(), x = s.getHeatmapStyle();
|
|
6180
6292
|
if (y) {
|
|
6181
|
-
const b = y.xValues.length,
|
|
6182
|
-
u.count = (b - 1) * (
|
|
6183
|
-
let
|
|
6293
|
+
const b = y.xValues.length, S = y.yValues.length;
|
|
6294
|
+
u.count = (b - 1) * (S - 1) * 6;
|
|
6295
|
+
let p = 1 / 0, v = -1 / 0;
|
|
6184
6296
|
for (let M = 0; M < y.zValues.length; M++) {
|
|
6185
6297
|
const A = y.zValues[M];
|
|
6186
|
-
A <
|
|
6298
|
+
A < p && (p = A), A > v && (v = A);
|
|
6187
6299
|
}
|
|
6188
|
-
|
|
6189
|
-
min: ((a =
|
|
6190
|
-
max: ((l =
|
|
6300
|
+
p === v && (p -= 1, v += 1), u.zBounds = {
|
|
6301
|
+
min: ((a = x == null ? void 0 : x.colorScale) == null ? void 0 : a.min) ?? (p === 1 / 0 ? 0 : p),
|
|
6302
|
+
max: ((l = x == null ? void 0 : x.colorScale) == null ? void 0 : l.max) ?? (v === -1 / 0 ? 1 : v)
|
|
6191
6303
|
}, u.zBounds.min === u.zBounds.max && (u.zBounds.max = u.zBounds.min + 1);
|
|
6192
6304
|
const w = `${s.getId()}_colormap`;
|
|
6193
6305
|
u.colormapTexture = i.renderer.getTexture(w);
|
|
@@ -6235,8 +6347,8 @@ function An(i, e) {
|
|
|
6235
6347
|
}
|
|
6236
6348
|
return t;
|
|
6237
6349
|
}
|
|
6238
|
-
function
|
|
6239
|
-
var
|
|
6350
|
+
function Ue(i, e, t) {
|
|
6351
|
+
var y, x, b, S;
|
|
6240
6352
|
const n = i.container.getBoundingClientRect();
|
|
6241
6353
|
if (n.width === 0 || n.height === 0) {
|
|
6242
6354
|
console.warn(
|
|
@@ -6244,24 +6356,24 @@ function He(i, e, t) {
|
|
|
6244
6356
|
);
|
|
6245
6357
|
return;
|
|
6246
6358
|
}
|
|
6247
|
-
i.overlay.clear(), i.overlay.setLatexAPI(i.latexAPI), (
|
|
6359
|
+
i.overlay.clear(), i.overlay.setLatexAPI(i.latexAPI), (y = i.layout.title) != null && y.visible && i.layout.title.text && i.overlay.drawChartTitle(e, i.layout.title);
|
|
6248
6360
|
let s = !1, o = !1, r = !1, a = 0, l = "degrees", h = 5, d = 12;
|
|
6249
|
-
i.series.forEach((
|
|
6250
|
-
const
|
|
6251
|
-
if (
|
|
6252
|
-
if (
|
|
6361
|
+
i.series.forEach((p) => {
|
|
6362
|
+
const v = p.getType();
|
|
6363
|
+
if (p.isVisible())
|
|
6364
|
+
if (v === "polar") {
|
|
6253
6365
|
s = !0;
|
|
6254
|
-
const
|
|
6255
|
-
if (
|
|
6256
|
-
for (let
|
|
6257
|
-
a = Math.max(a, Math.abs(
|
|
6258
|
-
const
|
|
6259
|
-
|
|
6366
|
+
const w = p.getPolarData();
|
|
6367
|
+
if (w) {
|
|
6368
|
+
for (let A = 0; A < w.r.length; A++)
|
|
6369
|
+
a = Math.max(a, Math.abs(w.r[A]));
|
|
6370
|
+
const M = p.getStyle();
|
|
6371
|
+
M.angleMode && (l = M.angleMode), M.radialDivisions && (h = M.radialDivisions), M.angularDivisions && (d = M.angularDivisions);
|
|
6260
6372
|
}
|
|
6261
|
-
} else
|
|
6373
|
+
} else v === "gauge" ? o = !0 : v === "sankey" && (r = !0);
|
|
6262
6374
|
});
|
|
6263
6375
|
const c = s || o || r;
|
|
6264
|
-
if (s && a > 0)
|
|
6376
|
+
if (i.overlay.setBusinessDayMapping(((x = i.getBusinessDayMapping) == null ? void 0 : x.call(i)) ?? null), s && a > 0)
|
|
6265
6377
|
i.overlay.drawPolarGrid(
|
|
6266
6378
|
e,
|
|
6267
6379
|
i.xScale,
|
|
@@ -6271,79 +6383,81 @@ function He(i, e, t) {
|
|
|
6271
6383
|
l
|
|
6272
6384
|
);
|
|
6273
6385
|
else if (!o && !r) {
|
|
6274
|
-
const
|
|
6386
|
+
const p = i.yAxisOptionsMap.get(i.primaryYAxisId);
|
|
6275
6387
|
i.overlay.drawGrid(
|
|
6276
6388
|
e,
|
|
6277
6389
|
i.xScale,
|
|
6278
6390
|
t,
|
|
6279
6391
|
i.xAxisOptions,
|
|
6280
|
-
|
|
6392
|
+
p
|
|
6281
6393
|
);
|
|
6282
6394
|
}
|
|
6283
|
-
i.series.forEach((
|
|
6284
|
-
if (!
|
|
6285
|
-
const
|
|
6286
|
-
if (
|
|
6287
|
-
const
|
|
6288
|
-
|
|
6289
|
-
} else if (
|
|
6290
|
-
const
|
|
6291
|
-
|
|
6395
|
+
i.series.forEach((p) => {
|
|
6396
|
+
if (!p.isVisible()) return;
|
|
6397
|
+
const v = p.getType();
|
|
6398
|
+
if (v === "gauge") {
|
|
6399
|
+
const w = p.getGaugeData(), M = p.getGaugeStyle();
|
|
6400
|
+
w && M && Bn(i.overlayCtx, w, M, e);
|
|
6401
|
+
} else if (v === "sankey") {
|
|
6402
|
+
const w = p.getSankeyData(), M = p.getSankeyStyle();
|
|
6403
|
+
w && M && Tn(i.overlayCtx, w, M, e);
|
|
6292
6404
|
}
|
|
6293
6405
|
}), c || i.overlay.drawXAxis(e, i.xScale, i.xAxisOptions, i.layout.xAxisLayout);
|
|
6294
6406
|
const f = [], u = [];
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
}), c || (f.forEach((
|
|
6298
|
-
const
|
|
6299
|
-
if (
|
|
6300
|
-
const
|
|
6301
|
-
i.overlay.drawYAxis(e,
|
|
6407
|
+
i.yAxisOptionsMap.forEach((p, v) => {
|
|
6408
|
+
p.position === "right" ? u.push(v) : f.push(v);
|
|
6409
|
+
}), c || (f.forEach((p, v) => {
|
|
6410
|
+
const w = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
|
|
6411
|
+
if (w && M) {
|
|
6412
|
+
const A = v * 65;
|
|
6413
|
+
i.overlay.drawYAxis(e, w, M, "left", A, i.layout.yAxisLayout);
|
|
6302
6414
|
}
|
|
6303
|
-
}), u.forEach((
|
|
6304
|
-
const
|
|
6305
|
-
if (
|
|
6306
|
-
const
|
|
6307
|
-
i.overlay.drawYAxis(e,
|
|
6415
|
+
}), u.forEach((p, v) => {
|
|
6416
|
+
const w = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
|
|
6417
|
+
if (w && M) {
|
|
6418
|
+
const A = v * 65;
|
|
6419
|
+
i.overlay.drawYAxis(e, w, M, "right", A, i.layout.yAxisLayout);
|
|
6308
6420
|
}
|
|
6309
|
-
})), i.overlay.drawPlotBorder(e), i.series.forEach((
|
|
6310
|
-
if (
|
|
6311
|
-
const
|
|
6312
|
-
i.overlay.drawErrorBars(e,
|
|
6421
|
+
})), i.overlay.drawPlotBorder(e), i.series.forEach((p) => {
|
|
6422
|
+
if (p.isVisible() && p.hasErrorData()) {
|
|
6423
|
+
const v = p.getYAxisId() || i.primaryYAxisId, M = i.yScales.get(v) || t;
|
|
6424
|
+
i.overlay.drawErrorBars(e, p, i.xScale, M);
|
|
6313
6425
|
}
|
|
6314
|
-
}), i.series.forEach((
|
|
6315
|
-
if (!
|
|
6316
|
-
const
|
|
6317
|
-
i.overlay.drawCandlestickMarkers(e,
|
|
6318
|
-
})
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6426
|
+
}), i.series.forEach((p) => {
|
|
6427
|
+
if (!p.isVisible() || p.getType() !== "candlestick") return;
|
|
6428
|
+
const v = p.getYAxisId() || i.primaryYAxisId, w = i.yScales.get(v) || t;
|
|
6429
|
+
i.overlay.drawCandlestickMarkers(e, p, i.xScale, w);
|
|
6430
|
+
});
|
|
6431
|
+
const g = ((b = i.getAlerts) == null ? void 0 : b.call(i)) ?? [];
|
|
6432
|
+
if (g.length && i.overlay.drawPriceAlertLines(e, g, t), i.selectionRect && i.overlay.drawSelectionRect(i.selectionRect), i.selectionManager.render(i.overlayCtx, e), (S = i.cursorOptions) != null && S.enabled && i.cursorPosition) {
|
|
6433
|
+
const p = i.cursorOptions.valueDisplayMode ?? "floating";
|
|
6434
|
+
let v;
|
|
6435
|
+
p !== "disabled" && (v = i.cursorOptions.formatter ? i.cursorOptions.formatter(
|
|
6322
6436
|
i.pixelToDataX(i.cursorPosition.x),
|
|
6323
6437
|
i.pixelToDataY(i.cursorPosition.y),
|
|
6324
6438
|
""
|
|
6325
6439
|
) : `X: ${i.pixelToDataX(i.cursorPosition.x).toFixed(3)}
|
|
6326
6440
|
Y: ${i.pixelToDataY(i.cursorPosition.y).toExponential(2)}`);
|
|
6327
|
-
const
|
|
6441
|
+
const w = {
|
|
6328
6442
|
enabled: !0,
|
|
6329
6443
|
x: i.cursorPosition.x,
|
|
6330
6444
|
y: i.cursorPosition.y,
|
|
6331
6445
|
crosshair: i.cursorOptions.crosshair ?? !1,
|
|
6332
|
-
tooltipText:
|
|
6333
|
-
valueDisplayMode:
|
|
6446
|
+
tooltipText: v,
|
|
6447
|
+
valueDisplayMode: p,
|
|
6334
6448
|
cornerPosition: i.cursorOptions.cornerPosition ?? "top-left"
|
|
6335
6449
|
};
|
|
6336
|
-
i.overlay.drawCursor(e,
|
|
6450
|
+
i.overlay.drawCursor(e, w, i.cursorOptions.lineStyle);
|
|
6337
6451
|
}
|
|
6338
6452
|
}
|
|
6339
|
-
class
|
|
6453
|
+
class En {
|
|
6340
6454
|
constructor(e) {
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6455
|
+
m(this, "animationFrameId", null);
|
|
6456
|
+
m(this, "needsFullRender", !1);
|
|
6457
|
+
m(this, "needsOverlayRender", !1);
|
|
6458
|
+
m(this, "frameCount", 0);
|
|
6459
|
+
m(this, "lastRenderTime", performance.now());
|
|
6460
|
+
m(this, "initStarted", !1);
|
|
6347
6461
|
this.ctx = e;
|
|
6348
6462
|
}
|
|
6349
6463
|
/**
|
|
@@ -6356,6 +6470,10 @@ class Pn {
|
|
|
6356
6470
|
setRenderer(e) {
|
|
6357
6471
|
this.ctx.renderer = e;
|
|
6358
6472
|
}
|
|
6473
|
+
/** Swap the X scale (e.g. broken-axis plugin) — the context holds a snapshot. */
|
|
6474
|
+
setXScale(e) {
|
|
6475
|
+
this.ctx.xScale = e;
|
|
6476
|
+
}
|
|
6359
6477
|
/**
|
|
6360
6478
|
* Check if init has started
|
|
6361
6479
|
*/
|
|
@@ -6425,6 +6543,8 @@ class Pn {
|
|
|
6425
6543
|
getPlotArea: () => n,
|
|
6426
6544
|
pixelToDataX: this.ctx.pixelToDataX,
|
|
6427
6545
|
pixelToDataY: this.ctx.pixelToDataY,
|
|
6546
|
+
getBusinessDayMapping: this.ctx.getBusinessDayMapping,
|
|
6547
|
+
getAlerts: this.ctx.getAlerts,
|
|
6428
6548
|
selectionManager: this.ctx.selectionManager,
|
|
6429
6549
|
hoveredSeriesId: this.ctx.getHoveredSeriesId(),
|
|
6430
6550
|
layout: this.ctx.getLayout(),
|
|
@@ -6439,7 +6559,7 @@ class Pn {
|
|
|
6439
6559
|
if (this.lastRenderTime = o, !this.ctx.pluginManager.notifyBeforeRender(r))
|
|
6440
6560
|
return;
|
|
6441
6561
|
if (e) {
|
|
6442
|
-
const h =
|
|
6562
|
+
const h = In(s, n);
|
|
6443
6563
|
this.ctx.renderer.render(h, {
|
|
6444
6564
|
bounds: this.ctx.viewBounds,
|
|
6445
6565
|
invertX: !!this.ctx.xAxisOptions.invertAxis,
|
|
@@ -6451,9 +6571,9 @@ class Pn {
|
|
|
6451
6571
|
...r,
|
|
6452
6572
|
renderTime: performance.now() - t
|
|
6453
6573
|
};
|
|
6454
|
-
this.ctx.pluginManager.notifyRenderWebGL(d),
|
|
6574
|
+
this.ctx.pluginManager.notifyRenderWebGL(d), Ue(s, n, this.ctx.yScale);
|
|
6455
6575
|
} else
|
|
6456
|
-
|
|
6576
|
+
Ue(s, n, this.ctx.yScale);
|
|
6457
6577
|
const a = performance.now() - t, l = { ...r, renderTime: a };
|
|
6458
6578
|
this.ctx.pluginManager.notifyRenderOverlay(l), this.ctx.pluginManager.notifyAfterRender(l), this.ctx.events.emit("render", {
|
|
6459
6579
|
fps: 1e3 / a,
|
|
@@ -6479,7 +6599,7 @@ class Pn {
|
|
|
6479
6599
|
this.frameCount = 0;
|
|
6480
6600
|
}
|
|
6481
6601
|
}
|
|
6482
|
-
function
|
|
6602
|
+
function Rn(i) {
|
|
6483
6603
|
const t = {
|
|
6484
6604
|
id: i.seriesId ?? `${i.id}-indicator`,
|
|
6485
6605
|
data: i.data,
|
|
@@ -6507,8 +6627,64 @@ function kn(i) {
|
|
|
6507
6627
|
};
|
|
6508
6628
|
}
|
|
6509
6629
|
let Q = null;
|
|
6510
|
-
function
|
|
6511
|
-
|
|
6630
|
+
function Fn(i) {
|
|
6631
|
+
const e = performance.now();
|
|
6632
|
+
switch (i.indicator) {
|
|
6633
|
+
case "rsi":
|
|
6634
|
+
return {
|
|
6635
|
+
id: i.id,
|
|
6636
|
+
type: "indicator-result",
|
|
6637
|
+
indicator: "rsi",
|
|
6638
|
+
values: bt(i.data, i.period ?? 14),
|
|
6639
|
+
duration: performance.now() - e
|
|
6640
|
+
};
|
|
6641
|
+
case "sma":
|
|
6642
|
+
return {
|
|
6643
|
+
id: i.id,
|
|
6644
|
+
type: "indicator-result",
|
|
6645
|
+
indicator: "sma",
|
|
6646
|
+
values: xt(i.data, i.period ?? 14),
|
|
6647
|
+
duration: performance.now() - e
|
|
6648
|
+
};
|
|
6649
|
+
case "ema":
|
|
6650
|
+
return {
|
|
6651
|
+
id: i.id,
|
|
6652
|
+
type: "indicator-result",
|
|
6653
|
+
indicator: "ema",
|
|
6654
|
+
values: pt(i.data, i.period ?? 14),
|
|
6655
|
+
duration: performance.now() - e
|
|
6656
|
+
};
|
|
6657
|
+
case "macd": {
|
|
6658
|
+
const t = mt(
|
|
6659
|
+
i.data,
|
|
6660
|
+
i.fastPeriod ?? 12,
|
|
6661
|
+
i.slowPeriod ?? 26,
|
|
6662
|
+
i.signalPeriod ?? 9
|
|
6663
|
+
);
|
|
6664
|
+
return {
|
|
6665
|
+
id: i.id,
|
|
6666
|
+
type: "indicator-result",
|
|
6667
|
+
indicator: "macd",
|
|
6668
|
+
...t,
|
|
6669
|
+
duration: performance.now() - e
|
|
6670
|
+
};
|
|
6671
|
+
}
|
|
6672
|
+
case "bollingerBands": {
|
|
6673
|
+
const t = yt(i.data, i.period ?? 20, i.stdDev ?? 2);
|
|
6674
|
+
return {
|
|
6675
|
+
id: i.id,
|
|
6676
|
+
type: "indicator-result",
|
|
6677
|
+
indicator: "bollingerBands",
|
|
6678
|
+
...t,
|
|
6679
|
+
duration: performance.now() - e
|
|
6680
|
+
};
|
|
6681
|
+
}
|
|
6682
|
+
default:
|
|
6683
|
+
throw new Error(`Unknown indicator: ${i.indicator}`);
|
|
6684
|
+
}
|
|
6685
|
+
}
|
|
6686
|
+
function Dn() {
|
|
6687
|
+
return Q || (Q = new wt(
|
|
6512
6688
|
() => new Worker(new URL(
|
|
6513
6689
|
/* @vite-ignore */
|
|
6514
6690
|
"/assets/indicator.worker-bv0zC4EX.js",
|
|
@@ -6517,70 +6693,15 @@ function Bn() {
|
|
|
6517
6693
|
{
|
|
6518
6694
|
poolSize: 2,
|
|
6519
6695
|
syncFallback: !0,
|
|
6520
|
-
syncHandler
|
|
6521
|
-
const e = performance.now();
|
|
6522
|
-
switch (i.indicator) {
|
|
6523
|
-
case "rsi":
|
|
6524
|
-
return {
|
|
6525
|
-
id: i.id,
|
|
6526
|
-
type: "indicator-result",
|
|
6527
|
-
indicator: "rsi",
|
|
6528
|
-
values: pt(i.data, i.period ?? 14),
|
|
6529
|
-
duration: performance.now() - e
|
|
6530
|
-
};
|
|
6531
|
-
case "sma":
|
|
6532
|
-
return {
|
|
6533
|
-
id: i.id,
|
|
6534
|
-
type: "indicator-result",
|
|
6535
|
-
indicator: "sma",
|
|
6536
|
-
values: mt(i.data, i.period ?? 14),
|
|
6537
|
-
duration: performance.now() - e
|
|
6538
|
-
};
|
|
6539
|
-
case "ema":
|
|
6540
|
-
return {
|
|
6541
|
-
id: i.id,
|
|
6542
|
-
type: "indicator-result",
|
|
6543
|
-
indicator: "ema",
|
|
6544
|
-
values: yt(i.data, i.period ?? 14),
|
|
6545
|
-
duration: performance.now() - e
|
|
6546
|
-
};
|
|
6547
|
-
case "macd": {
|
|
6548
|
-
const t = gt(
|
|
6549
|
-
i.data,
|
|
6550
|
-
i.fastPeriod ?? 12,
|
|
6551
|
-
i.slowPeriod ?? 26,
|
|
6552
|
-
i.signalPeriod ?? 9
|
|
6553
|
-
);
|
|
6554
|
-
return {
|
|
6555
|
-
id: i.id,
|
|
6556
|
-
type: "indicator-result",
|
|
6557
|
-
indicator: "macd",
|
|
6558
|
-
...t,
|
|
6559
|
-
duration: performance.now() - e
|
|
6560
|
-
};
|
|
6561
|
-
}
|
|
6562
|
-
case "bollingerBands": {
|
|
6563
|
-
const t = ft(i.data, i.period ?? 20, i.stdDev ?? 2);
|
|
6564
|
-
return {
|
|
6565
|
-
id: i.id,
|
|
6566
|
-
type: "indicator-result",
|
|
6567
|
-
indicator: "bollingerBands",
|
|
6568
|
-
...t,
|
|
6569
|
-
duration: performance.now() - e
|
|
6570
|
-
};
|
|
6571
|
-
}
|
|
6572
|
-
default:
|
|
6573
|
-
throw new Error(`Unknown indicator: ${i.indicator}`);
|
|
6574
|
-
}
|
|
6575
|
-
}
|
|
6696
|
+
syncHandler: Fn
|
|
6576
6697
|
}
|
|
6577
6698
|
)), Q;
|
|
6578
6699
|
}
|
|
6579
|
-
function
|
|
6700
|
+
function ue(i) {
|
|
6580
6701
|
return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
|
|
6581
6702
|
}
|
|
6582
|
-
async function
|
|
6583
|
-
const e =
|
|
6703
|
+
async function de(i) {
|
|
6704
|
+
const e = St(i.indicator), t = await Dn().run({ id: e, type: "indicator", ...i });
|
|
6584
6705
|
return {
|
|
6585
6706
|
values: t.values,
|
|
6586
6707
|
signal: t.signal,
|
|
@@ -6590,34 +6711,34 @@ async function ue(i) {
|
|
|
6590
6711
|
duration: t.duration
|
|
6591
6712
|
};
|
|
6592
6713
|
}
|
|
6593
|
-
async function
|
|
6594
|
-
return
|
|
6714
|
+
async function Ln(i, e = 14) {
|
|
6715
|
+
return de({ indicator: "rsi", data: ue(i), period: e });
|
|
6595
6716
|
}
|
|
6596
|
-
async function
|
|
6597
|
-
return
|
|
6717
|
+
async function zn(i, e = 14) {
|
|
6718
|
+
return de({ indicator: "sma", data: ue(i), period: e });
|
|
6598
6719
|
}
|
|
6599
|
-
async function
|
|
6600
|
-
return
|
|
6720
|
+
async function On(i, e = 14) {
|
|
6721
|
+
return de({ indicator: "ema", data: ue(i), period: e });
|
|
6601
6722
|
}
|
|
6602
|
-
async function
|
|
6603
|
-
return
|
|
6723
|
+
async function $n(i, e = 12, t = 26, n = 9) {
|
|
6724
|
+
return de({
|
|
6604
6725
|
indicator: "macd",
|
|
6605
|
-
data:
|
|
6726
|
+
data: ue(i),
|
|
6606
6727
|
fastPeriod: e,
|
|
6607
6728
|
slowPeriod: t,
|
|
6608
6729
|
signalPeriod: n
|
|
6609
6730
|
});
|
|
6610
6731
|
}
|
|
6611
|
-
async function
|
|
6612
|
-
return
|
|
6732
|
+
async function Yn(i, e = 20, t = 2) {
|
|
6733
|
+
return de({ indicator: "bollingerBands", data: ue(i), period: e, stdDev: t });
|
|
6613
6734
|
}
|
|
6614
|
-
function
|
|
6735
|
+
function ps() {
|
|
6615
6736
|
Q == null || Q.destroy(), Q = null;
|
|
6616
6737
|
}
|
|
6617
|
-
function
|
|
6738
|
+
function _n(i) {
|
|
6618
6739
|
return i === "bollingerBands" ? "bollinger" : i;
|
|
6619
6740
|
}
|
|
6620
|
-
function
|
|
6741
|
+
function Vn(i) {
|
|
6621
6742
|
const e = i.getData(), t = e.x;
|
|
6622
6743
|
if (!(t != null && t.length))
|
|
6623
6744
|
throw new Error("[addIndicator] Source series has no X data");
|
|
@@ -6627,7 +6748,16 @@ function Ln(i) {
|
|
|
6627
6748
|
throw new Error("[addIndicator] Source series has no price/Y data");
|
|
6628
6749
|
return { x: t, prices: s };
|
|
6629
6750
|
}
|
|
6630
|
-
function
|
|
6751
|
+
function Xn(i) {
|
|
6752
|
+
const e = i.getData(), t = e.x;
|
|
6753
|
+
if (!(t != null && t.length))
|
|
6754
|
+
throw new Error("[addIndicator] Source series has no X data");
|
|
6755
|
+
const n = e.open ?? e.y, s = e.high ?? e.y, o = e.low ?? e.y, r = e.close ?? e.y;
|
|
6756
|
+
if (!(n != null && n.length) || !(s != null && s.length) || !(o != null && o.length) || !(r != null && r.length))
|
|
6757
|
+
throw new Error("[addIndicator] Source series has no OHLC data — use candlestick");
|
|
6758
|
+
return { x: t, open: n, high: s, low: o, close: r };
|
|
6759
|
+
}
|
|
6760
|
+
function rt(i, e) {
|
|
6631
6761
|
if (e) {
|
|
6632
6762
|
const s = i.getSeries(e);
|
|
6633
6763
|
if (!s) throw new Error(`[addIndicator] Source series "${e}" not found`);
|
|
@@ -6641,19 +6771,19 @@ function st(i, e) {
|
|
|
6641
6771
|
throw new Error("[addIndicator] No line/candlestick/bar series found — pass sourceSeriesId");
|
|
6642
6772
|
return n;
|
|
6643
6773
|
}
|
|
6644
|
-
async function
|
|
6645
|
-
const
|
|
6646
|
-
switch (
|
|
6774
|
+
async function at(i, e, t, n = {}, s) {
|
|
6775
|
+
const o = _n(i), r = n.id ?? o, a = e instanceof Float32Array || e instanceof Float64Array ? e : Float32Array.from(e);
|
|
6776
|
+
switch (o) {
|
|
6647
6777
|
case "rsi": {
|
|
6648
|
-
const
|
|
6778
|
+
const l = n.period ?? 14, { values: h } = await Ln(t, l);
|
|
6649
6779
|
return {
|
|
6650
|
-
id:
|
|
6780
|
+
id: r,
|
|
6651
6781
|
preset: "rsi",
|
|
6652
6782
|
placement: "oscillator",
|
|
6653
6783
|
yRange: [0, 100],
|
|
6654
6784
|
data: {
|
|
6655
|
-
x:
|
|
6656
|
-
lines: [{ id: "rsi", y:
|
|
6785
|
+
x: a,
|
|
6786
|
+
lines: [{ id: "rsi", y: h, color: "#ab47bc", width: 1.5 }],
|
|
6657
6787
|
referenceLines: [
|
|
6658
6788
|
{ y: 70, color: "rgba(239, 83, 80, 0.5)", dash: [4, 4] },
|
|
6659
6789
|
{ y: 30, color: "rgba(38, 166, 154, 0.5)", dash: [4, 4] }
|
|
@@ -6662,40 +6792,40 @@ async function ot(i, e, t, n = {}) {
|
|
|
6662
6792
|
};
|
|
6663
6793
|
}
|
|
6664
6794
|
case "macd": {
|
|
6665
|
-
const
|
|
6795
|
+
const l = n.fastPeriod ?? 12, h = n.slowPeriod ?? 26, d = n.signalPeriod ?? 9, c = await $n(t, l, h, d);
|
|
6666
6796
|
return {
|
|
6667
|
-
id:
|
|
6797
|
+
id: r,
|
|
6668
6798
|
preset: "macd",
|
|
6669
6799
|
placement: "oscillator",
|
|
6670
6800
|
data: {
|
|
6671
|
-
x:
|
|
6801
|
+
x: a,
|
|
6672
6802
|
histogram: {
|
|
6673
|
-
y:
|
|
6803
|
+
y: c.histogram ?? new Float32Array(t.length),
|
|
6674
6804
|
positiveColor: "#26a69a",
|
|
6675
6805
|
negativeColor: "#ef5350"
|
|
6676
6806
|
},
|
|
6677
6807
|
lines: [
|
|
6678
|
-
{ id: "macd", y:
|
|
6679
|
-
{ id: "signal", y:
|
|
6808
|
+
{ id: "macd", y: c.values, color: "#42a5f5", width: 1.5 },
|
|
6809
|
+
{ id: "signal", y: c.signal ?? c.values, color: "#ff9800", width: 1 }
|
|
6680
6810
|
],
|
|
6681
6811
|
baseline: 0
|
|
6682
6812
|
}
|
|
6683
6813
|
};
|
|
6684
6814
|
}
|
|
6685
6815
|
case "bollinger": {
|
|
6686
|
-
const
|
|
6816
|
+
const l = n.period ?? 20, h = n.stdDev ?? 2, d = await Yn(t, l, h), c = d.upper ?? d.values, f = d.lower ?? d.values;
|
|
6687
6817
|
return {
|
|
6688
|
-
id:
|
|
6818
|
+
id: r,
|
|
6689
6819
|
preset: "bollinger",
|
|
6690
6820
|
placement: "overlay",
|
|
6691
6821
|
data: {
|
|
6692
|
-
x:
|
|
6693
|
-
lines: [{ id: "mid", y:
|
|
6822
|
+
x: a,
|
|
6823
|
+
lines: [{ id: "mid", y: d.values, color: "rgba(99, 102, 241, 0.9)", width: 1 }],
|
|
6694
6824
|
fills: [
|
|
6695
6825
|
{
|
|
6696
6826
|
id: "band",
|
|
6697
|
-
upper:
|
|
6698
|
-
lower:
|
|
6827
|
+
upper: c,
|
|
6828
|
+
lower: f,
|
|
6699
6829
|
color: "rgba(99, 102, 241, 0.15)"
|
|
6700
6830
|
}
|
|
6701
6831
|
]
|
|
@@ -6703,26 +6833,48 @@ async function ot(i, e, t, n = {}) {
|
|
|
6703
6833
|
};
|
|
6704
6834
|
}
|
|
6705
6835
|
case "ema": {
|
|
6706
|
-
const
|
|
6836
|
+
const l = n.period ?? 14, { values: h } = await On(t, l);
|
|
6707
6837
|
return {
|
|
6708
|
-
id:
|
|
6838
|
+
id: r,
|
|
6709
6839
|
preset: "ema",
|
|
6710
6840
|
placement: "overlay",
|
|
6711
6841
|
data: {
|
|
6712
|
-
x:
|
|
6713
|
-
lines: [{ id: "ema", y:
|
|
6842
|
+
x: a,
|
|
6843
|
+
lines: [{ id: "ema", y: h, color: "#ffd54f", width: 1.5 }]
|
|
6714
6844
|
}
|
|
6715
6845
|
};
|
|
6716
6846
|
}
|
|
6717
6847
|
case "sma": {
|
|
6718
|
-
const
|
|
6848
|
+
const l = n.period ?? 14, { values: h } = await zn(t, l);
|
|
6719
6849
|
return {
|
|
6720
|
-
id:
|
|
6850
|
+
id: r,
|
|
6721
6851
|
preset: "sma",
|
|
6722
6852
|
placement: "overlay",
|
|
6723
6853
|
data: {
|
|
6724
|
-
x:
|
|
6725
|
-
lines: [{ id: "sma", y:
|
|
6854
|
+
x: a,
|
|
6855
|
+
lines: [{ id: "sma", y: h, color: "#4fc3f7", width: 1.5 }]
|
|
6856
|
+
}
|
|
6857
|
+
};
|
|
6858
|
+
}
|
|
6859
|
+
case "stochastic": {
|
|
6860
|
+
if (!s)
|
|
6861
|
+
throw new Error("[addIndicator] stochastic requires a candlestick source series");
|
|
6862
|
+
const l = Xn(s), h = n.period ?? 14, d = n.signalPeriod ?? 3, c = vt(l, h, d);
|
|
6863
|
+
return {
|
|
6864
|
+
id: r,
|
|
6865
|
+
preset: "stochastic",
|
|
6866
|
+
placement: "oscillator",
|
|
6867
|
+
yRange: [0, 100],
|
|
6868
|
+
data: {
|
|
6869
|
+
x: a,
|
|
6870
|
+
lines: [
|
|
6871
|
+
{ id: "k", y: c.values, color: "#42a5f5", width: 1.5 },
|
|
6872
|
+
{ id: "d", y: c.signal ?? c.values, color: "#ff9800", width: 1 }
|
|
6873
|
+
],
|
|
6874
|
+
referenceLines: [
|
|
6875
|
+
{ y: 80, color: "rgba(239, 83, 80, 0.5)", dash: [4, 4] },
|
|
6876
|
+
{ y: 20, color: "rgba(38, 166, 154, 0.5)", dash: [4, 4] }
|
|
6877
|
+
]
|
|
6726
6878
|
}
|
|
6727
6879
|
};
|
|
6728
6880
|
}
|
|
@@ -6730,24 +6882,24 @@ async function ot(i, e, t, n = {}) {
|
|
|
6730
6882
|
throw new Error(`[addIndicator] Unknown preset: ${i}`);
|
|
6731
6883
|
}
|
|
6732
6884
|
}
|
|
6733
|
-
function
|
|
6885
|
+
function Wn(i, e) {
|
|
6734
6886
|
for (const t of [...i.getAllSeries()]) {
|
|
6735
6887
|
const n = t.getId();
|
|
6736
6888
|
(n === e || n.startsWith(`${e}-`)) && i.removeSeries(n);
|
|
6737
6889
|
}
|
|
6738
6890
|
}
|
|
6739
|
-
async function
|
|
6740
|
-
const n =
|
|
6741
|
-
return
|
|
6891
|
+
async function Nn(i, e, t = {}) {
|
|
6892
|
+
const n = rt(i, t.sourceSeriesId), { x: s, prices: o } = Vn(n);
|
|
6893
|
+
return at(e, s, o, t, n);
|
|
6742
6894
|
}
|
|
6743
|
-
async function
|
|
6895
|
+
async function Hn(i, e, t = {}) {
|
|
6744
6896
|
var l;
|
|
6745
6897
|
if (t.pane === "new")
|
|
6746
6898
|
throw new Error(
|
|
6747
6899
|
"[addIndicator] pane: 'new' requires createStackedChart — use buildIndicatorPaneFromPreset() instead"
|
|
6748
6900
|
);
|
|
6749
|
-
const n =
|
|
6750
|
-
|
|
6901
|
+
const n = rt(i, t.sourceSeriesId), s = t.yAxisId ?? ((l = n.getYAxisId) == null ? void 0 : l.call(n)), o = await Nn(i, e, t);
|
|
6902
|
+
Wn(i, o.id);
|
|
6751
6903
|
const r = Se({
|
|
6752
6904
|
id: o.id,
|
|
6753
6905
|
data: o.data,
|
|
@@ -6765,29 +6917,29 @@ async function $n(i, e, t = {}) {
|
|
|
6765
6917
|
seriesIds: a
|
|
6766
6918
|
};
|
|
6767
6919
|
}
|
|
6768
|
-
async function
|
|
6769
|
-
const
|
|
6770
|
-
return
|
|
6771
|
-
id: n.id ??
|
|
6920
|
+
async function xs(i, e, t, n, s) {
|
|
6921
|
+
const o = await at(i, e, t, n, s);
|
|
6922
|
+
return Rn({
|
|
6923
|
+
id: n.id ?? o.id,
|
|
6772
6924
|
height: n.height ?? 0.25,
|
|
6773
|
-
label: n.label ??
|
|
6774
|
-
yRange: n.yRange ??
|
|
6925
|
+
label: n.label ?? o.id.toUpperCase(),
|
|
6926
|
+
yRange: n.yRange ?? o.yRange ?? "auto",
|
|
6775
6927
|
tickCount: n.tickCount,
|
|
6776
6928
|
showXAxis: n.showXAxis,
|
|
6777
6929
|
seriesId: n.seriesId,
|
|
6778
6930
|
style: n.style,
|
|
6779
|
-
data:
|
|
6931
|
+
data: o.data
|
|
6780
6932
|
});
|
|
6781
6933
|
}
|
|
6782
|
-
class
|
|
6934
|
+
class Un {
|
|
6783
6935
|
constructor(e, t) {
|
|
6784
|
-
|
|
6785
|
-
|
|
6936
|
+
m(this, "alerts", /* @__PURE__ */ new Map());
|
|
6937
|
+
m(this, "idCounter", 0);
|
|
6786
6938
|
this.events = e, this.getSeries = t;
|
|
6787
6939
|
}
|
|
6788
6940
|
addAlert(e) {
|
|
6789
6941
|
const t = e.id ?? `alert_${++this.idCounter}`;
|
|
6790
|
-
return this.alerts.set(t, { ...e, id: t
|
|
6942
|
+
return this.alerts.set(t, { ...e, id: t }), t;
|
|
6791
6943
|
}
|
|
6792
6944
|
removeAlert(e) {
|
|
6793
6945
|
return this.alerts.delete(e);
|
|
@@ -6796,12 +6948,11 @@ class Yn {
|
|
|
6796
6948
|
this.alerts.clear();
|
|
6797
6949
|
}
|
|
6798
6950
|
getAlerts() {
|
|
6799
|
-
return Array.from(this.alerts.values())
|
|
6951
|
+
return Array.from(this.alerts.values());
|
|
6800
6952
|
}
|
|
6801
6953
|
/** Call after data updates / render tick. */
|
|
6802
6954
|
evaluate() {
|
|
6803
6955
|
for (const [e, t] of [...this.alerts.entries()]) {
|
|
6804
|
-
if (t.latched && t.once !== !1) continue;
|
|
6805
6956
|
const n = this.getSeries(t.seriesId);
|
|
6806
6957
|
if (!n) continue;
|
|
6807
6958
|
const s = n.getData(), o = s.close ?? s.y;
|
|
@@ -6830,88 +6981,118 @@ class Yn {
|
|
|
6830
6981
|
triggeredAt: Date.now(),
|
|
6831
6982
|
triggerPrice: r
|
|
6832
6983
|
};
|
|
6833
|
-
this.events.emit("alert", h), t.once !== !1 &&
|
|
6984
|
+
this.events.emit("alert", h), t.once !== !1 && this.alerts.delete(e);
|
|
6834
6985
|
}
|
|
6835
6986
|
}
|
|
6836
6987
|
destroy() {
|
|
6837
6988
|
this.alerts.clear();
|
|
6838
6989
|
}
|
|
6839
6990
|
}
|
|
6840
|
-
|
|
6991
|
+
const qn = {
|
|
6992
|
+
entry: "#38bdf8",
|
|
6993
|
+
sl: "#ef4444",
|
|
6994
|
+
tp: "#22c55e"
|
|
6995
|
+
}, Gn = {
|
|
6996
|
+
entry: "Entry",
|
|
6997
|
+
sl: "SL",
|
|
6998
|
+
tp: "TP"
|
|
6999
|
+
};
|
|
7000
|
+
function jn(i, e) {
|
|
7001
|
+
const t = i.style ?? "entry";
|
|
7002
|
+
return {
|
|
7003
|
+
id: e,
|
|
7004
|
+
type: "horizontal-line",
|
|
7005
|
+
y: i.price,
|
|
7006
|
+
color: i.color ?? qn[t],
|
|
7007
|
+
label: i.label ?? Gn[t],
|
|
7008
|
+
labelPosition: "right",
|
|
7009
|
+
lineDash: t === "sl" ? [6, 4] : t === "tp" ? [4, 4] : void 0,
|
|
7010
|
+
interactive: i.interactive ?? !1
|
|
7011
|
+
};
|
|
7012
|
+
}
|
|
7013
|
+
class Qn {
|
|
6841
7014
|
constructor(e) {
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
7015
|
+
m(this, "container");
|
|
7016
|
+
m(this, "webglCanvas");
|
|
7017
|
+
m(this, "overlayCanvas");
|
|
7018
|
+
m(this, "overlayCtx");
|
|
7019
|
+
m(this, "series", /* @__PURE__ */ new Map());
|
|
7020
|
+
m(this, "events", new dt());
|
|
7021
|
+
m(this, "viewBounds", {
|
|
6849
7022
|
xMin: -0.5,
|
|
6850
7023
|
xMax: 0.5,
|
|
6851
7024
|
yMin: -1e-5,
|
|
6852
7025
|
yMax: 1e-5
|
|
6853
7026
|
});
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
7027
|
+
m(this, "xAxisOptions");
|
|
7028
|
+
m(this, "yAxisOptionsMap");
|
|
7029
|
+
m(this, "primaryYAxisId");
|
|
7030
|
+
m(this, "dpr");
|
|
7031
|
+
/**
|
|
7032
|
+
* When set, overrides the device pixel ratio used by `resize()` instead of
|
|
7033
|
+
* recomputing it from `window.devicePixelRatio`. Used by high-resolution
|
|
7034
|
+
* export (snapshot) so the boosted DPR is not clobbered on the next resize.
|
|
7035
|
+
*/
|
|
7036
|
+
m(this, "dprOverride", null);
|
|
7037
|
+
m(this, "backgroundColor");
|
|
7038
|
+
m(this, "plotAreaBackground");
|
|
7039
|
+
m(this, "renderer");
|
|
7040
|
+
m(this, "activeRendererType", "webgl");
|
|
7041
|
+
m(this, "rendererInitPromise", null);
|
|
7042
|
+
m(this, "overlay");
|
|
7043
|
+
m(this, "interaction");
|
|
7044
|
+
m(this, "xScale");
|
|
7045
|
+
m(this, "yScales");
|
|
7046
|
+
m(this, "theme");
|
|
7047
|
+
m(this, "baseTheme");
|
|
7048
|
+
m(this, "colorScheme");
|
|
7049
|
+
m(this, "cursorOptions", null);
|
|
7050
|
+
m(this, "cursorPosition", null);
|
|
7051
|
+
m(this, "showLegend");
|
|
7052
|
+
m(this, "legend", null);
|
|
7053
|
+
m(this, "originalSeriesStyles", /* @__PURE__ */ new Map());
|
|
7054
|
+
m(this, "hoveredSeriesId", null);
|
|
7055
|
+
m(this, "showControls");
|
|
7056
|
+
m(this, "toolbarOptions");
|
|
7057
|
+
m(this, "controls", null);
|
|
7058
|
+
m(this, "layout");
|
|
7059
|
+
m(this, "_isDestroyed", !1);
|
|
6881
7060
|
/** When true, skip resize (stacked pane drag uses CSS scaling instead). */
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
7061
|
+
m(this, "resizeSuspended", !1);
|
|
7062
|
+
m(this, "autoScroll", !1);
|
|
7063
|
+
m(this, "showStatistics", !1);
|
|
7064
|
+
m(this, "initQueueId", null);
|
|
7065
|
+
m(this, "chartId");
|
|
7066
|
+
m(this, "commandQueue", []);
|
|
7067
|
+
m(this, "annotationQueue", []);
|
|
7068
|
+
m(this, "annotationIdCounter", 0);
|
|
7069
|
+
m(this, "tooltipConfigQueue", []);
|
|
7070
|
+
m(this, "fitLineQueue", []);
|
|
7071
|
+
m(this, "selectionRect", null);
|
|
7072
|
+
m(this, "pluginManager");
|
|
7073
|
+
m(this, "initialOptions");
|
|
6895
7074
|
// Composed modules
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
7075
|
+
m(this, "pluginBridge");
|
|
7076
|
+
m(this, "axisManager");
|
|
7077
|
+
m(this, "stateManager");
|
|
7078
|
+
m(this, "renderLoop");
|
|
7079
|
+
m(this, "resizeObserver", null);
|
|
7080
|
+
m(this, "animationEngine");
|
|
7081
|
+
m(this, "animationConfig");
|
|
7082
|
+
m(this, "selectionManager");
|
|
7083
|
+
m(this, "responsiveManager");
|
|
7084
|
+
m(this, "alertManager");
|
|
7085
|
+
m(this, "timeScaleMapping", null);
|
|
7086
|
+
m(this, "positionLineCounter", 0);
|
|
6906
7087
|
this.initialOptions = e, this.container = e.container, this.chartId = e.id ?? `chart_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
6907
|
-
const t =
|
|
7088
|
+
const t = sn(this.container, e);
|
|
6908
7089
|
if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? Oe(e.colorScheme) : $e(t.theme.isDark), this.backgroundColor = t.backgroundColor, this.plotAreaBackground = t.plotAreaColor, this.showLegend = t.showLegend, this.showControls = t.showControls, this.toolbarOptions = e.toolbar, this.autoScroll = t.autoScroll, this.showStatistics = t.showStatistics, this.dpr = t.dpr, this.xAxisOptions = t.xAxisOptions, this.xScale = t.xScale, this.yAxisOptionsMap = t.yAxisOptionsMap, this.yScales = t.yScales, this.primaryYAxisId = t.primaryYAxisId, this.webglCanvas = t.webglCanvas, this.overlayCanvas = t.overlayCanvas, this.overlayCtx = t.overlayCtx, this.layout = t.layout, this.layout.crosshair && this.enableCursor({
|
|
6909
7090
|
enabled: this.layout.crosshair.enabled !== !1,
|
|
6910
7091
|
crosshair: !0,
|
|
6911
7092
|
snap: this.layout.crosshair.snapToData,
|
|
6912
7093
|
valueDisplayMode: this.layout.crosshair.valueDisplayMode,
|
|
6913
7094
|
cornerPosition: this.layout.crosshair.cornerPosition
|
|
6914
|
-
}), this.pluginManager = new
|
|
7095
|
+
}), this.pluginManager = new fn({
|
|
6915
7096
|
chart: this,
|
|
6916
7097
|
container: this.container,
|
|
6917
7098
|
theme: this.theme,
|
|
@@ -6950,18 +7131,18 @@ class _n {
|
|
|
6950
7131
|
var r;
|
|
6951
7132
|
return (r = this.pluginManager) == null ? void 0 : r.get(o);
|
|
6952
7133
|
}
|
|
6953
|
-
}), this.pluginBridge = new
|
|
7134
|
+
}), this.pluginBridge = new Sn(this.pluginManager), e.loading !== !1) {
|
|
6954
7135
|
const o = typeof e.loading == "object" ? e.loading : {
|
|
6955
7136
|
message: "Loading SciPlot...",
|
|
6956
7137
|
overlayOpacity: 0.1
|
|
6957
7138
|
};
|
|
6958
|
-
this.use(
|
|
7139
|
+
this.use(gt({
|
|
6959
7140
|
...o,
|
|
6960
7141
|
autoShow: !0
|
|
6961
7142
|
// Ensure it shows immediately
|
|
6962
7143
|
}));
|
|
6963
7144
|
}
|
|
6964
|
-
e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new
|
|
7145
|
+
e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new ii(this.overlayCtx, this.theme), this.selectionManager = new oi({
|
|
6965
7146
|
getSeries: () => this.series,
|
|
6966
7147
|
getPlotArea: () => this.getPlotArea(),
|
|
6967
7148
|
getXScale: () => this.xScale,
|
|
@@ -6972,18 +7153,18 @@ class _n {
|
|
|
6972
7153
|
requestRender: () => this.requestRender()
|
|
6973
7154
|
}), this.events.on("selectionChange", (o) => {
|
|
6974
7155
|
this.pluginManager.notifySelectionChange(o.selected);
|
|
6975
|
-
}), this.animationEngine = new
|
|
7156
|
+
}), this.animationEngine = new it(), this.animationConfig = typeof e.animations == "boolean" ? { ...W, enabled: e.animations } : _e(e.animations);
|
|
6976
7157
|
const s = typeof e.responsive == "boolean" ? { enabled: e.responsive } : e.responsive;
|
|
6977
|
-
this.responsiveManager = new
|
|
7158
|
+
this.responsiveManager = new ri(
|
|
6978
7159
|
{
|
|
6979
7160
|
container: this.container,
|
|
6980
7161
|
onStateChange: (o) => this.handleResponsiveChange(o)
|
|
6981
7162
|
},
|
|
6982
7163
|
s
|
|
6983
|
-
), this.alertManager = new
|
|
7164
|
+
), this.alertManager = new Un(this.events, (o) => {
|
|
6984
7165
|
const r = o ? this.series.get(o) : void 0;
|
|
6985
7166
|
return r || this.series.values().next().value;
|
|
6986
|
-
}), this.axisManager = new
|
|
7167
|
+
}), this.axisManager = new wn({
|
|
6987
7168
|
xAxisOptions: this.xAxisOptions,
|
|
6988
7169
|
xScale: this.xScale,
|
|
6989
7170
|
yAxisOptionsMap: this.yAxisOptionsMap,
|
|
@@ -6991,7 +7172,7 @@ class _n {
|
|
|
6991
7172
|
primaryYAxisId: this.primaryYAxisId,
|
|
6992
7173
|
series: this.series,
|
|
6993
7174
|
requestRender: () => this.requestRender()
|
|
6994
|
-
}), this.stateManager = new
|
|
7175
|
+
}), this.stateManager = new kn({
|
|
6995
7176
|
viewBounds: this.viewBounds,
|
|
6996
7177
|
xAxisOptions: this.xAxisOptions,
|
|
6997
7178
|
xScale: this.xScale,
|
|
@@ -7012,7 +7193,7 @@ class _n {
|
|
|
7012
7193
|
removeSeries: (o) => this.removeSeries(o),
|
|
7013
7194
|
addSeries: (o) => this.addSeries(o),
|
|
7014
7195
|
requestRender: () => this.requestRender()
|
|
7015
|
-
}), this.renderLoop = new
|
|
7196
|
+
}), this.renderLoop = new En({
|
|
7016
7197
|
webglCanvas: this.webglCanvas,
|
|
7017
7198
|
overlayCanvas: this.overlayCanvas,
|
|
7018
7199
|
overlayCtx: this.overlayCtx,
|
|
@@ -7037,14 +7218,16 @@ class _n {
|
|
|
7037
7218
|
pluginManager: this.pluginManager,
|
|
7038
7219
|
getLayout: () => this.layout,
|
|
7039
7220
|
getLatex: () => this.latex,
|
|
7040
|
-
updateSeriesBuffer: (o) =>
|
|
7221
|
+
updateSeriesBuffer: (o) => ce(this.getSeriesContext(), o),
|
|
7041
7222
|
getPlotArea: () => this.getPlotArea(),
|
|
7042
7223
|
pixelToDataX: (o) => this.pixelToDataX(o),
|
|
7043
7224
|
pixelToDataY: (o, r) => this.pixelToDataY(o, r),
|
|
7225
|
+
getBusinessDayMapping: () => this.timeScaleMapping,
|
|
7226
|
+
getAlerts: () => this.alertManager.getAlerts(),
|
|
7044
7227
|
get yScale() {
|
|
7045
7228
|
return this.yScales.get(this.primaryYAxisId) || this.yScales.values().next().value;
|
|
7046
7229
|
}
|
|
7047
|
-
}), this.interaction = new
|
|
7230
|
+
}), this.interaction = new ni(
|
|
7048
7231
|
this.container,
|
|
7049
7232
|
{
|
|
7050
7233
|
onZoom: (o, r) => {
|
|
@@ -7126,11 +7309,21 @@ class _n {
|
|
|
7126
7309
|
},
|
|
7127
7310
|
onInteraction: (o) => {
|
|
7128
7311
|
this.pluginManager.notifyInteraction(o);
|
|
7312
|
+
},
|
|
7313
|
+
onPointClick: (o, r, a, l) => {
|
|
7314
|
+
const h = this.pixelToDataX(o), d = this.pixelToDataY(r);
|
|
7315
|
+
this.events.emit("click", {
|
|
7316
|
+
point: { x: h, y: d },
|
|
7317
|
+
pixelX: o,
|
|
7318
|
+
pixelY: r,
|
|
7319
|
+
ctrlKey: a,
|
|
7320
|
+
shiftKey: l
|
|
7321
|
+
});
|
|
7129
7322
|
}
|
|
7130
7323
|
},
|
|
7131
7324
|
() => this.getPlotArea(),
|
|
7132
7325
|
(o) => this.getInteractedBounds(o),
|
|
7133
|
-
() =>
|
|
7326
|
+
() => rn(this.yAxisOptionsMap)
|
|
7134
7327
|
), this.resizeObserver = new ResizeObserver(() => {
|
|
7135
7328
|
!this.isDestroyed && !this.resizeSuspended && this.resize();
|
|
7136
7329
|
}), this.resizeObserver.observe(this.container), this.initControls(), this.initLegend(e);
|
|
@@ -7143,7 +7336,8 @@ class _n {
|
|
|
7143
7336
|
return this._isDestroyed;
|
|
7144
7337
|
}
|
|
7145
7338
|
setXScale(e) {
|
|
7146
|
-
|
|
7339
|
+
var t, n, s;
|
|
7340
|
+
this.xScale = e, (t = this.axisManager) == null || t.setXScale(e), (n = this.renderLoop) == null || n.setXScale(e), (s = this.stateManager) == null || s.setXScale(e), this.requestRender();
|
|
7147
7341
|
}
|
|
7148
7342
|
setYScale(e, t) {
|
|
7149
7343
|
this.yScales.set(e, t), this.requestRender();
|
|
@@ -7203,6 +7397,9 @@ class _n {
|
|
|
7203
7397
|
get forecasting() {
|
|
7204
7398
|
return this.pluginBridge.forecasting;
|
|
7205
7399
|
}
|
|
7400
|
+
get patterns() {
|
|
7401
|
+
return this.pluginBridge.patterns;
|
|
7402
|
+
}
|
|
7206
7403
|
get latex() {
|
|
7207
7404
|
var e;
|
|
7208
7405
|
return ((e = this.pluginBridge) == null ? void 0 : e.latex) ?? this.getPluginAPI("velo-plot-latex");
|
|
@@ -7218,7 +7415,7 @@ class _n {
|
|
|
7218
7415
|
if (!(this.renderLoop.isInitStarted() || this._isDestroyed)) {
|
|
7219
7416
|
this.rendererInitPromise && (await this.rendererInitPromise, this.rendererInitPromise = null), this.renderer || (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.renderLoop.setRenderer(this.renderer);
|
|
7220
7417
|
for (const e of this.series.values())
|
|
7221
|
-
|
|
7418
|
+
ce(this.getSeriesContext(), e);
|
|
7222
7419
|
this.renderLoop.startInit(), this.resize(), this.startRenderLoop(), this.commandQueue.length > 0 && (this.commandQueue.forEach((e) => {
|
|
7223
7420
|
try {
|
|
7224
7421
|
e.fn();
|
|
@@ -7247,7 +7444,7 @@ class _n {
|
|
|
7247
7444
|
this.initQueueId = e;
|
|
7248
7445
|
}
|
|
7249
7446
|
initControls() {
|
|
7250
|
-
this.controls =
|
|
7447
|
+
this.controls = mn({
|
|
7251
7448
|
container: this.container,
|
|
7252
7449
|
theme: this.theme,
|
|
7253
7450
|
showControls: this.showControls,
|
|
@@ -7283,7 +7480,7 @@ class _n {
|
|
|
7283
7480
|
initLegend(e) {
|
|
7284
7481
|
var n;
|
|
7285
7482
|
const t = (n = e.layout) == null ? void 0 : n.legend;
|
|
7286
|
-
this.legend =
|
|
7483
|
+
this.legend = pn(
|
|
7287
7484
|
{
|
|
7288
7485
|
container: this.container,
|
|
7289
7486
|
theme: this.theme,
|
|
@@ -7320,7 +7517,7 @@ class _n {
|
|
|
7320
7517
|
if (this.hoveredSeriesId = s.getId(), o) {
|
|
7321
7518
|
const l = s.getStyle();
|
|
7322
7519
|
this.originalSeriesStyles.set(s.getId(), { ...l });
|
|
7323
|
-
const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) ||
|
|
7520
|
+
const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Et(l.color || "#ff0055", this.theme.isDark);
|
|
7324
7521
|
s.setStyle({
|
|
7325
7522
|
color: h
|
|
7326
7523
|
}), (a = this.legend) == null || a.updateSeriesStyle(s);
|
|
@@ -7344,7 +7541,7 @@ class _n {
|
|
|
7344
7541
|
);
|
|
7345
7542
|
}
|
|
7346
7543
|
setTheme(e) {
|
|
7347
|
-
this.baseTheme = typeof e == "string" ?
|
|
7544
|
+
this.baseTheme = typeof e == "string" ? et(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = _(this.theme.backgroundColor), this.plotAreaBackground = _(this.theme.plotAreaBackground || this.theme.backgroundColor), this.container.style.backgroundColor = this.theme.backgroundColor, this.overlay.setTheme(this.theme), this.tooltip.updateChartTheme(this.theme), this.controls && this.controls.updateTheme(this.theme), this.legend && this.legend.updateTheme(this.theme), this.initialOptions.colorScheme || (this.colorScheme = $e(this.theme.isDark)), this.requestRender();
|
|
7348
7545
|
}
|
|
7349
7546
|
/**
|
|
7350
7547
|
* Set the color scheme for multi-series charts
|
|
@@ -7360,7 +7557,7 @@ class _n {
|
|
|
7360
7557
|
return this.colorScheme;
|
|
7361
7558
|
}
|
|
7362
7559
|
getPlotArea() {
|
|
7363
|
-
return
|
|
7560
|
+
return on(this.container, this.yAxisOptionsMap, this.layout);
|
|
7364
7561
|
}
|
|
7365
7562
|
getInteractedBounds(e) {
|
|
7366
7563
|
if (e) {
|
|
@@ -7375,7 +7572,7 @@ class _n {
|
|
|
7375
7572
|
return this.viewBounds;
|
|
7376
7573
|
}
|
|
7377
7574
|
exportImage(e = "png") {
|
|
7378
|
-
return
|
|
7575
|
+
return hi(
|
|
7379
7576
|
this.webglCanvas,
|
|
7380
7577
|
this.overlayCanvas,
|
|
7381
7578
|
this.backgroundColor,
|
|
@@ -7387,7 +7584,7 @@ class _n {
|
|
|
7387
7584
|
}
|
|
7388
7585
|
exportSVG() {
|
|
7389
7586
|
const e = this.container.getBoundingClientRect();
|
|
7390
|
-
return
|
|
7587
|
+
return ci(
|
|
7391
7588
|
this.getAllSeries(),
|
|
7392
7589
|
this.viewBounds,
|
|
7393
7590
|
this.getPlotArea(),
|
|
@@ -7405,6 +7602,7 @@ class _n {
|
|
|
7405
7602
|
}
|
|
7406
7603
|
// Series Management (delegates to ChartSeries)
|
|
7407
7604
|
getSeriesContext() {
|
|
7605
|
+
const e = this;
|
|
7408
7606
|
return {
|
|
7409
7607
|
series: this.series,
|
|
7410
7608
|
renderer: this.renderer,
|
|
@@ -7412,18 +7610,24 @@ class _n {
|
|
|
7412
7610
|
autoScale: () => this.autoScale(),
|
|
7413
7611
|
autoScaleYOnly: () => this.autoScaleYOnly(),
|
|
7414
7612
|
requestRender: () => this.requestRender(),
|
|
7415
|
-
addAnnotation: (
|
|
7613
|
+
addAnnotation: (t) => this.addAnnotation(t),
|
|
7416
7614
|
xAxisOptions: this.xAxisOptions,
|
|
7417
7615
|
yAxisOptionsMap: this.yAxisOptionsMap,
|
|
7418
7616
|
autoScrollEnabled: this.autoScroll,
|
|
7419
|
-
addSeries: (
|
|
7617
|
+
addSeries: (t) => this.addSeries(t),
|
|
7420
7618
|
updateLegend: () => {
|
|
7421
7619
|
this.legend && this.legend.update(this.getAllSeries());
|
|
7620
|
+
},
|
|
7621
|
+
get timeScaleMapping() {
|
|
7622
|
+
return e.timeScaleMapping;
|
|
7623
|
+
},
|
|
7624
|
+
set timeScaleMapping(t) {
|
|
7625
|
+
e.timeScaleMapping = t;
|
|
7422
7626
|
}
|
|
7423
7627
|
};
|
|
7424
7628
|
}
|
|
7425
7629
|
addSeries(e) {
|
|
7426
|
-
|
|
7630
|
+
Qi(this.getSeriesContext(), e);
|
|
7427
7631
|
const t = this.series.get(e.id);
|
|
7428
7632
|
t && this.pluginManager.notifySeriesAdd({ series: t, changeType: "add" });
|
|
7429
7633
|
}
|
|
@@ -7435,11 +7639,11 @@ class _n {
|
|
|
7435
7639
|
}
|
|
7436
7640
|
removeSeries(e) {
|
|
7437
7641
|
const t = this.series.get(e);
|
|
7438
|
-
|
|
7642
|
+
Ji(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
|
|
7439
7643
|
}
|
|
7440
7644
|
updateSeries(e, t) {
|
|
7441
7645
|
var s, o;
|
|
7442
|
-
|
|
7646
|
+
Ki(this.getSeriesContext(), e, t), this.recalculateTools();
|
|
7443
7647
|
const n = this.series.get(e);
|
|
7444
7648
|
n && this.pluginManager.notifyDataUpdate({
|
|
7445
7649
|
seriesId: e,
|
|
@@ -7449,7 +7653,7 @@ class _n {
|
|
|
7449
7653
|
}), this.alertManager.evaluate();
|
|
7450
7654
|
}
|
|
7451
7655
|
appendData(e, t, n) {
|
|
7452
|
-
|
|
7656
|
+
en(this.getSeriesContext(), e, t, n), this.recalculateTools();
|
|
7453
7657
|
const s = this.series.get(e);
|
|
7454
7658
|
s && this.pluginManager.notifyDataUpdate({
|
|
7455
7659
|
seriesId: e,
|
|
@@ -7462,7 +7666,7 @@ class _n {
|
|
|
7462
7666
|
this.autoScroll = e;
|
|
7463
7667
|
}
|
|
7464
7668
|
setMaxPoints(e, t) {
|
|
7465
|
-
|
|
7669
|
+
tn(this.getSeriesContext(), e, t);
|
|
7466
7670
|
}
|
|
7467
7671
|
/**
|
|
7468
7672
|
* Add a line of best fit to a series
|
|
@@ -7479,7 +7683,7 @@ class _n {
|
|
|
7479
7683
|
* For stacked layouts use buildIndicatorPaneFromPreset() when creating panes.
|
|
7480
7684
|
*/
|
|
7481
7685
|
async addIndicator(e, t) {
|
|
7482
|
-
return
|
|
7686
|
+
return Hn(this, e, t);
|
|
7483
7687
|
}
|
|
7484
7688
|
addAlert(e) {
|
|
7485
7689
|
return this.alertManager.addAlert(e);
|
|
@@ -7490,6 +7694,13 @@ class _n {
|
|
|
7490
7694
|
clearAlerts() {
|
|
7491
7695
|
this.alertManager.clearAlerts();
|
|
7492
7696
|
}
|
|
7697
|
+
getAlerts() {
|
|
7698
|
+
return this.alertManager.getAlerts();
|
|
7699
|
+
}
|
|
7700
|
+
addPositionLine(e) {
|
|
7701
|
+
const t = e.id ?? `position-${++this.positionLineCounter}`;
|
|
7702
|
+
return this.addAnnotation(jn(e, t)), t;
|
|
7703
|
+
}
|
|
7493
7704
|
setDrawingMode(e) {
|
|
7494
7705
|
var n;
|
|
7495
7706
|
const t = this.getPluginAPI("velo-plot-drawing-tools");
|
|
@@ -7525,7 +7736,7 @@ class _n {
|
|
|
7525
7736
|
zoom(e) {
|
|
7526
7737
|
const t = { ...this.viewBounds };
|
|
7527
7738
|
if (this.animationConfig.enabled && e.animate !== !1) {
|
|
7528
|
-
const n =
|
|
7739
|
+
const n = Mi(
|
|
7529
7740
|
this.getAnimatedNavContext(),
|
|
7530
7741
|
e
|
|
7531
7742
|
);
|
|
@@ -7533,7 +7744,7 @@ class _n {
|
|
|
7533
7744
|
s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
|
|
7534
7745
|
});
|
|
7535
7746
|
} else
|
|
7536
|
-
|
|
7747
|
+
mi(this.getNavContext(), e);
|
|
7537
7748
|
this.pluginManager.notifyViewChange({
|
|
7538
7749
|
previous: t,
|
|
7539
7750
|
current: { ...this.viewBounds },
|
|
@@ -7543,7 +7754,7 @@ class _n {
|
|
|
7543
7754
|
}
|
|
7544
7755
|
pan(e, t, n) {
|
|
7545
7756
|
const s = { ...this.viewBounds };
|
|
7546
|
-
|
|
7757
|
+
pi(this.getNavContext(), e, t, n), this.pluginManager.notifyViewChange({
|
|
7547
7758
|
previous: s,
|
|
7548
7759
|
current: { ...this.viewBounds },
|
|
7549
7760
|
trigger: "pan",
|
|
@@ -7556,7 +7767,7 @@ class _n {
|
|
|
7556
7767
|
fit(e) {
|
|
7557
7768
|
this.executeOrQueue("fit", () => {
|
|
7558
7769
|
const t = { ...this.viewBounds }, n = e == null ? void 0 : e.padding;
|
|
7559
|
-
|
|
7770
|
+
bi(this.getNavContext(), {
|
|
7560
7771
|
x: e == null ? void 0 : e.x,
|
|
7561
7772
|
y: e == null ? void 0 : e.y,
|
|
7562
7773
|
padding: n
|
|
@@ -7578,7 +7789,7 @@ class _n {
|
|
|
7578
7789
|
this.executeOrQueue("autoScale", () => {
|
|
7579
7790
|
const t = { ...this.viewBounds };
|
|
7580
7791
|
if (this.animationConfig.enabled && e) {
|
|
7581
|
-
const n =
|
|
7792
|
+
const n = Ci(
|
|
7582
7793
|
this.getAnimatedNavContext(),
|
|
7583
7794
|
!0
|
|
7584
7795
|
);
|
|
@@ -7586,7 +7797,7 @@ class _n {
|
|
|
7586
7797
|
s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
|
|
7587
7798
|
});
|
|
7588
7799
|
} else
|
|
7589
|
-
|
|
7800
|
+
xi(this.getNavContext());
|
|
7590
7801
|
this.pluginManager.notifyViewChange({
|
|
7591
7802
|
previous: t,
|
|
7592
7803
|
current: { ...this.viewBounds },
|
|
@@ -7600,14 +7811,14 @@ class _n {
|
|
|
7600
7811
|
* Used during streaming to prevent X-axis shifting
|
|
7601
7812
|
*/
|
|
7602
7813
|
autoScaleYOnly() {
|
|
7603
|
-
|
|
7814
|
+
vi(this.getNavContext()), this.requestRender();
|
|
7604
7815
|
}
|
|
7605
7816
|
/**
|
|
7606
7817
|
* Animate view bounds to specific target
|
|
7607
7818
|
*/
|
|
7608
7819
|
animateTo(e) {
|
|
7609
7820
|
var n, s, o, r;
|
|
7610
|
-
const t =
|
|
7821
|
+
const t = Ai(
|
|
7611
7822
|
this.getAnimatedNavContext(),
|
|
7612
7823
|
{
|
|
7613
7824
|
xMin: (n = e.xRange) == null ? void 0 : n[0],
|
|
@@ -7647,7 +7858,7 @@ class _n {
|
|
|
7647
7858
|
}
|
|
7648
7859
|
handleBoxZoom(e) {
|
|
7649
7860
|
const t = e === null;
|
|
7650
|
-
this.selectionRect =
|
|
7861
|
+
this.selectionRect = Si(
|
|
7651
7862
|
this.getNavContext(),
|
|
7652
7863
|
e,
|
|
7653
7864
|
this.selectionRect,
|
|
@@ -7706,10 +7917,10 @@ class _n {
|
|
|
7706
7917
|
}
|
|
7707
7918
|
// Export
|
|
7708
7919
|
exportCSV(e) {
|
|
7709
|
-
return
|
|
7920
|
+
return ai(this.getAllSeries(), e);
|
|
7710
7921
|
}
|
|
7711
7922
|
exportJSON(e) {
|
|
7712
|
-
return
|
|
7923
|
+
return li(this.getAllSeries(), this.viewBounds, e);
|
|
7713
7924
|
}
|
|
7714
7925
|
// ============================================
|
|
7715
7926
|
// Axis Management
|
|
@@ -7744,7 +7955,7 @@ class _n {
|
|
|
7744
7955
|
}
|
|
7745
7956
|
async initGpuRenderer() {
|
|
7746
7957
|
var t, n;
|
|
7747
|
-
const e = await
|
|
7958
|
+
const e = await qt(this.webglCanvas, {
|
|
7748
7959
|
backend: "webgpu",
|
|
7749
7960
|
powerPreference: "high-performance"
|
|
7750
7961
|
});
|
|
@@ -7762,6 +7973,16 @@ class _n {
|
|
|
7762
7973
|
setDPR(e) {
|
|
7763
7974
|
this.dpr = e, this.renderer.setDPR(e), this.overlay.setTheme(this.theme), this.resize(), this.requestRender();
|
|
7764
7975
|
}
|
|
7976
|
+
/**
|
|
7977
|
+
* Locks the device pixel ratio to an explicit value (or clears the lock with
|
|
7978
|
+
* `null`). Unlike {@link setDPR}, this survives subsequent `resize()` calls,
|
|
7979
|
+
* which is required for high-resolution export: the backing stores must stay
|
|
7980
|
+
* enlarged while the snapshot is captured. Pass `null` to restore automatic
|
|
7981
|
+
* DPR handling based on `window.devicePixelRatio`.
|
|
7982
|
+
*/
|
|
7983
|
+
setDevicePixelRatioOverride(e) {
|
|
7984
|
+
this.dprOverride = e, e !== null && (this.dpr = e, this.renderer.setDPR(e), this.overlay.setTheme(this.theme)), this.resize(), this.requestRender();
|
|
7985
|
+
}
|
|
7765
7986
|
/**
|
|
7766
7987
|
* Update X axis configuration
|
|
7767
7988
|
*/
|
|
@@ -7769,7 +7990,7 @@ class _n {
|
|
|
7769
7990
|
this.axisManager.updateXAxis(e), this.requestRender();
|
|
7770
7991
|
}
|
|
7771
7992
|
updateLayout(e) {
|
|
7772
|
-
this.layout =
|
|
7993
|
+
this.layout = st({
|
|
7773
7994
|
...this.layout,
|
|
7774
7995
|
...e
|
|
7775
7996
|
}), this.requestRender();
|
|
@@ -7991,8 +8212,8 @@ class _n {
|
|
|
7991
8212
|
// Rendering
|
|
7992
8213
|
resize() {
|
|
7993
8214
|
if (this.isDestroyed || this.resizeSuspended || !this.renderer) return;
|
|
7994
|
-
const e = this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
|
|
7995
|
-
Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)),
|
|
8215
|
+
const e = this.dprOverride ?? this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
|
|
8216
|
+
Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), an(
|
|
7996
8217
|
this.container,
|
|
7997
8218
|
this.webglCanvas,
|
|
7998
8219
|
this.overlayCanvas,
|
|
@@ -8052,9 +8273,9 @@ class _n {
|
|
|
8052
8273
|
this.selectionManager.clearSelection(), await new Promise((e) => requestAnimationFrame(() => requestAnimationFrame(e))), this.animationEngine.isAnimating() && await this.animationEngine.waitForIdle(), this.deltaTool && this.deltaTool.recalculate(), this.peakTool && this.peakTool.recalculate(), this.requestOverlayRender();
|
|
8053
8274
|
}
|
|
8054
8275
|
}
|
|
8055
|
-
function
|
|
8056
|
-
const e = new
|
|
8057
|
-
return
|
|
8276
|
+
function bs(i) {
|
|
8277
|
+
const e = new Qn(i);
|
|
8278
|
+
return bn().then((t) => {
|
|
8058
8279
|
if (e.setInitQueueId(t), e.isDestroyed) {
|
|
8059
8280
|
Ie(t);
|
|
8060
8281
|
return;
|
|
@@ -8065,63 +8286,65 @@ function ls(i) {
|
|
|
8065
8286
|
}), e;
|
|
8066
8287
|
}
|
|
8067
8288
|
export {
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8289
|
+
as as $,
|
|
8290
|
+
it as A,
|
|
8291
|
+
os as B,
|
|
8292
|
+
vn as C,
|
|
8072
8293
|
Te as D,
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8294
|
+
ei as E,
|
|
8295
|
+
et as F,
|
|
8296
|
+
O as G,
|
|
8297
|
+
ot as H,
|
|
8298
|
+
We as I,
|
|
8299
|
+
Ne as J,
|
|
8300
|
+
Mn as K,
|
|
8301
|
+
Kt as L,
|
|
8081
8302
|
ae as M,
|
|
8082
8303
|
Pe as N,
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8304
|
+
ii as O,
|
|
8305
|
+
Cn as P,
|
|
8306
|
+
An as Q,
|
|
8307
|
+
Pn as R,
|
|
8308
|
+
Di as S,
|
|
8309
|
+
ys as T,
|
|
8310
|
+
ms as U,
|
|
8311
|
+
Ln as V,
|
|
8312
|
+
zn as W,
|
|
8313
|
+
On as X,
|
|
8314
|
+
$n as Y,
|
|
8315
|
+
Yn as Z,
|
|
8316
|
+
ps as _,
|
|
8317
|
+
Hn as a,
|
|
8318
|
+
Rn as a0,
|
|
8319
|
+
at as a1,
|
|
8320
|
+
ls as a2,
|
|
8321
|
+
jn as a3,
|
|
8322
|
+
dn as a4,
|
|
8323
|
+
fn as a5,
|
|
8324
|
+
xs as b,
|
|
8325
|
+
bs as c,
|
|
8326
|
+
Nn as d,
|
|
8327
|
+
qi as e,
|
|
8328
|
+
ti as f,
|
|
8329
|
+
Se as g,
|
|
8330
|
+
Vn as h,
|
|
8331
|
+
cs as i,
|
|
8332
|
+
te as j,
|
|
8333
|
+
wi as k,
|
|
8334
|
+
W as l,
|
|
8335
|
+
st as m,
|
|
8336
|
+
_e as n,
|
|
8337
|
+
rs as o,
|
|
8338
|
+
us as p,
|
|
8339
|
+
ds as q,
|
|
8340
|
+
rt as r,
|
|
8118
8341
|
Y as s,
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8342
|
+
gs as t,
|
|
8343
|
+
ie as u,
|
|
8344
|
+
hs as v,
|
|
8345
|
+
fs as w,
|
|
8346
|
+
Ze as x,
|
|
8347
|
+
_ as y,
|
|
8348
|
+
Jt as z
|
|
8126
8349
|
};
|
|
8127
|
-
//# sourceMappingURL=ChartCore-
|
|
8350
|
+
//# sourceMappingURL=ChartCore-ivzLqxVb.js.map
|