Back to Devexpress

ChartControl.DataSource Property

wpf-devexpress-dot-xpf-dot-charts-dot-chartcontrol-e0793f35.md

latest4.3 KB
Original Source

ChartControl.DataSource Property

Gets or sets the chart control’s data source.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public object DataSource { get; set; }
vb
Public Property DataSource As Object

Property Value

TypeDescription
Object

A Object that represents the chart’s data source.

|

Remarks

Use the DataSource property for data binding using a series template.

When a data source is assigned to the DataSource property, define the name of a data column upon which new series will be created (and named), via the Diagram.SeriesDataMember property. And, for the Diagram.SeriesTemplate property, choose the common view type for the auto-created series. Then, assign the required data fields to the Series.ArgumentDataMember and Series.ValueDataMember properties.

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

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.

wpf-data-grid-display-chart-control-in-grid-details/CS/WpfApplication19/MainWindow.xaml#L20

xml
</StackPanel>
<dxc:ChartControl DataSource="{Binding Path=Orders}" Grid.Column="1" Height="200" Margin="10,10,10,10">
    <dxc:SimpleDiagram2D>

wpf-pivot-grid-visualize-data-in-chart/CS/WpfPivotChart/MainWindow.xaml#L39

xml
</dxpg:PivotGridControl>
<dxc:ChartControl DataSource="{Binding ElementName=pivotGridControl1, Path=ChartDataSource}"
          x:Name="chartControl1" Grid.Column="1" Grid.Row="1">

wpf-data-grid-create-master-detail-grid-in-code/CS/MasterDetailInCode/MainWindow.xaml#L17

xml
<DataTemplate x:Key="chartTemplate">
    <dxc:ChartControl DataSource="{Binding Path=Orders}">
        <dxc:SimpleDiagram2D>

See Also

SeriesDataMember

SeriesTemplate

Define a Template for Automatic Series

ChartControl Class

ChartControl Members

DevExpress.Xpf.Charts Namespace