我正在使用GoogleCharts API顯示與我的性別重新分區的餅,但我有一個小問題,我的餡餅是不完整的,如下圖所示。 谷歌圖表餡餅不完整
我這個JSON陣列產生的呢:
{"cols":[{"id":"","label":"Topping","pattern":"","type":"string"},{"id":"","label":"Slices","pattern":"","type":"number"}],"rows":[{"c":[{"v":"Homme","f":null},{"v":"2","f":null}]},{"c":[{"v":"Femme","f":null},{"v":"1","f":null}]}]}
這是我的Javascript代碼
function drawSexChart() {
var jsonData = $.ajax({
url: "http://localhost/studentlink/web/js/ajax.php?sexChart",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
console.log(jsonData);
var chart = new google.visualization.PieChart(document.getElementById('chartUsersBySex'));
chart.draw(data, null);
}
我沒有任何想法,爲什麼我的餡餅是uncomplete。
如果有人能幫助我?
預先感謝您
托馬斯