velo-plot 1.15.0 → 1.19.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-BimVvUEg.js → ChartCore-DQ691eXH.js} +1523 -996
- package/dist/ChartCore-DQ691eXH.js.map +1 -0
- package/dist/assets/downsample.worker-C70QJ04y.js +2 -0
- package/dist/assets/downsample.worker-C70QJ04y.js.map +1 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js +2 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -0
- package/dist/core/OverlayRenderer.d.ts +2 -0
- package/dist/core/chart/ChartAlerts.d.ts +42 -0
- package/dist/core/chart/ChartCore.d.ts +19 -1
- package/dist/core/chart/ChartRenderLoop.d.ts +4 -2
- package/dist/core/chart/ChartRenderer.d.ts +3 -2
- package/dist/core/chart/candlestickMarkers.d.ts +23 -0
- package/dist/core/chart/heikinAshi.d.ts +10 -0
- package/dist/core/chart/series/types.d.ts +2 -2
- package/dist/core/chart/types.d.ts +7 -0
- package/dist/core/indicator/addIndicator.d.ts +36 -0
- package/dist/core/indicator/index.d.ts +2 -0
- package/dist/core/indicator/indicatorPresets.d.ts +37 -0
- package/dist/core/series/Series.d.ts +3 -0
- package/dist/core/stacked/types.d.ts +8 -0
- package/dist/core/time/TimeScale.d.ts +31 -0
- package/dist/createStackedChart-BPooTQ9z.js +1164 -0
- package/dist/createStackedChart-BPooTQ9z.js.map +1 -0
- package/dist/gpu/adapter/gpuRenderer.d.ts +21 -0
- package/dist/gpu/backends/webgpu/WebGPUBackend.d.ts +2 -1
- package/dist/gpuRenderer-BpaMYz-k.js +1848 -0
- package/dist/gpuRenderer-BpaMYz-k.js.map +1 -0
- package/dist/index-D7dTq6VB.js +503 -0
- package/dist/index-D7dTq6VB.js.map +1 -0
- package/dist/{index-Ce2JgkH_.js → index-DoYxf1cV.js} +86 -43
- package/dist/{index-Ce2JgkH_.js.map → index-DoYxf1cV.js.map} +1 -1
- package/dist/{index.core-C_-CFftD.js → index.core-BtGFYMOu.js} +2 -2
- package/dist/{index.core-C_-CFftD.js.map → index.core-BtGFYMOu.js.map} +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/indicators--eJGmVox.js +302 -0
- package/dist/indicators--eJGmVox.js.map +1 -0
- package/dist/plugins/analysis.js +530 -807
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/caching.js +26 -21
- package/dist/plugins/caching.js.map +1 -1
- package/dist/plugins/drawing-tools/index.d.ts +16 -0
- package/dist/plugins/gpu.js +202 -1895
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/keyboard/index.d.ts +1 -7
- package/dist/plugins/keyboard.js +1 -1
- package/dist/plugins/lazy-load/types.d.ts +7 -0
- package/dist/plugins/lazy-load.js +131 -108
- package/dist/plugins/lazy-load.js.map +1 -1
- package/dist/plugins/replay/index.d.ts +19 -0
- package/dist/plugins/virtualization/types.d.ts +12 -0
- package/dist/plugins/virtualization.js +1 -1
- package/dist/pool-15HMCNv8.js +88 -0
- package/dist/pool-15HMCNv8.js.map +1 -0
- package/dist/react.js +2 -2
- package/dist/renderer/CandlestickRenderer.d.ts +1 -1
- package/dist/renderer/ChartSeriesRenderer.d.ts +6 -0
- package/dist/renderer/GpuChartRenderer.d.ts +23 -0
- package/dist/renderer/index.d.ts +3 -0
- package/dist/renderer/spike/WebGLGridSpike.d.ts +40 -0
- package/dist/testing/baselines/v1.15.0.json.d.ts +51 -0
- package/dist/testing/gridSpikeBenchmark.d.ts +49 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/rendererBenchmark.d.ts +13 -0
- package/dist/testing/stage1BrowserBench.d.ts +42 -0
- package/dist/types.d.ts +21 -1
- package/dist/velo-plot.full.js +1322 -789
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +20 -20
- package/dist/workers/downsample.d.ts +38 -0
- package/dist/workers/downsampleAsync.d.ts +6 -0
- package/dist/workers/indicator.worker.d.ts +32 -0
- package/dist/workers/indicatorsAsync.d.ts +26 -0
- package/dist/workers/pool.d.ts +36 -0
- package/package.json +11 -1
- package/dist/ChartCore-BimVvUEg.js.map +0 -1
- package/dist/createStackedChart-CjsKcOvX.js +0 -1088
- package/dist/createStackedChart-CjsKcOvX.js.map +0 -1
- package/dist/index-ChgIdk3N.js +0 -229
- package/dist/index-ChgIdk3N.js.map +0 -1
|
@@ -0,0 +1,1164 @@
|
|
|
1
|
+
import Ve, { useState as fe, useRef as ge, useEffect as de, useCallback as se, forwardRef as Je, useImperativeHandle as Ze, useMemo as Qe } from "react";
|
|
2
|
+
import { c as ye, m as Be, M as ie, b as Ke, a as et, r as tt, e as rt, d as nt, g as ot } from "./ChartCore-DQ691eXH.js";
|
|
3
|
+
import { c as it } from "./index-CUGS98p4.js";
|
|
4
|
+
var ve = { exports: {} }, ce = {};
|
|
5
|
+
/**
|
|
6
|
+
* @license React
|
|
7
|
+
* react-jsx-runtime.production.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
var Oe;
|
|
15
|
+
function at() {
|
|
16
|
+
if (Oe) return ce;
|
|
17
|
+
Oe = 1;
|
|
18
|
+
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
19
|
+
function t(a, s, c) {
|
|
20
|
+
var v = null;
|
|
21
|
+
if (c !== void 0 && (v = "" + c), s.key !== void 0 && (v = "" + s.key), "key" in s) {
|
|
22
|
+
c = {};
|
|
23
|
+
for (var T in s)
|
|
24
|
+
T !== "key" && (c[T] = s[T]);
|
|
25
|
+
} else c = s;
|
|
26
|
+
return s = c.ref, {
|
|
27
|
+
$$typeof: e,
|
|
28
|
+
type: a,
|
|
29
|
+
key: v,
|
|
30
|
+
ref: s !== void 0 ? s : null,
|
|
31
|
+
props: c
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return ce.Fragment = r, ce.jsx = t, ce.jsxs = t, ce;
|
|
35
|
+
}
|
|
36
|
+
var le = {};
|
|
37
|
+
/**
|
|
38
|
+
* @license React
|
|
39
|
+
* react-jsx-runtime.development.js
|
|
40
|
+
*
|
|
41
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the MIT license found in the
|
|
44
|
+
* LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
var Ie;
|
|
47
|
+
function st() {
|
|
48
|
+
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
49
|
+
function e(n) {
|
|
50
|
+
if (n == null) return null;
|
|
51
|
+
if (typeof n == "function")
|
|
52
|
+
return n.$$typeof === k ? null : n.displayName || n.name || null;
|
|
53
|
+
if (typeof n == "string") return n;
|
|
54
|
+
switch (n) {
|
|
55
|
+
case u:
|
|
56
|
+
return "Fragment";
|
|
57
|
+
case j:
|
|
58
|
+
return "Profiler";
|
|
59
|
+
case l:
|
|
60
|
+
return "StrictMode";
|
|
61
|
+
case p:
|
|
62
|
+
return "Suspense";
|
|
63
|
+
case R:
|
|
64
|
+
return "SuspenseList";
|
|
65
|
+
case $:
|
|
66
|
+
return "Activity";
|
|
67
|
+
}
|
|
68
|
+
if (typeof n == "object")
|
|
69
|
+
switch (typeof n.tag == "number" && console.error(
|
|
70
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
71
|
+
), n.$$typeof) {
|
|
72
|
+
case L:
|
|
73
|
+
return "Portal";
|
|
74
|
+
case g:
|
|
75
|
+
return n.displayName || "Context";
|
|
76
|
+
case _:
|
|
77
|
+
return (n._context.displayName || "Context") + ".Consumer";
|
|
78
|
+
case x:
|
|
79
|
+
var m = n.render;
|
|
80
|
+
return n = n.displayName, n || (n = m.displayName || m.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
|
|
81
|
+
case f:
|
|
82
|
+
return m = n.displayName || null, m !== null ? m : e(n.type) || "Memo";
|
|
83
|
+
case b:
|
|
84
|
+
m = n._payload, n = n._init;
|
|
85
|
+
try {
|
|
86
|
+
return e(n(m));
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function r(n) {
|
|
93
|
+
return "" + n;
|
|
94
|
+
}
|
|
95
|
+
function t(n) {
|
|
96
|
+
try {
|
|
97
|
+
r(n);
|
|
98
|
+
var m = !1;
|
|
99
|
+
} catch {
|
|
100
|
+
m = !0;
|
|
101
|
+
}
|
|
102
|
+
if (m) {
|
|
103
|
+
m = console;
|
|
104
|
+
var E = m.error, O = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
|
|
105
|
+
return E.call(
|
|
106
|
+
m,
|
|
107
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
108
|
+
O
|
|
109
|
+
), r(n);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function a(n) {
|
|
113
|
+
if (n === u) return "<>";
|
|
114
|
+
if (typeof n == "object" && n !== null && n.$$typeof === b)
|
|
115
|
+
return "<...>";
|
|
116
|
+
try {
|
|
117
|
+
var m = e(n);
|
|
118
|
+
return m ? "<" + m + ">" : "<...>";
|
|
119
|
+
} catch {
|
|
120
|
+
return "<...>";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function s() {
|
|
124
|
+
var n = S.A;
|
|
125
|
+
return n === null ? null : n.getOwner();
|
|
126
|
+
}
|
|
127
|
+
function c() {
|
|
128
|
+
return Error("react-stack-top-frame");
|
|
129
|
+
}
|
|
130
|
+
function v(n) {
|
|
131
|
+
if (z.call(n, "key")) {
|
|
132
|
+
var m = Object.getOwnPropertyDescriptor(n, "key").get;
|
|
133
|
+
if (m && m.isReactWarning) return !1;
|
|
134
|
+
}
|
|
135
|
+
return n.key !== void 0;
|
|
136
|
+
}
|
|
137
|
+
function T(n, m) {
|
|
138
|
+
function E() {
|
|
139
|
+
Z || (Z = !0, console.error(
|
|
140
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
141
|
+
m
|
|
142
|
+
));
|
|
143
|
+
}
|
|
144
|
+
E.isReactWarning = !0, Object.defineProperty(n, "key", {
|
|
145
|
+
get: E,
|
|
146
|
+
configurable: !0
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function w() {
|
|
150
|
+
var n = e(this.type);
|
|
151
|
+
return Q[n] || (Q[n] = !0, console.error(
|
|
152
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
153
|
+
)), n = this.props.ref, n !== void 0 ? n : null;
|
|
154
|
+
}
|
|
155
|
+
function A(n, m, E, O, oe, ae) {
|
|
156
|
+
var M = E.ref;
|
|
157
|
+
return n = {
|
|
158
|
+
$$typeof: y,
|
|
159
|
+
type: n,
|
|
160
|
+
key: m,
|
|
161
|
+
props: E,
|
|
162
|
+
_owner: O
|
|
163
|
+
}, (M !== void 0 ? M : null) !== null ? Object.defineProperty(n, "ref", {
|
|
164
|
+
enumerable: !1,
|
|
165
|
+
get: w
|
|
166
|
+
}) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
|
|
167
|
+
configurable: !1,
|
|
168
|
+
enumerable: !1,
|
|
169
|
+
writable: !0,
|
|
170
|
+
value: 0
|
|
171
|
+
}), Object.defineProperty(n, "_debugInfo", {
|
|
172
|
+
configurable: !1,
|
|
173
|
+
enumerable: !1,
|
|
174
|
+
writable: !0,
|
|
175
|
+
value: null
|
|
176
|
+
}), Object.defineProperty(n, "_debugStack", {
|
|
177
|
+
configurable: !1,
|
|
178
|
+
enumerable: !1,
|
|
179
|
+
writable: !0,
|
|
180
|
+
value: oe
|
|
181
|
+
}), Object.defineProperty(n, "_debugTask", {
|
|
182
|
+
configurable: !1,
|
|
183
|
+
enumerable: !1,
|
|
184
|
+
writable: !0,
|
|
185
|
+
value: ae
|
|
186
|
+
}), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
|
|
187
|
+
}
|
|
188
|
+
function D(n, m, E, O, oe, ae) {
|
|
189
|
+
var M = m.children;
|
|
190
|
+
if (M !== void 0)
|
|
191
|
+
if (O)
|
|
192
|
+
if (H(M)) {
|
|
193
|
+
for (O = 0; O < M.length; O++)
|
|
194
|
+
Y(M[O]);
|
|
195
|
+
Object.freeze && Object.freeze(M);
|
|
196
|
+
} else
|
|
197
|
+
console.error(
|
|
198
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
199
|
+
);
|
|
200
|
+
else Y(M);
|
|
201
|
+
if (z.call(m, "key")) {
|
|
202
|
+
M = e(n);
|
|
203
|
+
var W = Object.keys(m).filter(function(me) {
|
|
204
|
+
return me !== "key";
|
|
205
|
+
});
|
|
206
|
+
O = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", ne[M + O] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
207
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
208
|
+
let props = %s;
|
|
209
|
+
<%s {...props} />
|
|
210
|
+
React keys must be passed directly to JSX without using spread:
|
|
211
|
+
let props = %s;
|
|
212
|
+
<%s key={someKey} {...props} />`,
|
|
213
|
+
O,
|
|
214
|
+
M,
|
|
215
|
+
W,
|
|
216
|
+
M
|
|
217
|
+
), ne[M + O] = !0);
|
|
218
|
+
}
|
|
219
|
+
if (M = null, E !== void 0 && (t(E), M = "" + E), v(m) && (t(m.key), M = "" + m.key), "key" in m) {
|
|
220
|
+
E = {};
|
|
221
|
+
for (var U in m)
|
|
222
|
+
U !== "key" && (E[U] = m[U]);
|
|
223
|
+
} else E = m;
|
|
224
|
+
return M && T(
|
|
225
|
+
E,
|
|
226
|
+
typeof n == "function" ? n.displayName || n.name || "Unknown" : n
|
|
227
|
+
), A(
|
|
228
|
+
n,
|
|
229
|
+
M,
|
|
230
|
+
E,
|
|
231
|
+
s(),
|
|
232
|
+
oe,
|
|
233
|
+
ae
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function Y(n) {
|
|
237
|
+
C(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === b && (n._payload.status === "fulfilled" ? C(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
|
|
238
|
+
}
|
|
239
|
+
function C(n) {
|
|
240
|
+
return typeof n == "object" && n !== null && n.$$typeof === y;
|
|
241
|
+
}
|
|
242
|
+
var F = Ve, y = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), g = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), $ = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), S = F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, H = Array.isArray, J = console.createTask ? console.createTask : function() {
|
|
243
|
+
return null;
|
|
244
|
+
};
|
|
245
|
+
F = {
|
|
246
|
+
react_stack_bottom_frame: function(n) {
|
|
247
|
+
return n();
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
var Z, Q = {}, K = F.react_stack_bottom_frame.bind(
|
|
251
|
+
F,
|
|
252
|
+
c
|
|
253
|
+
)(), re = J(a(c)), ne = {};
|
|
254
|
+
le.Fragment = u, le.jsx = function(n, m, E) {
|
|
255
|
+
var O = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
256
|
+
return D(
|
|
257
|
+
n,
|
|
258
|
+
m,
|
|
259
|
+
E,
|
|
260
|
+
!1,
|
|
261
|
+
O ? Error("react-stack-top-frame") : K,
|
|
262
|
+
O ? J(a(n)) : re
|
|
263
|
+
);
|
|
264
|
+
}, le.jsxs = function(n, m, E) {
|
|
265
|
+
var O = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
266
|
+
return D(
|
|
267
|
+
n,
|
|
268
|
+
m,
|
|
269
|
+
E,
|
|
270
|
+
!0,
|
|
271
|
+
O ? Error("react-stack-top-frame") : K,
|
|
272
|
+
O ? J(a(n)) : re
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
}()), le;
|
|
276
|
+
}
|
|
277
|
+
process.env.NODE_ENV === "production" ? ve.exports = at() : ve.exports = st();
|
|
278
|
+
var ue = ve.exports;
|
|
279
|
+
function ct(e, r = {}) {
|
|
280
|
+
const [t, a] = fe(null), [s, c] = fe(!1), [v, T] = fe(null), [w, A] = fe(null), D = ge(r);
|
|
281
|
+
D.current = r, de(() => {
|
|
282
|
+
const u = e.current;
|
|
283
|
+
if (u) {
|
|
284
|
+
try {
|
|
285
|
+
const l = ye({
|
|
286
|
+
...D.current,
|
|
287
|
+
container: u
|
|
288
|
+
});
|
|
289
|
+
l.on("zoom", () => {
|
|
290
|
+
A(l.getViewBounds());
|
|
291
|
+
}), a(l), c(!0), A(l.getViewBounds()), T(null);
|
|
292
|
+
} catch (l) {
|
|
293
|
+
console.error("[useSciPlot] Failed to initialize chart:", l), T(l instanceof Error ? l : new Error(String(l))), c(!1);
|
|
294
|
+
}
|
|
295
|
+
return () => {
|
|
296
|
+
t && (t.destroy(), a(null), c(!1));
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}, [e]);
|
|
300
|
+
const Y = se(
|
|
301
|
+
(u) => {
|
|
302
|
+
t && (t.addSeries(u), A(t.getViewBounds()));
|
|
303
|
+
},
|
|
304
|
+
[t]
|
|
305
|
+
), C = se(
|
|
306
|
+
(u, l) => {
|
|
307
|
+
t && t.updateSeries(u, l);
|
|
308
|
+
},
|
|
309
|
+
[t]
|
|
310
|
+
), F = se(
|
|
311
|
+
(u) => {
|
|
312
|
+
t && t.removeSeries(u);
|
|
313
|
+
},
|
|
314
|
+
[t]
|
|
315
|
+
), y = se(
|
|
316
|
+
(u) => {
|
|
317
|
+
t && t.zoom(u);
|
|
318
|
+
},
|
|
319
|
+
[t]
|
|
320
|
+
), L = se(() => {
|
|
321
|
+
t && (t.resetZoom(), A(t.getViewBounds()));
|
|
322
|
+
}, [t]);
|
|
323
|
+
return {
|
|
324
|
+
chart: t,
|
|
325
|
+
isReady: s,
|
|
326
|
+
error: v,
|
|
327
|
+
bounds: w,
|
|
328
|
+
addSeries: Y,
|
|
329
|
+
updateSeries: C,
|
|
330
|
+
removeSeries: F,
|
|
331
|
+
zoom: y,
|
|
332
|
+
resetZoom: L
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const $t = Je(
|
|
336
|
+
function({
|
|
337
|
+
series: r = [],
|
|
338
|
+
zoom: t,
|
|
339
|
+
onZoomChange: a,
|
|
340
|
+
cursor: s,
|
|
341
|
+
width: c = "100%",
|
|
342
|
+
height: v = 400,
|
|
343
|
+
className: T = "",
|
|
344
|
+
style: w = {},
|
|
345
|
+
debug: A = !1,
|
|
346
|
+
...D
|
|
347
|
+
}, Y) {
|
|
348
|
+
const C = ge(null), F = ge(/* @__PURE__ */ new Map()), {
|
|
349
|
+
chart: y,
|
|
350
|
+
isReady: L,
|
|
351
|
+
bounds: u,
|
|
352
|
+
addSeries: l,
|
|
353
|
+
updateSeries: j,
|
|
354
|
+
removeSeries: _,
|
|
355
|
+
resetZoom: g
|
|
356
|
+
} = ct(C, D);
|
|
357
|
+
Ze(
|
|
358
|
+
Y,
|
|
359
|
+
() => ({
|
|
360
|
+
getChart: () => y,
|
|
361
|
+
resetZoom: g,
|
|
362
|
+
getBounds: () => u
|
|
363
|
+
}),
|
|
364
|
+
[y, g, u]
|
|
365
|
+
), de(() => {
|
|
366
|
+
if (!L || !y) return;
|
|
367
|
+
const p = new Map(r.map((f) => [f.id, f])), R = F.current;
|
|
368
|
+
R.forEach((f, b) => {
|
|
369
|
+
p.has(b) || _(b);
|
|
370
|
+
}), p.forEach((f, b) => {
|
|
371
|
+
const $ = R.get(b);
|
|
372
|
+
if ($)
|
|
373
|
+
($.x !== f.x || $.y !== f.y) && j(b, {
|
|
374
|
+
x: f.x,
|
|
375
|
+
y: f.y
|
|
376
|
+
});
|
|
377
|
+
else {
|
|
378
|
+
const k = {
|
|
379
|
+
id: f.id,
|
|
380
|
+
type: "line",
|
|
381
|
+
data: { x: f.x, y: f.y },
|
|
382
|
+
style: {
|
|
383
|
+
color: f.color ?? "#ff0055",
|
|
384
|
+
width: f.width ?? 1.5
|
|
385
|
+
},
|
|
386
|
+
visible: f.visible ?? !0
|
|
387
|
+
};
|
|
388
|
+
l(k), p.size === 1 && y.autoScale();
|
|
389
|
+
}
|
|
390
|
+
}), F.current = p;
|
|
391
|
+
}, [r, L, y, l, j, _]), de(() => {
|
|
392
|
+
!L || !y || !t || y.zoom(t);
|
|
393
|
+
}, [L, y, t]), de(() => {
|
|
394
|
+
!L || !y || !a || y.on("zoom", (p) => {
|
|
395
|
+
a({
|
|
396
|
+
xMin: p.x[0],
|
|
397
|
+
xMax: p.x[1],
|
|
398
|
+
yMin: p.y[0],
|
|
399
|
+
yMax: p.y[1]
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}, [L, y, a]), de(() => {
|
|
403
|
+
!L || !y || (s != null && s.enabled ? y.enableCursor(s) : y.disableCursor());
|
|
404
|
+
}, [L, y, s]);
|
|
405
|
+
const x = Qe(
|
|
406
|
+
() => ({
|
|
407
|
+
position: "relative",
|
|
408
|
+
width: typeof c == "number" ? `${c}px` : c,
|
|
409
|
+
height: typeof v == "number" ? `${v}px` : v,
|
|
410
|
+
...w
|
|
411
|
+
}),
|
|
412
|
+
[c, v, w]
|
|
413
|
+
);
|
|
414
|
+
return /* @__PURE__ */ ue.jsx(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
ref: C,
|
|
418
|
+
className: `velo-plot-container ${T}`,
|
|
419
|
+
style: x,
|
|
420
|
+
children: A && u && /* @__PURE__ */ ue.jsxs(
|
|
421
|
+
"div",
|
|
422
|
+
{
|
|
423
|
+
style: {
|
|
424
|
+
position: "absolute",
|
|
425
|
+
top: 8,
|
|
426
|
+
right: 8,
|
|
427
|
+
background: "rgba(0,0,0,0.7)",
|
|
428
|
+
color: "#0f0",
|
|
429
|
+
padding: "4px 8px",
|
|
430
|
+
borderRadius: 4,
|
|
431
|
+
fontSize: 11,
|
|
432
|
+
fontFamily: "monospace"
|
|
433
|
+
},
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ ue.jsxs("div", { children: [
|
|
436
|
+
"X: [",
|
|
437
|
+
u.xMin.toFixed(3),
|
|
438
|
+
", ",
|
|
439
|
+
u.xMax.toFixed(3),
|
|
440
|
+
"]"
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ ue.jsxs("div", { children: [
|
|
443
|
+
"Y: [",
|
|
444
|
+
u.yMin.toExponential(2),
|
|
445
|
+
", ",
|
|
446
|
+
u.yMax.toExponential(2),
|
|
447
|
+
"]"
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ ue.jsxs("div", { children: [
|
|
450
|
+
"Series: ",
|
|
451
|
+
r.length
|
|
452
|
+
] })
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
), he = 5, xe = 1 / 6, lt = { top: 4, bottom: 8, left: 4 }, He = { bottom: 55 };
|
|
460
|
+
function ut(e) {
|
|
461
|
+
if (typeof e == "number") return e;
|
|
462
|
+
switch (e) {
|
|
463
|
+
case "8k":
|
|
464
|
+
return 8;
|
|
465
|
+
case "4k":
|
|
466
|
+
return 4;
|
|
467
|
+
case "2k":
|
|
468
|
+
return 2;
|
|
469
|
+
default:
|
|
470
|
+
return 1;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function dt(e) {
|
|
474
|
+
return new Promise((r, t) => {
|
|
475
|
+
const a = new Image();
|
|
476
|
+
a.onload = () => r(a), a.onerror = t, a.src = e;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function je(e, r) {
|
|
480
|
+
const t = e.getBoundingClientRect();
|
|
481
|
+
return {
|
|
482
|
+
x: t.left - r.left,
|
|
483
|
+
y: t.top - r.top,
|
|
484
|
+
width: t.width,
|
|
485
|
+
height: t.height
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
async function ft(e, r, t, a, s, c = {}) {
|
|
489
|
+
var u;
|
|
490
|
+
const {
|
|
491
|
+
format: v = "png",
|
|
492
|
+
quality: T = 0.92,
|
|
493
|
+
resolution: w = "standard",
|
|
494
|
+
includeBackground: A = !0,
|
|
495
|
+
includeDividers: D = !0,
|
|
496
|
+
transparent: Y = !1
|
|
497
|
+
} = c, C = ut(w), y = (((u = t[0]) == null ? void 0 : u.getDPR()) ?? (typeof window < "u" ? window.devicePixelRatio : 1)) * C, L = t.map((l) => l.getDPR());
|
|
498
|
+
try {
|
|
499
|
+
if (C > 1) {
|
|
500
|
+
for (const f of t)
|
|
501
|
+
f.setDPR(y), f.render();
|
|
502
|
+
await new Promise((f) => requestAnimationFrame(f)), await new Promise((f) => setTimeout(f, 50));
|
|
503
|
+
}
|
|
504
|
+
const l = e.getBoundingClientRect(), j = Math.max(1, Math.round(l.width * y)), _ = Math.max(1, Math.round(l.height * y)), g = document.createElement("canvas");
|
|
505
|
+
g.width = j, g.height = _;
|
|
506
|
+
const x = g.getContext("2d");
|
|
507
|
+
if (!x) throw new Error("Failed to create export canvas");
|
|
508
|
+
!Y && A && (x.fillStyle = s || "#ffffff", x.fillRect(0, 0, j, _));
|
|
509
|
+
const p = v === "jpeg" ? "jpeg" : "png";
|
|
510
|
+
for (let f = 0; f < r.length; f++) {
|
|
511
|
+
const b = je(r[f], l), $ = t[f].exportImage(p), k = await dt($);
|
|
512
|
+
x.drawImage(
|
|
513
|
+
k,
|
|
514
|
+
Math.round(b.x * y),
|
|
515
|
+
Math.round(b.y * y),
|
|
516
|
+
Math.round(b.width * y),
|
|
517
|
+
Math.round(b.height * y)
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
if (D && a.length) {
|
|
521
|
+
x.fillStyle = "rgba(128, 128, 128, 0.35)";
|
|
522
|
+
for (const f of a) {
|
|
523
|
+
const b = je(f, l);
|
|
524
|
+
x.fillRect(
|
|
525
|
+
Math.round(b.x * y),
|
|
526
|
+
Math.round(b.y * y),
|
|
527
|
+
Math.max(1, Math.round(b.width * y)),
|
|
528
|
+
Math.max(1, Math.round(b.height * y))
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
const R = v === "jpeg" ? "image/jpeg" : v === "webp" ? "image/webp" : "image/png";
|
|
533
|
+
return g.toDataURL(R, T);
|
|
534
|
+
} finally {
|
|
535
|
+
if (C > 1)
|
|
536
|
+
for (let l = 0; l < t.length; l++)
|
|
537
|
+
t[l].setDPR(L[l]), t[l].render();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
const B = "velo-pane-divider", q = "velo-pane-resizing";
|
|
541
|
+
function ht(e) {
|
|
542
|
+
if (typeof document > "u") return;
|
|
543
|
+
let r = document.getElementById("velo-pane-divider-styles");
|
|
544
|
+
r || (r = document.createElement("style"), r.id = "velo-pane-divider-styles", document.head.appendChild(r));
|
|
545
|
+
const a = e === "horizontal" ? "ew-resize" : "ns-resize";
|
|
546
|
+
r.textContent = `
|
|
547
|
+
.${B} {
|
|
548
|
+
flex: 0 0 var(--velo-divider-size, 6px);
|
|
549
|
+
position: relative;
|
|
550
|
+
cursor: ${a};
|
|
551
|
+
touch-action: none;
|
|
552
|
+
z-index: 20;
|
|
553
|
+
background: transparent;
|
|
554
|
+
user-select: none;
|
|
555
|
+
}
|
|
556
|
+
.${B}::after {
|
|
557
|
+
content: "";
|
|
558
|
+
position: absolute;
|
|
559
|
+
background: rgba(128, 128, 128, 0.35);
|
|
560
|
+
transition: background 0.15s;
|
|
561
|
+
}
|
|
562
|
+
.${B}[data-direction="vertical"]::after {
|
|
563
|
+
left: 0;
|
|
564
|
+
right: 0;
|
|
565
|
+
top: 50%;
|
|
566
|
+
transform: translateY(-50%);
|
|
567
|
+
height: 1px;
|
|
568
|
+
}
|
|
569
|
+
.${B}[data-direction="horizontal"]::after {
|
|
570
|
+
top: 0;
|
|
571
|
+
bottom: 0;
|
|
572
|
+
left: 50%;
|
|
573
|
+
transform: translateX(-50%);
|
|
574
|
+
width: 1px;
|
|
575
|
+
}
|
|
576
|
+
.${B}:hover::after,
|
|
577
|
+
.${q} .${B}::after {
|
|
578
|
+
background: rgba(0, 242, 255, 0.65);
|
|
579
|
+
}
|
|
580
|
+
.${B}[data-direction="vertical"]:hover::after,
|
|
581
|
+
.${q} .${B}[data-direction="vertical"]::after {
|
|
582
|
+
height: 2px;
|
|
583
|
+
}
|
|
584
|
+
.${B}[data-direction="horizontal"]:hover::after,
|
|
585
|
+
.${q} .${B}[data-direction="horizontal"]::after {
|
|
586
|
+
width: 2px;
|
|
587
|
+
}
|
|
588
|
+
.${B}-handle {
|
|
589
|
+
position: absolute;
|
|
590
|
+
left: 50%;
|
|
591
|
+
top: 50%;
|
|
592
|
+
transform: translate(-50%, -50%);
|
|
593
|
+
width: 32px;
|
|
594
|
+
height: 12px;
|
|
595
|
+
display: flex;
|
|
596
|
+
align-items: center;
|
|
597
|
+
justify-content: center;
|
|
598
|
+
opacity: 0;
|
|
599
|
+
transition: opacity 0.15s;
|
|
600
|
+
pointer-events: none;
|
|
601
|
+
color: rgba(0, 242, 255, 0.9);
|
|
602
|
+
font-size: 10px;
|
|
603
|
+
line-height: 1;
|
|
604
|
+
}
|
|
605
|
+
.${B}:hover .${B}-handle,
|
|
606
|
+
.${q} .${B}-handle {
|
|
607
|
+
opacity: 1;
|
|
608
|
+
}
|
|
609
|
+
.${q} {
|
|
610
|
+
cursor: ${a} !important;
|
|
611
|
+
}
|
|
612
|
+
.${q} * {
|
|
613
|
+
cursor: ${a} !important;
|
|
614
|
+
}
|
|
615
|
+
.${q} [data-pane-id] {
|
|
616
|
+
position: relative !important;
|
|
617
|
+
overflow: hidden !important;
|
|
618
|
+
}
|
|
619
|
+
`;
|
|
620
|
+
}
|
|
621
|
+
function mt(e, r, t) {
|
|
622
|
+
const a = document.createElement("div");
|
|
623
|
+
a.className = B, a.dataset.dividerIndex = String(e), a.dataset.direction = t, a.style.setProperty("--velo-divider-size", `${r}px`);
|
|
624
|
+
const s = document.createElement("div");
|
|
625
|
+
return s.className = `${B}-handle`, s.textContent = t === "horizontal" ? "⇔" : "⇕", a.appendChild(s), a;
|
|
626
|
+
}
|
|
627
|
+
function pt(e, r) {
|
|
628
|
+
const t = r === "horizontal" ? "min-width:0;" : "min-height:0;";
|
|
629
|
+
return typeof e == "number" ? `flex:${e} 1 0;${t}` : `flex:1 1 ${e};${t}`;
|
|
630
|
+
}
|
|
631
|
+
function We(e, r, t = xe, a = 0) {
|
|
632
|
+
if (r < 1 || e <= 0) return 1;
|
|
633
|
+
const s = e * t, c = Math.max(a, s);
|
|
634
|
+
return Math.min(c, e / r);
|
|
635
|
+
}
|
|
636
|
+
function gt(e, r, t = xe, a = 0) {
|
|
637
|
+
return We(e, r, t, a);
|
|
638
|
+
}
|
|
639
|
+
function yt(e, r) {
|
|
640
|
+
const t = e.length;
|
|
641
|
+
if (t === 0) return e;
|
|
642
|
+
const a = Math.max(1, Math.round(r)), s = e.reduce((w, A) => w + A, 0);
|
|
643
|
+
if (s <= 0) {
|
|
644
|
+
const w = Math.floor(a / t), A = e.map(() => w);
|
|
645
|
+
return A[t - 1] = a - w * (t - 1), A;
|
|
646
|
+
}
|
|
647
|
+
const c = e.map((w) => w / s * a), v = [];
|
|
648
|
+
let T = 0;
|
|
649
|
+
for (let w = 0; w < t - 1; w++)
|
|
650
|
+
v.push(Math.max(1, Math.round(c[w]))), T += v[w];
|
|
651
|
+
return v.push(Math.max(1, a - T)), v;
|
|
652
|
+
}
|
|
653
|
+
function vt(e, r, t, a, s = {}) {
|
|
654
|
+
const c = s.direction ?? "vertical", v = c === "horizontal";
|
|
655
|
+
ht(c);
|
|
656
|
+
const T = s.minPaneRatio ?? xe, w = s.minPanePx ?? 0, A = s.dividerSize ?? 6, D = r.length, Y = (u) => v ? gt(u, D, T, w) : We(u, D, T, w), C = [], F = [];
|
|
657
|
+
if (r.length < 2)
|
|
658
|
+
return { dividers: C, destroy: () => {
|
|
659
|
+
} };
|
|
660
|
+
const y = () => {
|
|
661
|
+
const u = C.length * A, l = v ? e.clientWidth : e.clientHeight;
|
|
662
|
+
return Math.max(1, l - u);
|
|
663
|
+
}, L = (u, l, j, _) => {
|
|
664
|
+
var k;
|
|
665
|
+
const g = y(), x = Y(g), p = _.reduce(
|
|
666
|
+
(S, z, H) => H === u || H === l ? S : S + z,
|
|
667
|
+
0
|
|
668
|
+
), R = g - p;
|
|
669
|
+
let f = _[u] + j;
|
|
670
|
+
f = Math.max(x, Math.min(R - x, f));
|
|
671
|
+
const b = R - f;
|
|
672
|
+
_[u] = f, _[l] = b;
|
|
673
|
+
const $ = a.reduce((S, z) => S + z, 0);
|
|
674
|
+
if (a[u] = f / g * $, a[l] = b / g * $, (k = s.onDragMove) == null || k.call(s, _, u, l), s.onResize) {
|
|
675
|
+
const S = {};
|
|
676
|
+
for (let z = 0; z < t.length; z++)
|
|
677
|
+
S[t[z]] = a[z];
|
|
678
|
+
s.onResize(S);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
for (let u = 0; u < r.length - 1; u++) {
|
|
682
|
+
const l = mt(u, A, c);
|
|
683
|
+
r[u].after(l), C.push(l);
|
|
684
|
+
const _ = (g) => {
|
|
685
|
+
var b, $;
|
|
686
|
+
g.preventDefault(), l.setPointerCapture(g.pointerId), e.classList.add(q);
|
|
687
|
+
const x = ((b = s.onDragStart) == null ? void 0 : b.call(s, u, u + 1)) ?? r.map(
|
|
688
|
+
(k) => v ? k.getBoundingClientRect().width : k.getBoundingClientRect().height
|
|
689
|
+
);
|
|
690
|
+
($ = s.onDragMove) == null || $.call(s, x, u, u + 1);
|
|
691
|
+
let p = v ? g.clientX : g.clientY;
|
|
692
|
+
const R = (k) => {
|
|
693
|
+
const S = v ? k.clientX : k.clientY, z = S - p;
|
|
694
|
+
p = S, z !== 0 && L(u, u + 1, z, x);
|
|
695
|
+
}, f = (k) => {
|
|
696
|
+
var S;
|
|
697
|
+
l.releasePointerCapture(k.pointerId), e.classList.remove(q), l.removeEventListener("pointermove", R), l.removeEventListener("pointerup", f), l.removeEventListener("pointercancel", f), (S = s.onDragEnd) == null || S.call(s, x);
|
|
698
|
+
};
|
|
699
|
+
l.addEventListener("pointermove", R), l.addEventListener("pointerup", f), l.addEventListener("pointercancel", f);
|
|
700
|
+
};
|
|
701
|
+
l.addEventListener("pointerdown", _), F.push(() => l.removeEventListener("pointerdown", _));
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
dividers: C,
|
|
705
|
+
destroy: () => {
|
|
706
|
+
for (const u of F) u();
|
|
707
|
+
for (const u of C) u.remove();
|
|
708
|
+
e.classList.remove(q);
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function xt(e, r, t = "vertical") {
|
|
713
|
+
for (let a = 0; a < e.length; a++)
|
|
714
|
+
e[a].style.cssText = `${pt(r[a], t)}position:relative;overflow:hidden;`;
|
|
715
|
+
}
|
|
716
|
+
function De(e) {
|
|
717
|
+
return typeof e == "number" ? e : 1;
|
|
718
|
+
}
|
|
719
|
+
function bt(e, r = 6) {
|
|
720
|
+
if (!Number.isFinite(e) || e <= 0) return r;
|
|
721
|
+
const t = Math.floor(e / 36);
|
|
722
|
+
return Math.max(2, Math.min(r, t));
|
|
723
|
+
}
|
|
724
|
+
function wt(e, r = 8) {
|
|
725
|
+
if (!Number.isFinite(e) || e <= 0) return r;
|
|
726
|
+
const t = Math.floor(e / 72);
|
|
727
|
+
return Math.max(2, Math.min(r, t));
|
|
728
|
+
}
|
|
729
|
+
function Fe(e) {
|
|
730
|
+
var t;
|
|
731
|
+
return e ? ((t = (Array.isArray(e) ? e : [e])[0]) == null ? void 0 : t.tickCount) ?? 6 : 6;
|
|
732
|
+
}
|
|
733
|
+
function Rt(e) {
|
|
734
|
+
const r = e.wrapper.clientHeight, t = e.wrapper.clientWidth, a = bt(r, e.baseYTickCount);
|
|
735
|
+
if (e.chart.updateYAxis("default", { tickCount: a }), e.showXAxis) {
|
|
736
|
+
const s = wt(t, e.baseXTickCount);
|
|
737
|
+
e.chart.updateXAxis({ tickCount: s });
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
function Ne(e) {
|
|
741
|
+
for (const r of e) Rt(r);
|
|
742
|
+
}
|
|
743
|
+
function Ue(e) {
|
|
744
|
+
const r = e ? Array.isArray(e) ? e : [e] : [{}];
|
|
745
|
+
let t = 0, a = 0;
|
|
746
|
+
for (const s of r)
|
|
747
|
+
s.position === "right" ? a++ : t++;
|
|
748
|
+
return { left: Math.max(1, t), right: a };
|
|
749
|
+
}
|
|
750
|
+
function St(e, r) {
|
|
751
|
+
var a;
|
|
752
|
+
let t = 0;
|
|
753
|
+
for (const s of e) {
|
|
754
|
+
const { left: c } = Ue((a = s.chart) == null ? void 0 : a.yAxis);
|
|
755
|
+
t = Math.max(t, (c - 1) * 65);
|
|
756
|
+
}
|
|
757
|
+
return r + t;
|
|
758
|
+
}
|
|
759
|
+
function Et(e, r) {
|
|
760
|
+
var a;
|
|
761
|
+
let t = 0;
|
|
762
|
+
for (const s of e) {
|
|
763
|
+
const { right: c } = Ue((a = s.chart) == null ? void 0 : a.yAxis);
|
|
764
|
+
t = Math.max(t, c * 65);
|
|
765
|
+
}
|
|
766
|
+
return r + t;
|
|
767
|
+
}
|
|
768
|
+
function At(e, r) {
|
|
769
|
+
const t = r === "horizontal" ? "min-width:0;" : "min-height:0;";
|
|
770
|
+
return typeof e == "number" ? `flex:${e} 1 0;${t}` : `flex:1 1 ${e};${t}`;
|
|
771
|
+
}
|
|
772
|
+
function Ye(e) {
|
|
773
|
+
if (!(e != null && e.length)) return [];
|
|
774
|
+
const r = [];
|
|
775
|
+
for (const t of e)
|
|
776
|
+
t.type === "indicator" ? r.push(...Ke(t)) : r.push(t);
|
|
777
|
+
return r;
|
|
778
|
+
}
|
|
779
|
+
function Xe(e, r, t, a, s, c, v, T, w) {
|
|
780
|
+
var $, k, S, z, H, J, Z, Q, K, re, ne, n, m;
|
|
781
|
+
const A = a === 0, D = a === s - 1, Y = w === "horizontal", F = !Y && t.sharedXAxis !== "none" && !v, L = Y && (t.sharedYAxis ?? "left") !== "none" && !T, l = (t.gap ?? 0) > 0 ? lt : { top: 0, bottom: 0, left: 0 }, j = Y ? {
|
|
782
|
+
top: c.top,
|
|
783
|
+
right: D ? c.right : l.left ?? 0,
|
|
784
|
+
left: L ? l.left ?? 4 : c.left,
|
|
785
|
+
bottom: c.bottom
|
|
786
|
+
} : {
|
|
787
|
+
top: A ? c.top : l.top,
|
|
788
|
+
right: c.right,
|
|
789
|
+
left: c.left,
|
|
790
|
+
bottom: F ? l.bottom : D ? ((k = ($ = t.layout) == null ? void 0 : $.margins) == null ? void 0 : k.bottom) ?? He.bottom : c.bottom
|
|
791
|
+
}, _ = ((S = e.chart) == null ? void 0 : S.xAxis) ?? {}, g = {
|
|
792
|
+
..._,
|
|
793
|
+
showLine: v ? _.showLine ?? !0 : !1,
|
|
794
|
+
showTicks: v ? _.showTicks ?? !0 : !1,
|
|
795
|
+
showLabels: v ? _.showLabels ?? !0 : !1
|
|
796
|
+
}, x = ((z = e.chart) == null ? void 0 : z.yAxis) ?? {}, R = (Array.isArray(x) ? x : [x]).map((E) => ({
|
|
797
|
+
...E,
|
|
798
|
+
showLine: T ? E.showLine ?? !0 : !1,
|
|
799
|
+
showTicks: T ? E.showTicks ?? !0 : !1,
|
|
800
|
+
showLabels: T ? E.showLabels ?? !0 : !1
|
|
801
|
+
})), f = Array.isArray((H = e.chart) == null ? void 0 : H.yAxis) ? R : R[0];
|
|
802
|
+
return (e.interactive ?? !0) || (r.style.pointerEvents = "none"), {
|
|
803
|
+
...e.chart,
|
|
804
|
+
id: e.id,
|
|
805
|
+
container: r,
|
|
806
|
+
showLegend: ((J = e.chart) == null ? void 0 : J.showLegend) ?? t.showLegend ?? !1,
|
|
807
|
+
theme: ((Z = e.chart) == null ? void 0 : Z.theme) ?? t.theme,
|
|
808
|
+
devicePixelRatio: t.devicePixelRatio ?? ((Q = e.chart) == null ? void 0 : Q.devicePixelRatio),
|
|
809
|
+
loading: ((K = e.chart) == null ? void 0 : K.loading) ?? !1,
|
|
810
|
+
xAxis: g,
|
|
811
|
+
yAxis: f,
|
|
812
|
+
layout: Be({
|
|
813
|
+
...t.layout,
|
|
814
|
+
...(re = e.chart) == null ? void 0 : re.layout,
|
|
815
|
+
margins: { ...j, ...(ne = t.layout) == null ? void 0 : ne.margins, ...(m = (n = e.chart) == null ? void 0 : n.layout) == null ? void 0 : m.margins }
|
|
816
|
+
})
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function pe(e, r, t, a) {
|
|
820
|
+
const s = r > 0 && t > 0 ? a === "horizontal" ? `margin-left:${r}px;` : `margin-top:${r}px;` : "";
|
|
821
|
+
return `${At(e, a)}position:relative;overflow:hidden;${s}`;
|
|
822
|
+
}
|
|
823
|
+
function Pt(e, r, t) {
|
|
824
|
+
return e === !1 ? {
|
|
825
|
+
axis: "none",
|
|
826
|
+
syncCursor: !1,
|
|
827
|
+
syncZoom: !1,
|
|
828
|
+
syncPan: !1,
|
|
829
|
+
bidirectional: !0,
|
|
830
|
+
masterId: void 0
|
|
831
|
+
} : {
|
|
832
|
+
axis: t === "horizontal" ? "y" : "x",
|
|
833
|
+
bidirectional: !0,
|
|
834
|
+
masterId: r,
|
|
835
|
+
syncCursor: !0,
|
|
836
|
+
syncZoom: !0,
|
|
837
|
+
syncPan: !0,
|
|
838
|
+
...typeof e == "object" ? e : {}
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
function zt(e) {
|
|
842
|
+
var Se, Ee, Ae, Pe, Te, _e, ke, Ce;
|
|
843
|
+
const { container: r, panes: t } = e;
|
|
844
|
+
if (!r) throw new Error("[StackedChart] container is required");
|
|
845
|
+
if (t.length < 1 || t.length > he)
|
|
846
|
+
throw new Error(`[StackedChart] panes must be 1–${he}`);
|
|
847
|
+
const a = e.masterPaneId ?? t[0].id, s = e.direction ?? "vertical", c = s === "horizontal", v = e.sharedXAxis ?? "bottom", T = e.sharedYAxis ?? "left", w = e.gap ?? 0, A = e.resizable, D = !!A, Y = typeof A == "object" ? A.dividerSize ?? 6 : 6, C = Be(e.layout), F = ((Se = C.margins) == null ? void 0 : Se.left) ?? ie.left, y = ((Ee = C.margins) == null ? void 0 : Ee.right) ?? ie.right, L = ((Ae = C.margins) == null ? void 0 : Ae.top) ?? ie.top, u = St(t, F), l = Et(t, y);
|
|
848
|
+
r.replaceChildren(), r.style.display = "flex", r.style.flexDirection = c ? "row" : "column", r.style.width = "100%";
|
|
849
|
+
const j = r.offsetHeight || parseInt(getComputedStyle(r).height, 10), _ = r.offsetWidth || parseInt(getComputedStyle(r).width, 10);
|
|
850
|
+
c ? (_ > 0 ? (r.style.width = `${_}px`, r.style.minWidth = `${_}px`) : r.style.width || (r.style.minWidth = "480px"), r.style.height = j > 0 ? `${j}px` : "320px", r.style.minHeight = r.style.height) : j > 0 ? (r.style.height = `${j}px`, r.style.minHeight = `${j}px`) : r.style.height || (r.style.minHeight = "320px"), r.style.overflow = "hidden", r.style.position = "relative";
|
|
851
|
+
const g = t.map((o) => o.id), x = t.map((o) => De(o.height)), p = /* @__PURE__ */ new Map(), R = [], f = [];
|
|
852
|
+
let b = null, $ = !1, k = 0, S = 0, z = null;
|
|
853
|
+
const H = (o) => {
|
|
854
|
+
const i = Array.from({ length: R.length }, (d, h) => h);
|
|
855
|
+
for (const d of i) {
|
|
856
|
+
const h = p.get(g[d]);
|
|
857
|
+
h && h.resize();
|
|
858
|
+
}
|
|
859
|
+
Ne(
|
|
860
|
+
i.map((d) => f[d]).filter(Boolean)
|
|
861
|
+
);
|
|
862
|
+
}, J = () => {
|
|
863
|
+
k || (k = requestAnimationFrame(() => {
|
|
864
|
+
k = 0, !$ && H();
|
|
865
|
+
}));
|
|
866
|
+
}, Z = new ResizeObserver(() => {
|
|
867
|
+
$ || J();
|
|
868
|
+
});
|
|
869
|
+
Z.observe(r);
|
|
870
|
+
const Q = () => {
|
|
871
|
+
for (let o = 0; o < R.length; o++)
|
|
872
|
+
R[o].style.cssText = pe(x[o], w, o, s);
|
|
873
|
+
}, K = () => {
|
|
874
|
+
const o = (R.length - 1) * Y;
|
|
875
|
+
return c ? Math.max(1, r.clientWidth - o) : Math.max(1, r.clientHeight - o);
|
|
876
|
+
}, re = () => {
|
|
877
|
+
for (const o of R) {
|
|
878
|
+
const i = o.firstElementChild;
|
|
879
|
+
i && (i.style.cssText = "position:absolute;inset:0;width:100%;height:100%;");
|
|
880
|
+
}
|
|
881
|
+
}, ne = () => {
|
|
882
|
+
const o = K(), i = R.map(
|
|
883
|
+
(h) => c ? h.getBoundingClientRect().width : h.getBoundingClientRect().height
|
|
884
|
+
), d = i.reduce((h, P) => h + P, 0);
|
|
885
|
+
return d > 0 ? i.map((h) => h * (o / d)) : i;
|
|
886
|
+
}, n = (o) => {
|
|
887
|
+
for (let i = 0; i < R.length; i++) {
|
|
888
|
+
const d = Math.max(1, Math.round(o[i])), h = w > 0 && i > 0 ? c ? `margin-left:${w}px;` : `margin-top:${w}px;` : "", P = c ? "width" : "height";
|
|
889
|
+
R[i].style.cssText = `${P}:${d}px;flex:0 0 auto;min-height:0;min-width:0;position:relative;overflow:hidden;${h}`;
|
|
890
|
+
}
|
|
891
|
+
}, m = () => {
|
|
892
|
+
if (S = 0, !$ || !z) return;
|
|
893
|
+
const { sizes: o, leadingIdx: i, trailingIdx: d } = z;
|
|
894
|
+
n(o);
|
|
895
|
+
for (const h of [i, d]) {
|
|
896
|
+
const P = p.get(g[h]);
|
|
897
|
+
P && (P.resize(), Ne([f[h]]));
|
|
898
|
+
}
|
|
899
|
+
}, E = (o, i, d) => {
|
|
900
|
+
z = { sizes: o, leadingIdx: i, trailingIdx: d }, !S && (S = requestAnimationFrame(m));
|
|
901
|
+
}, O = (o) => {
|
|
902
|
+
const i = o.reduce((h, P) => h + P, 0);
|
|
903
|
+
if (i <= 0) return;
|
|
904
|
+
const d = x.reduce((h, P) => h + P, 0);
|
|
905
|
+
for (let h = 0; h < x.length; h++)
|
|
906
|
+
x[h] = o[h] / i * d;
|
|
907
|
+
}, oe = (o) => {
|
|
908
|
+
var i;
|
|
909
|
+
for (const d of p.values())
|
|
910
|
+
(i = d.setResizeSuspended) == null || i.call(d, o);
|
|
911
|
+
}, ae = (o, i) => {
|
|
912
|
+
var d, h, P, N, I, G;
|
|
913
|
+
for (let X = 0; X < g.length; X++)
|
|
914
|
+
X === o || X === i || (h = (d = p.get(g[X])) == null ? void 0 : d.setResizeSuspended) == null || h.call(d, !0);
|
|
915
|
+
(N = (P = p.get(g[o])) == null ? void 0 : P.setResizeSuspended) == null || N.call(P, !1), (G = (I = p.get(g[i])) == null ? void 0 : I.setResizeSuspended) == null || G.call(I, !1);
|
|
916
|
+
}, M = c ? ((Te = (Pe = e.layout) == null ? void 0 : Pe.margins) == null ? void 0 : Te.bottom) ?? He.bottom : ie.bottom;
|
|
917
|
+
for (let o = 0; o < t.length; o++) {
|
|
918
|
+
const i = t[o], d = o === 0, h = o === t.length - 1, P = c ? i.showXAxis ?? !0 : i.showXAxis ?? (v === "bottom" ? h : !0), N = c ? i.showYAxis ?? (T === "left" ? d : !0) : i.showYAxis ?? !0, I = document.createElement("div");
|
|
919
|
+
I.dataset.paneId = i.id, I.style.cssText = pe(x[o], w, o, s);
|
|
920
|
+
const G = document.createElement("div");
|
|
921
|
+
G.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", I.appendChild(G), r.appendChild(I), R.push(I);
|
|
922
|
+
const X = ye(
|
|
923
|
+
Xe(
|
|
924
|
+
i,
|
|
925
|
+
G,
|
|
926
|
+
e,
|
|
927
|
+
o,
|
|
928
|
+
t.length,
|
|
929
|
+
{
|
|
930
|
+
left: c && !N ? ie.left : u,
|
|
931
|
+
right: l,
|
|
932
|
+
top: L,
|
|
933
|
+
bottom: M
|
|
934
|
+
},
|
|
935
|
+
P,
|
|
936
|
+
N,
|
|
937
|
+
s
|
|
938
|
+
)
|
|
939
|
+
), ee = Ye(i.series);
|
|
940
|
+
if (ee.length)
|
|
941
|
+
for (const te of ee) X.addSeries(te);
|
|
942
|
+
i.yRange && i.yRange !== "auto" && X.zoom({ y: i.yRange, animate: !1 }), p.set(i.id, X), f.push({
|
|
943
|
+
chart: X,
|
|
944
|
+
wrapper: I,
|
|
945
|
+
baseYTickCount: Fe((_e = i.chart) == null ? void 0 : _e.yAxis),
|
|
946
|
+
baseXTickCount: ((Ce = (ke = i.chart) == null ? void 0 : ke.xAxis) == null ? void 0 : Ce.tickCount) ?? 8,
|
|
947
|
+
showXAxis: P
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
if (D && t.length > 1) {
|
|
951
|
+
const o = typeof A == "object" ? {
|
|
952
|
+
minPaneRatio: A.minPaneRatio,
|
|
953
|
+
minPanePx: A.minPanePx,
|
|
954
|
+
dividerSize: A.dividerSize
|
|
955
|
+
} : {};
|
|
956
|
+
b = vt(
|
|
957
|
+
r,
|
|
958
|
+
R,
|
|
959
|
+
g,
|
|
960
|
+
x,
|
|
961
|
+
{
|
|
962
|
+
direction: s,
|
|
963
|
+
...o,
|
|
964
|
+
onDragStart: (i, d) => ($ = !0, oe(!0), ae(i, d), ne()),
|
|
965
|
+
onDragMove: (i, d, h) => {
|
|
966
|
+
E(i, d, h);
|
|
967
|
+
},
|
|
968
|
+
onDragEnd: (i) => {
|
|
969
|
+
S && (cancelAnimationFrame(S), S = 0), z = null, $ = !1;
|
|
970
|
+
const d = yt(i, K());
|
|
971
|
+
O(d), re(), Q(), oe(!1), H();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
const W = p.get(a);
|
|
977
|
+
if (!W)
|
|
978
|
+
throw new Error(`[StackedChart] masterPaneId "${a}" not found in panes`);
|
|
979
|
+
const U = it(
|
|
980
|
+
Array.from(p.values()),
|
|
981
|
+
Pt(e.sync, a, s)
|
|
982
|
+
), me = () => {
|
|
983
|
+
const o = W.theme ?? W.baseTheme;
|
|
984
|
+
return (o == null ? void 0 : o.backgroundColor) ?? "#ffffff";
|
|
985
|
+
}, be = () => {
|
|
986
|
+
const i = Date.now();
|
|
987
|
+
return new Promise((h) => {
|
|
988
|
+
const P = () => {
|
|
989
|
+
const N = ot();
|
|
990
|
+
if (N.pending === 0 && !N.isProcessing || Date.now() - i > 8e3) {
|
|
991
|
+
h();
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
setTimeout(P, 50);
|
|
995
|
+
};
|
|
996
|
+
P();
|
|
997
|
+
}).then(() => new Promise((h) => {
|
|
998
|
+
requestAnimationFrame(() => {
|
|
999
|
+
H(), h();
|
|
1000
|
+
});
|
|
1001
|
+
}));
|
|
1002
|
+
}, we = async (o = {}) => {
|
|
1003
|
+
await be();
|
|
1004
|
+
for (const d of p.values()) d.render();
|
|
1005
|
+
await new Promise((d) => requestAnimationFrame(d));
|
|
1006
|
+
const i = await ft(
|
|
1007
|
+
r,
|
|
1008
|
+
R,
|
|
1009
|
+
Array.from(p.values()),
|
|
1010
|
+
(b == null ? void 0 : b.dividers) ?? [],
|
|
1011
|
+
me(),
|
|
1012
|
+
o
|
|
1013
|
+
);
|
|
1014
|
+
if (o.download) {
|
|
1015
|
+
const d = o.format === "jpeg" ? "jpg" : o.format ?? "png", h = document.createElement("a");
|
|
1016
|
+
h.download = `${o.fileName ?? "velo-plot-stack"}.${d}`, h.href = i, document.body.appendChild(h), h.click(), document.body.removeChild(h);
|
|
1017
|
+
}
|
|
1018
|
+
return i;
|
|
1019
|
+
}, Re = (o) => {
|
|
1020
|
+
var $e, ze, Me, Le;
|
|
1021
|
+
if (p.size >= he)
|
|
1022
|
+
throw new Error(`[StackedChart] Cannot exceed ${he} panes`);
|
|
1023
|
+
if (p.has(o.id))
|
|
1024
|
+
throw new Error(`[StackedChart] Pane "${o.id}" already exists`);
|
|
1025
|
+
if (!c && v === "bottom" && g.length > 0) {
|
|
1026
|
+
const V = g[g.length - 1];
|
|
1027
|
+
($e = p.get(V)) == null || $e.updateXAxis({
|
|
1028
|
+
showLabels: !1,
|
|
1029
|
+
showTicks: !1,
|
|
1030
|
+
showLine: !1
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
const i = De(o.height ?? 0.25), d = x.reduce((V, Ge) => V + Ge, 0), h = d > 0 ? (1 - i) / d : 1;
|
|
1034
|
+
for (let V = 0; V < x.length; V++) x[V] *= h;
|
|
1035
|
+
const P = g.length;
|
|
1036
|
+
g.push(o.id), x.push(i);
|
|
1037
|
+
const N = document.createElement("div");
|
|
1038
|
+
N.dataset.paneId = o.id, N.style.cssText = pe(x[P], w, P, s);
|
|
1039
|
+
const I = document.createElement("div");
|
|
1040
|
+
I.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", N.appendChild(I), r.appendChild(N), R.push(N);
|
|
1041
|
+
const X = c ? o.showXAxis ?? !0 : o.showXAxis ?? (v === "bottom" ? !0 : !0), ee = c ? o.showYAxis ?? (T === "left" ? P === 0 : !0) : o.showYAxis ?? !0, te = ye(
|
|
1042
|
+
Xe(
|
|
1043
|
+
o,
|
|
1044
|
+
I,
|
|
1045
|
+
e,
|
|
1046
|
+
P,
|
|
1047
|
+
g.length,
|
|
1048
|
+
{
|
|
1049
|
+
left: c && !ee ? ie.left : u,
|
|
1050
|
+
right: l,
|
|
1051
|
+
top: L,
|
|
1052
|
+
bottom: M
|
|
1053
|
+
},
|
|
1054
|
+
X,
|
|
1055
|
+
ee,
|
|
1056
|
+
s
|
|
1057
|
+
)
|
|
1058
|
+
), qe = Ye(o.series);
|
|
1059
|
+
for (const V of qe) te.addSeries(V);
|
|
1060
|
+
return o.yRange && o.yRange !== "auto" && te.zoom({ y: o.yRange, animate: !1 }), p.set(o.id, te), f.push({
|
|
1061
|
+
chart: te,
|
|
1062
|
+
wrapper: N,
|
|
1063
|
+
baseYTickCount: Fe((ze = o.chart) == null ? void 0 : ze.yAxis),
|
|
1064
|
+
baseXTickCount: ((Le = (Me = o.chart) == null ? void 0 : Me.xAxis) == null ? void 0 : Le.tickCount) ?? 8,
|
|
1065
|
+
showXAxis: X
|
|
1066
|
+
}), U.add(te), Q(), H(), te;
|
|
1067
|
+
};
|
|
1068
|
+
return {
|
|
1069
|
+
container: r,
|
|
1070
|
+
getPane(o) {
|
|
1071
|
+
return p.get(o);
|
|
1072
|
+
},
|
|
1073
|
+
getPanes() {
|
|
1074
|
+
return Array.from(p.values());
|
|
1075
|
+
},
|
|
1076
|
+
getMaster() {
|
|
1077
|
+
return W;
|
|
1078
|
+
},
|
|
1079
|
+
getGroup() {
|
|
1080
|
+
return U;
|
|
1081
|
+
},
|
|
1082
|
+
fitAll(o) {
|
|
1083
|
+
U.fitAll(o);
|
|
1084
|
+
},
|
|
1085
|
+
resetAll() {
|
|
1086
|
+
U.resetAll();
|
|
1087
|
+
},
|
|
1088
|
+
resize() {
|
|
1089
|
+
H();
|
|
1090
|
+
},
|
|
1091
|
+
getPaneRatios() {
|
|
1092
|
+
const o = {};
|
|
1093
|
+
for (let i = 0; i < g.length; i++)
|
|
1094
|
+
o[g[i]] = x[i];
|
|
1095
|
+
return o;
|
|
1096
|
+
},
|
|
1097
|
+
setPaneRatios(o) {
|
|
1098
|
+
for (let i = 0; i < g.length; i++) {
|
|
1099
|
+
const d = g[i];
|
|
1100
|
+
o[d] !== void 0 && (x[i] = o[d]);
|
|
1101
|
+
}
|
|
1102
|
+
xt(R, x, s), H();
|
|
1103
|
+
},
|
|
1104
|
+
setSyncAxis(o) {
|
|
1105
|
+
U.syncAxis(o);
|
|
1106
|
+
},
|
|
1107
|
+
getSyncAxis() {
|
|
1108
|
+
return U.getOptions().axis ?? "x";
|
|
1109
|
+
},
|
|
1110
|
+
setSyncOptions(o) {
|
|
1111
|
+
U.updateOptions(o);
|
|
1112
|
+
},
|
|
1113
|
+
whenReady() {
|
|
1114
|
+
return be();
|
|
1115
|
+
},
|
|
1116
|
+
exportImage(o) {
|
|
1117
|
+
return we(o);
|
|
1118
|
+
},
|
|
1119
|
+
snapshot(o) {
|
|
1120
|
+
return we(o);
|
|
1121
|
+
},
|
|
1122
|
+
addPane(o) {
|
|
1123
|
+
return Re(o);
|
|
1124
|
+
},
|
|
1125
|
+
async addIndicator(o, i = {}) {
|
|
1126
|
+
var X;
|
|
1127
|
+
const d = p.get(a) ?? W;
|
|
1128
|
+
if (i.pane !== "new")
|
|
1129
|
+
return { ...await et(d, o, i), chart: d };
|
|
1130
|
+
const h = tt(d, i.sourceSeriesId), { x: P, prices: N } = rt(h), I = await nt(o, P, N, {
|
|
1131
|
+
id: i.id ?? o,
|
|
1132
|
+
label: i.label ?? o.toUpperCase(),
|
|
1133
|
+
height: i.paneHeight ?? 0.25,
|
|
1134
|
+
showXAxis: i.showXAxis,
|
|
1135
|
+
period: i.period,
|
|
1136
|
+
fastPeriod: i.fastPeriod,
|
|
1137
|
+
slowPeriod: i.slowPeriod,
|
|
1138
|
+
signalPeriod: i.signalPeriod,
|
|
1139
|
+
stdDev: i.stdDev
|
|
1140
|
+
}), G = Re(I);
|
|
1141
|
+
return {
|
|
1142
|
+
id: I.id,
|
|
1143
|
+
preset: o,
|
|
1144
|
+
placement: "oscillator",
|
|
1145
|
+
seriesIds: ((X = I.series) == null ? void 0 : X.map((ee) => ee.id)) ?? [],
|
|
1146
|
+
paneId: I.id,
|
|
1147
|
+
chart: G
|
|
1148
|
+
};
|
|
1149
|
+
},
|
|
1150
|
+
destroy() {
|
|
1151
|
+
k && cancelAnimationFrame(k), S && cancelAnimationFrame(S), Z.disconnect(), b == null || b.destroy(), U.destroy();
|
|
1152
|
+
for (const o of p.values()) o.destroy();
|
|
1153
|
+
p.clear(), r.replaceChildren();
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
export {
|
|
1158
|
+
$t as S,
|
|
1159
|
+
he as a,
|
|
1160
|
+
xe as b,
|
|
1161
|
+
zt as c,
|
|
1162
|
+
ct as u
|
|
1163
|
+
};
|
|
1164
|
+
//# sourceMappingURL=createStackedChart-BPooTQ9z.js.map
|