Skip to content Skip to sidebar Skip to footer

How To Pass Array In Highchart ??

I have just started using highcharts and here I am stuck - I have 2 array named - js_platform, js_totalTest , which I am fetching from the database. The code to generate chart is

Solution 1:

Do something like -

series: 
    [{
        data:  [<?phpecho join($totalTest, ',') ?>]
    }]

Refer to the link (http://www.highcharts.com/docs/working-with-data/preprocessing-data-from-a-database)

Solution 2:

Try this way like. Your array js_totalTest contains the data and name values

Loop your array data

var arr = [];
for(var i=0;i<js_totalTest.length;i++)
{
    arr[i] = {};
    arr[i]['name'] = '';  //Here push your series name field in your example "John, Jane etc"for(var j=0;j<s.length;j++)
    {
            arr_data.push(parseInt(s[j]));
    }
    arr[i]['data'] = parseInt('') ;  // Here push your series data (Eg: 5 ,3 , etc.)
}

Pass arr in series

series: arr

Post a Comment for "How To Pass Array In Highchart ??"