Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Chart.js bar chart: show tooltip on label hover

I'm using Chart.js library to draw a bar chart and I want to show tooltip not only on bar hover, but also on x-axis label hover for that bar. I found onHover method for configuration, but it only lets me access the array of currently hovered bars, which isn't useful.

So, how can I access mouse event and maybe take position from there to compare it against bar labels positions? Or there is another way to do it?

My current configuration:

const countryChartOptions = {
    hover: {
         onHover: this.onChartHover,

const onHover = (activeElements) => {

It only prints out hovered bars data, but I'm stuck to figure out how to extend it for behavior I need.

like image 207
kemsbe Avatar asked Jan 27 '17 18:01


2 Answers

What about :

options: {
  tooltips: {
    // Add this..
    intersect: false
like image 97
l2aelba Avatar answered Nov 10 '22 13:11


It works for me

  options: {
      intersect : false,
like image 31
Shivam Vyas Avatar answered Nov 10 '22 11:11

Shivam Vyas