[Chartjs]-Mouse over on line chart data active other data-set in Chart.js

5๐Ÿ‘

โœ…

Iโ€™ve tried edit the tooltips mode but the result is not I expected. It shows the tooltips in difference dataset with same index.

The tooltip configuration controls display of the tooltip popup, not the dataset points. Points are controlled by the hover configuration. This is mentioned on the page you linked (emphasis mine):

When configuring interaction with the graph via hover or tooltips, a number of different modes are available.

If you only want the single point you are hovering over to be highlighted, use:

options: {
  hover: {
    mode: 'point'
  }
}

If you want the whole dataset highlighted when hovering any single dataset point, use:

options: {
  hover: {
    mode: 'dataset'
  }
}

If you want to highlight the dataset and see all dataset values in the tooltip, use:

options: {
  hover: {
    mode: 'dataset'
  },
  tooltips: {
    mode: 'dataset'
  }
}

Leave a comment