In order to display a chart, you have to populate RadChart control with some data. You can do that in two ways:
The Populating with Data is part of Telerik UI for WPF, a
professional grade UI library with 160+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
The Populating with Data is part of Telerik UI for WPF, a professional grade UI library with 160+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
Manually, by adding chart points - DataPoints.
With data binding by using SeriesMapping/ItemMapping.
In this section you will find:
Data binding overview - here you will find information about the supported data sources and RadChart's data binding basics.
DataPoint class represents a single piece of data that is visualized in a chart series. Each DataPoint has various properties that allow you to define every chart piece, such as: XValue, YValue, BubleSize, etc. Notice that depending on the selected chart type only a subset of them will be applied to the distinct chart series e.g. DataPoint.BubbleSize is applicable only to Bubble / Bubble3D series types, while the Open, Close, High, Low values are applicable only to Stick / CandleStick charts.
However, even if some of the DataPoint properties are not required for the selected chart type, you can still bind or set them in order to use their values to format the item labels and/or tooltips. See Format Expressions and Formattin the tooltips.
Usually, data points are used when you want to show a chart with static data. For more information take a look at the Creating a Chart Declaratively topic and the Creating a Chart in Code-behind topic.
Data binding is one of the most powerful features provided by the .Net platform, that makes it easier to bind UI with the business logic. RadChart control supports data binding via SeriesMapping / ItemMapping.
SeriesMapping is used to define a single chart series. You need to add a separate SeriesMapping for each chart series that you would like to create from the data bound to the chart control. Each SeriesMapping holds a collection of ItemMapping instances which define the relation between individual data fields (in the context of the RadChart.ItemsSource) and the chart series fields (in the context of DataPointMember values) i.e. if you would like to bind the XValue and YValue of a Bar chart series items, you need to add a single SeriesMapping instance with two ItemMapping instances for the DataPointMember.XValue and the DataPointMember.YValue relations respectively.
DataPointMember and DataPoint classes are related. For each data item of the underlying data source, RadChart will create an instance of DataPoint and depending on the value of ItemMapping.DataPointMember will set the value of the corresponding property. What happens if you have SeriesMapping with two ItemMapping instances for the DataPointMember.XValue and the DataPointMember.YValue. RadChart will create one DataPoint where DataPoint.XValue will be set to the value of the data field specified for DataPointMember.XValue and DataPoint.YValue with the value of the data field specified for the DataPointMember.YValue.
More about data binding and supported data types you can see here.