1๐
โ
Add typeof
to check if label is undefined, so hide()
or destroy()
if need it.
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
var label = data.labels[tooltipItem.index];
if(typeof label !== 'undefined') {
return label;
} else {
label.destroy();
}
}
}
}
1๐
First use typeof label != "undefined"
to see if its undefined or not.
Second use optionsSistema.defaults.global.tooltips.enabled = false;
this will remove the label.
Here is a demo of it.
0๐
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
var label = data.labels[tooltipItem.index];
if(label !== undefined){//use undefined instead 'undefined'
return label;
}else{
return label.destroy()
}
}
}
}
0๐
There is no other option than to use custom tooltip using custom property of tooltip object. Refer custom tooltips
Source:stackexchange.com