chart-streaming

command
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Streaming chart

Three waveforms scroll by, each the latest 15,000 samples of a signal sampled 1,000 times a second, with noise and isolated spikes. Every frame takes in the samples that arrived since the last, keeps the extremes of each pixel column with chart.MinMax, and strokes them with Painter.StrokePolyline.

go run ./examples/chart-streaming
go run ./examples/chart-streaming -mode path   # MinMax, then StrokePath
go run ./examples/chart-streaming -mode raw    # every sample, StrokePath
go run ./examples/chart-streaming -mode index -samples 1000000
go run ./examples/chart-streaming -mode index -duration 20s
MYGO_FRAME_STATS=all go run ./examples/chart-streaming   # each frame's timing

index uses chart.MinMaxIndex and the same StrokePolyline path as polyline. Both use the same deterministic raw samples and viewport. History is bounded at twice the visible sample count; when it expires, the example resets the indexes and generates the retained window again. This deliberately exposes rebuild costs instead of growing history forever. The window requests 1360×800 DIP; the plot's physical width follows its layout and the display scale. MYGO_FRAME_STATS measures frames including renderer submission, not GPU execution or physical display scanout.

Documentation

Overview

Chart-streaming draws three rolling waveforms of 15,000 samples each, 1,000 new samples a second, reduced to a few points per pixel column.

Jump to

Keyboard shortcuts

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