Skip to main content

Legend.Orientation Property

Gets or sets whether legend items are arranged in a column (from the top to the bottom) or row (from the left to the right). This is a bindable property.

Namespace: DevExpress.Maui.Charts

Assembly: DevExpress.Maui.Charts.dll

NuGet Package: DevExpress.Maui.Charts

Declaration

public LegendOrientation Orientation { get; set; }

Property Value

Type Default Description
LegendOrientation LeftToRight

A LegendOrientation enumeration value that specifies the legend orientation.

Available values:

Name Description
LeftToRight

Legend items are positioned horizontally from the left to the right according to the corresponding series indexes within a chart view.

LegendOrientation.LeftToRight

TopToBottom

Legend items are positioned vertically from the top to the bottom according to the corresponding series indexes within a chart view.

LegendOrientation.TopToBottom

Remarks

Use the Orientation property to specify whether the legend should be vertically or horizontally oriented.

Example

This example shows how to add a legend to a pie chart and adjust the legend settings.

  1. To add a legend to the chart, assign a Legend object to the PieChartView.Legend property and use the following properties of this object to specify the legend orientation and position:

    • Orientation - display legend items in a row, from left to right.
    • VerticalPosition - place the legend above the chart diagram.
    • HorizontalPosition - align the legend horizontally to the center.
  2. Set the Legend.Style property to a LegendStyle object and specify the following properties of this object to configure the legend appearance:

  3. To exclude points of the chart’s first series from the legend, set the VisibleInLegend property of this series to false.

Chart Legend

<dxc:PieChartView x:Name="chartView">
    <dxc:PieChartView.Series>
        <dxc:DonutSeries Data="{Binding SecuritiesByTypes}" VisibleInLegend="False"/>
        <dxc:DonutSeries Data="{Binding SecuritiesByRisk}"/>
    </dxc:PieChartView.Series>
    <dxc:PieChartView.Legend>
        <dxc:Legend Orientation="LeftToRight"
                    VerticalPosition="TopOutside"
                    HorizontalPosition="Center">
            <dxc:Legend.Style>
                <dxc:LegendStyle BorderColor="LightGray" BorderThickness="3"
                                 BackgroundColor="Gray"
                                 MarkerSize="30" TextIndent="10"
                                 ItemsHorizontalIndent="50"
                                 Padding="150,150,10,10">
                    <dxc:LegendStyle.TextStyle>
                        <dxc:TextStyle Color="White" Size="24"/>
                    </dxc:LegendStyle.TextStyle>
                </dxc:LegendStyle>
            </dxc:Legend.Style>
        </dxc:Legend>
    </dxc:PieChartView.Legend>
</dxc:PieChartView>
See Also