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

      0  

    Default Unanswered: function to analyze store data then feed it to pie chart

    Unanswered: function to analyze store data then feed it to pie chart


    Hi everyone, so I have a store:

    Code:
        Ext.define('AM.store.Users', {
            extend: 'Ext.data.Store',
            model: 'AM.model.User',
            data: [
                {Name: 'derp', Grade: 'FR'},
                {Name: 'herp', Grade: 'SR'},
                         ....
                {Name: 'beavis', Grade: 'SR'}
            ]
         });
    And a chart:

    Code:
    Ext.define('AM.view.user.Chart' , {
            extend: 'Ext.chart.Chart',
            alias: 'widget.userchart',
                       ...(basic config stuff)...
            series: [{
                    type: 'pie',
                    //categoryField: 'Level',
                    angleField: 'Level',
                    showInLegend: true,
            }]
            //put functions here to analyze store?
        });
    I want the pie chart to show the grade-level distribution in my store. Do I have to write functions that analyze the store and pass new values to the pi chart? If so, where would I stick those functions in MVC architecture? Sorry if this question is too broad, I'm a beginner in extjs

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,935
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I am not sure I understand your request ...

    Are you asking how to create calculated fields?
    http://docs.sencha.com/ext-js/4-1/#!...ld-cfg-convert

    If you need to create functions, you can create an 'class' and include it in your app as needed.
    Scott.

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

      0  

    Default


    Thanks for the response scott, sorry my question was so unclear.

    Basically I have a store with a groupField and I would like to display those groups in a pie chart. So the group field would be the grade level and the chart would show the relative amounts of students in each grade. I don't know if there is an easy way to display fieldGroups in pie charts or if I have to calculate new fields that count up the number of entries with FR as their grade and so forth

Thread Participants: 1

Tags for this Thread