A newer version of this page is available. Switch to the current version.

ChartDataSourceAdapter Class

The base class for data adapters that provide data to generate chart items.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v18.2.dll

Declaration

public abstract class ChartDataSourceAdapter :
    DataSourceAdapterBase,
    IMapChartDataAdapter,
    IMapDataAdapter,
    ILockableObject,
    ILegendDataProvider,
    IChartDataAdapterCore
Public MustInherit Class ChartDataSourceAdapter
    Inherits DataSourceAdapterBase
    Implements IMapChartDataAdapter,
               IMapDataAdapter,
               ILockableObject,
               ILegendDataProvider,
               IChartDataAdapterCore

Remarks

This class introduces the ChartDataSourceAdapter.ItemMinSize and ChartDataSourceAdapter.ItemMaxSize properties to specify the maximum and minimum sizes of adapter generated chart items. The ChartDataSourceAdapter also introduces the ChartDataSourceAdapter.MeasureRules property, that allows specifying the rules for size changes, depending on the chart item value.

Examples

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.

    // 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;
}

Implements

See Also