Callback for ResetTool not working

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!’); } ‘’’

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {‘custom_callbacks’: [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)

``

Hi,

Users should never have to mess with the callbacks dictionary directly, and are certainly never advised to, and why it is purposefully not demonstrated anywhere in the docs. It would have been made private except for some technical hurdles with doing so. Instead you should always use the js_on_event method which is what is demonstrated in all the docs and examples, e.g.

  https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py

Thanks,

Bryan

···

On Mar 29, 2019, at 9:18 AM, [email protected] wrote:

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = '')
p.line(x = [1, 2], y = [3, 4])
code = ''' console.log(' !!! INSIDE !!!'); } '''

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {'custom_callbacks': [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)

--
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/78c7a36f-d4ec-4aeb-b59b-82c41b4cbf51%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I first tried on_js_event but it didn’t work that is why I came up with my previous solution. Is there any way to get it work? Thanks

from bokeh.models import ResetTool, CustomJS
from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!‘) ‘’’

rest_tool = ResetTool()
rest_tool.js_on_event(‘tap’, CustomJS(code = code))
p.add_tools(rest_tool)

show(p)

``

···

On Friday, March 29, 2019 at 5:23:23 PM UTC+1, Bryan Van de ven wrote:

Hi,

Users should never have to mess with the callbacks dictionary directly, and are certainly never advised to, and why it is purposefully not demonstrated anywhere in the docs. It would have been made private except for some technical hurdles with doing so. Instead you should always use the js_on_event method which is what is demonstrated in all the docs and examples, e.g.

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py](https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py)

Thanks,

Bryan

On Mar 29, 2019, at 9:18 AM, [email protected] wrote:

Is there any way to make this callback work for the ResetTool?

from bokeh.models import ResetTool, CustomJS

from bokeh.plotting import figure, show

p = figure(tools = ‘’)
p.line(x = [1, 2], y = [3, 4])
code = ‘’’ console.log(’ !!! INSIDE !!!‘); } ‘’’

rest_tool = ResetTool()
rest_tool.js_event_callbacks = {‘custom_callbacks’: [CustomJS(code = code)] }
p.add_tools(rest_tool)

show(p)


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/78c7a36f-d4ec-4aeb-b59b-82c41b4cbf51%40continuum.io.

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