DXLegend Class
A chart element that displays series and series points’ designations.
Namespace: DevExpress.Xamarin.iOS.Charts
Assembly: DevExpress.Xamarin.iOS.Charts.dll
NuGet Package: DevExpress.XamarinForms.Charts
Declaration
public class DXLegend :
DXChartElement
Related API Members
The following members return DXLegend objects:
Remarks
The Legend looks as follows:
Note that a legend’s content depends on a chart that displays legend:
The legend displays items that refer to series when the DXChart shows a legend. A legend item’s text contains DXSeriesBase.DisplayName in this case.
The legend displays items for series points if the DXPieChart shows a legend. The DXSeriesBase.LegendTextPattern property configures legend items’ text.
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:
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 |
---|---|
Gets or sets the chart’s legend. | |
| A chart element that displays series and series points’ designations. |
| |
| |
|
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:
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 |
---|---|
| |
|