crosshair: axis badges, clustered cursor labels, and the shared-y horizontal line
- Axis badges: the y value in the y label strip and the x time in the x strip, each a full-opacity panel in the crosshair's colour, **centred on the line it names**. The tick text is flushed before the fill -- the over-text batch is flushed after every line batch, so without that flush the label behind printed through the panel (the "transparent backplate" defect). - Cursor labels: collected across the cursor loop and clustered at its end, so two marks in one column share a panel with one line each instead of overprinting, and a label stays on its own mark's row. - Figure: a split row's cells share one y (`set_share_row_y`), so the horizontal line is drawn in every cell of the hovered row -- one value, one scale, spanning the row -- and still in no other row. Tests: `figure_crosshair_horizontal_spans_a_split_rows_cells`, plus the render-smoke additions for the badge placement/flush and the clustered labels.
This commit is contained in:
1 parent
2cb31cbb91
commit
1d5b286611
9 files changed
+469
-49
No files matched your search
@@ -557,6 +557,14 @@ class Plot {
|
||||
/// belongs to. An id that names no cursor is ignored, like every other setter here.
|
||||
void set_cursor_color(u32 id, Color color);
|
||||
|
||||
/// A cursor's caption (see `Cursor::label`): a vertical marker's badge text -- a horizontal
|
||||
/// ruler writes its own value and needs no caption to be readable. Rendered on a
|
||||
/// backplate, and labels whose backplates meet are merged into one panel with one line per
|
||||
/// label (see the renderer), which is what keeps a marker pair half a division apart
|
||||
/// readable instead of a smear of two texts over one column. An empty string removes the
|
||||
/// caption; an id that names no cursor is ignored, like every other setter here.
|
||||
void set_cursor_label(u32 id, std::string label);
|
||||
|
||||
/// A cursor's stroke: its logical width (`<= 0` for the style's default) and its dash
|
||||
/// (`dash.off <= 0` for solid). The instrument's own, like its colour -- see `Cursor::width`.
|
||||
void set_cursor_stroke(u32 id, f32 width, Vec2 dash);
|
||||
@@ -888,6 +896,14 @@ class Plot {
|
||||
/// **not** part of `set_crosshair()`, so placing a hover cannot silently change it.
|
||||
void set_crosshair_readout(bool on) noexcept { crosshair_.show_readout = on; }
|
||||
|
||||
/// Writes or clears the two **axis badges** (see `Crosshair::axis_labels`): the y value in
|
||||
/// the y label strip and the x value in the x label strip, at the heights and columns the
|
||||
/// crosshair's lines meet the axes at. Takes effect on the next `layout()`. **Not** part of
|
||||
/// `set_crosshair()`, for the same reason the readout flag is not.
|
||||
void set_crosshair_axis_labels(bool on) noexcept { crosshair_.axis_labels = on; }
|
||||
/// The axis-badge flag, as set.
|
||||
bool crosshair_axis_labels() const noexcept { return crosshair_.axis_labels; }
|
||||
|
||||
/// Overrides this plot's crosshair stroke and dash, in logical pixels, without touching the
|
||||
/// global style every other plot draws with (spec §17): each field left negative in `s`
|
||||
/// defers to the matching `Style::crosshair_*` metric, so `CrosshairStyle{}` (the default)
|
||||
|
||||
Reference in new issue
Block a user