feat(examples): a three-row synced Figure demo, on a GLFW host that draws one

The multi-plot example the phase exists for: three plots stacked in one
Figure, sharing one x link with following armed, each row carrying its own
named signals and its own legend, driven by six StreamSeries at 500 kS/s.
Two cursors and a region with an exact statistics readout reach the direct
manipulation of spec §5 in the same frame, and PLOT_DEMO_SYNC=1 is a
self-checking mode that exits non-zero unless all three rows hold one range
and the shared right edge keeps tracking the newest sample through a zoom, a
pan on another row and more arriving data.

The GLFW host gains the figure mode the demo needs: set_figure() makes the
run loop draw the Figure instead of its own plot and route each pointer,
wheel and key event to the row it lands in, through one Controller per row
(row_controller()). All of it is opt-in; the single-plot path is untouched.
This commit is contained in:
Martino Ferrari committed 2026-09-28 15:24:22 +02:00
1 parent 770da4c2b2
commit 942f88c568
9 files changed
+917 -39

No files matched your search

+2 -1
View File
@@ -623,7 +623,8 @@ int main(int argc, char** argv) {
{"time", {-0.5, 0.5}, true, plot::AxisPlace::Bottom, false, plot::TickFormat::Time});
const u32 axis_y = graph.add_y_axis(
{"signal", {-4.0, 4.0}, true, plot::AxisPlace::Left, false, plot::TickFormat::Si});
const u32 trace = graph.add_trace({&stream, kTraceColor, 1.5f, axis_x, axis_y});
// Named, so the plot's legend -- on by default -- lists the signal.
const u32 trace = graph.add_trace({&stream, kTraceColor, 1.5f, axis_x, axis_y, "signal"});
// Snapped cursors sit exactly on a sample, so the readout measures samples and
// not a rounded position between two of them.