Results 1 to 8 of 8

Thread: RadarAxis drawAxis method

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2011
    Posts
    13
    Vote Rating
    0
      0  

    Default RadarAxis drawAxis method

    Hello,

    I have a radar chart that I've integrated inside the portal example.
    When the chart gets rendered I noticed in firebug an error: "sprites[i + j] is undefined".
    I've debugged the application and I saw that j is undefined in the method: the only reference to it is a declaration on line 44054, but it is used on line 44101 on the store.each function.
    What is the logic behind using the j variable?

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,154
    Answers
    87
    Vote Rating
    34
      0  

    Default

    Can you post a small code sample?

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2011
    Posts
    13
    Vote Rating
    0
      0  

    Default Code sample

    Code:
     
    for (i = 0; i < steps; i++) {                sprites[i].setAttributes({
                        x: centerX,
                        y: centerY,
                        radius: Math.max(rho * (i + 1) / steps, 0),
                        stroke: '#ccc'
                    }, true);
                }
                
                store.each(function(rec, j) {
                    sprites[i + j].setAttributes({
                        path: ['M', centerX, centerY, 'L', centerX + rho * cos(j / l * pi2), centerY + rho * sin(j / l * pi2), 'Z'],
                        stroke: '#ccc'
                    }, true);
    });
    The problem appears on store.each(function(rec, j)) method body.
    j is undefined here.

  4. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,154
    Answers
    87
    Vote Rating
    34
      0  

    Default

    Are you shure that i isnt undefined instead of j?

    Firebug can be misleading somethimes.

    And what is Store, an Ext Array? Can you give its definition.

  5. #5
    Ext JS Premium Member
    Join Date
    Nov 2011
    Posts
    13
    Vote Rating
    0
      0  

    Default

    store is a reference to the attached Store of the view. It contains data that gets displayed in the chart.
    i can't be undefined as its value is set in the for structure. j is undefined as it is not manipulated anywhere inside the body of the function(drawAxis).

  6. #6
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,154
    Answers
    87
    Vote Rating
    34
      0  

    Default

    If it is out of scope then it can be undefined. But ok.

    its possible that the each function on the store only has one input param. Store.data had three.

    So try

    Code:
    store.data.each(function(rec, j) {
        sprites[i + j].setAttributes({
            path: ['M', centerX, centerY, 'L', centerX + rho * cos(j / l * pi2), centerY + rho * sin(j / l * pi2), 'Z'],
            stroke: '#ccc'
        }, true);
    });

Posting Permissions

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