0
這是我的代碼:的Ajax highcharts餅圖不顯示數據
$.ajax({
url: 'dashboard/gender',
type: 'post',
async: true,
dataType: "json",
success: function (data) {
visitorData(data);
}
});
function visitorData (data) {
$('#gender-pie').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Genders'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: data,
});
}
下面是響應:{ 「男性」:9 「女」:2}
我的控制器200確定。正確傳遞數據。但數據不在我的分區內。標題顯示正確。
我實際上解析我的數據轉換成JSON發送它們(從控制器功能)之前,所以這不是我的情況。 @將 –