Legend
The Chart legend displays the name of the configured data series.
To customize the legend, use the ChartLegend configuration component.
The following example demonstrates how to configure the position and orientation of the Chart legend.
Hiding the Legend
If you set the series names, the Chart displays a default legend.
The following example demonstrates how to hide the legend by using its visible
property.
Clicking Legend Items
Clicking the legend items triggers the onLegendItemClick
event which can be used to toggle the visibility of the clicked series. When onLegendItemClick
is not handled, the Chart itself toggles the series visibility.
Customizing the Position
You can remove the legend from the flow and absolutely position it by setting the position to custom
and configuring the offsetX
and offsetY
options.
Setting a Title
The Chart legend section can be configured to hold a title with customizable layout and content.
To define a title, use the ChartLegendTitle
component.