feat(plot): crosshair with an interpolated per-signal hover readout

This commit is contained in:
Martino Ferrari committed 2026-09-28 18:57:33 +02:00
1 parent a153b73ead
commit fd0c471430
11 files changed
+809 -22

No files matched your search

+12
View File
@@ -487,6 +487,18 @@ class Renderer {
/// them again, so the panel a test asserts and the panel this draws are the same
/// numbers.
void draw_legend(const Plot& plot, const PlotLayout& layout);
/// The crosshair: the two lines, a marker per trace, and the readout panel with a swatch and
/// a value per listed row. Every rect -- the two stroke boxes, the panel, the markers'
/// positions and the rows' boxes -- comes from `PlotLayout::crosshair`, which placed it
/// inside `axes`; this stages exactly that geometry, so the crosshair a test measures and the
/// crosshair a frame paints are one set of numbers. Clipped to `axes` with the rest of the
/// interior passes, which is what keeps a marker for an off-scale sample inside the rect.
///
/// The panel is a backplate like the legend's, so it is drawn after the lines and the
/// markers and before any of the frame's text. The rows' values were formatted by the plot
/// (in the trace's own y axis' format) and are staged here as they stand -- this layer
/// formats nothing.
void draw_crosshair(const Plot& plot, const PlotLayout& layout);
/// The built-in backend the renderer owns, and the face the frames draw with:
/// `set_text_backend()` writes `font_`, which starts here and comes back here
+7
View File
@@ -41,6 +41,13 @@ struct Style {
Color axis_text = Color::hex(0xC8D0DC);
Color cursor = Color::hex(0xFFB020);
Color measure_fill = Color::hex(0xFFB020, 0.15f);
/// The crosshair's colour: its two lines, its markers' own colour excepted, and the
/// readout panel's border (spec §15). Deliberately **not** `cursor`: the cursor accent is
/// an orange that a caller's own cursors, a region's bounds and its fill all already use,
/// while the crosshair is a passive hover instrument that has to read as *chrome* over a
/// dense trace rather than as another handle to grab. A pale cyan does that against the
/// dark default theme, and it is a colour no default element of a frame shares.
Color crosshair = Color::hex(0xB8E8FF);
// --- the scale ----------------------------------------------------------