Legend:update
methodLegend:update(options: chart.LegendUpdateOptions)Change the legend items, position, anchor, orientation, colors, or font size.
-- items replaces the whole list.
legend:update({
items = {
{ label = "North", color = color("#e69875") },
{ label = "South", color = color("#7fbbb3") },
},
anchor = "bottom_right",
orientation = "horizontal",
})options chart.LegendUpdateOptions options 8 keys Omitted keys keep their current value.
| Key | Type | Description |
|---|---|---|
| items | table | Legend entries array. |
| pos | table | Panel position, as a vec2. |
| anchor | "top_left" | "top_right" | "bottom_left" | "bottom_right" | "top_center" | "bottom_center" | Corner / edge the legend anchors to. |
| orientation | "vertical" | "horizontal" | Stack direction of legend items. |
| background | Color | Panel background color. |
| border | Color | Panel border color. |
| color | Color | Item label color. |
| font_size | number | string | Size of the item labels, or of a gradient legend's value labels — a number (px) or a unit string like "1.5rem"/"50vw". |