Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide/disable tooltips chart.js

I'm trying to hide the tooltips in a line chart using chart.js.

I have tried this code, but they never hide.

Chart.defaults.global.tooltipenabled = false; 

You can see all the code here of the chart:

https://jsfiddle.net/w6zs07xx/ Thanks!

like image 779
user1937021 Avatar asked Apr 30 '16 10:04

user1937021


People also ask

How do I hide the tooltip of a specific data set?

length > 0) { // first check if the tooltip relates to a dataset index we don't want to show if (tooltipsToDisplay. indexOf(active[0]. _datasetIndex) === -1) { // we don't want to show this tooltip so set it's opacity back to 0 // which causes the tooltip draw method to do nothing chartInstance.

What is chart legend Javascript?

The chart legend displays data about the datasets that are appearing on the chart.


2 Answers

To turn off for a specific chart instead of in global defaults use this in the options object. Using v2.5.0

options: {     tooltips: {          enabled: false     } } 
like image 161
Jon Avatar answered Sep 25 '22 14:09

Jon


For me showTooltips = false didn't work.

My solution was:

Chart.defaults.global.tooltips.enabled = false; 

My version is:

2.1.4

like image 38
Diego Galocha Avatar answered Sep 23 '22 14:09

Diego Galocha