0
votes

Using chart.js, I've defined an onClick event handler for my chart and now tooltips don't appear when the mouse hovers over a bar, only when I click the bar.

My code looks like this:

events: ['click'],
                    onClick: function (evt, info) {
                            console.log(evt)
                            console.log(info)
                        }
                    }

How can I get tooltips to display on hover again?

1

1 Answers

0
votes

You will have to add the mousemove event also. This way you tell the browser to listen to mousemove event for the tooltip.

If you just specify click event then the chart will not respond to all other events like mousemove events.

Try this:

      events: ['click', 'mousemove' ],

         onClick: function (evt, info) {
              console.log(evt)
              console.log(info)
        },

You can look here ( link ) for more details regarding the chart.js events.