score:17

Accepted answer

If you have that series data in an array, you can process it as follows:

var myData = [18, 635, 21, 177, 20, 165, 22, 163, 24, 162, 25, 145, 19, 143,
             23, 139, 26, 112, 27, 110, 28, 104, 30, 91, 29, 88, 31, 68, 32,
             57, 36, 55, 34, 53, 33, 51, 35, 46, 37, 44, 39, 42, 43, 39, 42, 
             39, 41, 38, 38, 37, 44, 36, 45, 34, 48, 31, 40, 31, 47, 27, 49,
             23, 46, 21, 50, 21, 52, 17, 55, 17, 53, 16, 51, 15, 54, 12, 58, 6,
             57, 6, 59, 4, 63, 4, 56, 3, 62, 2, 64, 2, 100, 2, 68, 1, 78, 1, 60,
             1, 97, 1, 70, 1, 65, 1, 69, 1, 71, 1];
var mySeries = [];
    for (var i = 0; i < myData.length; i++) {
        mySeries.push([myData[i], myData[i + 1]]);
        i++
    }

Once you have your series data in 'mySeries', you can just set your chart data using:

series:[{
    data: mySeries
}]

Alternatively, if you want to add the data after rendering the chart, you can add the series data dynamically using:

chart.series[0].setData(mySeries);

http://jsfiddle.net/Cm3Ps/ (press the 'Add My Data' button).

score:2

Actually, the function requires parameter as array of int.

Assume you get a function

drawChartFunction(data) {
    // some code here
    series: [{ data: data}]
} 

You can try it:

array = {9,8,7,6}
var series = [];
for (var i = 0; i < array.length; i++) {
    series.push([i, array.[i]]); 
}

After the for executed, your series likes

0,9
1,8
2,7
3,6

Then, you call drawChartFunction(series)

So your chart is drawn by using 4 points 0 1 2 3 with their values 9 8 7 6


Related Query

More Query from same tag