Results 1 to 2 of 2

Thread: Use numeric value of nested json data in Extjs 4 chart

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    25
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    The week number needs to be within the object
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •