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 ¶
- func Downsample(samples []historian.Sample, maxPoints int) []historian.Sample
- func FeedChart(chart *gui.LineChart, seriesName string, samples []historian.Sample)
- func LoadRange(h *historian.Historian, tag string, from, to time.Time) ([]historian.Sample, error)
- func PlayInto(chart *gui.LineChart, h *historian.Historian, seriesName, tag string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Downsample ¶
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 ¶
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 ¶
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.