views:

29

answers:

1

if i am using below static values than my code is working fine:

ohlc = [[090300, 25.75, 25.75, 25.75, 25.75], 
  [090400, 25.75, 25.75, 25.75, 25.75], 
  [090700, 25.73, 25.73, 25.73, 25.73], 
  [091300, 25.76, 25.76, 25.76, 25.76]];

but if i am using below code than my code is not working

var labels = xmlDoc.getElementsByTagName('node');
        arr = new Array();
        var str = '';
        for (i = 0; i < labels.length; i++) {
            if (labels[i].childNodes.length >= 9) {
                arr[i] = new Array(5);
                arr[i][0] = labels[i].childNodes[1].textContent;
                arr[i][1] = labels[i].childNodes[3].textContent;
                arr[i][2] = labels[i].childNodes[5].textContent;
                arr[i][3] = labels[i].childNodes[7].textContent;
                arr[i][4] = labels[i].childNodes[9].textContent;
            }


        }

even i did loop on arr and alert the value than i have copyed value of array and pasted static and its working.. i am reading xml and creating an 2D array to show chart in jqphot. please give me a clue for this

+1  A: 

You probably need to convert the text strings to numbers. You would use the parseFloat function for that:

// ...
arr[i] = new Array(5);
arr[i][0] = parseFloat(labels[i].childNodes[1].textContent);
// ...
sje397
thanks let me try
Rajesh Rolen- DotNet Developer
wow..gr8.... its working now...thanks a lot .. thanks a lot
Rajesh Rolen- DotNet Developer