Legend Configuration
The legend provides a key to identify different series in your chart. Highcharts offers extensive options to customize legend appearance, position, and behavior.Basic Legend Setup
By default, legends are enabled and positioned at the bottom of the chart:Legend Positioning
Alignment and Layout
Fine-tuning Position
Usex and y offsets for precise positioning:
Legend Styling
Basic Appearance
From the Legend options (ts/Core/Legend/LegendOptions.ts:64-111):
Item Styling
Customize how legend items appear:Symbol Customization
Legend Behavior
Interactive Features
Series-Specific Legend Options
Control which series appear in the legend:Advanced Legend Features
Custom Legend Labels
Legend Title
Add a title to your legend:Reversed Legend
Reverse the order of legend items:Layout Options
Responsive Width
Control legend width based on container:Column Alignment
For vertical legends with multiple columns:Legend Events
Handle legend interactions:Theme Example
From the DarkUnica theme (ts/Extensions/Themes/DarkUnica.ts:137-153):
HTML Legends
Create completely custom legends using HTML:Accessibility
Ensure legends are accessible:Best Practices
Legend Design Tips
- Keep legend labels concise and descriptive
- Use consistent symbol sizes for visual harmony
- Position legends where they don’t obscure important data
- Enable navigation for legends with many items
- Consider using colors with sufficient contrast