playback

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package playback replays recorded historian history into a LineChart: it loads a tag's samples over a time range, optionally decimates them to a point budget, and feeds them into a rolling series so the chart's time axis shows the persisted trend instead of only the live tail.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Downsample

func Downsample(samples []historian.Sample, maxPoints int) []historian.Sample

Downsample evenly decimates samples down to about maxPoints points, always keeping the first and the last. It is pure and allocation-light: when maxPoints < 1, or there are no more than maxPoints samples, the input slice is returned unchanged (so empty and single-element inputs pass through).

func FeedChart

func FeedChart(chart *gui.LineChart, seriesName string, samples []historian.Sample)

FeedChart replays samples into a rolling series named seriesName on chart: it sizes the series' ring buffer to hold exactly the samples, then pushes each (TS, Value) so the chart's time axis spans the loaded history rather than dropping the oldest points.

func LoadRange

func LoadRange(h *historian.Historian, tag string, from, to time.Time) ([]historian.Sample, error)

LoadRange is a thin, stable wrapper over Historian.Query: it returns tag's samples whose timestamp is in [from, to] inclusive, ordered ascending. The indirection lets callers depend on playback rather than the historian query signature directly.

func PlayInto

func PlayInto(chart *gui.LineChart, h *historian.Historian, seriesName, tag string, from, to time.Time, maxPoints int) error

PlayInto loads tag's history in [from, to], decimates it to at most maxPoints points, and feeds the result into chart's seriesName series. It returns any error from the underlying query; on success chart holds the range's trend.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL