[Chartjs]-Angular chart.js onClick is not working โ€“ how to get all elements of a bar when it is clicked on

8๐Ÿ‘

โœ…

TRY adding the following on-click event handler in your chart options โ€ฆ

options: {
   onClick: function(e) {
      var element = this.getElementAtEvent(e);
      if (element.length) {
         console.log(element[0])
      }
   },
   ...
}

This should work as far as I can tell

Leave a comment