Box Select vs. Lasso Select and Tap

Hi,

I find that selecting points via the Lasso Select or Tap tools triggers the callback attached to a ColumnDataSource:

scatter_src_b = ColumnDataSource( data = scatter_df_b )

scatter_src_b.callback = CustomJS.from_py_func( ScatterCB )

However, selecting points via the Box Select tool does not trigger this callback.

Is this the intended behaviour?

If I want to support selecting points via the Box Select tool, do I need to write a custom callback for the BoxSelectTool similar to the “boxselecttool_callback.html” example at:

where I would obtain the geometry coordinates of the box-selection and then determine which data points reside within that area?

thanks

albert.

Updating my own post.

In preparing a simplified sample to demonstrate the problem – I found that BoxSelect actually did work in the same way as the LassoSelect and Tap tools.

The question then became why it didn’t work in my (more complicated) use case.

I found that the problem was due to my using specific renderers so that different HoverTool tooltips could be attached to different data items on the plot. So I needed to create a BoxSelectTool for the specific renderers of interest. Code snippet that hopefully illustrates what I’m talking about…

hover_summary = BModels.HoverTool( renderers=[renderer_summary], tooltips=summary_tips )

plot.add_tools( hover_summary )

hover_scatter = BModels.HoverTool( renderers=renderer_list, tooltips=scatter_tips )

plot.add_tools( hover_scatter )

box_select = BModels.BoxSelectTool( renderers=renderer_list )

plot.add_tools( box_select )

cheers

···

On Tuesday, January 3, 2017 at 11:29:50 AM UTC-8, Albert Chau wrote:

Hi,

I find that selecting points via the Lasso Select or Tap tools triggers the callback attached to a ColumnDataSource:

scatter_src_b = ColumnDataSource( data = scatter_df_b )

scatter_src_b.callback = CustomJS.from_py_func( ScatterCB )

However, selecting points via the Box Select tool does not trigger this callback.

Is this the intended behaviour?

If I want to support selecting points via the Box Select tool, do I need to write a custom callback for the BoxSelectTool similar to the “boxselecttool_callback.html” example at:

http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html

where I would obtain the geometry coordinates of the box-selection and then determine which data points reside within that area?

thanks

albert.