Can not cancel draw of tooltip using beforeTooltipDraw
See original GitHub issueExpected behavior
When any plugin returns false from beforeTooltipDraw
, then the tooltip is canceled and not drawn. This is the stated behavior in the docs.
Example: https://codepen.io/granthynd/pen/GRxBgPr
Current behavior
Returning false from beforeTooltipDraw
does not seem to cancel anything. The Tooltip is still drawn.
Reproducible sample
https://codepen.io/granthynd/pen/GRxBgPr
Optional extra steps/info to reproduce
Just hover over a tooltip and you will see the console logs of each step.
Possible solution
No response
Context
I am trying to write a small custom plugin to draw a crosshair line on the chart, but the tooltip drawing seems to interfere with that, so I would like to cancel the drawing of the tooltip so I can manually update it myself.
chart.js version
v3.9.1
Browser name and version
Chrome 103
Link to your project
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
beforeTooltipDraw does not cancel draw - CodePen
The owner of this Pen needs to verify their email address to enable Full Page View. Their name is Grant. Feel free to...
Read more >Interface: ExtendedPlugin - Chart.js
Called before drawing the tooltip . If any plugin returns false , the tooltip drawing is cancelled until another render is triggered. #...
Read more >Moving vertical line when hovering over the chart using chart ...
This question is two years old. Nowadays, we can achieve this using plugins and hook calls in this case beforeTooltipDraw to capture the ......
Read more >Flickering with tracking ownerdraw ToolTip - MSDN - Microsoft
However, when the tooltip is drawn, the dummy text passed as argument to ToolTip.Show() is displayed just before ToolTip.Draw is called (as ...
Read more >ChartControl - @pnp/spfx-controls-react
To find sample code that you can use, visit the Chart. ... Note that this hook will not be called if the tooltip...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hopefully, it is that simple 🙏 I actually have not contributed to open source before, let me take a whack at creating a PR for it.
@LeeLenaleee I’m not 100% sure that’s an enhancement because it’s not working as designed, I guess. Nevertheless it could be a bug to fix in version 4.0 even because there is a workaround, setting
cancelable
totrue
inside the hook implementation.