Live data

Real-time charts in Blazor: append points to a SeriesBuffer from any thread. The chart coalesces the changes and redraws at most every RefreshInterval milliseconds; the tooltip stays open while it updates.

A two-minute window

Visitors on the store right now, web and app: two buffers with a time window, fed four times a second.

Chart with 2 series. Web: 478 values, lowest 139 at 11/30/2026 9:01 PM, highest 192 at 11/30/2026 9:03 PM, trend stable. App: 478 values, lowest 83 at 11/30/2026 9:02 PM, highest 116 at 11/30/2026 9:01 PM, trend stable. 501001502009:01:30 PM9:01:45 PM9:02:00 PM9:02:15 PM9:02:30 PM9:02:45 PM9:03:00 PM9:03:15 PMVisitorsWebAppAutoscale: 200AutoscaleUse Left and Right to move between points, Up and Down to change series. Press Escape to leave.

Code
Razor
<RioChart TItem="double" RefreshInterval="250">
    <LineSeries Name="Web" Buffer="web" Curve="CurveType.Monotone" />
    <LineSeries Name="App" Buffer="app" Curve="CurveType.Monotone" />
</RioChart>

@code {
    SeriesBuffer web = new(timeWindow: TimeSpan.FromMinutes(2));
    SeriesBuffer app = new(timeWindow: TimeSpan.FromMinutes(2));

    void OnVisitors(DateTime time, double count) => web.Append(time, count); // any thread
}

From a stream

C#
await buffer.ConsumeAsync(analytics.VisitorsAsync(token), v => v.Time, v => v.Count, token);

Buffers keep at most Capacity points (100 000 by default) and, with a timeWindow, only the latest span of time.

An unhandled error has occurred. Reload 🗙