Back to Devexpress

SeriesDataAdapter Class

maui-devexpress-dot-maui-dot-charts-48b237c6.md

latest3.3 KB
Original Source

SeriesDataAdapter Class

Provides the data for the ChartView series.

Namespace : DevExpress.Maui.Charts

Assembly : DevExpress.Maui.Charts.dll

NuGet Package : DevExpress.Maui.Charts

Declaration

csharp
[ContentProperty("ValueDataMembers")]
public class SeriesDataAdapter :
    DataSourceAdapterBase,
    IXYSeriesData,
    IChangeableSeriesData

Example

This example shows how to provide data for the ChartView series.

Set the Data property of your series to a new SeriesDataAdapter instance. Use the DataSource, ArgumentDataMember, and ValueDataMembers properties to specify the data source for the chart, and to define data source members used to generate series points and labels.

csharp
public class MainViewModel {
    public List<Gdp> Gdps { get; }
    public IList<GdpValue> GdpValueForChina => Gdps[0].Values;

    public MainViewModel() {
        Gdps = new List<Gdp> {
            new Gdp(
                    "China",
                    new GdpValue(new DateTime(2017, 1, 1), 19.391),
                    // ...
                    new GdpValue(new DateTime(2007, 1, 1), 14.478)
                    ),
            };
    }
}
// ...
public class GdpValue {
    public DateTime Year { get; }
    public double Value { get; }

    public GdpValue(DateTime year, double value) {
        this.Year = year;
        this.Value = value;
    }
}
xaml
<dxc:ChartView>
    <dxc:ChartView.BindingContext>
        <local:ViewModel/>
    </dxc:ChartView.BindingContext>
    <dxc:ChartView.Series>
        <dxc:LineSeries>
            <dxc:LineSeries.Data>
                <dxc:SeriesDataAdapter DataSource="{Binding GdpValueForChina}"
                                       ArgumentDataMember="Year">
                    <dxc:ValueDataMember Type="Value" Member="Value"/>
                </dxc:SeriesDataAdapter>
            </dxc:LineSeries.Data>
        </dxc:LineSeries>
    </dxc:ChartView.Series>
</dxc:ChartView>

Implements

INotifyPropertyChanged

IDisposable

IXYSeriesData

IChangeableSeriesData

Inheritance

System.Object BindableObject DataSourceAdapterBase SeriesDataAdapter

Extension Methods

Yield<SeriesDataAdapter>()

YieldIfNotNull<SeriesDataAdapter>()

See Also

SeriesDataAdapter Members

DevExpress.Maui.Charts Namespace