Chart.js
Chart.js copied to clipboard
Cant disable `onhover` for dataset
Expected behavior
It should disable
Current behavior
It is not being disabled
Reproducible sample
onhover return is not being honored
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
The code below should disable the hover effect for all the datasets except 1. However it has no effect.
onHover:function(evt,activeEls,chart) {
console.log(evt,activeEls,chart);
if (activeEls.datasetIndex === 1) {
return true;
}
else{
return false;
}
},
chart.js version
latest
Browser name and version
chrome latest
Link to your project
No response
If you want your onHover function to only work for 1 dataset you need to write it like this:
onHover:function(evt,activeEls,chart){
if (activeEls.datasetIndex !== 1) {
return;
}
// Your actual code
},
Closing as this is not a bug, just a wrong implementation