1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    13
    Vote Rating
    0
    rans is on a distinguished road

      0  

    Default Unanswered: update chart pie after filter

    Unanswered: update chart pie after filter


    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



    1.jpg2.jpg

    thanks
    ran

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    435
    Answers
    3109
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    The pie should change automatically when the store changes as long as the events on the store fire.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    13
    Vote Rating
    0
    rans is on a distinguished road

      0  

    Default


    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.

Tags for this Thread