Skip to main content
A newer version of this page is available.

DXChart.AddSeries(DXSeries) Method

Adds the specified series to the Chart for display.

Namespace: DevExpress.Xamarin.iOS.Charts

Assembly: DevExpress.Xamarin.iOS.Charts.dll

Declaration

public virtual void AddSeries(
    DXSeries series
)

Parameters

Name Type Description
series DXSeries

The series to display.

Example

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

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

this.chart.AddSeries(new DXLineSeries {
    Data = new GdpData(new List<Gdp> {
        new Gdp(year:2015, value:18.037),
        new Gdp(year:2014, value:17.393),
        new Gdp(year:2013, value:16.692),
        new Gdp(year:2012, value:16.155),
        new Gdp(year:2011, value:15.518),
        new Gdp(year:2010, value:14.964),
        new Gdp(year:2009, value:14.419),
        new Gdp(year:2008, value:14.719)
    })
});

// ...
class GdpData : DXNumericSeriesData {
    List<Gdp> gdpPoints;

    public GdpData(List<Gdp> points) {
        this.gdpPoints = points;
    }

    public override int DataCount { get => gdpPoints.Count; }
    public override double GetArgumentByIndex(int index) => gdpPoints[index].Year;
    public override double GetValueByIndex(int index) => gdpPoints[index].Value;
}

class Gdp {
    public int Year { get; private set; }
    public double Value { get; private set; }

    public Gdp(int year, double value) {
        this.Year = year;
        this.Value = value;
    }
}

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

Symbol

Description

DXChart.Series

Returns all series the Pie chart displays.

DXChart.AddSeries(DXSeries)

Adds the specified series to the Chart for display.

DXChart.RemoveSeries(DXSeries)

Removes the specified series from the Chart.

DXChart.RemoveSeriesAtIndex(nint)

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

DXSeries

The base class for all series the DXChart displays.

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

See Also