Module legend
Expand description
Shared responsive legend layout for comparative charts.
measure, wrap and paint_entry lay out and paint a legend
from the theme: each entry is a series swatch and its Caption label,
measured by the renderer so long labels never overlap. layout is the
older renderer-free estimate. [SeriesToggles] is the legend’s
interactive half: which series people hid and where to click to toggle
them.
Structs§
- Legend
Entry - One measured legend entry.
Constants§
Functions§
- layout
- Place legend items left-to-right and wrap before the chart edge.
- measure
- Measure each label as an entry: swatch, gap, label; one
Captionline plus a tight step tall. - paint_
entry - Paint one entry into
rect: the series swatch, then its label in secondary ink, elided to the rect. - paint_
entry_ emphasised paint_entryfor a legend people point at: anemphasisedentry (the hovered or chosen series) reads in primary ink.- rows
- wrap
- Place measured entries left to right from
top, wrapping beforeright, a section step apart. An entry wider than the space is clamped to it (its label elides when painted).