PDA

View Full Version : update chart pie after filter



rans
8 Nov 2012, 7:39 AM
hi,

I am having problem with filtering my chart fields.
I have a chart pie that contain some fields. the user can filtering the chart pie and select which fields he want to see.
the problem is if the pie had 8 fields and now the user selecet only 6 fields, the filtering filter only the data but not filter the fields as well.

for example, if I have the fields
{name:'Asia','data1':9, sex:'Male'},
{name:'Africa','data1':2, sex:'Male'},
{name:'Europe','data1':5, sex:'Female'},
{name:'USA','data1':3, sex:'Male'},

and I want to filter Asia, Africa and Europe, I can still see the USA name fields.

the code:
storeIng.filterBy(function(record,id){
var fieldName = record.get('name')
for(var i = 0; i < fields.length; i++) {
if (fields[i] === fieldName)
return true;
}
return false;
});

I add screen shots as well



3992439925

thanks
ran

mitchellsimoens
10 Nov 2012, 6:15 AM
The pie should change automatically when the store changes as long as the events on the store fire.

rans
11 Nov 2012, 4:55 AM
the pie change but it seems like I have a "ghost" field as you can see on the attheched pics.
moreover, I did the same action on ext-4.0.7-gpl/examples/charts/Pie.html

handler: function() {
//store1.loadData(generateData(6, 20));
fields = ["June", "May"];
store1.filterBy(function(record,id){
var fieldName = record.get('name')
for(var i = 0; i < fields.length; i++) {
if (fields[i] === fieldName)
return true;
}
return false;
});
}

and the result remain the same, I have a ghost fields of all the other month.