export class PlotBuffer { constructor(maxPoints = 1600) { this.maxPoints = maxPoints; this.points = []; } addPoint(point) { this.points.push(point); if (this.points.length > this.maxPoints) { this.points.splice(0, this.points.length - this.maxPoints); } } clear() { this.points = []; } getVisiblePoints(currentPlotTimeMs, windowDurationMs) { const minTime = currentPlotTimeMs - windowDurationMs; return this.points.filter((point) => point.timeMs >= minTime && point.timeMs <= currentPlotTimeMs); } }