score:2

make an array of avg instead of having avg1, avg2 etc....

$graph_data = array('categories'=>$categories, 'avgs'=>$array_of_avgs)

then in javascript side

success: function(data){

            options.xAxis.categories = data.categories;
            for(var i in data.avgs){
               options.series[i].name = 'Avg'+i;
               options.series[i].data = data.avgs[i];
            }


            var chart = new Highcharts.Chart(options);

And everything will be fine


Related Articles