Back to Devexpress

PieSeriesDataAdapter.ValueDataMember Property

maui-devexpress-dot-maui-dot-charts-dot-pieseriesdataadapter.md

latest3.1 KB
Original Source

PieSeriesDataAdapter.ValueDataMember Property

Gets or sets the name of the data field that contains series point values. This is a bindable property.

Namespace : DevExpress.Maui.Charts

Assembly : DevExpress.Maui.Charts.dll

NuGet Package : DevExpress.Maui.Charts

Declaration

csharp
public string ValueDataMember { get; set; }

Property Value

TypeDescription
String

The name of the data field that contains series point values.

|

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.

csharp
using System.Collections.Generic;
using Microsoft.Maui.Graphics;
// ...

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;
    }
}
xaml
<dxc:PieChartView>
    <dxc:PieChartView.BindingContext>
        <local:ViewModel/>
    </dxc:PieChartView.BindingContext>
    <dxc:PieChartView.Series>
        <dxc:PieSeries>
            <dxc:PieSeries.Data>
                <dxc:PieSeriesDataAdapter DataSource="{Binding LandAreas}" 
                                          LabelDataMember="CountryName" 
                                          ValueDataMember="Area"/>
            </dxc:PieSeries.Data>
        </dxc:PieSeries>
    </dxc:PieChartView.Series>
</dxc:PieChartView>

See Also

PieSeriesDataAdapter Class

PieSeriesDataAdapter Members

DevExpress.Maui.Charts Namespace