velo-plot 2.0.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-BhQ4j7f5.js → ChartCore-ivzLqxVb.js} +419 -393
- package/dist/ChartCore-ivzLqxVb.js.map +1 -0
- package/dist/{SciPlot-GJvw7GJo.js → SciPlot-CEU4ApgD.js} +2 -2
- package/dist/{SciPlot-GJvw7GJo.js.map → SciPlot-CEU4ApgD.js.map} +1 -1
- package/dist/{axisFormat-SPX-CD5s.js → axisFormat-CzumxpCL.js} +3 -3
- package/dist/axisFormat-CzumxpCL.js.map +1 -0
- package/dist/core/chart/ChartAxisManager.d.ts +2 -0
- package/dist/core/chart/ChartCore.d.ts +15 -0
- package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +2 -0
- package/dist/core/chart/ChartStateManager.d.ts +2 -0
- package/dist/core/chart/types.d.ts +5 -0
- package/dist/core/sync/index.d.ts +0 -1
- package/dist/{createStackedChart-DJSmqerD.js → createStackedChart-DxNW0VkF.js} +178 -179
- 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-CWipqOLP.js → index-qunX30Xu.js} +2 -2
- package/dist/{index-CWipqOLP.js.map → index-qunX30Xu.js.map} +1 -1
- package/dist/{index.core-fpZ1dYN0.js → index.core-COREBDNq.js} +25 -24
- package/dist/{index.core-fpZ1dYN0.js.map → index.core-COREBDNq.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{mockDatafeed-Cdg5hKEo.js → mockDatafeed-927foCM4.js} +2 -2
- 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/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 +2 -2
- package/dist/symbols-DT0eLlpW.js +568 -0
- package/dist/symbols-DT0eLlpW.js.map +1 -0
- package/dist/trading.js +5 -5
- package/dist/velo-plot.full.js +184 -182
- package/dist/velo-plot.js +3 -3
- package/dist/workers/indicatorsAsync.d.ts +24 -0
- package/package.json +1 -1
- package/dist/ChartCore-BhQ4j7f5.js.map +0 -1
- package/dist/axisFormat-SPX-CD5s.js.map +0 -1
- package/dist/createStackedChart-DJSmqerD.js.map +0 -1
- package/dist/index-CUGS98p4.js.map +0 -1
- package/dist/index-D7dTq6VB.js.map +0 -1
- package/dist/mockDatafeed-Cdg5hKEo.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as
|
|
2
|
-
import { c as
|
|
3
|
-
const ot = 5, rt = 1 / 6,
|
|
4
|
-
function
|
|
1
|
+
import { m as Mt, M as W, c as St, g as Ot, a as Yt, r as Bt, h as _t, b as jt, i as Nt } from "./ChartCore-ivzLqxVb.js";
|
|
2
|
+
import { c as qt } from "./index-CaXWSOTk.js";
|
|
3
|
+
const ot = 5, rt = 1 / 6, Gt = { top: 4, bottom: 8, left: 4 }, Lt = { bottom: 55 };
|
|
4
|
+
function Wt(t) {
|
|
5
5
|
if (typeof t == "number") return t;
|
|
6
6
|
switch (t) {
|
|
7
7
|
case "8k":
|
|
@@ -30,7 +30,7 @@ function Pt(t, n) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
async function Kt(t, n, o, r, a, d = {}) {
|
|
33
|
-
var
|
|
33
|
+
var f;
|
|
34
34
|
const {
|
|
35
35
|
format: b = "png",
|
|
36
36
|
quality: k = 0.92,
|
|
@@ -38,57 +38,57 @@ async function Kt(t, n, o, r, a, d = {}) {
|
|
|
38
38
|
includeBackground: R = !0,
|
|
39
39
|
includeDividers: X = !0,
|
|
40
40
|
transparent: H = !1
|
|
41
|
-
} = d, E =
|
|
41
|
+
} = d, E = Wt(y), C = (((f = o[0]) == null ? void 0 : f.getDPR()) ?? (typeof window < "u" ? window.devicePixelRatio : 1)) * E, B = o.map((l) => l.getDPR());
|
|
42
42
|
try {
|
|
43
43
|
if (E > 1) {
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
await new Promise((
|
|
44
|
+
for (const u of o)
|
|
45
|
+
typeof u.setDevicePixelRatioOverride == "function" ? u.setDevicePixelRatioOverride(C) : u.setDPR(C), u.render();
|
|
46
|
+
await new Promise((u) => requestAnimationFrame(u)), await new Promise((u) => requestAnimationFrame(u)), await new Promise((u) => setTimeout(u, 50));
|
|
47
47
|
}
|
|
48
|
-
const l = t.getBoundingClientRect(), T = Math.max(1, Math.round(l.width *
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
!H && R && (
|
|
48
|
+
const l = t.getBoundingClientRect(), T = Math.max(1, Math.round(l.width * C)), S = Math.max(1, Math.round(l.height * C)), h = document.createElement("canvas");
|
|
49
|
+
h.width = T, h.height = S;
|
|
50
|
+
const m = h.getContext("2d");
|
|
51
|
+
if (!m) throw new Error("Failed to create export canvas");
|
|
52
|
+
!H && R && (m.fillStyle = a || "#ffffff", m.fillRect(0, 0, T, S));
|
|
53
53
|
const g = b === "jpeg" ? "jpeg" : "png";
|
|
54
|
-
for (let
|
|
55
|
-
const w = Pt(n[
|
|
56
|
-
|
|
54
|
+
for (let u = 0; u < n.length; u++) {
|
|
55
|
+
const w = Pt(n[u], l), D = o[u].exportImage(g), A = await Ut(D);
|
|
56
|
+
m.drawImage(
|
|
57
57
|
A,
|
|
58
|
-
Math.round(w.x *
|
|
59
|
-
Math.round(w.y *
|
|
60
|
-
Math.round(w.width *
|
|
61
|
-
Math.round(w.height *
|
|
58
|
+
Math.round(w.x * C),
|
|
59
|
+
Math.round(w.y * C),
|
|
60
|
+
Math.round(w.width * C),
|
|
61
|
+
Math.round(w.height * C)
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
if (X && r.length) {
|
|
65
|
-
|
|
66
|
-
for (const
|
|
67
|
-
const w = Pt(
|
|
68
|
-
|
|
69
|
-
Math.round(w.x *
|
|
70
|
-
Math.round(w.y *
|
|
71
|
-
Math.max(1, Math.round(w.width *
|
|
72
|
-
Math.max(1, Math.round(w.height *
|
|
65
|
+
m.fillStyle = "rgba(128, 128, 128, 0.35)";
|
|
66
|
+
for (const u of r) {
|
|
67
|
+
const w = Pt(u, l);
|
|
68
|
+
m.fillRect(
|
|
69
|
+
Math.round(w.x * C),
|
|
70
|
+
Math.round(w.y * C),
|
|
71
|
+
Math.max(1, Math.round(w.width * C)),
|
|
72
|
+
Math.max(1, Math.round(w.height * C))
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
const v = b === "jpeg" ? "image/jpeg" : b === "webp" ? "image/webp" : "image/png";
|
|
77
|
-
return
|
|
77
|
+
return h.toDataURL(v, k);
|
|
78
78
|
} finally {
|
|
79
79
|
if (E > 1)
|
|
80
80
|
for (let l = 0; l < o.length; l++)
|
|
81
|
-
o[l].setDPR(
|
|
81
|
+
typeof o[l].setDevicePixelRatioOverride == "function" ? o[l].setDevicePixelRatioOverride(null) : o[l].setDPR(B[l]), o[l].render();
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const
|
|
84
|
+
const L = "velo-pane-divider", F = "velo-pane-resizing";
|
|
85
85
|
function Qt(t) {
|
|
86
86
|
if (typeof document > "u") return;
|
|
87
87
|
let n = document.getElementById("velo-pane-divider-styles");
|
|
88
88
|
n || (n = document.createElement("style"), n.id = "velo-pane-divider-styles", document.head.appendChild(n));
|
|
89
89
|
const r = t === "horizontal" ? "ew-resize" : "ns-resize";
|
|
90
90
|
n.textContent = `
|
|
91
|
-
.${
|
|
91
|
+
.${L} {
|
|
92
92
|
flex: 0 0 var(--velo-divider-size, 6px);
|
|
93
93
|
position: relative;
|
|
94
94
|
cursor: ${r};
|
|
@@ -97,39 +97,39 @@ function Qt(t) {
|
|
|
97
97
|
background: transparent;
|
|
98
98
|
user-select: none;
|
|
99
99
|
}
|
|
100
|
-
.${
|
|
100
|
+
.${L}::after {
|
|
101
101
|
content: "";
|
|
102
102
|
position: absolute;
|
|
103
103
|
background: rgba(128, 128, 128, 0.35);
|
|
104
104
|
transition: background 0.15s;
|
|
105
105
|
}
|
|
106
|
-
.${
|
|
106
|
+
.${L}[data-direction="vertical"]::after {
|
|
107
107
|
left: 0;
|
|
108
108
|
right: 0;
|
|
109
109
|
top: 50%;
|
|
110
110
|
transform: translateY(-50%);
|
|
111
111
|
height: 1px;
|
|
112
112
|
}
|
|
113
|
-
.${
|
|
113
|
+
.${L}[data-direction="horizontal"]::after {
|
|
114
114
|
top: 0;
|
|
115
115
|
bottom: 0;
|
|
116
116
|
left: 50%;
|
|
117
117
|
transform: translateX(-50%);
|
|
118
118
|
width: 1px;
|
|
119
119
|
}
|
|
120
|
-
.${
|
|
121
|
-
.${F} .${
|
|
120
|
+
.${L}:hover::after,
|
|
121
|
+
.${F} .${L}::after {
|
|
122
122
|
background: rgba(0, 242, 255, 0.65);
|
|
123
123
|
}
|
|
124
|
-
.${
|
|
125
|
-
.${F} .${
|
|
124
|
+
.${L}[data-direction="vertical"]:hover::after,
|
|
125
|
+
.${F} .${L}[data-direction="vertical"]::after {
|
|
126
126
|
height: 2px;
|
|
127
127
|
}
|
|
128
|
-
.${
|
|
129
|
-
.${F} .${
|
|
128
|
+
.${L}[data-direction="horizontal"]:hover::after,
|
|
129
|
+
.${F} .${L}[data-direction="horizontal"]::after {
|
|
130
130
|
width: 2px;
|
|
131
131
|
}
|
|
132
|
-
.${
|
|
132
|
+
.${L}-handle {
|
|
133
133
|
position: absolute;
|
|
134
134
|
left: 50%;
|
|
135
135
|
top: 50%;
|
|
@@ -146,8 +146,8 @@ function Qt(t) {
|
|
|
146
146
|
font-size: 10px;
|
|
147
147
|
line-height: 1;
|
|
148
148
|
}
|
|
149
|
-
.${
|
|
150
|
-
.${F} .${
|
|
149
|
+
.${L}:hover .${L}-handle,
|
|
150
|
+
.${F} .${L}-handle {
|
|
151
151
|
opacity: 1;
|
|
152
152
|
}
|
|
153
153
|
.${F} {
|
|
@@ -164,9 +164,9 @@ function Qt(t) {
|
|
|
164
164
|
}
|
|
165
165
|
function Zt(t, n, o) {
|
|
166
166
|
const r = document.createElement("div");
|
|
167
|
-
r.className =
|
|
167
|
+
r.className = L, r.dataset.dividerIndex = String(t), r.dataset.direction = o, r.style.setProperty("--velo-divider-size", `${n}px`);
|
|
168
168
|
const a = document.createElement("div");
|
|
169
|
-
return a.className = `${
|
|
169
|
+
return a.className = `${L}-handle`, a.textContent = o === "horizontal" ? "⇔" : "⇕", r.appendChild(a), r;
|
|
170
170
|
}
|
|
171
171
|
function Vt(t, n) {
|
|
172
172
|
const o = n === "horizontal" ? "min-width:0;" : "min-height:0;";
|
|
@@ -197,58 +197,58 @@ function te(t, n) {
|
|
|
197
197
|
function ee(t, n, o, r, a = {}) {
|
|
198
198
|
const d = a.direction ?? "vertical", b = d === "horizontal";
|
|
199
199
|
Qt(d);
|
|
200
|
-
const k = a.minPaneRatio ?? rt, y = a.minPanePx ?? 0, R = a.dividerSize ?? 6, X = n.length, H = (
|
|
200
|
+
const k = a.minPaneRatio ?? rt, y = a.minPanePx ?? 0, R = a.dividerSize ?? 6, X = n.length, H = (f) => b ? Jt(f, X, k, y) : kt(f, X, k, y), E = [], q = [];
|
|
201
201
|
if (n.length < 2)
|
|
202
202
|
return { dividers: E, destroy: () => {
|
|
203
203
|
} };
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
return Math.max(1, l -
|
|
207
|
-
},
|
|
204
|
+
const C = () => {
|
|
205
|
+
const f = E.length * R, l = b ? t.clientWidth : t.clientHeight;
|
|
206
|
+
return Math.max(1, l - f);
|
|
207
|
+
}, B = (f, l, T, S) => {
|
|
208
208
|
var A;
|
|
209
|
-
const
|
|
210
|
-
(x, z, I) => I ===
|
|
209
|
+
const h = C(), m = H(h), g = S.reduce(
|
|
210
|
+
(x, z, I) => I === f || I === l ? x : x + z,
|
|
211
211
|
0
|
|
212
|
-
), v =
|
|
213
|
-
let
|
|
214
|
-
|
|
215
|
-
const w = v -
|
|
216
|
-
S[
|
|
217
|
-
const
|
|
218
|
-
if (r[
|
|
212
|
+
), v = h - g;
|
|
213
|
+
let u = S[f] + T;
|
|
214
|
+
u = Math.max(m, Math.min(v - m, u));
|
|
215
|
+
const w = v - u;
|
|
216
|
+
S[f] = u, S[l] = w;
|
|
217
|
+
const D = r.reduce((x, z) => x + z, 0);
|
|
218
|
+
if (r[f] = u / h * D, r[l] = w / h * D, (A = a.onDragMove) == null || A.call(a, S, f, l), a.onResize) {
|
|
219
219
|
const x = {};
|
|
220
220
|
for (let z = 0; z < o.length; z++)
|
|
221
221
|
x[o[z]] = r[z];
|
|
222
222
|
a.onResize(x);
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
for (let
|
|
226
|
-
const l = Zt(
|
|
227
|
-
n[
|
|
228
|
-
const S = (
|
|
229
|
-
var w,
|
|
230
|
-
|
|
231
|
-
const
|
|
225
|
+
for (let f = 0; f < n.length - 1; f++) {
|
|
226
|
+
const l = Zt(f, R, d);
|
|
227
|
+
n[f].after(l), E.push(l);
|
|
228
|
+
const S = (h) => {
|
|
229
|
+
var w, D;
|
|
230
|
+
h.preventDefault(), l.setPointerCapture(h.pointerId), t.classList.add(F);
|
|
231
|
+
const m = ((w = a.onDragStart) == null ? void 0 : w.call(a, f, f + 1)) ?? n.map(
|
|
232
232
|
(A) => b ? A.getBoundingClientRect().width : A.getBoundingClientRect().height
|
|
233
233
|
);
|
|
234
|
-
(
|
|
235
|
-
let g = b ?
|
|
234
|
+
(D = a.onDragMove) == null || D.call(a, m, f, f + 1);
|
|
235
|
+
let g = b ? h.clientX : h.clientY;
|
|
236
236
|
const v = (A) => {
|
|
237
237
|
const x = b ? A.clientX : A.clientY, z = x - g;
|
|
238
|
-
g = x, z !== 0 &&
|
|
239
|
-
},
|
|
238
|
+
g = x, z !== 0 && B(f, f + 1, z, m);
|
|
239
|
+
}, u = (A) => {
|
|
240
240
|
var x;
|
|
241
|
-
l.releasePointerCapture(A.pointerId), t.classList.remove(F), l.removeEventListener("pointermove", v), l.removeEventListener("pointerup",
|
|
241
|
+
l.releasePointerCapture(A.pointerId), t.classList.remove(F), l.removeEventListener("pointermove", v), l.removeEventListener("pointerup", u), l.removeEventListener("pointercancel", u), (x = a.onDragEnd) == null || x.call(a, m);
|
|
242
242
|
};
|
|
243
|
-
l.addEventListener("pointermove", v), l.addEventListener("pointerup",
|
|
243
|
+
l.addEventListener("pointermove", v), l.addEventListener("pointerup", u), l.addEventListener("pointercancel", u);
|
|
244
244
|
};
|
|
245
|
-
l.addEventListener("pointerdown", S),
|
|
245
|
+
l.addEventListener("pointerdown", S), q.push(() => l.removeEventListener("pointerdown", S));
|
|
246
246
|
}
|
|
247
247
|
return {
|
|
248
248
|
dividers: E,
|
|
249
249
|
destroy: () => {
|
|
250
|
-
for (const
|
|
251
|
-
for (const
|
|
250
|
+
for (const f of q) f();
|
|
251
|
+
for (const f of E) f.remove();
|
|
252
252
|
t.classList.remove(F);
|
|
253
253
|
}
|
|
254
254
|
};
|
|
@@ -310,39 +310,38 @@ function se(t, n) {
|
|
|
310
310
|
return n + o;
|
|
311
311
|
}
|
|
312
312
|
function ce(t, n) {
|
|
313
|
-
|
|
314
|
-
return typeof t == "number" ? `flex:${t} 1 0;${o}` : `flex:1 1 ${t};${o}`;
|
|
313
|
+
return `flex:${t} 1 0;${n === "horizontal" ? "min-width:0;" : "min-height:0;"}`;
|
|
315
314
|
}
|
|
316
315
|
function $t(t) {
|
|
317
316
|
if (!(t != null && t.length)) return [];
|
|
318
317
|
const n = [];
|
|
319
318
|
for (const o of t)
|
|
320
|
-
o.type === "indicator" ? n.push(...
|
|
319
|
+
o.type === "indicator" ? n.push(...Ot(o)) : n.push(o);
|
|
321
320
|
return n;
|
|
322
321
|
}
|
|
323
|
-
function
|
|
324
|
-
var
|
|
325
|
-
const R = r === 0, X = r === a - 1, H = y === "horizontal",
|
|
322
|
+
function Dt(t, n, o, r, a, d, b, k, y) {
|
|
323
|
+
var D, A, x, z, I, V, U, K, Q, J, tt, et, nt;
|
|
324
|
+
const R = r === 0, X = r === a - 1, H = y === "horizontal", q = !H && o.sharedXAxis !== "none" && !b, B = H && (o.sharedYAxis ?? "left") !== "none" && !k, l = (o.gap ?? 0) > 0 ? Gt : { top: 0, bottom: 0, left: 0 }, T = H ? {
|
|
326
325
|
top: d.top,
|
|
327
|
-
right: X ? d.right : l.left
|
|
328
|
-
left:
|
|
326
|
+
right: X ? d.right : l.left,
|
|
327
|
+
left: B ? l.left : d.left,
|
|
329
328
|
bottom: d.bottom
|
|
330
329
|
} : {
|
|
331
330
|
top: R ? d.top : l.top,
|
|
332
331
|
right: d.right,
|
|
333
332
|
left: d.left,
|
|
334
|
-
bottom:
|
|
335
|
-
}, S = ((x = t.chart) == null ? void 0 : x.xAxis) ?? {},
|
|
333
|
+
bottom: q ? l.bottom : X ? ((A = (D = o.layout) == null ? void 0 : D.margins) == null ? void 0 : A.bottom) ?? Lt.bottom : d.bottom
|
|
334
|
+
}, S = ((x = t.chart) == null ? void 0 : x.xAxis) ?? {}, h = {
|
|
336
335
|
...S,
|
|
337
336
|
showLine: b ? S.showLine ?? !0 : !1,
|
|
338
337
|
showTicks: b ? S.showTicks ?? !0 : !1,
|
|
339
338
|
showLabels: b ? S.showLabels ?? !0 : !1
|
|
340
|
-
},
|
|
341
|
-
...
|
|
342
|
-
showLine: k ?
|
|
343
|
-
showTicks: k ?
|
|
344
|
-
showLabels: k ?
|
|
345
|
-
})),
|
|
339
|
+
}, m = ((z = t.chart) == null ? void 0 : z.yAxis) ?? {}, v = (Array.isArray(m) ? m : [m]).map((G) => ({
|
|
340
|
+
...G,
|
|
341
|
+
showLine: k ? G.showLine ?? !0 : !1,
|
|
342
|
+
showTicks: k ? G.showTicks ?? !0 : !1,
|
|
343
|
+
showLabels: k ? G.showLabels ?? !0 : !1
|
|
344
|
+
})), u = Array.isArray((I = t.chart) == null ? void 0 : I.yAxis) ? v : v[0];
|
|
346
345
|
return (t.interactive ?? !0) || (n.style.pointerEvents = "none"), {
|
|
347
346
|
...t.chart,
|
|
348
347
|
id: t.id,
|
|
@@ -351,9 +350,9 @@ function Mt(t, n, o, r, a, d, b, k, y) {
|
|
|
351
350
|
theme: ((U = t.chart) == null ? void 0 : U.theme) ?? o.theme,
|
|
352
351
|
devicePixelRatio: o.devicePixelRatio ?? ((K = t.chart) == null ? void 0 : K.devicePixelRatio),
|
|
353
352
|
loading: ((Q = t.chart) == null ? void 0 : Q.loading) ?? !1,
|
|
354
|
-
xAxis:
|
|
355
|
-
yAxis:
|
|
356
|
-
layout:
|
|
353
|
+
xAxis: h,
|
|
354
|
+
yAxis: u,
|
|
355
|
+
layout: Mt({
|
|
357
356
|
...o.layout,
|
|
358
357
|
...(J = t.chart) == null ? void 0 : J.layout,
|
|
359
358
|
margins: { ...T, ...(tt = o.layout) == null ? void 0 : tt.margins, ...(nt = (et = t.chart) == null ? void 0 : et.layout) == null ? void 0 : nt.margins }
|
|
@@ -388,32 +387,32 @@ function fe(t) {
|
|
|
388
387
|
if (!n) throw new Error("[StackedChart] container is required");
|
|
389
388
|
if (o.length < 1 || o.length > ot)
|
|
390
389
|
throw new Error(`[StackedChart] panes must be 1–${ot}`);
|
|
391
|
-
const r = t.masterPaneId ?? o[0].id, a = t.direction ?? "vertical", d = a === "horizontal", b = t.sharedXAxis ?? "bottom", k = t.sharedYAxis ?? "left", y = t.gap ?? 0, R = t.resizable, X = !!R, H = typeof R == "object" ? R.dividerSize ?? 6 : 6, E =
|
|
390
|
+
const r = t.masterPaneId ?? o[0].id, a = t.direction ?? "vertical", d = a === "horizontal", b = t.sharedXAxis ?? "bottom", k = t.sharedYAxis ?? "left", y = t.gap ?? 0, R = t.resizable, X = !!R, H = typeof R == "object" ? R.dividerSize ?? 6 : 6, E = Mt(t.layout), q = ((ut = E.margins) == null ? void 0 : ut.left) ?? W.left, C = ((ht = E.margins) == null ? void 0 : ht.right) ?? W.right, B = ((ft = E.margins) == null ? void 0 : ft.top) ?? W.top, f = ae(o, q), l = se(o, C);
|
|
392
391
|
n.replaceChildren(), n.style.display = "flex", n.style.flexDirection = d ? "row" : "column", n.style.width = "100%";
|
|
393
392
|
const T = n.offsetHeight || parseInt(getComputedStyle(n).height, 10), S = n.offsetWidth || parseInt(getComputedStyle(n).width, 10);
|
|
394
|
-
d ? (S > 0
|
|
395
|
-
const
|
|
396
|
-
let w = null,
|
|
393
|
+
d ? (S > 0 && (n.style.width = `${S}px`, n.style.minWidth = `${S}px`), n.style.height = T > 0 ? `${T}px` : "320px", n.style.minHeight = n.style.height) : T > 0 ? (n.style.height = `${T}px`, n.style.minHeight = `${T}px`) : n.style.height || (n.style.minHeight = "320px"), n.style.overflow = "hidden", n.style.position = "relative";
|
|
394
|
+
const h = o.map((e) => e.id), m = o.map((e) => Rt(e.height)), g = /* @__PURE__ */ new Map(), v = [], u = [];
|
|
395
|
+
let w = null, D = !1, A = 0, x = 0, z = null;
|
|
397
396
|
const I = (e) => {
|
|
398
397
|
const i = Array.from({ length: v.length }, (s, c) => c);
|
|
399
398
|
for (const s of i) {
|
|
400
|
-
const c = g.get(
|
|
399
|
+
const c = g.get(h[s]);
|
|
401
400
|
c && c.resize();
|
|
402
401
|
}
|
|
403
402
|
Ct(
|
|
404
|
-
i.map((s) =>
|
|
403
|
+
i.map((s) => u[s]).filter(Boolean)
|
|
405
404
|
);
|
|
406
405
|
}, V = () => {
|
|
407
406
|
A || (A = requestAnimationFrame(() => {
|
|
408
|
-
A = 0, !
|
|
407
|
+
A = 0, !D && I();
|
|
409
408
|
}));
|
|
410
409
|
}, U = new ResizeObserver(() => {
|
|
411
|
-
|
|
410
|
+
D || V();
|
|
412
411
|
});
|
|
413
412
|
U.observe(n);
|
|
414
413
|
const K = () => {
|
|
415
414
|
for (let e = 0; e < v.length; e++)
|
|
416
|
-
v[e].style.cssText = it(
|
|
415
|
+
v[e].style.cssText = it(m[e], y, e, a);
|
|
417
416
|
}, Q = () => {
|
|
418
417
|
const e = (v.length - 1) * H;
|
|
419
418
|
return d ? Math.max(1, n.clientWidth - e) : Math.max(1, n.clientHeight - e);
|
|
@@ -433,58 +432,58 @@ function fe(t) {
|
|
|
433
432
|
v[i].style.cssText = `${p}:${s}px;flex:0 0 auto;min-height:0;min-width:0;position:relative;overflow:hidden;${c}`;
|
|
434
433
|
}
|
|
435
434
|
}, nt = () => {
|
|
436
|
-
if (x = 0, !
|
|
435
|
+
if (x = 0, !D || !z) return;
|
|
437
436
|
const { sizes: e, leadingIdx: i, trailingIdx: s } = z;
|
|
438
437
|
et(e);
|
|
439
438
|
for (const c of [i, s]) {
|
|
440
|
-
const p = g.get(
|
|
441
|
-
p && (p.resize(), Ct([
|
|
439
|
+
const p = g.get(h[c]);
|
|
440
|
+
p && (p.resize(), Ct([u[c]]));
|
|
442
441
|
}
|
|
443
|
-
},
|
|
442
|
+
}, G = (e, i, s) => {
|
|
444
443
|
z = { sizes: e, leadingIdx: i, trailingIdx: s }, !x && (x = requestAnimationFrame(nt));
|
|
445
444
|
}, Tt = (e) => {
|
|
446
445
|
const i = e.reduce((c, p) => c + p, 0);
|
|
447
446
|
if (i <= 0) return;
|
|
448
|
-
const s =
|
|
449
|
-
for (let c = 0; c <
|
|
450
|
-
|
|
447
|
+
const s = m.reduce((c, p) => c + p, 0);
|
|
448
|
+
for (let c = 0; c < m.length; c++)
|
|
449
|
+
m[c] = e[c] / i * s;
|
|
451
450
|
}, at = (e) => {
|
|
452
451
|
var i;
|
|
453
452
|
for (const s of g.values())
|
|
454
453
|
(i = s.setResizeSuspended) == null || i.call(s, e);
|
|
455
454
|
}, It = (e, i) => {
|
|
456
|
-
var s, c, p,
|
|
457
|
-
for (let
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
}, st = d ? ((gt = (mt = t.layout) == null ? void 0 : mt.margins) == null ? void 0 : gt.bottom) ??
|
|
455
|
+
var s, c, p, $, P, O;
|
|
456
|
+
for (let M = 0; M < h.length; M++)
|
|
457
|
+
M === e || M === i || (c = (s = g.get(h[M])) == null ? void 0 : s.setResizeSuspended) == null || c.call(s, !0);
|
|
458
|
+
($ = (p = g.get(h[e])) == null ? void 0 : p.setResizeSuspended) == null || $.call(p, !1), (O = (P = g.get(h[i])) == null ? void 0 : P.setResizeSuspended) == null || O.call(P, !1);
|
|
459
|
+
}, st = d ? ((gt = (mt = t.layout) == null ? void 0 : mt.margins) == null ? void 0 : gt.bottom) ?? Lt.bottom : W.bottom;
|
|
461
460
|
for (let e = 0; e < o.length; e++) {
|
|
462
|
-
const i = o[e], s = e === 0, c = e === o.length - 1, p = d ? i.showXAxis ?? !0 : i.showXAxis ?? (b === "bottom" ? c : !0),
|
|
463
|
-
P.dataset.paneId = i.id, P.style.cssText = it(
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
461
|
+
const i = o[e], s = e === 0, c = e === o.length - 1, p = d ? i.showXAxis ?? !0 : i.showXAxis ?? (b === "bottom" ? c : !0), $ = d ? i.showYAxis ?? (k === "left" ? s : !0) : i.showYAxis ?? !0, P = document.createElement("div");
|
|
462
|
+
P.dataset.paneId = i.id, P.style.cssText = it(m[e], y, e, a);
|
|
463
|
+
const O = document.createElement("div");
|
|
464
|
+
O.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", P.appendChild(O), n.appendChild(P), v.push(P);
|
|
465
|
+
const M = St(
|
|
466
|
+
Dt(
|
|
468
467
|
i,
|
|
469
|
-
|
|
468
|
+
O,
|
|
470
469
|
t,
|
|
471
470
|
e,
|
|
472
471
|
o.length,
|
|
473
472
|
{
|
|
474
|
-
left: d &&
|
|
473
|
+
left: d && !$ ? W.left : f,
|
|
475
474
|
right: l,
|
|
476
|
-
top:
|
|
475
|
+
top: B,
|
|
477
476
|
bottom: st
|
|
478
477
|
},
|
|
479
478
|
p,
|
|
480
|
-
|
|
479
|
+
$,
|
|
481
480
|
a
|
|
482
481
|
)
|
|
483
482
|
), j = $t(i.series);
|
|
484
483
|
if (j.length)
|
|
485
|
-
for (const N of j)
|
|
486
|
-
i.yRange && i.yRange !== "auto" &&
|
|
487
|
-
chart:
|
|
484
|
+
for (const N of j) M.addSeries(N);
|
|
485
|
+
i.yRange && i.yRange !== "auto" && M.zoom({ y: i.yRange, animate: !1 }), g.set(i.id, M), u.push({
|
|
486
|
+
chart: M,
|
|
488
487
|
wrapper: P,
|
|
489
488
|
baseYTickCount: zt((pt = i.chart) == null ? void 0 : pt.yAxis),
|
|
490
489
|
baseXTickCount: ((xt = (yt = i.chart) == null ? void 0 : yt.xAxis) == null ? void 0 : xt.tickCount) ?? 8,
|
|
@@ -500,17 +499,17 @@ function fe(t) {
|
|
|
500
499
|
w = ee(
|
|
501
500
|
n,
|
|
502
501
|
v,
|
|
503
|
-
|
|
504
|
-
|
|
502
|
+
h,
|
|
503
|
+
m,
|
|
505
504
|
{
|
|
506
505
|
direction: a,
|
|
507
506
|
...e,
|
|
508
|
-
onDragStart: (i, s) => (
|
|
507
|
+
onDragStart: (i, s) => (D = !0, at(!0), It(i, s), tt()),
|
|
509
508
|
onDragMove: (i, s, c) => {
|
|
510
|
-
|
|
509
|
+
G(i, s, c);
|
|
511
510
|
},
|
|
512
511
|
onDragEnd: (i) => {
|
|
513
|
-
x && (cancelAnimationFrame(x), x = 0), z = null,
|
|
512
|
+
x && (cancelAnimationFrame(x), x = 0), z = null, D = !1;
|
|
514
513
|
const s = te(i, Q());
|
|
515
514
|
Tt(s), J(), K(), at(!1), I();
|
|
516
515
|
}
|
|
@@ -520,7 +519,7 @@ function fe(t) {
|
|
|
520
519
|
const Z = g.get(r);
|
|
521
520
|
if (!Z)
|
|
522
521
|
throw new Error(`[StackedChart] masterPaneId "${r}" not found in panes`);
|
|
523
|
-
const
|
|
522
|
+
const _ = qt(
|
|
524
523
|
Array.from(g.values()),
|
|
525
524
|
le(t.sync, r, a)
|
|
526
525
|
), Ft = () => {
|
|
@@ -530,8 +529,8 @@ function fe(t) {
|
|
|
530
529
|
const i = Date.now();
|
|
531
530
|
return new Promise((c) => {
|
|
532
531
|
const p = () => {
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
532
|
+
const $ = Nt();
|
|
533
|
+
if ($.pending === 0 && !$.isProcessing || Date.now() - i > 8e3) {
|
|
535
534
|
c();
|
|
536
535
|
return;
|
|
537
536
|
}
|
|
@@ -566,48 +565,48 @@ function fe(t) {
|
|
|
566
565
|
throw new Error(`[StackedChart] Cannot exceed ${ot} panes`);
|
|
567
566
|
if (g.has(e.id))
|
|
568
567
|
throw new Error(`[StackedChart] Pane "${e.id}" already exists`);
|
|
569
|
-
if (!d && b === "bottom" &&
|
|
570
|
-
const
|
|
571
|
-
(vt = g.get(
|
|
568
|
+
if (!d && b === "bottom" && h.length > 0) {
|
|
569
|
+
const Y = h[h.length - 1];
|
|
570
|
+
(vt = g.get(Y)) == null || vt.updateXAxis({
|
|
572
571
|
showLabels: !1,
|
|
573
572
|
showTicks: !1,
|
|
574
573
|
showLine: !1
|
|
575
574
|
});
|
|
576
575
|
}
|
|
577
|
-
const i = Rt(e.height ?? 0.25), s =
|
|
578
|
-
for (let
|
|
579
|
-
const p =
|
|
580
|
-
|
|
581
|
-
const
|
|
582
|
-
|
|
576
|
+
const i = Rt(e.height ?? 0.25), s = m.reduce((Y, Ht) => Y + Ht, 0), c = s > 0 ? (1 - i) / s : 1;
|
|
577
|
+
for (let Y = 0; Y < m.length; Y++) m[Y] *= c;
|
|
578
|
+
const p = h.length;
|
|
579
|
+
h.push(e.id), m.push(i);
|
|
580
|
+
const $ = document.createElement("div");
|
|
581
|
+
$.dataset.paneId = e.id, $.style.cssText = it(m[p], y, p, a);
|
|
583
582
|
const P = document.createElement("div");
|
|
584
|
-
P.style.cssText = "position:absolute;inset:0;width:100%;height:100%;",
|
|
585
|
-
const
|
|
586
|
-
|
|
583
|
+
P.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", $.appendChild(P), n.appendChild($), v.push($);
|
|
584
|
+
const M = d ? e.showXAxis ?? !0 : e.showXAxis ?? (b === "bottom" ? !0 : !0), j = d ? e.showYAxis ?? (k === "left" ? p === 0 : !0) : e.showYAxis ?? !0, N = St(
|
|
585
|
+
Dt(
|
|
587
586
|
e,
|
|
588
587
|
P,
|
|
589
588
|
t,
|
|
590
589
|
p,
|
|
591
|
-
|
|
590
|
+
h.length,
|
|
592
591
|
{
|
|
593
|
-
left: d && !j ?
|
|
592
|
+
left: d && !j ? W.left : f,
|
|
594
593
|
right: l,
|
|
595
|
-
top:
|
|
594
|
+
top: B,
|
|
596
595
|
bottom: st
|
|
597
596
|
},
|
|
598
|
-
|
|
597
|
+
M,
|
|
599
598
|
j,
|
|
600
599
|
a
|
|
601
600
|
)
|
|
602
601
|
), Xt = $t(e.series);
|
|
603
|
-
for (const
|
|
604
|
-
return e.yRange && e.yRange !== "auto" && N.zoom({ y: e.yRange, animate: !1 }), g.set(e.id, N),
|
|
602
|
+
for (const Y of Xt) N.addSeries(Y);
|
|
603
|
+
return e.yRange && e.yRange !== "auto" && N.zoom({ y: e.yRange, animate: !1 }), g.set(e.id, N), u.push({
|
|
605
604
|
chart: N,
|
|
606
|
-
wrapper:
|
|
605
|
+
wrapper: $,
|
|
607
606
|
baseYTickCount: zt((wt = e.chart) == null ? void 0 : wt.yAxis),
|
|
608
607
|
baseXTickCount: ((At = (bt = e.chart) == null ? void 0 : bt.xAxis) == null ? void 0 : At.tickCount) ?? 8,
|
|
609
|
-
showXAxis:
|
|
610
|
-
}),
|
|
608
|
+
showXAxis: M
|
|
609
|
+
}), _.add(N), K(), I(), N;
|
|
611
610
|
};
|
|
612
611
|
return {
|
|
613
612
|
container: n,
|
|
@@ -621,38 +620,38 @@ function fe(t) {
|
|
|
621
620
|
return Z;
|
|
622
621
|
},
|
|
623
622
|
getGroup() {
|
|
624
|
-
return
|
|
623
|
+
return _;
|
|
625
624
|
},
|
|
626
625
|
fitAll(e) {
|
|
627
|
-
|
|
626
|
+
_.fitAll(e);
|
|
628
627
|
},
|
|
629
628
|
resetAll() {
|
|
630
|
-
|
|
629
|
+
_.resetAll();
|
|
631
630
|
},
|
|
632
631
|
resize() {
|
|
633
632
|
I();
|
|
634
633
|
},
|
|
635
634
|
getPaneRatios() {
|
|
636
635
|
const e = {};
|
|
637
|
-
for (let i = 0; i <
|
|
638
|
-
e[
|
|
636
|
+
for (let i = 0; i < h.length; i++)
|
|
637
|
+
e[h[i]] = m[i];
|
|
639
638
|
return e;
|
|
640
639
|
},
|
|
641
640
|
setPaneRatios(e) {
|
|
642
|
-
for (let i = 0; i <
|
|
643
|
-
const s =
|
|
644
|
-
e[s] !== void 0 && (
|
|
641
|
+
for (let i = 0; i < h.length; i++) {
|
|
642
|
+
const s = h[i];
|
|
643
|
+
e[s] !== void 0 && (m[i] = e[s]);
|
|
645
644
|
}
|
|
646
|
-
ne(v,
|
|
645
|
+
ne(v, m, a), I();
|
|
647
646
|
},
|
|
648
647
|
setSyncAxis(e) {
|
|
649
|
-
|
|
648
|
+
_.syncAxis(e);
|
|
650
649
|
},
|
|
651
650
|
getSyncAxis() {
|
|
652
|
-
return
|
|
651
|
+
return _.getOptions().axis ?? "x";
|
|
653
652
|
},
|
|
654
653
|
setSyncOptions(e) {
|
|
655
|
-
|
|
654
|
+
_.updateOptions(e);
|
|
656
655
|
},
|
|
657
656
|
whenReady() {
|
|
658
657
|
return ct();
|
|
@@ -667,11 +666,11 @@ function fe(t) {
|
|
|
667
666
|
return dt(e);
|
|
668
667
|
},
|
|
669
668
|
async addIndicator(e, i = {}) {
|
|
670
|
-
var
|
|
669
|
+
var M;
|
|
671
670
|
const s = g.get(r) ?? Z;
|
|
672
671
|
if (i.pane !== "new")
|
|
673
|
-
return { ...await
|
|
674
|
-
const c =
|
|
672
|
+
return { ...await Yt(s, e, i), chart: s };
|
|
673
|
+
const c = Bt(s, i.sourceSeriesId), { x: p, prices: $ } = _t(c), P = await jt(e, p, $, {
|
|
675
674
|
id: i.id ?? e,
|
|
676
675
|
label: i.label ?? e.toUpperCase(),
|
|
677
676
|
height: i.paneHeight ?? 0.25,
|
|
@@ -681,18 +680,18 @@ function fe(t) {
|
|
|
681
680
|
slowPeriod: i.slowPeriod,
|
|
682
681
|
signalPeriod: i.signalPeriod,
|
|
683
682
|
stdDev: i.stdDev
|
|
684
|
-
}, c),
|
|
683
|
+
}, c), O = dt(P);
|
|
685
684
|
return {
|
|
686
685
|
id: P.id,
|
|
687
686
|
preset: e,
|
|
688
687
|
placement: "oscillator",
|
|
689
|
-
seriesIds: ((
|
|
688
|
+
seriesIds: ((M = P.series) == null ? void 0 : M.map((j) => j.id)) ?? [],
|
|
690
689
|
paneId: P.id,
|
|
691
|
-
chart:
|
|
690
|
+
chart: O
|
|
692
691
|
};
|
|
693
692
|
},
|
|
694
693
|
destroy() {
|
|
695
|
-
A && cancelAnimationFrame(A), x && cancelAnimationFrame(x), U.disconnect(), w == null || w.destroy(),
|
|
694
|
+
A && cancelAnimationFrame(A), x && cancelAnimationFrame(x), U.disconnect(), w == null || w.destroy(), _.destroy();
|
|
696
695
|
for (const e of g.values()) e.destroy();
|
|
697
696
|
g.clear(), n.replaceChildren();
|
|
698
697
|
}
|
|
@@ -703,4 +702,4 @@ export {
|
|
|
703
702
|
rt as a,
|
|
704
703
|
fe as c
|
|
705
704
|
};
|
|
706
|
-
//# sourceMappingURL=createStackedChart-
|
|
705
|
+
//# sourceMappingURL=createStackedChart-DxNW0VkF.js.map
|