New to Telerik UI for WPF? Download free 30-day trial


This feature is available in data bound scenarios only!

The RadChart allows you to programmatically sort its data. This is achieved via the SortDescriptors property of the RadChart or the SortDescriptors property of the SeriesMapping. This collection allows you to use descriptors which define the sorting member and the sorting direction for the data to which the RadChart is bound. As this is a collection, you are able not only to add, but to remove or clear the entries in it, too.

The items in this collection are of type ChartSortDescriptor. It exposes two important properties:

  • Member - defines the property of the data object, by which the data will be sorted.

  • SortDirection - defines the sorting direction.

Basically the sorting in the context of the RadChart represents the way in which the data points are connected. For example, if you have a LineSeriesDefinition and you define an ascending sorting, the line will connect the points in ascending order.

Here is an example of a chart without sorting descriptors.

WPF RadChart

Here is an example of implementing sorting.

To use the ChartSortDescriptors in XAML you have to declare the following namespace:

<!--  xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"  --> 

<telerik:RadChart x:Name="radChart"> 
        <telerik:ChartSortDescriptor Member="Quantity" SortDirection="Ascending" /> 

ChartSortDescriptor descriptor = new ChartSortDescriptor(); 
descriptor.Member = "Title"; 
descriptor.SortDirection = ListSortDirection.Ascending; 
Dim descriptor As New ChartSortDescriptor() 
descriptor.Member = "Title" 
descriptor.SortDirection = ListSortDirection.Ascending 

Here is a snapshot of the result. WPF RadChart

In this article