velo-plot 1.11.1 → 1.15.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/README.md +35 -2
- package/dist/{index.core-CYu3tydL.js → ChartCore-BimVvUEg.js} +1936 -1588
- package/dist/ChartCore-BimVvUEg.js.map +1 -0
- package/dist/axisFormat-B7o_uIEA.js +127 -0
- package/dist/axisFormat-B7o_uIEA.js.map +1 -0
- package/dist/core/OverlayRenderer.d.ts +1 -2
- package/dist/core/chart/ChartCore.d.ts +18 -1
- package/dist/core/chart/ChartRenderLoop.d.ts +4 -0
- package/dist/core/chart/ChartScaling.d.ts +11 -0
- package/dist/core/chart/NavigationUtils.d.ts +12 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +7 -2
- package/dist/core/chart/types.d.ts +13 -1
- package/dist/core/format/axisFormat.d.ts +16 -0
- package/dist/core/indicator/buildIndicatorPane.d.ts +22 -0
- package/dist/core/indicator/buildIndicatorSeries.d.ts +14 -0
- package/dist/core/indicator/index.d.ts +3 -0
- package/dist/core/indicator/types.d.ts +74 -0
- package/dist/core/render/pixelSnap.d.ts +8 -0
- package/dist/core/series/SeriesBounds.d.ts +1 -1
- package/dist/core/stacked/createStackedChart.d.ts +3 -0
- package/dist/core/stacked/index.d.ts +6 -0
- package/dist/core/stacked/paneAxis.d.ts +20 -0
- package/dist/core/stacked/paneResize.d.ts +29 -0
- package/dist/core/stacked/stackExport.d.ts +18 -0
- package/dist/core/stacked/types.d.ts +120 -0
- package/dist/core/sync/index.d.ts +25 -70
- package/dist/createStackedChart-CjsKcOvX.js +1088 -0
- package/dist/createStackedChart-CjsKcOvX.js.map +1 -0
- package/dist/index-CUGS98p4.js +277 -0
- package/dist/index-CUGS98p4.js.map +1 -0
- package/dist/index-ChgIdk3N.js +229 -0
- package/dist/index-ChgIdk3N.js.map +1 -0
- package/dist/{index-D8ifudJH.js → index-DjeWClO9.js} +601 -561
- package/dist/index-DjeWClO9.js.map +1 -0
- package/dist/index.core-C_-CFftD.js +167 -0
- package/dist/index.core-C_-CFftD.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/math-Ddm2EZjj.js +85 -0
- package/dist/math-Ddm2EZjj.js.map +1 -0
- package/dist/plugins/analysis.js +132 -130
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/anomaly-detection.d.ts +1 -0
- package/dist/plugins/anomaly-detection.js +221 -0
- package/dist/plugins/anomaly-detection.js.map +1 -0
- package/dist/plugins/broken-axis.d.ts +3 -0
- package/dist/plugins/broken-axis.js +262 -0
- package/dist/plugins/broken-axis.js.map +1 -0
- package/dist/plugins/caching.d.ts +3 -0
- package/dist/plugins/caching.js +182 -0
- package/dist/plugins/caching.js.map +1 -0
- package/dist/plugins/data-transform.d.ts +3 -0
- package/dist/plugins/data-transform.js +146 -0
- package/dist/plugins/data-transform.js.map +1 -0
- package/dist/plugins/debug.js +12 -11
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting.d.ts +1 -0
- package/dist/plugins/forecasting.js +236 -0
- package/dist/plugins/forecasting.js.map +1 -0
- package/dist/plugins/latex.d.ts +1 -0
- package/dist/plugins/latex.js +454 -0
- package/dist/plugins/latex.js.map +1 -0
- package/dist/plugins/lazy-load.d.ts +3 -0
- package/dist/plugins/lazy-load.js +189 -0
- package/dist/plugins/lazy-load.js.map +1 -0
- package/dist/plugins/ml-integration.d.ts +3 -0
- package/dist/plugins/ml-integration.js +355 -0
- package/dist/plugins/ml-integration.js.map +1 -0
- package/dist/plugins/offscreen.d.ts +3 -0
- package/dist/plugins/offscreen.js +169 -0
- package/dist/plugins/offscreen.js.map +1 -0
- package/dist/plugins/pattern-recognition.d.ts +3 -0
- package/dist/plugins/pattern-recognition.js +690 -0
- package/dist/plugins/pattern-recognition.js.map +1 -0
- package/dist/plugins/radar.d.ts +3 -0
- package/dist/plugins/radar.js +103 -0
- package/dist/plugins/radar.js.map +1 -0
- package/dist/plugins/regression.d.ts +3 -0
- package/dist/plugins/regression.js +634 -0
- package/dist/plugins/regression.js.map +1 -0
- package/dist/plugins/roi.d.ts +1 -0
- package/dist/plugins/roi.js +223 -0
- package/dist/plugins/roi.js.map +1 -0
- package/dist/plugins/snapshot/types.d.ts +1 -1
- package/dist/plugins/snapshot.d.ts +3 -0
- package/dist/plugins/snapshot.js +90 -0
- package/dist/plugins/snapshot.js.map +1 -0
- package/dist/plugins/sync/index.d.ts +2 -1
- package/dist/plugins/sync.js +12 -244
- package/dist/plugins/sync.js.map +1 -1
- package/dist/plugins/tools/tooltip/TooltipManager.d.ts +9 -1
- package/dist/plugins/tools/tooltip/format.d.ts +7 -0
- package/dist/plugins/tools/tooltip/types.d.ts +6 -8
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/video-recorder.d.ts +3 -0
- package/dist/plugins/video-recorder.js +104 -0
- package/dist/plugins/video-recorder.js.map +1 -0
- package/dist/plugins/virtualization.d.ts +3 -0
- package/dist/plugins/virtualization.js +6 -0
- package/dist/plugins/virtualization.js.map +1 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/useStackedPlot.d.ts +17 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +31 -0
- package/dist/react.js.map +1 -0
- package/dist/types.d.ts +21 -1
- package/dist/utils-BK5UUXxj.js +172 -0
- package/dist/utils-BK5UUXxj.js.map +1 -0
- package/dist/velo-plot.full.js +1000 -5576
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +23 -22
- package/dist/velo-plot.js.map +1 -1
- package/package.json +17 -3
- package/dist/EventEmitter-DAbs2K1C.js +0 -60
- package/dist/EventEmitter-DAbs2K1C.js.map +0 -1
- package/dist/index-D8ifudJH.js.map +0 -1
- package/dist/index.core-CYu3tydL.js.map +0 -1
- package/dist/utils-Dbro9-qM.js +0 -254
- package/dist/utils-Dbro9-qM.js.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
function U(u, a, r) {
|
|
2
|
+
const i = u.length;
|
|
3
|
+
if (r >= i || r <= 2)
|
|
4
|
+
return {
|
|
5
|
+
x: new Float32Array(u),
|
|
6
|
+
y: new Float32Array(a),
|
|
7
|
+
indices: new Uint32Array(Array.from({ length: i }, (w, D) => D))
|
|
8
|
+
};
|
|
9
|
+
const x = new Float32Array(r), p = new Float32Array(r), l = new Uint32Array(r);
|
|
10
|
+
x[0] = u[0], p[0] = a[0], l[0] = 0;
|
|
11
|
+
const d = (i - 2) / (r - 2);
|
|
12
|
+
let m = 0, h = 1;
|
|
13
|
+
for (let w = 0; w < r - 2; w++) {
|
|
14
|
+
const D = Math.floor((w + 1) * d) + 1, b = Math.floor((w + 2) * d) + 1, g = Math.min(b, i - 1), y = Math.min(
|
|
15
|
+
Math.floor((w + 3) * d) + 1,
|
|
16
|
+
i
|
|
17
|
+
);
|
|
18
|
+
let f = 0, S = 0, z = 0;
|
|
19
|
+
for (let n = g; n < y; n++)
|
|
20
|
+
f += u[n], S += a[n], z++;
|
|
21
|
+
z > 0 && (f /= z, S /= z);
|
|
22
|
+
let F = -1, v = D;
|
|
23
|
+
const e = u[m], t = a[m];
|
|
24
|
+
for (let n = D; n < b && n < i; n++) {
|
|
25
|
+
const s = Math.abs(
|
|
26
|
+
(e - f) * (a[n] - t) - (e - u[n]) * (S - t)
|
|
27
|
+
);
|
|
28
|
+
s > F && (F = s, v = n);
|
|
29
|
+
}
|
|
30
|
+
x[h] = u[v], p[h] = a[v], l[h] = v, m = v, h++;
|
|
31
|
+
}
|
|
32
|
+
return x[r - 1] = u[i - 1], p[r - 1] = a[i - 1], l[r - 1] = i - 1, { x, y: p, indices: l };
|
|
33
|
+
}
|
|
34
|
+
function E(u, a, r) {
|
|
35
|
+
const i = u.length;
|
|
36
|
+
if (r >= i / 2)
|
|
37
|
+
return {
|
|
38
|
+
x: new Float32Array(u),
|
|
39
|
+
y: new Float32Array(a),
|
|
40
|
+
indices: new Uint32Array(Array.from({ length: i }, (m, h) => h))
|
|
41
|
+
};
|
|
42
|
+
const x = i / r, p = [], l = [], d = [];
|
|
43
|
+
for (let m = 0; m < r; m++) {
|
|
44
|
+
const h = Math.floor(m * x), w = Math.floor((m + 1) * x);
|
|
45
|
+
let D = 1 / 0, b = -1 / 0, g = h, y = h;
|
|
46
|
+
for (let f = h; f < w && f < i; f++)
|
|
47
|
+
a[f] < D && (D = a[f], g = f), a[f] > b && (b = a[f], y = f);
|
|
48
|
+
g <= y ? (p.push(u[g], u[y]), l.push(a[g], a[y]), d.push(g, y)) : (p.push(u[y], u[g]), l.push(a[y], a[g]), d.push(y, g));
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
x: new Float32Array(p),
|
|
52
|
+
y: new Float32Array(l),
|
|
53
|
+
indices: new Uint32Array(d)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function Y(u, a, r = 2) {
|
|
57
|
+
const i = a * r;
|
|
58
|
+
return Math.min(u, i);
|
|
59
|
+
}
|
|
60
|
+
const k = {
|
|
61
|
+
name: "velo-plot-virtualization",
|
|
62
|
+
version: "1.0.0",
|
|
63
|
+
description: "Viewport-aware data virtualization with LOD strategies",
|
|
64
|
+
provides: ["performance", "data-virtualization"],
|
|
65
|
+
tags: ["performance", "lod", "virtualization"]
|
|
66
|
+
}, V = {
|
|
67
|
+
enabled: !0,
|
|
68
|
+
mode: "lod",
|
|
69
|
+
targetPoints: "auto",
|
|
70
|
+
pointsPerPixel: 2,
|
|
71
|
+
lodLevels: [1, 4, 8, 16],
|
|
72
|
+
strategy: "lttb",
|
|
73
|
+
reuseOriginalData: !0,
|
|
74
|
+
syncWithLazyLoad: !0,
|
|
75
|
+
includeSeries: [],
|
|
76
|
+
excludeSeries: [],
|
|
77
|
+
debug: !1
|
|
78
|
+
};
|
|
79
|
+
function L(u = {}) {
|
|
80
|
+
const a = { ...V, ...u };
|
|
81
|
+
let r = null, i = !1;
|
|
82
|
+
const x = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
83
|
+
let l = null, d = null;
|
|
84
|
+
function m(e, ...t) {
|
|
85
|
+
a.debug && r && r.log.info(`[Virtualization] ${e}`, ...t);
|
|
86
|
+
}
|
|
87
|
+
function h(e) {
|
|
88
|
+
if (!a.enabled || a.includeSeries.length > 0 && !a.includeSeries.includes(e.getId()) || a.excludeSeries.includes(e.getId())) return !1;
|
|
89
|
+
const t = e.getType();
|
|
90
|
+
return t === "line" || t === "scatter" || t === "line+scatter" || t === "step" || t === "step+scatter";
|
|
91
|
+
}
|
|
92
|
+
function w(e) {
|
|
93
|
+
if (!r) return e;
|
|
94
|
+
if (a.targetPoints !== "auto") return Math.max(2, a.targetPoints);
|
|
95
|
+
const t = r.render.canvasSize.width / r.render.pixelRatio;
|
|
96
|
+
return Y(e, t, a.pointsPerPixel);
|
|
97
|
+
}
|
|
98
|
+
function D(e, t, n, s) {
|
|
99
|
+
if (n >= e.length || e.length <= 2)
|
|
100
|
+
return { x: new Float32Array(e), y: new Float32Array(t) };
|
|
101
|
+
if (s === "minmax") {
|
|
102
|
+
const c = Math.ceil(n / 2), A = E(e, t, c);
|
|
103
|
+
return { x: A.x, y: A.y };
|
|
104
|
+
}
|
|
105
|
+
const o = U(e, t, n);
|
|
106
|
+
return { x: o.x, y: o.y };
|
|
107
|
+
}
|
|
108
|
+
function b(e, t) {
|
|
109
|
+
a.reuseOriginalData && x.set(e, { x: t.x, y: t.y });
|
|
110
|
+
}
|
|
111
|
+
function g(e) {
|
|
112
|
+
return x.get(e) ?? null;
|
|
113
|
+
}
|
|
114
|
+
function y(e, t, n, s, o, c) {
|
|
115
|
+
p.set(e, {
|
|
116
|
+
seriesId: e,
|
|
117
|
+
originalPoints: t,
|
|
118
|
+
renderedPoints: n,
|
|
119
|
+
targetPoints: s,
|
|
120
|
+
lastUpdated: Date.now(),
|
|
121
|
+
mode: o,
|
|
122
|
+
strategy: c
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function f(e) {
|
|
126
|
+
if (!r || !l) return;
|
|
127
|
+
const t = e.getId(), n = e.getData();
|
|
128
|
+
if (!(n != null && n.x) || !(n != null && n.y) || n.x.length === 0) return;
|
|
129
|
+
if (!h(e)) {
|
|
130
|
+
const c = g(t);
|
|
131
|
+
c && a.reuseOriginalData && (i = !0, l(t, { x: c.x, y: c.y }), i = !1);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
b(t, { x: n.x, y: n.y });
|
|
135
|
+
const s = w(n.x.length), o = D(n.x, n.y, s, a.strategy);
|
|
136
|
+
i = !0, l(t, { x: o.x, y: o.y }), i = !1, y(t, n.x.length, o.x.length, s, a.mode, a.strategy);
|
|
137
|
+
}
|
|
138
|
+
function S() {
|
|
139
|
+
r && r.data.getAllSeries().forEach((e) => f(e));
|
|
140
|
+
}
|
|
141
|
+
function z(e, t) {
|
|
142
|
+
var c, A, I, M;
|
|
143
|
+
if (!r || !l) return;
|
|
144
|
+
if (!a.enabled || i) {
|
|
145
|
+
l(e, t);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!((A = (c = r.chart).getSeries) == null ? void 0 : A.call(c, e))) {
|
|
149
|
+
l(e, t);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const s = g(e);
|
|
153
|
+
s && a.reuseOriginalData && (i = !0, l(e, { x: s.x, y: s.y }), i = !1), l(e, t);
|
|
154
|
+
const o = (M = (I = r.chart).getSeries) == null ? void 0 : M.call(I, e);
|
|
155
|
+
o && (b(e, { x: o.getData().x, y: o.getData().y }), f(o));
|
|
156
|
+
}
|
|
157
|
+
function F(e, t, n) {
|
|
158
|
+
var A, I, M, O;
|
|
159
|
+
if (!r || !d || !l) return;
|
|
160
|
+
if (!a.enabled || i) {
|
|
161
|
+
d(e, t, n);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (!((I = (A = r.chart).getSeries) == null ? void 0 : I.call(A, e))) {
|
|
165
|
+
d(e, t, n);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const o = g(e);
|
|
169
|
+
o && a.reuseOriginalData && (i = !0, l(e, { x: o.x, y: o.y }), i = !1), d(e, t, n);
|
|
170
|
+
const c = (O = (M = r.chart).getSeries) == null ? void 0 : O.call(M, e);
|
|
171
|
+
c && (b(e, { x: c.getData().x, y: c.getData().y }), f(c));
|
|
172
|
+
}
|
|
173
|
+
const v = {
|
|
174
|
+
enable() {
|
|
175
|
+
a.enabled = !0, S();
|
|
176
|
+
},
|
|
177
|
+
disable() {
|
|
178
|
+
if (a.enabled = !1, !r || !l) return;
|
|
179
|
+
const e = l;
|
|
180
|
+
r.data.getAllSeries().forEach((t) => {
|
|
181
|
+
const n = g(t.getId());
|
|
182
|
+
n && (i = !0, e(t.getId(), { x: n.x, y: n.y }), i = !1);
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
isEnabled() {
|
|
186
|
+
return a.enabled;
|
|
187
|
+
},
|
|
188
|
+
updateConfig(e) {
|
|
189
|
+
Object.assign(a, e), S();
|
|
190
|
+
},
|
|
191
|
+
invalidate(e) {
|
|
192
|
+
var t, n;
|
|
193
|
+
if (r) {
|
|
194
|
+
if (e) {
|
|
195
|
+
const s = (n = (t = r.chart).getSeries) == null ? void 0 : n.call(t, e);
|
|
196
|
+
s && f(s);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
S();
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
getStats(e) {
|
|
203
|
+
return p.get(e) ?? null;
|
|
204
|
+
},
|
|
205
|
+
getAllStats() {
|
|
206
|
+
return Array.from(p.values());
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
manifest: k,
|
|
211
|
+
onInit(e) {
|
|
212
|
+
var n, s;
|
|
213
|
+
r = e, r.chart.virtualization = v;
|
|
214
|
+
const t = r.chart;
|
|
215
|
+
l = ((n = t.updateSeries) == null ? void 0 : n.bind(t)) ?? null, d = ((s = t.appendData) == null ? void 0 : s.bind(t)) ?? null, l && (t.updateSeries = (o, c) => z(o, c)), d && (t.appendData = (o, c, A) => F(o, c, A)), r.events.on("zoom", () => S()), r.events.on("pan", () => S()), r.events.on("resize", () => S()), S(), m("Initialized");
|
|
216
|
+
},
|
|
217
|
+
onDestroy(e) {
|
|
218
|
+
l && (e.chart.updateSeries = l), d && (e.chart.appendData = d), delete e.chart.virtualization, r = null, x.clear(), p.clear();
|
|
219
|
+
},
|
|
220
|
+
api: v
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export {
|
|
224
|
+
L as P,
|
|
225
|
+
Y as c,
|
|
226
|
+
U as l,
|
|
227
|
+
E as m
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=index-ChgIdk3N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ChgIdk3N.js","sources":["../src/workers/downsample.ts","../src/plugins/virtualization/index.ts"],"sourcesContent":["/**\n * LTTB (Largest-Triangle-Three-Buckets) Downsampling Algorithm\n *\n * This algorithm downsamples time-series data while preserving visual features.\n * It's much better than naive sampling for preserving peaks and valleys.\n *\n * Reference: https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf\n */\n\nexport interface DownsampleResult {\n x: Float32Array;\n y: Float32Array;\n /** Original indices of selected points */\n indices: Uint32Array;\n}\n\n/**\n * Downsample data using LTTB algorithm\n *\n * @param x - X values (e.g., potential)\n * @param y - Y values (e.g., current)\n * @param targetPoints - Number of output points\n * @returns Downsampled data\n */\nexport function lttbDownsample(\n x: Float32Array | Float64Array,\n y: Float32Array | Float64Array,\n targetPoints: number\n): DownsampleResult {\n const length = x.length;\n\n // No need to downsample\n if (targetPoints >= length || targetPoints <= 2) {\n return {\n x: new Float32Array(x),\n y: new Float32Array(y),\n indices: new Uint32Array(Array.from({ length }, (_, i) => i)),\n };\n }\n\n const outX = new Float32Array(targetPoints);\n const outY = new Float32Array(targetPoints);\n const outIndices = new Uint32Array(targetPoints);\n\n // Always include first point\n outX[0] = x[0];\n outY[0] = y[0];\n outIndices[0] = 0;\n\n // Bucket size\n const bucketSize = (length - 2) / (targetPoints - 2);\n\n let a = 0; // Previous selected point index\n let outIdx = 1;\n\n for (let i = 0; i < targetPoints - 2; i++) {\n // Calculate bucket boundaries\n const bucketStart = Math.floor((i + 1) * bucketSize) + 1;\n const bucketEnd = Math.floor((i + 2) * bucketSize) + 1;\n\n // Calculate average point of next bucket\n const nextBucketStart = Math.min(bucketEnd, length - 1);\n const nextBucketEnd = Math.min(\n Math.floor((i + 3) * bucketSize) + 1,\n length\n );\n\n let avgX = 0;\n let avgY = 0;\n let avgCount = 0;\n\n for (let j = nextBucketStart; j < nextBucketEnd; j++) {\n avgX += x[j];\n avgY += y[j];\n avgCount++;\n }\n\n if (avgCount > 0) {\n avgX /= avgCount;\n avgY /= avgCount;\n }\n\n // Find point in current bucket with largest triangle area\n let maxArea = -1;\n let maxIndex = bucketStart;\n\n const aX = x[a];\n const aY = y[a];\n\n for (let j = bucketStart; j < bucketEnd && j < length; j++) {\n // Calculate triangle area (simplified: |x1(y2-y3) + x2(y3-y1) + x3(y1-y2)| / 2)\n const area = Math.abs(\n (aX - avgX) * (y[j] - aY) - (aX - x[j]) * (avgY - aY)\n );\n\n if (area > maxArea) {\n maxArea = area;\n maxIndex = j;\n }\n }\n\n // Store selected point\n outX[outIdx] = x[maxIndex];\n outY[outIdx] = y[maxIndex];\n outIndices[outIdx] = maxIndex;\n\n a = maxIndex;\n outIdx++;\n }\n\n // Always include last point\n outX[targetPoints - 1] = x[length - 1];\n outY[targetPoints - 1] = y[length - 1];\n outIndices[targetPoints - 1] = length - 1;\n\n return { x: outX, y: outY, indices: outIndices };\n}\n\n/**\n * Min-Max per bucket downsampling\n *\n * Simpler alternative to LTTB that preserves extremes in each bucket.\n * Uses 2 points per bucket (min and max), so output is ~2x target.\n */\nexport function minMaxDownsample(\n x: Float32Array | Float64Array,\n y: Float32Array | Float64Array,\n bucketCount: number\n): DownsampleResult {\n const length = x.length;\n\n if (bucketCount >= length / 2) {\n return {\n x: new Float32Array(x),\n y: new Float32Array(y),\n indices: new Uint32Array(Array.from({ length }, (_, i) => i)),\n };\n }\n\n const bucketSize = length / bucketCount;\n const outX: number[] = [];\n const outY: number[] = [];\n const outIndices: number[] = [];\n\n for (let b = 0; b < bucketCount; b++) {\n const start = Math.floor(b * bucketSize);\n const end = Math.floor((b + 1) * bucketSize);\n\n let minY = Infinity;\n let maxY = -Infinity;\n let minIdx = start;\n let maxIdx = start;\n\n for (let i = start; i < end && i < length; i++) {\n if (y[i] < minY) {\n minY = y[i];\n minIdx = i;\n }\n if (y[i] > maxY) {\n maxY = y[i];\n maxIdx = i;\n }\n }\n\n // Add points in order (min first if it comes before max)\n if (minIdx <= maxIdx) {\n outX.push(x[minIdx], x[maxIdx]);\n outY.push(y[minIdx], y[maxIdx]);\n outIndices.push(minIdx, maxIdx);\n } else {\n outX.push(x[maxIdx], x[minIdx]);\n outY.push(y[maxIdx], y[minIdx]);\n outIndices.push(maxIdx, minIdx);\n }\n }\n\n return {\n x: new Float32Array(outX),\n y: new Float32Array(outY),\n indices: new Uint32Array(outIndices),\n };\n}\n\n/**\n * Calculate optimal target points based on canvas width\n */\nexport function calculateTargetPoints(\n dataLength: number,\n canvasWidth: number,\n pointsPerPixel = 2\n): number {\n // Never draw more than pointsPerPixel per pixel\n const maxPoints = canvasWidth * pointsPerPixel;\n return Math.min(dataLength, maxPoints);\n}\n","/**\n * @fileoverview Data virtualization plugin (LOD/min-max)\n * @module plugins/virtualization\n */\n\nimport type {\n PluginVirtualizationConfig,\n VirtualizationAPI,\n VirtualizationStats,\n VirtualizationMode,\n VirtualizationStrategy,\n} from \"./types\";\nimport type { ChartPlugin, PluginContext, PluginManifest } from \"../types\";\nimport type { Series } from \"../../core/Series\";\nimport type { SeriesUpdateData } from \"../../types\";\nimport {\n lttbDownsample,\n minMaxDownsample,\n calculateTargetPoints,\n} from \"../../workers/downsample\";\n\nconst manifest: PluginManifest = {\n name: \"velo-plot-virtualization\",\n version: \"1.0.0\",\n description: \"Viewport-aware data virtualization with LOD strategies\",\n provides: [\"performance\", \"data-virtualization\"],\n tags: [\"performance\", \"lod\", \"virtualization\"],\n};\n\nconst DEFAULT_CONFIG: Required<PluginVirtualizationConfig> = {\n enabled: true,\n mode: \"lod\",\n targetPoints: \"auto\",\n pointsPerPixel: 2,\n lodLevels: [1, 4, 8, 16],\n strategy: \"lttb\",\n reuseOriginalData: true,\n syncWithLazyLoad: true,\n includeSeries: [],\n excludeSeries: [],\n debug: false,\n};\n\ntype SeriesCache = {\n x: Float32Array | Float64Array;\n y: Float32Array | Float64Array;\n};\n\nexport function PluginVirtualization(\n userConfig: Partial<PluginVirtualizationConfig> = {}\n): ChartPlugin<PluginVirtualizationConfig> {\n const config = { ...DEFAULT_CONFIG, ...userConfig };\n let ctx: PluginContext | null = null;\n let isInternalUpdate = false;\n\n const originalData = new Map<string, SeriesCache>();\n const stats = new Map<string, VirtualizationStats>();\n\n let originalUpdateSeries: ((id: string, data: SeriesUpdateData) => void) | null = null;\n let originalAppendData: ((id: string, x: number[] | Float32Array, y: number[] | Float32Array) => void) | null = null;\n\n function log(message: string, ...args: unknown[]) {\n if (config.debug && ctx) {\n ctx.log.info(`[Virtualization] ${message}`, ...args);\n }\n }\n\n function shouldVirtualize(series: Series): boolean {\n if (!config.enabled) return false;\n if (config.includeSeries.length > 0 && !config.includeSeries.includes(series.getId())) return false;\n if (config.excludeSeries.includes(series.getId())) return false;\n\n const type = series.getType();\n return (\n type === \"line\" ||\n type === \"scatter\" ||\n type === \"line+scatter\" ||\n type === \"step\" ||\n type === \"step+scatter\"\n );\n }\n\n function getTargetPoints(dataLength: number): number {\n if (!ctx) return dataLength;\n if (config.targetPoints !== \"auto\") return Math.max(2, config.targetPoints);\n const width = ctx.render.canvasSize.width / ctx.render.pixelRatio;\n return calculateTargetPoints(dataLength, width, config.pointsPerPixel);\n }\n\n function downsampleData(\n x: Float32Array | Float64Array,\n y: Float32Array | Float64Array,\n targetPoints: number,\n strategy: VirtualizationStrategy\n ): { x: Float32Array; y: Float32Array } {\n if (targetPoints >= x.length || x.length <= 2) {\n return { x: new Float32Array(x), y: new Float32Array(y) };\n }\n\n if (strategy === \"minmax\") {\n const bucketCount = Math.ceil(targetPoints / 2);\n const result = minMaxDownsample(x, y, bucketCount);\n return { x: result.x, y: result.y };\n }\n\n const result = lttbDownsample(x, y, targetPoints);\n return { x: result.x, y: result.y };\n }\n\n function cacheOriginal(seriesId: string, data: SeriesCache): void {\n if (!config.reuseOriginalData) return;\n originalData.set(seriesId, { x: data.x, y: data.y });\n }\n\n function restoreOriginal(seriesId: string): SeriesCache | null {\n return originalData.get(seriesId) ?? null;\n }\n\n function updateStats(\n seriesId: string,\n originalPoints: number,\n renderedPoints: number,\n targetPoints: number,\n mode: VirtualizationMode,\n strategy: VirtualizationStrategy\n ): void {\n stats.set(seriesId, {\n seriesId,\n originalPoints,\n renderedPoints,\n targetPoints,\n lastUpdated: Date.now(),\n mode,\n strategy,\n });\n }\n\n function applyVirtualization(series: Series): void {\n if (!ctx || !originalUpdateSeries) return;\n const seriesId = series.getId();\n const data = series.getData();\n if (!data?.x || !data?.y || data.x.length === 0) return;\n\n if (!shouldVirtualize(series)) {\n const original = restoreOriginal(seriesId);\n if (original && config.reuseOriginalData) {\n isInternalUpdate = true;\n originalUpdateSeries(seriesId, { x: original.x, y: original.y });\n isInternalUpdate = false;\n }\n return;\n }\n\n cacheOriginal(seriesId, { x: data.x, y: data.y });\n\n const targetPoints = getTargetPoints(data.x.length);\n const downsampled = downsampleData(data.x, data.y, targetPoints, config.strategy);\n\n isInternalUpdate = true;\n originalUpdateSeries(seriesId, { x: downsampled.x, y: downsampled.y });\n isInternalUpdate = false;\n\n updateStats(seriesId, data.x.length, downsampled.x.length, targetPoints, config.mode, config.strategy);\n }\n\n function refreshAll(): void {\n if (!ctx) return;\n ctx.data.getAllSeries().forEach((series) => applyVirtualization(series));\n }\n\n function handleUpdateSeries(id: string, data: SeriesUpdateData): void {\n if (!ctx || !originalUpdateSeries) return;\n if (!config.enabled || isInternalUpdate) {\n originalUpdateSeries(id, data);\n return;\n }\n\n const series = ctx.chart.getSeries?.(id) as Series | undefined;\n if (!series) {\n originalUpdateSeries(id, data);\n return;\n }\n\n const original = restoreOriginal(id);\n if (original && config.reuseOriginalData) {\n isInternalUpdate = true;\n originalUpdateSeries(id, { x: original.x, y: original.y });\n isInternalUpdate = false;\n }\n\n originalUpdateSeries(id, data);\n\n const updatedSeries = ctx.chart.getSeries?.(id) as Series | undefined;\n if (updatedSeries) {\n cacheOriginal(id, { x: updatedSeries.getData().x, y: updatedSeries.getData().y });\n applyVirtualization(updatedSeries);\n }\n }\n\n function handleAppendData(\n id: string,\n x: number[] | Float32Array,\n y: number[] | Float32Array\n ): void {\n if (!ctx || !originalAppendData || !originalUpdateSeries) return;\n\n if (!config.enabled || isInternalUpdate) {\n originalAppendData(id, x, y);\n return;\n }\n\n const series = ctx.chart.getSeries?.(id) as Series | undefined;\n if (!series) {\n originalAppendData(id, x, y);\n return;\n }\n\n const original = restoreOriginal(id);\n if (original && config.reuseOriginalData) {\n isInternalUpdate = true;\n originalUpdateSeries(id, { x: original.x, y: original.y });\n isInternalUpdate = false;\n }\n\n originalAppendData(id, x, y);\n\n const updatedSeries = ctx.chart.getSeries?.(id) as Series | undefined;\n if (updatedSeries) {\n cacheOriginal(id, { x: updatedSeries.getData().x, y: updatedSeries.getData().y });\n applyVirtualization(updatedSeries);\n }\n }\n\n const api: VirtualizationAPI & Record<string, unknown> = {\n enable() {\n config.enabled = true;\n refreshAll();\n },\n disable() {\n config.enabled = false;\n if (!ctx || !originalUpdateSeries) return;\n const updater = originalUpdateSeries;\n ctx.data.getAllSeries().forEach((series) => {\n const original = restoreOriginal(series.getId());\n if (original) {\n isInternalUpdate = true;\n updater(series.getId(), { x: original.x, y: original.y });\n isInternalUpdate = false;\n }\n });\n },\n isEnabled() {\n return config.enabled;\n },\n updateConfig(newConfig) {\n Object.assign(config, newConfig);\n refreshAll();\n },\n invalidate(seriesId) {\n if (!ctx) return;\n if (seriesId) {\n const series = ctx.chart.getSeries?.(seriesId) as Series | undefined;\n if (series) applyVirtualization(series);\n return;\n }\n refreshAll();\n },\n getStats(seriesId) {\n return stats.get(seriesId) ?? null;\n },\n getAllStats() {\n return Array.from(stats.values());\n },\n };\n\n return {\n manifest,\n onInit(pluginCtx: PluginContext) {\n ctx = pluginCtx;\n (ctx.chart as any).virtualization = api;\n\n const chart = ctx.chart as any;\n originalUpdateSeries = chart.updateSeries?.bind(chart) ?? null;\n originalAppendData = chart.appendData?.bind(chart) ?? null;\n\n if (originalUpdateSeries) {\n chart.updateSeries = (id: string, data: SeriesUpdateData) => handleUpdateSeries(id, data);\n }\n\n if (originalAppendData) {\n chart.appendData = (id: string, x: number[] | Float32Array, y: number[] | Float32Array) =>\n handleAppendData(id, x, y);\n }\n\n ctx.events.on(\"zoom\", () => refreshAll());\n ctx.events.on(\"pan\", () => refreshAll());\n ctx.events.on(\"resize\", () => refreshAll());\n\n refreshAll();\n log(\"Initialized\");\n },\n onDestroy(pluginCtx: PluginContext) {\n if (originalUpdateSeries) {\n (pluginCtx.chart as any).updateSeries = originalUpdateSeries;\n }\n if (originalAppendData) {\n (pluginCtx.chart as any).appendData = originalAppendData;\n }\n delete (pluginCtx.chart as any).virtualization;\n ctx = null;\n originalData.clear();\n stats.clear();\n },\n api,\n };\n}\n\nexport default PluginVirtualization;\n\n// Type exports\nexport type {\n PluginVirtualizationConfig,\n VirtualizationAPI,\n VirtualizationStats,\n VirtualizationMode,\n VirtualizationStrategy,\n} from \"./types\";\n"],"names":["lttbDownsample","x","y","targetPoints","length","_","i","outX","outY","outIndices","bucketSize","a","outIdx","bucketStart","bucketEnd","nextBucketStart","nextBucketEnd","avgX","avgY","avgCount","j","maxArea","maxIndex","aX","aY","area","minMaxDownsample","bucketCount","b","start","end","minY","maxY","minIdx","maxIdx","calculateTargetPoints","dataLength","canvasWidth","pointsPerPixel","maxPoints","manifest","DEFAULT_CONFIG","PluginVirtualization","userConfig","config","ctx","isInternalUpdate","originalData","stats","originalUpdateSeries","originalAppendData","log","message","args","shouldVirtualize","series","type","getTargetPoints","width","downsampleData","strategy","result","cacheOriginal","seriesId","data","restoreOriginal","updateStats","originalPoints","renderedPoints","mode","applyVirtualization","original","downsampled","refreshAll","handleUpdateSeries","id","_a","_b","_c","_d","updatedSeries","handleAppendData","api","updater","newConfig","pluginCtx","chart"],"mappings":"AAwBO,SAASA,EACdC,GACAC,GACAC,GACkB;AAClB,QAAMC,IAASH,EAAE;AAGjB,MAAIE,KAAgBC,KAAUD,KAAgB;AAC5C,WAAO;AAAA,MACL,GAAG,IAAI,aAAaF,CAAC;AAAA,MACrB,GAAG,IAAI,aAAaC,CAAC;AAAA,MACrB,SAAS,IAAI,YAAY,MAAM,KAAK,EAAE,QAAAE,EAAA,GAAU,CAACC,GAAGC,MAAMA,CAAC,CAAC;AAAA,IAAA;AAIhE,QAAMC,IAAO,IAAI,aAAaJ,CAAY,GACpCK,IAAO,IAAI,aAAaL,CAAY,GACpCM,IAAa,IAAI,YAAYN,CAAY;AAG/C,EAAAI,EAAK,CAAC,IAAIN,EAAE,CAAC,GACbO,EAAK,CAAC,IAAIN,EAAE,CAAC,GACbO,EAAW,CAAC,IAAI;AAGhB,QAAMC,KAAcN,IAAS,MAAMD,IAAe;AAElD,MAAIQ,IAAI,GACJC,IAAS;AAEb,WAASN,IAAI,GAAGA,IAAIH,IAAe,GAAGG,KAAK;AAEzC,UAAMO,IAAc,KAAK,OAAOP,IAAI,KAAKI,CAAU,IAAI,GACjDI,IAAY,KAAK,OAAOR,IAAI,KAAKI,CAAU,IAAI,GAG/CK,IAAkB,KAAK,IAAID,GAAWV,IAAS,CAAC,GAChDY,IAAgB,KAAK;AAAA,MACzB,KAAK,OAAOV,IAAI,KAAKI,CAAU,IAAI;AAAA,MACnCN;AAAA,IAAA;AAGF,QAAIa,IAAO,GACPC,IAAO,GACPC,IAAW;AAEf,aAASC,IAAIL,GAAiBK,IAA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