velo-plot 3.0.0 → 4.0.0-alpha.1
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/README.md +22 -15
- package/dist/ChartCore-KYG2HTcK.js +7474 -0
- package/dist/ChartCore-KYG2HTcK.js.map +1 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js +75 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js.map +1 -0
- package/dist/{index.core-BmZe2jRQ.js → PluginRegistry-CDf_jcnp.js} +19 -33
- package/dist/PluginRegistry-CDf_jcnp.js.map +1 -0
- package/dist/SVGDocumentBuilder-C-uLkcFW.js +83 -0
- package/dist/SVGDocumentBuilder-C-uLkcFW.js.map +1 -0
- package/dist/angular-hooks.js +1 -1
- package/dist/angular.js +8 -8
- package/dist/{axisFormat-CzumxpCL.js → axisFormat-Sz4WIJfQ.js} +2 -2
- package/dist/{axisFormat-CzumxpCL.js.map → axisFormat-Sz4WIJfQ.js.map} +1 -1
- package/dist/{chartSyncBridge-DbWrwtyP.js → chartSyncBridge-C1uRy0ZS.js} +12 -11
- package/dist/{chartSyncBridge-DbWrwtyP.js.map → chartSyncBridge-C1uRy0ZS.js.map} +1 -1
- package/dist/core/ChartStatistics.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +19 -20
- package/dist/core/chart/ChartFeatureHooks.d.ts +7 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +5 -0
- package/dist/core/chart/ChartRenderer.d.ts +9 -0
- package/dist/core/chart/ChartSetup.d.ts +1 -0
- package/dist/core/chart/chartExportPatch.d.ts +2 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +9 -7
- package/dist/core/chart/exporter/svg/SVGDocumentBuilder.d.ts +27 -0
- package/dist/core/chart/exporter/svg/SVGExportContext.d.ts +147 -0
- package/dist/core/chart/exporter/svg/SVGOrchestrator.d.ts +3 -0
- package/dist/core/chart/exporter/svg/SVGThemeAdapter.d.ts +22 -0
- package/dist/core/chart/exporter/svg/__tests__/testFixtures.d.ts +46 -0
- package/dist/core/chart/exporter/svg/__tests__/visualTestUtils.d.ts +12 -0
- package/dist/core/chart/exporter/svg/overlay/axes.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/border.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/errorBars.d.ts +7 -0
- package/dist/core/chart/exporter/svg/overlay/grid.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/index.d.ts +12 -0
- package/dist/core/chart/exporter/svg/overlay/legend.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/pluginCharts.d.ts +6 -0
- package/dist/core/chart/exporter/svg/overlay/polarGrid.d.ts +4 -0
- package/dist/core/chart/exporter/svg/overlay/specialChart.d.ts +15 -0
- package/dist/core/chart/exporter/svg/overlay/title.d.ts +4 -0
- package/dist/core/chart/exporter/svg/plugins/annotations.d.ts +5 -0
- package/dist/core/chart/exporter/svg/plugins/brokenAxis.d.ts +20 -0
- package/dist/core/chart/exporter/svg/plugins/latex.d.ts +9 -0
- package/dist/core/chart/exporter/svg/plugins/register.d.ts +8 -0
- package/dist/core/chart/exporter/svg/plugins/regression.d.ts +33 -0
- package/dist/core/chart/exporter/svg/plugins/roi.d.ts +12 -0
- package/dist/core/chart/exporter/svg/plugins/tradeMarkers.d.ts +3 -0
- package/dist/core/chart/exporter/svg/plugins/types.d.ts +28 -0
- package/dist/core/chart/exporter/svg/plugins/watermark.d.ts +13 -0
- package/dist/core/chart/exporter/svg/series/band.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/bar.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/boxplot.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/candlestick.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/finitePoints.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/gauge.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/heatmap.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/indicator.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/line.d.ts +12 -0
- package/dist/core/chart/exporter/svg/series/polar.d.ts +6 -0
- package/dist/core/chart/exporter/svg/series/radar.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/registry.d.ts +10 -0
- package/dist/core/chart/exporter/svg/series/sankey.d.ts +5 -0
- package/dist/core/chart/exporter/svg/series/scatter.d.ts +1 -0
- package/dist/core/chart/exporter/svg/series/ternary.d.ts +7 -0
- package/dist/core/chart/exporter/svg/series/waterfall.d.ts +6 -0
- package/dist/core/chart/exporter/svg/seriesAtTimestamp.d.ts +4 -0
- package/dist/core/chart/exporter/svg/seriesUtils.d.ts +3 -0
- package/dist/core/chart/exporter/svg/symbols.d.ts +5 -0
- package/dist/core/chart/exporter/svg/tickUtils.d.ts +9 -0
- package/dist/core/chart/mountSVGString.d.ts +5 -0
- package/dist/core/chart/overlaySeriesRegistry.d.ts +7 -0
- package/dist/core/chart/series/SeriesActions.d.ts +1 -0
- package/dist/core/chart/series/SeriesBufferLite.d.ts +13 -0
- package/dist/core/chart/series/seriesOptionsRegistry.d.ts +8 -0
- package/dist/core/chart/series/seriesTypeRegistry.d.ts +5 -0
- package/dist/core/chart/types.d.ts +2 -2
- package/dist/core/stacked/StackSVGComposer.d.ts +14 -0
- package/dist/core/stacked/index.d.ts +3 -2
- package/dist/core/stacked/types.d.ts +12 -4
- package/dist/createStackedChart-DjA3aJAu.js +2761 -0
- package/dist/createStackedChart-DjA3aJAu.js.map +1 -0
- package/dist/{hooks-CYPCxoZx.js → hooks-4wQH27r9.js} +7 -7
- package/dist/{hooks-CYPCxoZx.js.map → hooks-4wQH27r9.js.map} +1 -1
- package/dist/{index-qunX30Xu.js → index-B7PTX94B.js} +2133 -2133
- package/dist/index-B7PTX94B.js.map +1 -0
- package/dist/{index-BMiZoKmm.js → index-BgrvqltV.js} +67 -67
- package/dist/index-BgrvqltV.js.map +1 -0
- package/dist/index-Bj-xyXY6.js +582 -0
- package/dist/index-Bj-xyXY6.js.map +1 -0
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index.core.d.ts +8 -6
- package/dist/index.d.ts +1 -14
- package/dist/plugins/3d.js +3 -1
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/PluginManager.d.ts +5 -0
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations.js +8 -7
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/broken-axis.js +198 -152
- package/dist/plugins/broken-axis.js.map +1 -1
- package/dist/plugins/createPlugin.d.ts +8 -0
- package/dist/plugins/debug.js +32 -32
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting.js +273 -258
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu.js +2033 -209
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n.js +286 -23
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/latex.js +766 -207
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/loading/index.d.ts +1 -2
- package/dist/plugins/loading.js +3 -4
- package/dist/plugins/ml-integration.js +107 -93
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.js +11 -10
- package/dist/plugins/offscreen.js.map +1 -1
- package/dist/plugins/radar/types.d.ts +11 -0
- package/dist/plugins/radar.js +64 -53
- package/dist/plugins/radar.js.map +1 -1
- package/dist/plugins/regression.js +254 -256
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi/index.d.ts +2 -0
- package/dist/plugins/roi.js +184 -145
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot.js +20 -15
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming.js +1 -1
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/types.d.ts +4 -0
- package/dist/react.js +55 -58
- package/dist/react.js.map +1 -1
- package/dist/regression-HNdyk1Dm.js +28 -0
- package/dist/regression-HNdyk1Dm.js.map +1 -0
- package/dist/renderer/ChartSeriesRenderer.d.ts +3 -2
- package/dist/renderer/NativeWebGLRenderer.d.ts +2 -1
- package/dist/renderer/SVGChartRenderer.d.ts +15 -0
- package/dist/renderer/SankeyRenderer.d.ts +1 -0
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +5 -1
- package/dist/renderer/native/draw.d.ts +2 -47
- package/dist/renderer/native/drawCore.d.ts +27 -0
- package/dist/renderer/native/drawExtended.d.ts +29 -0
- package/dist/renderer/native/frameRenderExtended.d.ts +1 -0
- package/dist/renderer/native/frameRenderRegistry.d.ts +27 -0
- package/dist/renderer/native/programFactoryCore.d.ts +6 -0
- package/dist/renderer/native/programFactoryExtended.d.ts +4 -0
- package/dist/renderer/native/utils.d.ts +3 -29
- package/dist/renderer/native/utilsCore.d.ts +14 -0
- package/dist/renderer/native/utilsExtended.d.ts +17 -0
- package/dist/renderer/overlaySeriesExtended.d.ts +1 -0
- package/dist/renderer/registerExtendedSeries.d.ts +1 -0
- package/dist/renderer/registerSVG.d.ts +5 -0
- package/dist/renderer/registerWebGPU.d.ts +2 -0
- package/dist/renderer/sankeyLayout.d.ts +29 -0
- package/dist/renderer/seriesBufferExtended.d.ts +4 -0
- package/dist/scientific/index.d.ts +1 -5
- package/dist/scientific/registerScientific.d.ts +1 -0
- package/dist/scientific.js +41 -41
- package/dist/solid.js +56 -59
- package/dist/solid.js.map +1 -1
- package/dist/svelte.js +26 -29
- package/dist/svelte.js.map +1 -1
- package/dist/tickUtils-B_X-ha13.js +41 -0
- package/dist/tickUtils-B_X-ha13.js.map +1 -0
- package/dist/trading/index.d.ts +1 -4
- package/dist/trading/registerTrading.d.ts +3 -0
- package/dist/trading.js +42 -42
- package/dist/types.d.ts +5 -4
- package/dist/velo-plot.full.js +1951 -1275
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +33 -28
- package/dist/velo-plot.js.map +1 -1
- package/dist/vue/VeloPlot.vue.d.ts +1 -1
- package/dist/vue/index.d.ts +33 -33
- package/dist/vue.js +17 -20
- package/dist/vue.js.map +1 -1
- package/package.json +14 -1
- package/dist/ChartCore-BpzRvN4Y.js +0 -8467
- package/dist/ChartCore-BpzRvN4Y.js.map +0 -1
- package/dist/createStackedChart-Dm-YqUT7.js +0 -756
- package/dist/createStackedChart-Dm-YqUT7.js.map +0 -1
- package/dist/gpuRenderer-BpaMYz-k.js +0 -1848
- package/dist/gpuRenderer-BpaMYz-k.js.map +0 -1
- package/dist/index-BMiZoKmm.js.map +0 -1
- package/dist/index-qunX30Xu.js.map +0 -1
- package/dist/index-x4stH3jD.js +0 -282
- package/dist/index-x4stH3jD.js.map +0 -1
- package/dist/index.core-BmZe2jRQ.js.map +0 -1
- package/dist/mockDatafeed-DHIDPcpX.js +0 -515
- package/dist/mockDatafeed-DHIDPcpX.js.map +0 -1
- package/dist/symbols-DT0eLlpW.js +0 -568
- package/dist/symbols-DT0eLlpW.js.map +0 -1
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
import { f as u } from "./SVGDocumentBuilder-C-uLkcFW.js";
|
|
2
|
+
import { p as Z } from "./tickUtils-B_X-ha13.js";
|
|
3
|
+
function yt(r) {
|
|
4
|
+
const e = r.close.length, l = new Float32Array(e), n = new Float32Array(e), s = new Float32Array(e), h = new Float32Array(e);
|
|
5
|
+
for (let c = 0; c < e; c++) {
|
|
6
|
+
const p = r.open[c], f = r.high[c], x = r.low[c], b = r.close[c];
|
|
7
|
+
h[c] = (p + f + x + b) / 4, l[c] = c === 0 ? (p + b) / 2 : (l[c - 1] + h[c - 1]) / 2, n[c] = Math.max(f, l[c], h[c]), s[c] = Math.min(x, l[c], h[c]);
|
|
8
|
+
}
|
|
9
|
+
return { open: l, high: n, low: s, close: h };
|
|
10
|
+
}
|
|
11
|
+
function ut(r) {
|
|
12
|
+
const e = r.length, l = new Float64Array(e), n = new Float32Array(e), s = new Float32Array(e), h = new Float32Array(e), c = new Float32Array(e), p = new Float32Array(e);
|
|
13
|
+
for (let f = 0; f < e; f++) {
|
|
14
|
+
const x = r[f];
|
|
15
|
+
l[f] = x.time, n[f] = x.open, s[f] = x.high, h[f] = x.low, c[f] = x.close, p[f] = x.volume ?? 0;
|
|
16
|
+
}
|
|
17
|
+
return { x: l, open: n, high: s, low: h, close: c, volume: p };
|
|
18
|
+
}
|
|
19
|
+
function C(r) {
|
|
20
|
+
let e = r;
|
|
21
|
+
return () => (e = e * 16807 % 2147483647, (e - 1) / 2147483646);
|
|
22
|
+
}
|
|
23
|
+
function tt(r, e, l, n, s) {
|
|
24
|
+
const h = [];
|
|
25
|
+
let c = n;
|
|
26
|
+
for (let p = r; p <= e; p += l) {
|
|
27
|
+
const f = c, x = (s() - 0.48) * 2, b = Math.max(1, f + x), d = Math.max(f, b) + s() * 1.5, I = Math.min(f, b) - s() * 1.5;
|
|
28
|
+
h.push({
|
|
29
|
+
time: p,
|
|
30
|
+
open: f,
|
|
31
|
+
high: d,
|
|
32
|
+
low: I,
|
|
33
|
+
close: b,
|
|
34
|
+
volume: 1e3 + s() * 5e3
|
|
35
|
+
}), c = b;
|
|
36
|
+
}
|
|
37
|
+
return h;
|
|
38
|
+
}
|
|
39
|
+
function xt(r = {}) {
|
|
40
|
+
const e = r.barMs ?? 6e4, l = r.basePrice ?? 100, n = C(r.seed ?? 42), s = /* @__PURE__ */ new Map();
|
|
41
|
+
return {
|
|
42
|
+
async resolveSymbol(h) {
|
|
43
|
+
return {
|
|
44
|
+
symbol: h,
|
|
45
|
+
name: h,
|
|
46
|
+
description: `Mock symbol ${h}`,
|
|
47
|
+
timezone: "UTC",
|
|
48
|
+
session: "24x7",
|
|
49
|
+
pricescale: 100
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
async getBars(h) {
|
|
53
|
+
const c = `${h.symbol}:${h.from}:${h.to}`;
|
|
54
|
+
return s.has(c) || s.set(
|
|
55
|
+
c,
|
|
56
|
+
tt(h.from, h.to, e, l, n)
|
|
57
|
+
), s.get(c);
|
|
58
|
+
},
|
|
59
|
+
subscribeBars(h) {
|
|
60
|
+
let c = l + n() * 5;
|
|
61
|
+
const p = setInterval(() => {
|
|
62
|
+
const f = c, x = Math.max(1, f + (n() - 0.5) * 2), b = Math.max(f, x) + n(), d = Math.min(f, x) - n();
|
|
63
|
+
h.onBar({
|
|
64
|
+
time: Date.now(),
|
|
65
|
+
open: f,
|
|
66
|
+
high: b,
|
|
67
|
+
low: d,
|
|
68
|
+
close: x,
|
|
69
|
+
volume: 1e3 + n() * 3e3
|
|
70
|
+
}), c = x;
|
|
71
|
+
}, e);
|
|
72
|
+
return () => clearInterval(p);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function et(r, e) {
|
|
77
|
+
if (r.length === 0) return -1;
|
|
78
|
+
let l = 0, n = Math.abs(r[0] - e);
|
|
79
|
+
for (let s = 1; s < r.length; s++) {
|
|
80
|
+
const h = Math.abs(r[s] - e);
|
|
81
|
+
h < n && (n = h, l = s);
|
|
82
|
+
}
|
|
83
|
+
return l;
|
|
84
|
+
}
|
|
85
|
+
function nt(r) {
|
|
86
|
+
if (r.barX.length === 0)
|
|
87
|
+
return { x: r.x, y: r.y };
|
|
88
|
+
const e = et(r.barX, r.x);
|
|
89
|
+
if (e < 0) return { x: r.x, y: r.y };
|
|
90
|
+
const l = r.barX[e], n = [
|
|
91
|
+
r.open[e],
|
|
92
|
+
r.high[e],
|
|
93
|
+
r.low[e],
|
|
94
|
+
r.close[e]
|
|
95
|
+
], s = r.dataToPixelY(r.y), h = r.pixelThreshold ?? 12;
|
|
96
|
+
let c = r.y, p = 1 / 0;
|
|
97
|
+
for (const f of n) {
|
|
98
|
+
const x = r.dataToPixelY(f), b = Math.abs(x - s);
|
|
99
|
+
b < p && b <= h && (p = b, c = f);
|
|
100
|
+
}
|
|
101
|
+
return { x: l, y: c };
|
|
102
|
+
}
|
|
103
|
+
function L(r, e) {
|
|
104
|
+
const l = e.y - r.y, n = Math.abs(r.y), s = n > 0 ? l / n * 100 : 0, h = Math.round(Math.abs(e.x - r.x));
|
|
105
|
+
return { change: l, percent: s, bars: h, up: l >= 0 };
|
|
106
|
+
}
|
|
107
|
+
function Y(r) {
|
|
108
|
+
const e = r.change >= 0 ? "+" : "";
|
|
109
|
+
return `${e}${r.change.toFixed(2)} (${e}${r.percent.toFixed(2)}%) · ${r.bars} bars`;
|
|
110
|
+
}
|
|
111
|
+
function E(r) {
|
|
112
|
+
const e = Math.abs(r), l = e >= 1e3 ? 0 : e >= 1 ? 2 : 4;
|
|
113
|
+
return r.toLocaleString("en-US", {
|
|
114
|
+
minimumFractionDigits: l,
|
|
115
|
+
maximumFractionDigits: l
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const U = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1], ot = 4, rt = "#26a69a", at = "#ef5350";
|
|
119
|
+
function z(r, e) {
|
|
120
|
+
return r.startsWith("#") && r.length === 7 ? r + e : r;
|
|
121
|
+
}
|
|
122
|
+
const st = {
|
|
123
|
+
name: "velo-plot-drawing-tools",
|
|
124
|
+
version: "1.0.0",
|
|
125
|
+
description: "Interactive trendline, horizontal, vertical, rectangle, and fibonacci drawing",
|
|
126
|
+
provides: ["drawing"],
|
|
127
|
+
tags: ["drawing", "annotations", "trading"]
|
|
128
|
+
};
|
|
129
|
+
function B(r) {
|
|
130
|
+
return r !== "none" && r !== "pan";
|
|
131
|
+
}
|
|
132
|
+
function it(r) {
|
|
133
|
+
for (const e of r.data.getAllSeries())
|
|
134
|
+
if (e.getType() === "candlestick") return e;
|
|
135
|
+
}
|
|
136
|
+
function dt(r = {}) {
|
|
137
|
+
let e = null;
|
|
138
|
+
const l = r.autoDeselect !== !1, n = {
|
|
139
|
+
mode: "none",
|
|
140
|
+
pending: null,
|
|
141
|
+
start: null,
|
|
142
|
+
dragging: !1,
|
|
143
|
+
dragMoved: !1,
|
|
144
|
+
dragStartPixel: null,
|
|
145
|
+
cursor: null,
|
|
146
|
+
magnet: r.magnet ?? !1,
|
|
147
|
+
undoStack: [],
|
|
148
|
+
redoStack: []
|
|
149
|
+
}, s = r.color ?? "#38bdf8", h = r.measureUpColor ?? rt, c = r.measureDownColor ?? at;
|
|
150
|
+
function p() {
|
|
151
|
+
var t, o;
|
|
152
|
+
return ((o = e == null ? void 0 : (t = e.chart).getAnnotations) == null ? void 0 : o.call(t)) ?? [];
|
|
153
|
+
}
|
|
154
|
+
function f() {
|
|
155
|
+
n.undoStack.push(p()), n.redoStack = [];
|
|
156
|
+
}
|
|
157
|
+
function x() {
|
|
158
|
+
n.pending = null, n.start = null, n.dragging = !1, n.dragMoved = !1, n.dragStartPixel = null;
|
|
159
|
+
}
|
|
160
|
+
function b(t) {
|
|
161
|
+
var o, a;
|
|
162
|
+
n.mode = t, x(), (o = r.onModeChange) == null || o.call(r, t), (a = e == null ? void 0 : e.requestRender) == null || a.call(e);
|
|
163
|
+
}
|
|
164
|
+
function d() {
|
|
165
|
+
var t;
|
|
166
|
+
x(), l ? b("none") : (t = e == null ? void 0 : e.requestRender) == null || t.call(e);
|
|
167
|
+
}
|
|
168
|
+
function I(t, o) {
|
|
169
|
+
if (!e || !n.magnet) return { x: t, y: o };
|
|
170
|
+
const a = it(e);
|
|
171
|
+
if (!a) return { x: t, y: o };
|
|
172
|
+
const i = a.getData();
|
|
173
|
+
return !i.open || !i.high || !i.low || !i.close ? { x: t, y: o } : nt({
|
|
174
|
+
x: t,
|
|
175
|
+
y: o,
|
|
176
|
+
barX: i.x,
|
|
177
|
+
open: i.open,
|
|
178
|
+
high: i.high,
|
|
179
|
+
low: i.low,
|
|
180
|
+
close: i.close,
|
|
181
|
+
dataToPixelX: e.coords.dataToPixelX,
|
|
182
|
+
dataToPixelY: (y) => e.coords.dataToPixelY(y),
|
|
183
|
+
enabled: !0
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function A(t, o) {
|
|
187
|
+
return I(
|
|
188
|
+
t.coords.pixelToDataX(o.pixelX),
|
|
189
|
+
t.coords.pixelToDataY(o.pixelY)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
function R(t) {
|
|
193
|
+
e && (f(), e.chart.addAnnotation({
|
|
194
|
+
type: "horizontal-line",
|
|
195
|
+
y: t,
|
|
196
|
+
color: s,
|
|
197
|
+
interactive: !0
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
function O(t) {
|
|
201
|
+
e && (f(), e.chart.addAnnotation({
|
|
202
|
+
type: "vertical-line",
|
|
203
|
+
x: t,
|
|
204
|
+
color: s,
|
|
205
|
+
interactive: !0
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
function V(t, o) {
|
|
209
|
+
if (!e) return;
|
|
210
|
+
f();
|
|
211
|
+
const a = L(t, o), i = a.up ? h : c, y = (t.x + o.x) / 2;
|
|
212
|
+
e.chart.addAnnotation({
|
|
213
|
+
type: "rectangle",
|
|
214
|
+
xMin: Math.min(t.x, o.x),
|
|
215
|
+
xMax: Math.max(t.x, o.x),
|
|
216
|
+
yMin: Math.min(t.y, o.y),
|
|
217
|
+
yMax: Math.max(t.y, o.y),
|
|
218
|
+
strokeColor: i,
|
|
219
|
+
fillColor: z(i, "33"),
|
|
220
|
+
interactive: !0
|
|
221
|
+
}), e.chart.addAnnotation({
|
|
222
|
+
type: "arrow",
|
|
223
|
+
x1: y,
|
|
224
|
+
y1: t.y,
|
|
225
|
+
x2: y,
|
|
226
|
+
y2: o.y,
|
|
227
|
+
color: i,
|
|
228
|
+
headStyle: "filled",
|
|
229
|
+
interactive: !0
|
|
230
|
+
}), e.chart.addAnnotation({
|
|
231
|
+
type: "text",
|
|
232
|
+
x: y,
|
|
233
|
+
y: o.y,
|
|
234
|
+
text: Y(a),
|
|
235
|
+
color: "#ffffff",
|
|
236
|
+
backgroundColor: i,
|
|
237
|
+
padding: 4,
|
|
238
|
+
fontWeight: "bold",
|
|
239
|
+
anchor: a.up ? "bottom-center" : "top-center",
|
|
240
|
+
interactive: !0
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function W(t, o) {
|
|
244
|
+
if (e) {
|
|
245
|
+
if (n.mode === "measure") {
|
|
246
|
+
V(t, o);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (f(), n.mode === "trendline")
|
|
250
|
+
e.chart.addAnnotation({
|
|
251
|
+
type: "arrow",
|
|
252
|
+
x1: t.x,
|
|
253
|
+
y1: t.y,
|
|
254
|
+
x2: o.x,
|
|
255
|
+
y2: o.y,
|
|
256
|
+
color: s,
|
|
257
|
+
interactive: !0
|
|
258
|
+
});
|
|
259
|
+
else if (n.mode === "rectangle")
|
|
260
|
+
e.chart.addAnnotation({
|
|
261
|
+
type: "rectangle",
|
|
262
|
+
xMin: Math.min(t.x, o.x),
|
|
263
|
+
xMax: Math.max(t.x, o.x),
|
|
264
|
+
yMin: Math.min(t.y, o.y),
|
|
265
|
+
yMax: Math.max(t.y, o.y),
|
|
266
|
+
strokeColor: s,
|
|
267
|
+
fillColor: s + "22",
|
|
268
|
+
interactive: !0
|
|
269
|
+
});
|
|
270
|
+
else if (n.mode === "fibonacci") {
|
|
271
|
+
const a = Math.min(t.y, o.y), i = Math.max(t.y, o.y);
|
|
272
|
+
for (const y of U) {
|
|
273
|
+
const $ = i - (i - a) * y;
|
|
274
|
+
e.chart.addAnnotation({
|
|
275
|
+
type: "horizontal-line",
|
|
276
|
+
y: $,
|
|
277
|
+
color: s,
|
|
278
|
+
lineDash: y === 0 || y === 1 ? void 0 : [4, 4],
|
|
279
|
+
label: `${(y * 100).toFixed(1)}% ${E($)}`,
|
|
280
|
+
labelPosition: "right",
|
|
281
|
+
interactive: !0
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function G(t, o, a) {
|
|
288
|
+
const i = n.mode;
|
|
289
|
+
if (!B(i) || !n.cursor) return;
|
|
290
|
+
const y = n.cursor, $ = n.pending ?? n.start;
|
|
291
|
+
t.save(), t.strokeStyle = s, t.lineWidth = 1.5, t.setLineDash([6, 4]), t.globalAlpha = 0.85;
|
|
292
|
+
const S = (M, w) => ({
|
|
293
|
+
px: a.dataToPixelX(M),
|
|
294
|
+
py: a.dataToPixelY(w)
|
|
295
|
+
});
|
|
296
|
+
if (i === "horizontal") {
|
|
297
|
+
const { py: M } = S(0, y.y);
|
|
298
|
+
t.beginPath(), t.moveTo(o.x, M), t.lineTo(o.x + o.width, M), t.stroke();
|
|
299
|
+
} else if (i === "vertical") {
|
|
300
|
+
const { px: M } = S(y.x, 0);
|
|
301
|
+
t.beginPath(), t.moveTo(M, o.y), t.lineTo(M, o.y + o.height), t.stroke();
|
|
302
|
+
} else if ($) {
|
|
303
|
+
const M = S($.x, $.y), w = S(y.x, y.y);
|
|
304
|
+
if (i === "trendline")
|
|
305
|
+
t.beginPath(), t.moveTo(M.px, M.py), t.lineTo(w.px, w.py), t.stroke();
|
|
306
|
+
else if (i === "rectangle") {
|
|
307
|
+
const m = Math.min(M.px, w.px), g = Math.min(M.py, w.py), v = Math.abs(w.px - M.px), k = Math.abs(w.py - M.py);
|
|
308
|
+
t.strokeRect(m, g, v, k), t.fillStyle = s + "22", t.fillRect(m, g, v, k);
|
|
309
|
+
} else if (i === "fibonacci") {
|
|
310
|
+
const m = Math.min($.y, y.y), g = Math.max($.y, y.y);
|
|
311
|
+
t.font = "11px sans-serif", t.textAlign = "left", t.textBaseline = "bottom";
|
|
312
|
+
for (const v of U) {
|
|
313
|
+
const k = g - (g - m) * v, { py: P } = S(0, k);
|
|
314
|
+
t.beginPath(), t.moveTo(o.x, P), t.lineTo(o.x + o.width, P), t.stroke(), t.save(), t.setLineDash([]), t.globalAlpha = 1, t.fillStyle = s, t.fillText(
|
|
315
|
+
`${(v * 100).toFixed(1)}% ${E(k)}`,
|
|
316
|
+
o.x + 4,
|
|
317
|
+
P - 2
|
|
318
|
+
), t.restore();
|
|
319
|
+
}
|
|
320
|
+
} else i === "measure" && N(t, M, w, $, y);
|
|
321
|
+
}
|
|
322
|
+
t.restore();
|
|
323
|
+
}
|
|
324
|
+
function N(t, o, a, i, y) {
|
|
325
|
+
const $ = L(i, y), S = $.up ? h : c, M = Math.min(o.px, a.px), w = Math.min(o.py, a.py), m = Math.abs(a.px - o.px), g = Math.abs(a.py - o.py);
|
|
326
|
+
t.setLineDash([]), t.globalAlpha = 0.9, t.fillStyle = z(S, "33"), t.fillRect(M, w, m, g), t.strokeStyle = S, t.lineWidth = 1.5, t.strokeRect(M, w, m, g);
|
|
327
|
+
const v = (o.px + a.px) / 2;
|
|
328
|
+
t.beginPath(), t.moveTo(v, o.py), t.lineTo(v, a.py), t.stroke();
|
|
329
|
+
const k = 7, P = a.py >= o.py ? 1 : -1;
|
|
330
|
+
t.beginPath(), t.moveTo(v, a.py), t.lineTo(v - 4, a.py - P * k), t.lineTo(v + 4, a.py - P * k), t.closePath(), t.fillStyle = S, t.fill();
|
|
331
|
+
const T = Y($);
|
|
332
|
+
t.font = "12px sans-serif";
|
|
333
|
+
const F = t.measureText(T).width + 6 * 2, X = 20, Q = v - F / 2, H = $.up ? a.py - X - 8 : a.py + 8;
|
|
334
|
+
t.globalAlpha = 1, t.fillStyle = S, t.fillRect(Q, H, F, X), t.fillStyle = "#ffffff", t.textAlign = "center", t.textBaseline = "middle", t.fillText(T, v, H + X / 2);
|
|
335
|
+
}
|
|
336
|
+
function q(t) {
|
|
337
|
+
const o = n.mode;
|
|
338
|
+
if (!B(o) || !n.cursor) return [];
|
|
339
|
+
const a = Z(t.yScales) ?? [...t.yScales.values()][0];
|
|
340
|
+
if (!a) return [];
|
|
341
|
+
const i = t.plotArea, y = n.cursor, $ = n.pending ?? n.start, S = (m, g) => ({
|
|
342
|
+
px: t.xScale.transform(m),
|
|
343
|
+
py: a.transform(g)
|
|
344
|
+
}), M = 'stroke-dasharray="6,4"', w = [];
|
|
345
|
+
if (o === "horizontal") {
|
|
346
|
+
const { py: m } = S(0, y.y);
|
|
347
|
+
w.push(
|
|
348
|
+
`<line x1="${u(i.x)}" y1="${u(m)}" x2="${u(i.x + i.width)}" y2="${u(m)}" stroke="${s}" stroke-width="1.5" ${M}/>`
|
|
349
|
+
);
|
|
350
|
+
} else if (o === "vertical") {
|
|
351
|
+
const { px: m } = S(y.x, 0);
|
|
352
|
+
w.push(
|
|
353
|
+
`<line x1="${u(m)}" y1="${u(i.y)}" x2="${u(m)}" y2="${u(i.y + i.height)}" stroke="${s}" stroke-width="1.5" ${M}/>`
|
|
354
|
+
);
|
|
355
|
+
} else if ($) {
|
|
356
|
+
const m = S($.x, $.y), g = S(y.x, y.y);
|
|
357
|
+
if (o === "trendline")
|
|
358
|
+
w.push(
|
|
359
|
+
`<line x1="${u(m.px)}" y1="${u(m.py)}" x2="${u(g.px)}" y2="${u(g.py)}" stroke="${s}" stroke-width="1.5" ${M}/>`
|
|
360
|
+
);
|
|
361
|
+
else if (o === "rectangle") {
|
|
362
|
+
const v = Math.min(m.px, g.px), k = Math.min(m.py, g.py), P = Math.abs(g.px - m.px), T = Math.abs(g.py - m.py);
|
|
363
|
+
w.push(
|
|
364
|
+
`<rect x="${u(v)}" y="${u(k)}" width="${u(P)}" height="${u(T)}" fill="${s}22" stroke="${s}" stroke-width="1.5" ${M}/>`
|
|
365
|
+
);
|
|
366
|
+
} else if (o === "fibonacci") {
|
|
367
|
+
const v = Math.min($.y, y.y), k = Math.max($.y, y.y);
|
|
368
|
+
for (const P of U) {
|
|
369
|
+
const T = k - (k - v) * P, { py: D } = S(0, T);
|
|
370
|
+
w.push(
|
|
371
|
+
`<line x1="${u(i.x)}" y1="${u(D)}" x2="${u(i.x + i.width)}" y2="${u(D)}" stroke="${s}" stroke-width="1.5" ${M}/>`
|
|
372
|
+
), w.push(
|
|
373
|
+
`<text x="${u(i.x + 4)}" y="${u(D - 2)}" fill="${s}" font-size="11" font-family="sans-serif">${(P * 100).toFixed(1)}% ${E(T)}</text>`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
} else if (o === "measure") {
|
|
377
|
+
const v = L($, y), k = v.up ? h : c, P = Math.min(m.px, g.px), T = Math.min(m.py, g.py), D = Math.abs(g.px - m.px), _ = Math.abs(g.py - m.py), F = (m.px + g.px) / 2;
|
|
378
|
+
w.push(
|
|
379
|
+
`<rect x="${u(P)}" y="${u(T)}" width="${u(D)}" height="${u(_)}" fill="${z(k, "33")}" stroke="${k}" stroke-width="1.5"/>`
|
|
380
|
+
), w.push(
|
|
381
|
+
`<line x1="${u(F)}" y1="${u(m.py)}" x2="${u(F)}" y2="${u(g.py)}" stroke="${k}" stroke-width="1.5"/>`
|
|
382
|
+
), w.push(
|
|
383
|
+
`<text x="${u(F)}" y="${u(v.up ? g.py - 12 : g.py + 16)}" fill="${k}" font-size="12" font-family="sans-serif" text-anchor="middle">${Y(v)}</text>`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return w;
|
|
388
|
+
}
|
|
389
|
+
function j(t, o) {
|
|
390
|
+
var i;
|
|
391
|
+
if (!o.inPlotArea) return;
|
|
392
|
+
o.preventDefault();
|
|
393
|
+
const a = A(t, o);
|
|
394
|
+
if (n.mode === "horizontal") {
|
|
395
|
+
R(a.y), d();
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (n.mode === "vertical") {
|
|
399
|
+
O(a.x), d();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (n.pending) {
|
|
403
|
+
W(n.pending, a), d();
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (i = t.requestRender) == null || i.call(t);
|
|
407
|
+
}
|
|
408
|
+
function J(t, o) {
|
|
409
|
+
var i;
|
|
410
|
+
const a = A(t, o);
|
|
411
|
+
if (n.cursor = a, n.dragging && n.dragStartPixel) {
|
|
412
|
+
const y = o.pixelX - n.dragStartPixel.x, $ = o.pixelY - n.dragStartPixel.y;
|
|
413
|
+
Math.hypot(y, $) >= ot && (n.dragMoved = !0);
|
|
414
|
+
}
|
|
415
|
+
o.preventDefault(), (i = t.requestRender) == null || i.call(t);
|
|
416
|
+
}
|
|
417
|
+
function K(t, o) {
|
|
418
|
+
var y;
|
|
419
|
+
if (!n.dragging || !n.start) return;
|
|
420
|
+
const a = A(t, o), i = n.start;
|
|
421
|
+
if (n.dragging = !1, n.dragStartPixel = null, n.dragMoved) {
|
|
422
|
+
W(i, a), d();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
n.pending = i, n.start = null, n.cursor = a, (y = t.requestRender) == null || y.call(t);
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
manifest: st,
|
|
429
|
+
api: {
|
|
430
|
+
setMode(t) {
|
|
431
|
+
b(t);
|
|
432
|
+
},
|
|
433
|
+
getMode() {
|
|
434
|
+
return n.mode;
|
|
435
|
+
},
|
|
436
|
+
setMagnet(t) {
|
|
437
|
+
n.magnet = t;
|
|
438
|
+
},
|
|
439
|
+
isMagnet() {
|
|
440
|
+
return n.magnet;
|
|
441
|
+
},
|
|
442
|
+
undo() {
|
|
443
|
+
if (!e || n.undoStack.length === 0) return !1;
|
|
444
|
+
n.redoStack.push(p());
|
|
445
|
+
const t = n.undoStack.pop(), o = p();
|
|
446
|
+
for (const a of o) e.chart.removeAnnotation(a.id);
|
|
447
|
+
for (const a of t) e.chart.addAnnotation(a);
|
|
448
|
+
return !0;
|
|
449
|
+
},
|
|
450
|
+
redo() {
|
|
451
|
+
if (!e || n.redoStack.length === 0) return !1;
|
|
452
|
+
n.undoStack.push(p());
|
|
453
|
+
const t = n.redoStack.pop(), o = p();
|
|
454
|
+
for (const a of o) e.chart.removeAnnotation(a.id);
|
|
455
|
+
for (const a of t) e.chart.addAnnotation(a);
|
|
456
|
+
return !0;
|
|
457
|
+
},
|
|
458
|
+
clear() {
|
|
459
|
+
if (e) {
|
|
460
|
+
f();
|
|
461
|
+
for (const t of p()) e.chart.removeAnnotation(t.id);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
onInit(t) {
|
|
466
|
+
e = t;
|
|
467
|
+
},
|
|
468
|
+
onDestroy() {
|
|
469
|
+
e = null;
|
|
470
|
+
},
|
|
471
|
+
onInteraction(t, o) {
|
|
472
|
+
if (B(n.mode)) {
|
|
473
|
+
if (o.type === "mousedown") {
|
|
474
|
+
j(t, o);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (o.type === "mousemove") {
|
|
478
|
+
J(t, o);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
o.type === "mouseup" && K(t, o);
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
onRenderOverlay(t) {
|
|
485
|
+
const o = t.render.ctx2d;
|
|
486
|
+
o && G(o, t.render.plotArea, t.coords);
|
|
487
|
+
},
|
|
488
|
+
onExportSVG(t) {
|
|
489
|
+
var o;
|
|
490
|
+
if (t.builder && ((o = t.exportContext) == null ? void 0 : o.options.includeOverlays) !== !1)
|
|
491
|
+
for (const a of q(t))
|
|
492
|
+
t.builder.push("plugins", a);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
const lt = {
|
|
497
|
+
name: "velo-plot-replay",
|
|
498
|
+
version: "1.0.0",
|
|
499
|
+
description: "Bar-by-bar chart replay with speed control",
|
|
500
|
+
provides: ["replay"],
|
|
501
|
+
tags: ["replay", "trading"]
|
|
502
|
+
};
|
|
503
|
+
function mt(r) {
|
|
504
|
+
let e = null, l = null, n = 0, s = null, h = 1;
|
|
505
|
+
const c = r.frameMs ?? 250;
|
|
506
|
+
function p(x) {
|
|
507
|
+
const b = e, d = l, I = Math.min(x + 1, d.x.length), A = (R) => R ? R.subarray(0, I) : void 0;
|
|
508
|
+
b.chart.updateSeries(r.seriesId, {
|
|
509
|
+
x: A(d.x),
|
|
510
|
+
y: A(d.y),
|
|
511
|
+
open: A(d.open),
|
|
512
|
+
high: A(d.high),
|
|
513
|
+
low: A(d.low),
|
|
514
|
+
close: A(d.close)
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
const f = {
|
|
518
|
+
play(x = 1) {
|
|
519
|
+
l && (h = Math.max(0.1, x), s && clearInterval(s), s = setInterval(() => {
|
|
520
|
+
if (!e || !l) {
|
|
521
|
+
f.pause();
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
if (n >= l.x.length - 1) {
|
|
525
|
+
f.pause();
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
n++, p(n);
|
|
529
|
+
}, c / h));
|
|
530
|
+
},
|
|
531
|
+
pause() {
|
|
532
|
+
s && (clearInterval(s), s = null);
|
|
533
|
+
},
|
|
534
|
+
step(x = 1) {
|
|
535
|
+
l && (n = Math.min(l.x.length - 1, n + x), p(n));
|
|
536
|
+
},
|
|
537
|
+
seek(x) {
|
|
538
|
+
l && (n = Math.max(0, Math.min(l.x.length - 1, x)), p(n));
|
|
539
|
+
},
|
|
540
|
+
getIndex() {
|
|
541
|
+
return n;
|
|
542
|
+
},
|
|
543
|
+
getLength() {
|
|
544
|
+
return (l == null ? void 0 : l.x.length) ?? 0;
|
|
545
|
+
},
|
|
546
|
+
isPlaying() {
|
|
547
|
+
return s != null;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
return {
|
|
551
|
+
manifest: lt,
|
|
552
|
+
api: f,
|
|
553
|
+
onInit(x) {
|
|
554
|
+
e = x;
|
|
555
|
+
const b = e.chart.getSeries(r.seriesId);
|
|
556
|
+
if (!b) {
|
|
557
|
+
console.warn(`[PluginReplay] Series "${r.seriesId}" not found`);
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const d = b.getData();
|
|
561
|
+
l = {
|
|
562
|
+
x: Float32Array.from(d.x),
|
|
563
|
+
y: d.y ? Float32Array.from(d.y) : void 0,
|
|
564
|
+
open: d.open ? Float32Array.from(d.open) : void 0,
|
|
565
|
+
high: d.high ? Float32Array.from(d.high) : void 0,
|
|
566
|
+
low: d.low ? Float32Array.from(d.low) : void 0,
|
|
567
|
+
close: d.close ? Float32Array.from(d.close) : void 0
|
|
568
|
+
}, n = Math.max(0, l.x.length - 1);
|
|
569
|
+
},
|
|
570
|
+
onDestroy() {
|
|
571
|
+
f.pause(), e = null, l = null;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
export {
|
|
576
|
+
dt as P,
|
|
577
|
+
mt as a,
|
|
578
|
+
ut as b,
|
|
579
|
+
yt as c,
|
|
580
|
+
xt as d
|
|
581
|
+
};
|
|
582
|
+
//# sourceMappingURL=index-Bj-xyXY6.js.map
|