2๐
โ
Use ()=>
instead of function()
to keep the scope of this
within the callback:
canvas.onclick = (event) => {
... code to get the point clicked on such as
this.myChart.getPointsAtEvent( event )
};
For more details see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Functions/Arrow_functions
Source:stackexchange.com