Chartjs-Wrong tootip in chartjs

0👍

tooltips.mode: 'index' finds items from different datasets that are at the same index each.

You should use tooltips.mode: 'x' instead, it returns all items that would intersect based on the x coordinate of the position only.

options: {
    ...
    tooltips: {
      mode: 'x',
      intersect: 'true'
    }
},

Please also have a look at the this Chart.js samples page, which illustrates the behavior of the different combinations of the options tooltips.mode and tooltips.intersect.

Leave a comment