HoverTool and TapTool problem when TapTool is in 'inspect' behavior

Hi,
We try to use both HoverTool and TapTool on the same plot as you did in this Jupyter notebook : http://nbviewer.jupyter.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb
But, we don’t want the “selective” effect of the TapTool, we just want it to trigger a callback, so its behavior attribute is set to ‘inspect’.

The HoverTool works fine, but when we click on a glyph, the tooltip disappears and the callback is not triggered. Furthermore, an error message displays in the browser console :
TypeError: m is undefined
Bokeh</<[“models/tools/inspectors/hover_tool”]</s</e.prototype._update()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<[“common/selection_manager”]</o</e.prototype.inspect()
bokeh-0.12.0.min.js:3
bound ()
self-hosted:760
Bokeh</<[“models/tools/gestures/tap_tool”]</i</e.prototype._select()
bokeh-0.12.0.min.js:17
Bokeh</<[“models/tools/gestures/tap_tool”]</i</e.prototype._tap()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<[“common/ui_events”]</s</e.prototype._trigger_event()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._trigger()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._tap()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._hammer_element/</<()
bokeh-0.12.0.min.js:3
Bokeh</<[“hammerjs/hammer”]</</ct.prototype.emit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</<.emit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</K.prototype.tryEmit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</<.process/this._timer<()
bokeh-0.12.0.min.js:35
h/<()

``

I have written a simple code to reproduce the problem :

# coding=utf-8
from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, TapTool, HoverTool, CustomJS
from bokeh.plotting import Figure

output_file("layout.html")

source = ColumnDataSource(
    data=dict(x=[2,3,5], y=[8,5,2]),
    name='source'
)

p = Figure(plot_width=550, plot_height=550, sizing_mode="fixed")

p.circle(x='x', y='y', source=source, size=50)

p.add_tools(TapTool(behavior='inspect', callback=CustomJS(code="alert('foo');")))
p.add_tools(HoverTool())

show(p)

``

If one removes the ‘inspect’ attribute from the TapTool, all works perfectly. Is there any reason for this conflict ?

Thanks,

Guilhem

Hi!

" But, we
don’t want the “selective” effect of the TapTool" - I thought
TapTool always does a selection. I have never heard of setting the
behavior attribute - I wouldn’t be surprised if it’s broken - you
should feel free to open an issue though.

In the meantime I would suggest just manually styling the

selection/nonselection glyph so that even if it does a selection you
can’t tell - does that make sense?
Best,
Bird

···

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs

   On 7/12/16 4:36 AM,

wrote:

Hi,

    We try to use both HoverTool and TapTool on the same plot as you

did in this Jupyter notebook : http://nbviewer.jupyter.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb
But, we don’t want the “selective” effect of the TapTool, we
just want it to trigger a callback, so its behavior
attribute is set to ‘inspect’.

    The HoverTool works fine, but when we click on a glyph, the

tooltip disappears and the callback is not triggered.
Furthermore, an error message displays in the browser console :

TypeError: m is undefined

          Bokeh</<["models/tools/inspectors/hover_tool"]</s</e.prototype._update()

             bokeh-0.12.0.min.js:17

            Bokeh</<.backbone</</</y()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</g()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</p()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</c.trigger()

             bokeh-0.12.0.min.js:23

            Bokeh</<["common/selection_manager"]</o</e.prototype.inspect()

             bokeh-0.12.0.min.js:3

            bound ()

             self-hosted:760

            Bokeh</<["models/tools/gestures/tap_tool"]</i</e.prototype._select()

             bokeh-0.12.0.min.js:17

            Bokeh</<["models/tools/gestures/tap_tool"]</i</e.prototype._tap()

             bokeh-0.12.0.min.js:17

            Bokeh</<.backbone</</</y()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</g()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</p()

             bokeh-0.12.0.min.js:23

            Bokeh</<.backbone</</</c.trigger()

             bokeh-0.12.0.min.js:23

            Bokeh</<["common/ui_events"]</s</e.prototype._trigger_event()

             bokeh-0.12.0.min.js:3

            Bokeh</<["common/ui_events"]</s</e.prototype._trigger()

             bokeh-0.12.0.min.js:3

            Bokeh</<["common/ui_events"]</s</e.prototype._tap()

             bokeh-0.12.0.min.js:3

            Bokeh</<["common/ui_events"]</s</e.prototype._hammer_element/</<()

             bokeh-0.12.0.min.js:3

            Bokeh</<["hammerjs/hammer"]</</ct.prototype.emit()

             bokeh-0.12.0.min.js:35

          Bokeh</<["hammerjs/hammer"]</</<.emit()

             bokeh-0.12.0.min.js:35

            Bokeh</<["hammerjs/hammer"]</</K.prototype.tryEmit()

             bokeh-0.12.0.min.js:35

          Bokeh</<["hammerjs/hammer"]</</<.process/this._timer<()

             bokeh-0.12.0.min.js:35

            h/<()

