The data points in RadChartView are described by models of type that derives from the DataPoint object. The chart's series are using different data point classes based on their type. For example, the LineSeries, PointSeries, BarSeries and few more are using the CategoricalDataPoint class (derived from DataPoint) to describe the model of their data points. On the other hand, the scatter series as ScatterPointSeries are using the ScatterDataPoint class.
When you populate RadChartView's series with data there are two approaches which you can use
- Populate directly the DataPoints collection of the series - each chart's Series exposes a DataPoints collection which holds the plotted data points. Depending on the series type this collection can hold different objects (CategoricalDataPoint, ScatterDataPoint, etc.). You can populate this collection directly in code. In this scenario the DataItem of the DataPoint object won't be set because all necessary information is hold by the properties of the DataPoint class.
- Data Binding - You can create view model for the data points and populate the ItemsSource of the series with a collection that contains the view model objects. This will create an object of type DataPoint for each view model in the ItemsSource and it will add it in the series' DataPoints collection. In this scenario the DataItem property of the DataPoint objects will be set automatically to the view model behind the point.
In other words the DataItem property is read only and it cannot be set manually. If you want to have a value in the DataItem property you will need to populate the series using the data binding approach. However, if this doesn't work for you, you can bind the Source property of the Image element to another property of the DataPoint object (Value for example) and use an IValueConverter
which you can use to decide what image source to apply.
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items