5 Real-Time Chart Series
| (require rivet/chart) | package: rivet |
The chart data plane keeps time-series state on the Racket side and exports it in the two shapes native chart widgets consume: the recent-window pull (an ordinary typed RPC built from chart-series-window) and the high-rate append push (a bytes? batch carried by an application event). Samples are (cons timestamp-nanoseconds value) pairs of exact integers; Rivet’s typed surface is integer-native by design, and measurement domains (ns offsets, ps offsets, ppm drift) stay exact instead of losing precision to floating point.
The batch layout is a cross-language contract with the portable C++ decoder in "runtime/include/rivet/chart_batch.hpp" and the Swift decoder in RivetUI; the three implementations are pinned by shared golden bytes in their test suites. Rivet: First-Party Native Desktop Applications with Racket links the full convention guide.
procedure
(make-chart-series id [#:capacity capacity]) → chart-series?
id : string? capacity : exact-positive-integer? = 16384
procedure
(chart-series-append! series samples) → void?
series : chart-series?
samples :
(listof (cons/c exact-nonnegative-integer? exact-integer?))
procedure
→ (listof (cons/c exact-nonnegative-integer? exact-integer?)) series : chart-series? span-ns : (or/c #f exact-nonnegative-integer?)
procedure
(chart-series-drain-batch! series) → bytes?
series : chart-series?
procedure
→ (or/c #f (cons/c exact-nonnegative-integer? exact-integer?)) series : chart-series?
procedure
(chart-series-count series) → exact-nonnegative-integer?
series : chart-series?
procedure
(chart-series-capacity series) → exact-positive-integer?
series : chart-series?
procedure
(chart-series-appended series) → exact-nonnegative-integer?
series : chart-series?
procedure
(chart-series-dropped series) → exact-nonnegative-integer?
series : chart-series?
procedure
(chart-series-id series) → string?
series : chart-series?
procedure
(chart-series-reset! series) → void?
series : chart-series?
procedure
(chart-batch-encode samples [first-index]) → bytes?
samples : (listof (cons/c exact-nonnegative-integer? exact-integer?)) first-index : exact-nonnegative-integer? = 0
procedure
→
(listof (cons/c exact-nonnegative-integer? exact-integer?)) exact-nonnegative-integer? batch : bytes?
procedure
(chart-batch-sample-count batch) → exact-nonnegative-integer?
batch : bytes?
procedure
(chart-batch-first-index batch) → exact-nonnegative-integer?
batch : bytes?
value
chart-batch-magic : exact-nonnegative-integer?