Am trying to draw a pie chart with highcharts, after spending hours trying to figure out how process a JSON string into a javascript array. This is what i have
gateway_useage: function(usage_data) {
var options = {
chart: {
renderTo:'gateway-usage',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: { text: 'Gateway Usage' },
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
}
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: 'Usage',
}]
}
var serie1 = usage_data.map( function(e) {
return [e.gateway, e.val];
});
options.series.push({data: serie1});
var chart = new Highcharts.Chart(options);
}
After loading the page and checking the error console saying "Uncaught Highcharts error #14: www.highcharts.com/errors/14 ". What am doing wrong, please help me out
See Question&Answers more detail:os