且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

图表;无法读取未定义的属性“0"

更新时间:2022-10-29 17:13:21

Your stack trace tells me that either ctx or chartData is undefined. My guess is that it's ctx if you've already checked chartData. (Verify this using console.log.) Perhaps this is the answer if that's the case: canvas.getContext("2d") is undefined

If that's not the case, then an element that ChartJS was looking for in your JSON was undefined. You'll have to look through the documentation to see what element is missing if that's the case.