Chartjs-Angular 2 – Invoking function from a JS file (chart.js) – function not found

0πŸ‘

βœ…

To whoever may be interested – I ended up digesting the chart.js code and writing some custom functions within my Angular 2 files to take the event and extract the data (by detecting the mouse position and seeing what items were clicked on, etc).

If anyone needs any help or insight, please let me know and I’ll be happy to provide

0πŸ‘

This is probably another issue, but where is e coming from? It’s weird for the myNewChart.getElementsAtEvent(e) call to be floating around without being inside some sort of callback like

myChart.onclick = function(e){
        var points = myChart.getElementsAtEvent(e)
}

Also is your new Chart definitely a chart.js Chart object and not something else? I’ve never used ng2-charts but does it provide it’s own Chart object that’s missing this method?

Leave a comment