``

    I have written a simple code to reproduce the problem :
# coding=utf-8
from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, TapTool, HoverTool, CustomJS
from bokeh.plotting import Figure

output_file("layout.html")

source = ColumnDataSource(
    data=dict(x=[2,3,5], y=[8,5,2]),
    name='source'
)

p = Figure(plot_width=550, plot_height=550, sizing_mode="fixed")

p.circle(x='x', y='y', source=source, size=50)

p.add_tools(TapTool(behavior='inspect', callback=CustomJS(code="alert('foo');")))
p.add_tools(HoverTool())

show(p)

``

    If one removes the 'inspect' attribute from the TapTool, all

works perfectly. Is there any reason for this conflict ?

    Thanks,



    Guilhem

  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/b1c26bd7-072d-45ef-bed6-d1620f2ca519%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/b1c26bd7-072d-45ef-bed6-d1620f2ca519%40continuum.io?utm_medium=email&utm_source=footer).

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


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected]

This does seem like a bug, please file an issue with the sample code to reproduce.

Thanks,

Bryan

···

On Jul 18, 2016, at 5:24 PM, Sarah Bird - Continuum <[email protected]> wrote:

Hi!

"But, we don't want the "selective" effect of the TapTool" - I thought TapTool always does a selection. I have never heard of setting the behavior attribute - I wouldn't be surprised if it's broken - you should feel free to open an issue though.

In the meantime I would suggest just manually styling the selection/nonselection glyph so that even if it does a selection you can't tell - does that make sense? http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs

Best,

Bird

On 7/12/16 4:36 AM, [email protected] wrote:

Hi,

We try to use both HoverTool and TapTool on the same plot as you did in this Jupyter notebook : http://nbviewer.jupyter.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb
But, we don't want the "selective" effect of the TapTool, we just want it to trigger a callback, so its behavior attribute is set to 'inspect'.

The HoverTool works fine, but when we click on a glyph, the tooltip disappears and the callback is not triggered. Furthermore, an error message displays in the browser console :
TypeError: m is undefined
Bokeh</<["models/tools/inspectors/hover_tool"]</s</e.prototype._update()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<["common/selection_manager"]</o</e.prototype.inspect()
bokeh-0.12.0.min.js:3
bound ()
self-hosted:760
Bokeh</<["models/tools/gestures/tap_tool"]</i</e.prototype._select()
bokeh-0.12.0.min.js:17
Bokeh</<["models/tools/gestures/tap_tool"]</i</e.prototype._tap()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<["common/ui_events"]</s</e.prototype._trigger_event()
bokeh-0.12.0.min.js:3
Bokeh</<["common/ui_events"]</s</e.prototype._trigger()
bokeh-0.12.0.min.js:3
Bokeh</<["common/ui_events"]</s</e.prototype._tap()
bokeh-0.12.0.min.js:3
Bokeh</<["common/ui_events"]</s</e.prototype._hammer_element/</<()
bokeh-0.12.0.min.js:3
Bokeh</<["hammerjs/hammer"]</</ct.prototype.emit()
bokeh-0.12.0.min.js:35
Bokeh</<["hammerjs/hammer"]</</<.emit()
bokeh-0.12.0.min.js:35
Bokeh</<["hammerjs/hammer"]</</K.prototype.tryEmit()
bokeh-0.12.0.min.js:35
Bokeh</<["hammerjs/hammer"]</</<.process/this._timer<()
bokeh-0.12.0.min.js:35
h/<()

