1👍
✅
pollPieChart
is a local variable, not a property on the event’s this
context.
Inside the 'data:update'
event listener, js automatically sets this
to be the element on which the event occurred (document.getElementById('')
).
Simply removing the this.
from before pollPieChart
inside the callback should fix it, as it is defined within the current closure, not the global window
object.
To place it on the global window (though it’s not necessary here),use
window.pollPieChart = new Chart(ctx,
type: 'pie'
data: data
animation: animateRotate:true)
Source:stackexchange.com