feat(plot): an x axis caption drawn as chrome, not as an annotation
A host that re-anchors its x labels on a grid has to name the anchor somewhere, and an `Annotation` cannot serve: its anchor is a data coordinate, so the caption crawls across the plot under a pan and drifts under a zoom. `Plot::set_x_note()` takes the host's own string -- the host is the only one that knows how much precision the sum of a label and its caption needs -- and `Renderer::draw_x_note()` places it in the axes' bottom-left corner in pixels, on the legend's own backplate. It is measured in the renderer rather than in `Plot::layout()` because it reserves no space and nothing can be picked on it, and a caption explaining the x labels must not be able to move the layout those labels were measured into. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
03c41adbec
commit
59c2e45af7
5 files changed
+150
No files matched your search
@@ -534,6 +534,12 @@ 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);
|
||||
/// `Plot::x_note()`, in the bottom-left corner of the axes on the legend's backplate. It is
|
||||
/// measured here rather than in `Plot::layout()` on purpose: unlike a legend it reserves no
|
||||
/// space and nothing can be picked on it, so there is no measurement a host or a test needs to
|
||||
/// read back, and a caption that explains the x labels must not be able to move the layout the
|
||||
/// labels were measured into.
|
||||
void draw_x_note(const Plot& plot, const PlotLayout& layout);
|
||||
/// The backplate the legend and the crosshair's readout share: the frame's background at
|
||||
/// `kLegendPanelAlpha` over `panel`, with a one-device-pixel border in `border` around the
|
||||
/// outermost pixels the fill covers (the crisp-hairline rule -- a border drawn on the measured
|
||||
|
||||
Reference in new issue
Block a user