2 thoughts on “getElementsAtEvent with multiple bar charts always returns the same datasetIndex

  1. Oh I found out how to do it. Use getDatasetAtEvent() along with getElementsAtEvent()

    getElements gives you all the bars at the x value, while getdataset gives you all the elements that have the same dataset as the one being clicked.

    Using them together produces this result.. https://jsfiddle.net/w6oxwwte/

  2. The underlying cause of this behaviour is that getElementsAtEvent was designed for use with the label tooltip mode. getElementAtEvent will get the first found element and is used for the single mode tooltip.

Comments are closed.