Trends and History Binding
The point table keeps recent successful samples. Since 0.6, that history can be pushed directly to WinForms or WPF for trend charts, alarm timelines, or recent-sample lists.
Callback Binding
BindHistory pushes the current history immediately, then pushes again whenever a successful sample enters history. Failed polls only update the current snapshot Error; they do not enter history.
points.BindHistory("temperature", this, history =>
{
HistoryText.Text = string.Join(
" -> ",
history.TakeLast(8).Select(sample => $"{sample.Value} {sample.AlarmState}"));
});
Pass any WinForms Control or WPF FrameworkElement. Zeus marshals the callback to that UI thread.
Binding Source
var source = points.AsHistoryBindingSource("temperature", this);
TrendPanel.DataContext = source;
PointHistoryBindingSource exposes:
| Property | Meaning |
|---|---|
History | Successful samples, oldest to newest |
Latest | Latest successful sample |
Count / HasSamples | Sample count and availability |
LatestValue / LatestUpdatedAt | Latest value and timestamp |
LatestAlarmState / IsLatestAlarmed | Alarm state of the latest sample |
Chart Controls
Zeus does not depend on a chart library. Convert PointSnapshot to the format your chart needs:
points.BindHistory("temperature", this, history =>
{
chart.Series[0].Points.Clear();
foreach (var sample in history)
{
if (sample.UpdatedAt is not null && sample.Value is not null)
{
chart.Series[0].Points.AddXY(sample.UpdatedAt.Value.LocalDateTime, sample.Value);
}
}
});
History Capacity
Default capacity is 128 successful samples per point. Register a custom PointTable to change it:
builder.Services.AddSingleton(sp => new PointTable(sp.GetRequiredService<DeviceRegistry>(), historyCapacity: 32));
Set capacity to 0 to keep no samples; BindHistory still pushes an empty history.
Next: WinForms Adapter or WPF Adapter.