Skip to main content

Series.DataSource Property

Gets or sets a datasource which contains series data points.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.1.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

public object DataSource { get; set; }

Property Value

Type Description
Object

An object representing a series’ datasource.

Remarks

After the data source is assigned to the DataSource property, it is also required to provide appropriate values for the Series.ArgumentDataMember and Series.ValueDataMember properties.

Note that if the series’s data source implements the INotifyCollectionChanged interface, the Chart Control handles data source changes and updates the corresponding series. Call the ChartControl.UpdateData method to update data representation manually in other cases.

Example

The following example demonstrates how to bind a DXCharts control to an MDB database.

To accomplish this, it is necessary to add a corresponding DataSet to a project, and set the Series.ArgumentScaleType, Series.ArgumentDataMember, Series.ValueScaleType and Series.ValueDataMember properties to the required values.

Then, in a code-behind the Window.Initialize method, you can obtain all data from a DataSet, using the data adapter’s GetData method, and assign this data to a series’ Series.DataSource property.

<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" Title="Window1" Height="300" Width="396">
    <Grid>
        <dxc:ChartControl Name="chartControl1">
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram2D>
                    <dxc:XYDiagram2D.Series>
                        <dxc:BarSideBySideSeries2D Name="carSeries" ArgumentDataMember="Model" ValueDataMember="Price" />
                    </dxc:XYDiagram2D.Series>
                </dxc:XYDiagram2D>
            </dxc:ChartControl.Diagram>
        </dxc:ChartControl>
    </Grid>
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSource property.

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.

See Also