The click attribute on the canvas element is expecting a callback. In your code, you put the result of the function onClick as a callback (undefined), not the function itself. So basically, you can remove the paranthesis in your code :

<canvas id="line" class="chart chart-line chart-xl" data="data" labels="labels" legend="true" click="onClick" series="series"></canvas>

Hope this helps,


Related Query

More Query from same tag