Skip to main content

Overview

The legend property controls where the legend appears and whether it’s visible. The legend shows which color or pattern represents each data series.

Position

'auto' | 'top' | 'right' | 'none'
default:"auto"
Where to position the legend: - 'auto' - Automatically determine the appropriate position based on chart size and type - 'top' - Show the legend above the chart - 'right' - Show the legend to the right of the chart - 'none' - Hide the legend completely
Even when the legend is hidden with position: 'none', series colors are still applied to the chart. The legend position only affects visibility and placement, not the styling.

Legend interaction

When visible, the legend is interactive:
  • Click a legend item to toggle the series visibility (in supported contexts)

Complete example