Skip to main content

Module label

Module label 

Source

Structs§

PlotLabel
Text
A label PlotLabel draws: its text, where it sits relative to the plot origin and how it is drawn. font_size defaults to TEXT_SIZE.

Constants§

TEXT_GAP
The default gap, in pixels, between a label and what it labels.
TEXT_HEIGHT
The default height, in pixels, a label line takes: TEXT_SIZE plus TEXT_GAP.
TEXT_SIZE
The default label font size, in pixels, of Text and AxisText.

Functions§

measure_text_width
Returns the rendered width of text at font_size using the window’s current text style. Used for layout calculations that need to reserve space for labels before the scale ranges are fixed.
truncate_text_to_width
Truncate text with a trailing ellipsis so it fits within max_width at font_size. Returns text unchanged when it already fits; returns just the ellipsis when not even one character fits. max_width <= 0 is treated as “no budget” and returns text unchanged (the caller has no room to reason about).