The code below comes from a jupyter notebook:
from bokeh.io import show, output_notebook
from bokeh.plotting import ColumnDataSource, figure
from bokeh.models import HoverTool, Range1d
output_notebook()
fig = figure(tools=[HoverTool(tooltips=[("html", '@html{safe}')])])
fig.quad(left="left", top="top", bottom="bottom", right="right",
source=ColumnDataSource({"left": [1,3], "bottom": [1,3],
"right": [2,4], "top": [2,4],
"html":["<b>I'm bold</b>", "<span
style='color:red;font-size:32px;'>BIG RED TEXT</span>"]}))
show(fig)
I need to make the HoverTool tooltips stick to exactly where they are on a clicking the point, so if a user wanted to highlight the and copy the text in the tooltip they could. This codepen has an example of the type of behavior I would like to see. I know that this must be possible by either injecting some type of CustomJS or altering BokehJS coffescript and building BokehJS from scratch but I haven't been able to figure it out. Does anybody out there have any idea how to do this?
UPDATE:
It might be possible to a create a custom tool using the tap_tool.coffee, hover_tool.coffee or tooltip.coffee. I'll update this if I figure it out.
This is a workaround creating your own Hover text using
models.Label
inside the 'callback' function ofmodels.HoverTool
. Alsomodels.TapTool
is used for toggle updating the Label text. You can't edit the text in the glyphmodels.Label
, but anTextInput
widget
has been added where the text is updated as one hover the graph glyphs.