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

      0  

    Default Use numeric value of nested json data in Extjs 4 chart

    Use numeric value of nested json data in Extjs 4 chart


    My json looks like this :

    Code:
    {
        "Week": [
            1224,
            {
                "Total_OUT3F": 12,
                "Sev_Logged": "3_major",
                "Total_OUT3A5": 3,
                "IN1": 36,
                "OUT3FA_5": 15,
                "Total_IN1": 36,
                "OUT3A_5": 3,
                "OUT3-Fix": 12
            },
            1225,
            {
                "Total_OUT3F": 24,
                "Sev_Logged": "3_major",
                "Total_OUT3A5": 12,
                "IN1": 21,
                "OUT3FA_5": 21,
                "Total_IN1": 57,
                "OUT3A_5": 9,
                "OUT3-Fix": 12
            },
            1226,
            {
                "Total_OUT3F": 49,
                "Sev_Logged": "4_minor",
                "Total_OUT3A5": 17,
                "IN1": 40,
                "OUT3FA_5": 30,
                "Total_IN1": 97,
                "OUT3A_5": 5,
                "OUT3-Fix": 25
            }]}
    I'd like to get the "Week" values (1224,1225,1226) in the X axis of my chart. How can I do this please ?
    This is my model :

    Code:
    Ext.define('Metrics.model.GraphData', {
        extend: 'Ext.data.Model',
        fields: ['Week', 'OUT3FA_5','OUT3A_5','IN1','OUT3-Fix','Total_IN1','Total_OUT3F','Total_OUT3A5']
    });
    In my Chart js file, I put
    Code:
    xField = 'Week'
    but it doesn't take the numeric values.
    Please any help would be appreciated.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The week number needs to be within the object
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

Thread Participants: 1

Tags for this Thread