在花了几个小时试图弄清楚如何将 JSON 字符串处理成 javascript 数组之后,我试图用 highcharts 绘制一个饼图。这就是我所拥有的
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);
}
加载页面并检查错误控制台后显示“Uncaught Highcharts error #14: www.highcharts.com/errors/14”。做错了什么,请帮帮我