LegendDirection Enum

Lists the values that specify the layout of legend entries associated with the series in the ChartControl.Series collection.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.1.dll

Declaration

[ResourceFinder(typeof(XtraChartsResFinder), "PropertyNamesRes")]
public enum LegendDirection
<ResourceFinder(GetType(XtraChartsResFinder), "PropertyNamesRes")>
Public Enum LegendDirection

Members

Name Description
TopToBottom

Speifies that legend entries are positioned vertically from the top to the bottom of the legend according to the indexes of the corresponding series within the ChartControl.Series collection. The lower the index that a series object has in the ChartControl.Series collection, the higher position its legend entry has within the legend.

BottomToTop

Specifies that legend entries are positioned vertically from the bottom to the top of the legend according to the indexes of the corresponding series within the ChartControl.Series collection. The lower index that a series object has in the ChartControl.Series collection, the lower position its legend entry has within the legend.

LeftToRight

Speifies that legend entries are positioned horizontally from the left to the right of the legend according to the indexes of the corresponding series within the ChartControl.Series collection. The lower index that a series object has in the ChartControl.Series collection, the closer to the left bound its legend entry is positioned within the legend.

RightToLeft

Speifies that legend entries are positioned horizontally from the right to the left of the legend according to the indexes of the corresponding series within the ChartControl.Series collection. The lower index a series object has in the ChartControl.Series collection, the closer to the right bound its legend entry is positioned within the legend.

Related API Members

The following properties accept/return LegendDirection values:

Library Related API Members
Cross-Platform Class Library Legend.Direction
WinForms Controls LegendModel.Direction

Remarks

The values listed by the LegendDirection enumeration are used to set the Legend.Direction property.

For more information, refer to Legends.

Examples

This example demonstrates how a chart's Legend can be accessed and customized at runtime.

To control whether series, indicators, Constant Lines and Strips should be shown in the legend, use their SeriesBase.ShowInLegend, Indicator.ShowInLegend, ConstantLine.ShowInLegend and Strip.ShowInLegend properties.

Legend legend = chartControl1.Legend;

// Display the chart control's legend.
legend.Visible = true;

// Define its margins and alignment relative to the diagram.
legend.Margins.All = 8;
legend.AlignmentHorizontal = LegendAlignmentHorizontal.RightOutside;
legend.AlignmentVertical = LegendAlignmentVertical.Top;

// Define the layout of items within the legend.
legend.Direction = LegendDirection.LeftToRight;
legend.EquallySpacedItems = true;
legend.HorizontalIndent = 8;
legend.VerticalIndent = 8;
legend.TextVisible = true;
legend.TextOffset = 8;
legend.MarkerVisible = true;
legend.MarkerSize = new Size(20, 20);
legend.Padding.All = 4;

// Define the limits for the legend to occupy the chart's space.
legend.MaxHorizontalPercentage = 50;
legend.MaxVerticalPercentage = 50;

// Customize the legend appearance.
legend.BackColor = Color.Beige;
legend.FillStyle.FillMode = FillMode.Gradient;
((RectangleGradientFillOptions)legend.FillStyle.Options).Color2 = Color.Bisque;

legend.Border.Visible = true;
legend.Border.Color = Color.DarkBlue;
legend.Border.Thickness = 2;

legend.Shadow.Visible = true;
legend.Shadow.Color = Color.LightGray;
legend.Shadow.Size = 2;

// Customize the legend text properties.
legend.Antialiasing = false;
legend.Font = new Font("Arial", 9, FontStyle.Bold);
legend.TextColor = Color.DarkBlue;
See Also