[Chartjs]-How can I hide tooltip in Chart.js on a specific data label?

25👍

You can simply filter tooltips:

options: {
    tooltips: {
       filter: function (tooltipItem, data) {
           var label = data.labels[tooltipItem.index];
           if (label == "Red") {
             return false;
           } else {
             return true;
           }
       }
    }
}

See this jsfiddle: https://jsfiddle.net/beaver71/ndc2uao2/

3👍

Update for Chart.js 3:

options: {
  plugins: {
    tooltip: {
       filter: function (tooltipItem, data) {
           return tooltipItem.label === "Red";
       }
    }
  }
}

Leave a comment