Skip to main content
The legend section controls where the legend sits and how it presents series. A legend appears automatically when a chart maps color (or group) to more than one series.

Options

position
'auto' | 'top' | 'bottom' | 'left' | 'right' | 'none'
default:"auto"
Where the legend sits. 'none' hides it; 'auto' lets the engine choose based on the chart.
display
'pill' | 'direct' | 'auto'
default:"auto"
How series are labelled:
  • 'pill' — a boxed legend with a swatch and label per series.
  • 'direct' — labels drawn next to each series’ endpoint, no separate legend box. Reads well on line charts.
  • 'auto' — resolved during compilation from the chart type and legend position.

Direct labels

Combine display: 'direct' with position to steer which side the labels flow toward:

Hiding the legend