Skip to main content

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

Use x 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

1

Clickable Items

By default, clicking legend items toggles series visibility:
2

Checkboxes

Add checkboxes to legend items:
3

Navigation for Long Legends

Enable pagination for legends with many items:

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
Common Pitfalls
  • Too many legend items can overwhelm users
  • Floating legends may obscure data on smaller screens
  • Custom formatters can impact performance with many series
  • Ensure legend width doesn’t cause unwanted wrapping