This is a migrated thread and some comments may be shown as answers.

Q1 2010 Filtering problem

5 Answers 93 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ludovic Gerbault
Top achievements
Rank 1
Ludovic Gerbault asked on 15 Mar 2010, 09:35 AM
Hi

I've tried to combine the features of the radgrid grouping integration and the sorting and filtering mechanism.

The sorting works fine (except for the fact that I haven't yet managed to perfom sorting when you sort a group header), but the filtering seems a bit more complicated.

I subscribed to the filtered event of the grid, and in code behind, I use the to filteredevent to get the filterdescriptors that were both added and removed from the grid to add or remove them from the Chart

Removing works fine, but if I try add more than one ChartFilterDescriptor, the data won't display anymore, until I reset the filter (ergo removing all the ChartFilterDescriptors)

Is it a normal behaviour ?

ie : The filtering code I'm using

 
        void DetailInfo_Filtered(object sender, GridViewFilteredEventArgs e) 
        { 
            Queue<ChartFilterDescriptor> filtersToRemove = new Queue<ChartFilterDescriptor>(); 
 
            foreach (ChartFilterDescriptor descriptor in RadChart1.FilterDescriptors) 
            { 
                foreach (FilterDescriptor filter in e.Removed) 
                { 
                    if (descriptor.Value.Equals(filter.Value)) 
                        filtersToRemove.Enqueue(descriptor); 
                } 
            } 
 
            foreach (ChartFilterDescriptor descriptor in filtersToRemove) 
                RadChart1.FilterDescriptors.Remove(descriptor); 
 
            foreach (FilterDescriptor filter in e.Added) 
            { 
                RadChart1.FilterDescriptors.Add(new ChartFilterDescriptor(filter.Member, typeof(string), filter.Operator, filter.Value)); 
            } 
        } 
 

5 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 17 Mar 2010, 01:32 PM
Hi Subileau Pascal,

I'm afraid we cannot reproduce the problem. Please, take a look at the sample project I've attached - using the filtered event of the grid, both adding and removing of filter descriptors work as expected and the chart is are displayed correctly.

Should the sample code not help you, could you please isolate the issue in a project and send it to us, so we can inspect it further.

Sincerely yours,
Nikolay
the Telerik team

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? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 20 Aug 2010, 09:21 AM
Hi, I've just got back on this problem recently.

It seems that if I have 2 ChartFilterDescriptors on the same Member with the operator IsEqualTo, they conflict each other.

So I guess that the internal mechanism of the Chart is FilterDescriptor1 AND FilterDescriptor2 where I most certainly need FilterDescriptor1 OR FilterDescriptor2

because for instance, in my collection, it is impossible to have Country = France AND country = GB at the same time, which is why each time I have 2 filterdescriptors, the chart is always empty.

Am I correct, and if so, is there a way to change the interaction between 2 ChartFilterDescriptors ?
0
Nikolay
Telerik team
answered on 25 Aug 2010, 09:31 AM
Hello Subileau Pascal,

Indeed, this is how the mechanism of filtering worked in your specific version ( 2010.1.309 ), i.e. FilterDescriptor1 AND FilterDescriptor2. Our developers have worked on extending the filtering capabilities and have introduced CompositeFilterDescriptor, which would allow for specific operators to be set, so that you could have FilterDescriptor1 OR FilterDescriptor2, etc. This has been introduced with our Latest Internal Build, version 2010_2_0821.

Hope this helps.

All the best,
Nikolay
the Telerik team
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? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 25 Aug 2010, 10:06 AM
Hello

Thanks for the update

I did the upgrade to the last internal build, would you happen to have a code sample on how to use the CompositeFilterDescriptior inside a RadChart ?
0
Nikolay
Telerik team
answered on 27 Aug 2010, 09:17 AM
Hi Subileau Pascal,

Please, have a look at the code snippet below, which demonstrates how to use the CompositeFilterDescriptor :
CompositeFilterDescriptor compositeDescriptor = new CompositeFilterDescriptor();
compositeDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
compositeDescriptor.FilterDescriptors.Add( new FilterDescriptor( "City", FilterOperator.IsEqualTo, "Berlin", false ) );
compositeDescriptor.FilterDescriptors.Add( new FilterDescriptor( "City", FilterOperator.IsEqualTo, "Aachen", false ) );
this.radChart.FilterDescriptors.Add( compositeDescriptor );

Hope this helps.

Best wishes,
Nikolay
the Telerik team
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? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Ludovic Gerbault
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Ludovic Gerbault
Top achievements
Rank 1
Share this question
or