hover tool in toolbar

Hi,

I can’t seem to have the hover tool show up in the toolbar since I updated from 0.12.4 to 0.12.6, anyone knows how to get it back?

from bokeh.plotting import figure

from bokeh.models import HoverTool

from bokeh.layouts import gridplot

from bokeh.resources import CDN

from bokeh.embed import file_html

fig = figure(tools=“box_zoom,save”)

fig.line(x=range(10),y=range(10))

fig.add_tools( HoverTool() )

grid = gridplot([[fig]])

outfile=open(‘hovertest.html’,‘w’)

outfile.write(file_html(grid,CDN,‘test’))

outfile.close()

``

You need to add it to “tools” like this: fig = figure(tools = “box_zoom,save,hover”)
Or when adding later on you need to pass “tooltips” e.g. like this: fig.add_tools(HoverTool(tooltips = [(“index”, “$index”), (“(x,y)”, “($x, $y)”)]))

···

On Sunday, July 9, 2017 at 7:21:54 PM UTC+2, Sébastien Roche wrote:

Hi,

I can’t seem to have the hover tool show up in the toolbar since I updated from 0.12.4 to 0.12.6, anyone knows how to get it back?

from bokeh.plotting import figure

from bokeh.models import HoverTool

from bokeh.layouts import gridplot

from bokeh.resources import CDN

from bokeh.embed import file_html

fig = figure(tools=“box_zoom,save”)

fig.line(x=range(10),y=range(10))

fig.add_tools( HoverTool() )

grid = gridplot([[fig]])

outfile=open(‘hovertest.html’,‘w’)

outfile.write(file_html(grid,CDN,‘test’))

outfile.close()

``

Possibly a bug, hover tool icons show up in single plots but not in the "combined" toolbar for grid plots. There is some ongoing work around inspector tools and the toolbar that may have adversely intersected with the specific case of the grid plot combined toolbar. I'd suggest filing a bug report on GitHub. In the mean time the only workaround I can offer is not to merge the tools in the grid plot:

  grid = gridplot([[fig]], merge_tools=False)

Will add a toolbar for every subplot, but Hover icon will show up in them.

Thanks,

Bryan

···

On Jul 9, 2017, at 12:21, [email protected] wrote:

Hi,

I can't seem to have the hover tool show up in the toolbar since I updated from 0.12.4 to 0.12.6, anyone knows how to get it back?

from bokeh.plotting import figure
from bokeh.models import HoverTool
from bokeh.layouts import gridplot
from bokeh.resources import CDN
from bokeh.embed import file_html

fig = figure(tools="box_zoom,save")

fig.line(x=range(10),y=range(10))

fig.add_tools( HoverTool() )

grid = gridplot([[fig]])

outfile=open('hovertest.html','w')
outfile.write(file_html(grid,CDN,'test'))
outfile.close()

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4c8c7e83-aa2f-4149-afda-d33772a24414%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

You noted issue #6723 as duplicate of issue #5497. So you removed hovertool from grid layouts in order to not show multiple hover tools in the toolbar?

I have an application with several figures in a gridplot layout. I end up having to show a toolbar for each figure because I need the hovertool to be togged only when needed (since it crashes when hovering over clumped-up zoomed out data). This also causes ALL the other tools to be split between several toolbars even though they are merged correctly in a gridplot layout.

Wouldn’t it be more convenient to have several hovertools in the gridplot toolbar and not missing on the merging of all the other tools ?

I found a way to show a merged toolbar + individual hover tool for each figure by doing the following:

import bokeh
from bokeh.io import show
from bokeh.models import Button, CustomJS
from bokeh.plotting import figure
from bokeh.layouts import gridplot

tools = “box_zoom,pan,wheel_zoom,undo,reset,save,hover”

fig_list = [figure(plot_height=150,plot_width=300,tools=tools,active_inspect=,active_drag=“box_zoom”) for i in range(3)]

for fig in fig_list:
fig.scatter(x=range(10),y=range(10))

grid_list = [gridplot([[fig]],toolbar_location=‘left’) for fig in fig_list]

for grid in grid_list:
grid.children[0].logo = None
grid.children[0].merge_tools = False
grid.children[0].tools = [i for i in grid.children[0].tools if type(i)==bokeh.models.tools.HoverTool]

hover_button_code="""
if(cb_obj.button_type.includes(“success”)){
cb_obj.button_type = ‘danger’;
cb_obj.label = ‘Disable hover’
} else {

cb_obj.button_type = ‘success’;
cb_obj.label= ‘Enable hover’;
}

for(i=6;i<9;i++){document.getElementsByClassName(‘bk-toolbar-button’)[i].click()}
“”"

hover_button = Button(label=‘Enable hover’,button_type=‘success’,width=220)
hover_button.callback = CustomJS(code=hover_button_code)

grid_group = gridplot([[grid] for grid in grid_list]+[[hover_button]],toolbar_location=‘above’)

show(grid_group)

``

But this seems like a lot of manipulation, if anyone knows of a cleaner way to get that same layout I would be very interested.

This does not work anymore in bokeh 0.12.11 ! I don’t know how to get the hovertool to show in the toolbars now, it does not show up even with merge_tools=False so I can no longer select and click hover buttons from a JS callback.

Realistically, I wouldn't describe the things done in that script as supported, and I would say some of the things being accessed (ToolbarBox, bk- CSS classes) were definitely never intended to be used directly by users. I'd suggest a GH issue describing what you'd actually like to accomplish, so we can try to discuss what needs to be added in a supportable and documented way, maintained under test. It's also possible the dev who was working on this corner of Bokeh in the last release can offer a (hacky) update to your script for the time being.

Thanks,

Bryan

···

On Dec 5, 2017, at 09:05, Sébastien Roche <[email protected]> wrote:

This does not work anymore in bokeh 0.12.11 ! I don't know how to get the hovertool to show in the toolbars now, it does not show up even with merge_tools=False so I can no longer select and click hover buttons from a JS callback.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/abcdcb7b-c9f1-4bc4-b121-3f41ea966bdf%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks Bryan,

I posted on issue #5497, I ‘just’ need a merged hovertool, or a callback to turn several hovertools on/off.

···

Le mardi 5 décembre 2017 11:27:15 UTC-5, Bryan Van de ven a écrit :

Realistically, I wouldn’t describe the things done in that script as supported, and I would say some of the things being accessed (ToolbarBox, bk- CSS classes) were definitely never intended to be used directly by users. I’d suggest a GH issue describing what you’d actually like to accomplish, so we can try to discuss what needs to be added in a supportable and documented way, maintained under test. It’s also possible the dev who was working on this corner of Bokeh in the last release can offer a (hacky) update to your script for the time being.

Thanks,

Bryan

On Dec 5, 2017, at 09:05, Sébastien Roche [email protected] wrote:

This does not work anymore in bokeh 0.12.11 ! I don’t know how to get the hovertool to show in the toolbars now, it does not show up even with merge_tools=False so I can no longer select and click hover buttons from a JS callback.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/abcdcb7b-c9f1-4bc4-b121-3f41ea966bdf%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.