1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    18
    Answers
    1
    Vote Rating
    0
    siggi is on a distinguished road

      0  

    Default Unanswered: Chart with grouped Store

    Unanswered: Chart with grouped Store


    Hi,

    is there a possibility to reflect a grouped store in a chart, e.g. have a series for each store group?

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    91
    Answers
    6
    Vote Rating
    0
    alex9311 is on a distinguished road

      0  

    Default


    I went through this a while ago. I ended up making a new store out of my original store which had the group name and number in that group as field. I had a store called 'Chart' and grouped it by its 'level' field. Here is the code I used to create the store.

    Code:
            createStore:function(){
                    var store = Ext.data.StoreManager.lookup('Chart');
                    store.group('level');
                    var groups = store.getGroups();
                    // create new store basing on groups array
                    var groupStore = Ext.create('Ext.data.Store', {
                            model: 'C.model.GroupChart',
                            fields: [{
                                    name:'level', mapping: 'name'
                            }, {
                                    name: 'total', convert: function(value, record){
                                            return record.raw.children.length;
                                    }
                            }],
                            data: groups
                    });
            return groupStore;
            },

Thread Participants: 1