Skip to main content

DXChartBase.Legend Property

Gets or sets the chart’s legend.

Namespace: DevExpress.Xamarin.iOS.Charts

Assembly: DevExpress.Xamarin.iOS.Charts.dll

NuGet Package: DevExpress.XamarinForms.Charts

Declaration

public virtual DXLegend Legend { get; set; }

Property Value

Type Description
DXLegend

The chart legend.

Remarks

The Legend is a chart element that displays series and series points’ designations:

Legend example

Note that a legend’s content depends on a chart that displays legend:

How to: Change a legend’s position and layout

You can place a legend all around the chart area. For example, the following image shows the chart with the legend at the top-center, either horizontally or vertically:

TopOutside-Centered horizontal legend

The code below configures the legend as in the image above:

this.chart.Legend = new DXLegend {
    HorizontalPosition = DXLegendHorizontalPosition.center,
    VerticalPosition = DXLegendVerticalPosition.topOutside,
    Orientation = DXLegendOrientation.LeftToRight
};

Use the following symbols to configure a legend’s layout and position.

Symbol

Description

DXChartBase.Legend

Gets or sets the chart’s legend.

DXLegend

A chart element that displays series and series points’ designations.

DXLegend.HorizontalPosition

DXLegend.VerticalPosition

DXLegend.Orientation

How to: Show or hide a series in a legend

Use the DXSeriesBase.ShowInLegend property, to show or hide an individual series in a legend:

series.ShowInLegend = false;

How to: Configure a legend’s appearance

You can style a legend like any other chart element. Below are changeable appearance parameters:

Styleable legend elements

See the code snippet below to learn how to change this legend’s style:

// All sizes are in screen points.
legend.Style = new DXLegendStyle {
    BorderColor = UIColor.FromWhiteAlpha(0.4, 1),
    BackgroundColor = UIColor.FromWhiteAlpha(0.1647, 1),
    BorderThickness = 5,
    MarkerSize = 30,
    TextIndent = 25,
    ItemsVerticalIndent = 25,
    TextStyle = new DXTextStyle {
        FontSize = 30,
        ForegroundColor = UIColor.FromWhiteAlpha(0.5, 1)
    }
};

The following symbols customize the legend’s appearance:

Symbol

Description

DXLegend.Style

DXLegendStyle

See Also