Skip to main content

DXPieChart.AddSeries(DXPieSeries) Method

Adds the specified series to the Pie Chart to display.

Namespace: DevExpress.Xamarin.iOS.Charts

Assembly: DevExpress.Xamarin.iOS.Charts.dll

NuGet Package: DevExpress.XamarinForms.Charts

Declaration

public virtual void AddSeries(
    DXPieSeries series
)

Parameters

Name Type Description
series DXPieSeries

The series to display.

Example

The Pie Chart displays data Series provide. Series that inherit the DXPieSeries class are compatible with the Pie Chart.

The following code snippet shows how to add a series to a chart:

this.pieChart.AddSeries(new DXDonutSeries {
    Data = LandAreaListDataAdapter(new List<LandAreaItem> {
        new LandAreaItem("Russia", 17.098),
        new LandAreaItem("Canada", 9.985),
        new LandAreaItem("China", 9.597),
        new LandAreaItem("USA", 9.525),
        new LandAreaItem("Brazil", 8.515)
    })
});

// ...
class LandAreaListDataAdapter : DXPieSeriesData {
    IReadOnlyList<LandAreaItem> landAreas;

    public CountryAreaData(IReadOnlyList<LandAreaItem> landAreas) {
        this.landAreas = landAreas;
    }

    public override int DataCount { get => landAreas.Count; }    
    public override getLabelByIndex(int index) => landAreas[index].CountryName;
    public func getValueByIndex(int index) => landAreas[index].LandArea;
}
class LandAreaItem {
    public string CountryName { get; }
    public double LandArea { get; }

    public LandAreaItem(string countryName, double landArea) {
        CountryName = countryName;
        LandArea = landArea;
    }
}

The following table contains methods allowing you to obtain, add or remove series of the chart:

Property or Method

Description

Series

Returns all series the Pie chart displays.

AddSeries(DXPieSeries)

Adds the specified series to the Pie Chart to display.

RemoveSeries(DXPieSeries)

Removes the specified series from the Pie Chart.

RemoveSeriesAtIndex(nint)

Removes a series with the specified index from the Pie chart.

Refer to the Series guide to learn more about chart series.

See Also