Skip to main content

Module legend

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§

LegendEntry
One measured legend entry.

Constants§

ROW_HEIGHT

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 Caption line 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_entry for a legend people point at: an emphasised entry (the hovered or chosen series) reads in primary ink.
rows
wrap
Place measured entries left to right from top, wrapping before right, a section step apart. An entry wider than the space is clamped to it (its label elides when painted).