I have written a simple code to reproduce the problem :
# coding=utf-8
from bokeh.io import output_file,
show

from bokeh.models import ColumnDataSource, TapTool, HoverTool, CustomJS
from bokeh.plotting import Figure

output_file
("layout.html")

source
= ColumnDataSource(

data=dict(x=[2,3,5], y=[8,5,2]),

name='source'
)

p
= Figure(plot_width=550, plot_height=550, sizing_mode="fixed")

p
.circle(x='x', y='y', source=source, size=50)

p
.add_tools(TapTool(behavior='inspect', callback=CustomJS(code="alert('foo');")))

p
.add_tools(HoverTool())

show
(p)

If one removes the 'inspect' attribute from the TapTool, all works perfectly. Is there any reason for this conflict ?

Thanks,

Guilhem

--
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/b1c26bd7-072d-45ef-bed6-d1620f2ca519%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
Sarah Bird
Developer, Bokeh

--
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/7bfc68a5-91f0-dcde-07ba-8482ca2b9bee%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I have created an issue here : https://github.com/bokeh/bokeh/issues/4839
With a simple repository to reproduce : https://github.com/EngelOfChipolata/bokeh_hover_tap_tools

···

On Tuesday, July 12, 2016 at 12:47:18 PM UTC+2, [email protected] wrote:

Hi,
We try to use both HoverTool and TapTool on the same plot as you did in this Jupyter notebook : http://nbviewer.jupyter.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb
But, we don’t want the “selective” effect of the TapTool, we just want it to trigger a callback, so its behavior attribute is set to ‘inspect’.

The HoverTool works fine, but when we click on a glyph, the tooltip disappears and the callback is not triggered. Furthermore, an error message displays in the browser console :
TypeError: m is undefined
Bokeh</<[“models/tools/inspectors/hover_tool”]</s</e.prototype._update()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<[“common/selection_manager”]</o</e.prototype.inspect()
bokeh-0.12.0.min.js:3
bound ()
self-hosted:760
Bokeh</<[“models/tools/gestures/tap_tool”]</i</e.prototype._select()
bokeh-0.12.0.min.js:17
Bokeh</<[“models/tools/gestures/tap_tool”]</i</e.prototype._tap()
bokeh-0.12.0.min.js:17
Bokeh</<.backbone</</</y()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</g()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</p()
bokeh-0.12.0.min.js:23
Bokeh</<.backbone</</</c.trigger()
bokeh-0.12.0.min.js:23
Bokeh</<[“common/ui_events”]</s</e.prototype._trigger_event()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._trigger()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._tap()
bokeh-0.12.0.min.js:3
Bokeh</<[“common/ui_events”]</s</e.prototype._hammer_element/</<()
bokeh-0.12.0.min.js:3
Bokeh</<[“hammerjs/hammer”]</</ct.prototype.emit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</<.emit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</K.prototype.tryEmit()
bokeh-0.12.0.min.js:35
Bokeh</<[“hammerjs/hammer”]</</<.process/this._timer<()
bokeh-0.12.0.min.js:35
h/<()

``

I have written a simple code to reproduce the problem :

# coding=utf-8
from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource, TapTool, HoverTool, CustomJS
from bokeh.plotting import Figure

output_file("layout.html")

source = ColumnDataSource(
    data=dict(x=[2,3,5], y=[8,5,2]),
    name='source'
)

p = Figure(plot_width=550, plot_height=550, sizing_mode="fixed")

p.circle(x='x', y='y', source=source, size=50)

p.add_tools(TapTool(behavior='inspect', callback=CustomJS(code="alert('foo');")))
p.add_tools(HoverTool())

show(p)

``

If one removes the ‘inspect’ attribute from the TapTool, all works perfectly. Is there any reason for this conflict ?

Thanks,

Guilhem