Skip to main content

Adding Legends

At Design Time

You can add a new legend to a chart at design time as follows:

  1. Select the chart. In the Properties window, locate the ChartControl.Legends property and click the ellipsis button. In the editor, click Add.

    AddAdditionalLegend

  2. Use the Legend.DockTarget property to dock the legend to the required pane or chart control.

    LegendDocking

  3. Position the legend using LegendBase.AlignmentVertical and LegendBase.AlignmentHorizontal properties.

    LegendAlignment

    Tip

    For more information on the legend layout, read the following help topic: Legends Alignment and Layout.

  4. Assign the legend to a series, indicator, constant line or strip using the SeriesBase.Legend, Indicator.Legend, ConstantLine.Legend or Strip.Legend property respectively.

LegendAssigning

The following image shows the result:

AdditionalLegend

Note

The additional legend will not be displayed at runtime until it is assigned to a series, indicator, constant line, or strip. At design time, an empty legend will be labeled with Empty Legend text.

In Code

The following help topic describes how to add additional legends at runtime: How to: Add an Additional Legend to a Chart.

Example: Add an Additional Legend to a Chart

View Example

WinForms - Add an Additional Legend to a Chart, DevExpress

Example: Show a Chart Legend with Markers in a Separate Control

This example shows a ChartControl legend in a GridControl.

View Example

WinForms - Show a Chart Legend with Markers in a Separate Control, DevExpress