Legend.DockTarget Property

Specifies the element (chart or pane) to which the legend is docked.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v19.2.dll

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Layout)]
public ChartElement DockTarget { get; set; }
<XtraChartsLocalizableCategory(XtraChartsCategory.Layout)>
Public Property DockTarget As ChartElement

Property Value

Type Description
ChartElement

A ChartElement class descendant representing the dock target for the legend.

Remarks

Use the DockTarget, Legend.AlignmentVertical and Legend.AlignmentHorizontal properties to position the legend relative to its dock target.

For more information, refer to Legends Alignment and Layout.

Examples

To add an additional legend to a chart, create a new instance of the Legend class and add it to the ChartControl.Legends collection. Configure its Legend.DockTarget, Legend.AlignmentVertical and Legend.AlignmentHorizontal properties to specify the legend position within the chart.

NOTE

Note that the legend will not be shown until it is assigned to the SeriesBase.Legend, Indicator.Legend, ConstantLine.Legend or Strip.Legend property.

// Create a new instance of Legend.
Legend macdLegend = new Legend();
chart.Legends.Add(macdLegend);
// Specify the legend position.
macdLegend.DockTarget = diagram.Panes.GetPaneByName("macdPane");
macdLegend.AlignmentHorizontal = LegendAlignmentHorizontal.Left;
macdLegend.AlignmentVertical = LegendAlignmentVertical.Top;

// Assign the data displayed in the legend.
macd.Legend = macdLegend;
See Also