Skip to main content

Module legend

Module legend 

Source
Expand description

Legend layout and rendering.

This module handles the positioning, measurement, and drawing of legend boxes within a plot area. A legend consists of one or more LegendEntry items, each displaying a color swatch (line segment or filled rectangle) alongside a text label.

§Usage

  1. Build a Vec<LegendEntry> from the artists on your axes (typically by iterating over labeled artists and calling LegendEntry::line or LegendEntry::filled).
  2. Call draw_legend with the renderer, entries, plot area, desired Loc, and active Theme.

The legend is drawn last in the render pipeline so it appears on top of all data elements.

Structs§

LegendEntry
A single legend entry consisting of a color swatch and a text label.

Enums§

SwatchKind
Describes the visual representation of a legend swatch.

Functions§

draw_legend
Renders a legend box at the specified location within the plot area.