PieSeriesDataAdapter Class
Provides the data for the PieChartView series.
Namespace: DevExpress.XamarinForms.Charts
Assembly: DevExpress.XamarinForms.Charts.dll
NuGet Package: DevExpress.XamarinForms.Charts
Declaration
public class PieSeriesDataAdapter :
DataSourceAdapterBase,
IPieSeriesData
Example
This example shows how to provide data for the PieSeries.
Note
If you want to provide data for the ChartView, use the SeriesDataAdapter class.
Set the PieSeries.Data property to a new PieSeriesDataAdapter
instance. Use the DataSource, ValueDataMember, and LabelDataMember properties to specify the data source for the chart, and to define data source members used to generate series points and labels.
using System.Collections.Generic;
using Xamarin.Forms;
// ...
class ViewModel {
public IReadOnlyList<LandAreaItem> LandAreas { get; }
public ViewModel() {
LandAreas = new List<LandAreaItem>() {
new LandAreaItem("Russia", 17.098),
new LandAreaItem("Canada", 9.985),
new LandAreaItem("People's Republic of China", 9.597),
new LandAreaItem("United States of America", 9.834),
new LandAreaItem("Brazil", 8.516),
new LandAreaItem("Australia", 7.692),
new LandAreaItem("India", 3.287),
new LandAreaItem("Others", 81.2)
};
}
}
class LandAreaItem {
public string CountryName { get; }
public double Area { get; }
public LandAreaItem(string countryName, double area) {
this.CountryName = countryName;
this.Area = area;
}
}
Inheritance
Object
DataSourceAdapterBase
PieSeriesDataAdapter
See Also