Skip to main content
A newer version of this page is available. .

XRChart.DataSource Property

Gets or sets the chart control’s data source. If it’s empty, then the report’s data source will be used.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatData)]
public object DataSource { get; set; }

Property Value

Type Description
Object

A Object representing the chart control’s data source.

Remarks

Use the DataSource property to specify the data source from which the current chart control will obtain information about the data series it displays.

Note

If the data source isn’t set for the XRChart control (the DataSource property is set to null), then the data source will be obtained from the XtraReportBase.DataSource property of the report which contains this XRChart control.

There are two types of data binding available in a chart control: you can bind each series separately (series binding) or the entire chart (chart binding) to data. In both cases you first need to create a data source (any object which implements either IList, IListSource or IBindingList interfaces), and then assign it to the DataSource property.

If series binding is used (that is one or more series are contained within the XRChart.Series collection and both the SeriesBase.ArgumentDataMember and SeriesBase.ValueDataMembers properties of each series are correctly set), you can specify different data sources for each series using a series’ Series.DataSource property. In this case, the Series.DataSource property defined for a series has a higher priority than the DataSource property of the chart control.

Note that data binding performed at the chart control level (chart binding) can force series objects to be created dynamically based upon the common template settings. To do this, you should set the DataSource and XRChart.SeriesDataMember properties of a chart control and assign the required data fields to the SeriesBase.ArgumentDataMember and SeriesBase.ValueDataMembers properties which are available via the XRChart.SeriesTemplate property of the chart control. The series objects obtained automatically from a data source specified in this manner will not exist within the XRChart.Series collection and can be customized using the XRChart.SeriesTemplate settings.

Implements

DevExpress.Data.IDataContainerBase.DataSource
See Also