Expected behavior
When a tooltip has been filtered out, its callbacks should not run on hover. Running callbacks with missing parameters might have surprising consequences the user does not want.
Current behavior
At least the title callback is run with an empty TooltipItem array as parameter. Depending on how your callback is structured, this could break your code
Reproducible sample
https://codepen.io/ajuvonen/pen/OPWvmwG
Optional extra steps/info to reproduce
For demo purposes, all tooltips have been disabled. The title callback is run for each data point, however, and this causes console errors.
Possible solution
No response
Context
I have had to write a special guard in my title callbacks, even though in normal situations they can rely that the TooltipItem array is never empty.
chart.js version
4.5.1
Browser name and version
Firefox 152
Link to your project
No response
Expected behavior
When a tooltip has been filtered out, its callbacks should not run on hover. Running callbacks with missing parameters might have surprising consequences the user does not want.
Current behavior
At least the title callback is run with an empty TooltipItem array as parameter. Depending on how your callback is structured, this could break your code
Reproducible sample
https://codepen.io/ajuvonen/pen/OPWvmwG
Optional extra steps/info to reproduce
For demo purposes, all tooltips have been disabled. The title callback is run for each data point, however, and this causes console errors.
Possible solution
No response
Context
I have had to write a special guard in my title callbacks, even though in normal situations they can rely that the TooltipItem array is never empty.
chart.js version
4.5.1
Browser name and version
Firefox 152
Link to your project
No response