Filtering

This feature is available in data bound scenarios only!

The RadChart allows you to programmatically filter its data. This is achieved via the FilterDescriptors property of the RadChart or the FilterDescriptors 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 also to remove or clear the entries in it, too.

The items in this collection are of type ChartFilterDescriptor. It exposes a few important properties:

  • Member - defines the field of the data object, by which the data will be filtered.

  • Operator- defines the operator, which will be applied to the filtering criteria.

  • Value - defines the value that will be compared with the value of the Member property via the Operator property.

Here is an example of a chart without filter descriptors.

Silverlight RadChart without Filter Descriptors

Here is an example of implementing filtering.

To use the ChartFilterDescriptors 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:RadChart.FilterDescriptors> 
        <telerik:ChartFilterDescriptor Member="Quantity" 
                                       Operator="IsLessThanOrEqualTo" 
                                       Value="150" /> 
    </telerik:RadChart.FilterDescriptors> 
</telerik:RadChart> 

ChartFilterDescriptor descriptor = new ChartFilterDescriptor(); 
descriptor.Member = "Quantity"; 
descriptor.Operator = FilterOperator.IsLessThanOrEqualTo; 
descriptor.Value = 150; 
this.radChart.FilterDescriptors.Add(descriptor); 
Dim descriptor As New ChartFilterDescriptor() 
descriptor.Member = "Quantity" 
descriptor.[Operator] = FilterOperator.IsLessThanOrEqualTo 
descriptor.Value = 150 
Me.radChart.FilterDescriptors.Add(descriptor) 

Here is a snapshot of the result. Silverlight RadChart with Filtered Data

In this article