bokeh: [BUG] line_policy='none' for HoverTool does not generate any tooltip

Software versions

Python version : 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:35:26) [GCC 10.4.0] IPython version : 8.6.0 Tornado version : 6.2 Bokeh version : 3.0.1 BokehJS static path : /home/alsamii/conda3/envs/ml/lib/python3.10/site-packages/bokeh/server/static node.js version : v18.11.0 npm version : 8.19.2 Operating system : Linux-5.15.0-1022-azure-x86_64-with-glibc2.31

Browser name and version

Google Chrome Version 107.0.5304.87 (Official Build) (64-bit)

Jupyter notebook / Jupyter Lab version

3.5.0

Expected behavior

In version 2.4.3 I was able to use line_policy='none' in HoverTool, to get a tooltip that followed the mouse. But after I upgraded to 3.0.1, the following code does not generate any tooltip.

Observed behavior

By running the example code, the tooltip does not show up in version 3.0.1, but I am able to get the tooltip in v2.4.3.

Example code

import bokeh.plotting as bokplt
import bokeh.models as bokm
import bokeh.io as bokio

bokio.reset_output()
bokio.output_notebook()

p = bokplt.figure(width=800, height=200)

coord_hover_line = p.line(x=[0,100], y=[10, 5], alpha=0.0)

p.add_tools(bokm.HoverTool(
    tooltips=[("x ", "$x{0.0}")],
    renderers=[coord_hover_line],
    mode='vline',
    line_policy='none',
))

p.add_tools(bokm.CrosshairTool(dimensions="height", line_alpha=0.2))

bokio.show(p)

Stack traceback or browser console output

No response

Screenshots

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@AliSamiiXOM We will have to investigate. We may have to add something new. Or perhaps we will just add back explicit handling of none, and leave a more thorough rework of the hover tool for some later time. If I squint hard enough at the current help string for line_policy perhaps the previous behavior of "none" can be justified (but it would need documentation added). I supposed that would probably be least disruptive to users. If that happens it would be in a 3.0.2 release in ~6-7 weeks.

I don’t have any immediate WARs to suggest, if I think of one I will add it here.

@AliSamiiXOM please edit the issue to have a meaningful title.

At least, this was what I was getting with version 2.4.3. After upgrading to 3.0.1, the tooltip follows the line.

Also, you re going to need to provide some screenshots or video. I just tried your code above with 2.4.3 and 3.0.1 and it behaved identically (and as expected) in both cases for me. The tooltip stayed with the line with both (which is the behavior for as long back as I can recall).