Overview
Legends help users identify the data series rendered in a Chart.
This example demonstrates the default legend behavior where each
series appears as an individual legend item based on its name by setting the Visible property in the ChartLegendSettings component to true.
Shapes
Legend shapes visually represent the corresponding data series in a Chart.
This example demonstrates customizing legend items using different shapes
such as Circle and Rectangle using the LegendShape property in the ChartSeries component to improve series differentiation.
Position
The legend position property controls where the legend is displayed
within the Chart area. This example demonstrates positioning the
legend at the top of the Chart by setting the Position property to LegendPosition.Top in the ChartLegendSettings component to improve visibility and layout.
Legend Custom Position
The legend can be positioned freely within the Chart area using custom
X and Y coordinates. This example demonstrates placing the legend at a
specific location to avoid overlapping with the plotted data by setting the Position property to LegendPosition.Custom and providing coordinates to the Location property in the ChartLegendSettings component.
Alignment
The legend alignment property controls how legend items are aligned
within the legend container. This example demonstrates aligning the
legend items to the far end by setting the Alignment property to Alignment.Far in the ChartLegendSettings component for improved visual balance.
Reverse (Inversed)
The inversed property allows you to reverse the order of legend items.
This is useful when the series rendering order needs to be displayed
in reverse within the legend for better comparison. This can be achieved by setting the Reverse property to true in the ChartLegendSettings component.
Toggle Visibility
The ToggleVisibility property allows users to show or hide a series by clicking on
its corresponding legend item. This example demonstrates how this feature can be used to compare
different product categories' revenue more effectively.
Size And Appearance
The legend's visual appearance can be customized using the Background property and the ChartLegendBorder component within the ChartLegendSettings component.
This example demonstrates how to set a background color and a border around the legend area to make it stand out.
Item Size
The size and spacing of legend items can be customized using the ShapeHeight, ShapeWidth, and ShapePadding properties in the ChartLegendSettings component.
This example demonstrates how to adjust these properties to change the dimensions of the legend shapes and the spacing between them and their labels.
Pagination
When the number of legend items exceeds the available legend area, pagination is automatically enabled.
This example demonstrates how to set a fixed Width and Height for the legend in the ChartLegendSettings component,
triggering the pagination behavior for the multiple series displayed in the chart.
Legend Text Customization
MaximumLabelWidth: Defines the maximum width of legend labels in the ChartLegendSettings component.
ChartLegendTextStyle: Enables detailed customization of the legend text appearance, such as font size, color, and weight.