PieChartDataAdapter Class
The data adapter that provides data to generate Pie chart items.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v18.1.dll
Declaration
[DataAccessMetadata("All", SupportedProcessingModes = "Simple", Platform = "Win", EnableDirectBinding = false)]
[PieChartDataAdapter.PieBindingProperties]
public class PieChartDataAdapter :
ChartDataSourceAdapter
Example
The PieChartDataAdapter class is intended to automatically generate pie charts from a data source.
To do this, create the PieChartDataAdapter object, set its DataSourceAdapterBase.DataSource property and assign this data adapter to the VectorItemsLayer.Data property.
Then, specify the following properties of the PieChartDataAdapter object.
- The PieChartDataAdapter.PieItemDataMember property;
- The MapItemMappingInfo.Latitude and MapItemMappingInfo.Longitude mappings of the PieChartDataAdapter.Mappings property;
- The MapChartItemMappingInfo.Value mapping of the PieChartDataAdapter.Mappings property;
- The MapPieMappingInfo.PieSegment mapping of the PieChartDataAdapter.Mappings property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-use-piechartdataadapter-to-add-pie-charts-to-a-map-t141324
// Assign a PieChartDataAdapter object to Data.
PieLayer.Data = CreateData();
// Create pie chart data adapter and specify its parameters.
IMapDataAdapter CreateData() {
PieChartDataAdapter adapter = new PieChartDataAdapter() {
DataSource = LoadDataFromXml(xmlFilepath),
PieItemDataMember = "Name",
ItemMinSize = 20,
ItemMaxSize = 60
};
// Specify mappings.
adapter.Mappings.Latitude = "CapitalLat";
adapter.Mappings.Longitude = "CapitalLon";
adapter.Mappings.PieSegment = "MedalClass";
adapter.Mappings.Value = "Quantity";
// Specify measure rules
adapter.MeasureRules = new MeasureRules();
adapter.MeasureRules.RangeStops.Add(1);
adapter.MeasureRules.RangeStops.Add(10);
adapter.MeasureRules.RangeStops.Add(20);
adapter.MeasureRules.RangeStops.Add(30);
adapter.MeasureRules.RangeStops.Add(40);
return adapter;
}
private DataTable LoadDataFromXml(string path) {
DataSet ds = new DataSet();
ds.ReadXml(path);
DataTable table = ds.Tables[0];
return table;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PieChartDataAdapter class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.