我已经查询并且json在检查元素>网络>预览中显示数据 然后在我的js代码中获取它。
这里将提取数据
"dataSrc": function (jsn) {
fill_pie([jsn.all_acc, jsn.recordsFiltered], ['All Accounts', 'Verified Accounts']);
return jsn.data;
}
数据将在此处显示
function fill_pie(varData = [0], varLabel = ['No Data']) {
if (filterClick == 1) {
if (myChart) {
myChart.destroy();
}
var ctx = document.getElementById("myChart").getContext("2d");
myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: varLabel,
datasets: [{
data: varData,
backgroundColor: ["#83827E", "#00C851",],
}]
},
options: {
title: {
display: true,
text: "Real Property Tax Account"
},
responsive: true,
legend: {
display: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
userCallback: function (label, index, labels) {
// when the floored value is the same as the value we have a whole number
if (Math.floor(label) === label) {
return label;
}
},
}
}],
},
}
});
filterClick = 0;
}
}
fill_pie();
})
它显示“无数据”并且网络中没有错误。有什么问题吗?我该怎么办?