我有以下数组,可用于绘制带有高脚椅的饼图
这是我的代码
var dataChart = [];
function getData()
{
return $.get('/report/charts-top-10-claimant')
.done(function(data) {
for (var i=0; i<data.length; i++) {
dataChart.push(data[i]);
}
});
}
getData();
$(function() {
console.log(dataChart);
$('#test').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: ''
},
tooltip: {
pointFormat: '{point.y} <b>({point.percentage:.1f}%)</strong>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</strong>: {point.y} ({point.percentage:.1f}%)',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
colorByPoint: true,
data: []
}]
});
$('#claimant-by-amount').on('click', function(e) {
var chart = $('#test').highcharts();
chart.series[0].setData(dataChart);
});
});
加载页面并检查错误控制台后,提示“未捕获的Highcharts错误#14:www.highcharts.com/errors/14”。怎么了,请帮帮我
答案 0 :(得分:1)