the callback object returns an indices array, but to what do those indices refer
Hi @guillaume.androz I am not sure what indices array you are referring to. The callback is supplied with two arguments:
- the model itself, in this case the
BoxSelectionTool
- a model-specific data payload object, in this case
{g: geometry}
that supplies the spatial coordinates of the box.
There are no selection indices passed to HoverTool.callback
, as can be verified in the source code (In general, actual code and sample output is strongly recommended to focus the discussion, at this point I can only speculate what you are referring to.)
I would strongly advise against using the .callback
mechanism in any case. They were replaced by the general .js_on_change
facility, that can be use to uniformly trigger callbacks on any Bokeh property change. These ad-hoc .callback
properties date back to the very early days of the project, and are sprinkled inconsistently around. They have been deprecated for some time, and will be removed in future (not too distant) release.
If you want to respond to changes in scatter selection indices, you should do:
source.selected.js_on_change('indices', customjs_callback)
for every data source that you care about. (Or if you do want the actual box geometry, you can use .js_on_event
with BoxSelection
event type)
if the selected area does not include one point of a data source, all the points of this data source remain “active” i.e. visually there is not alpha applied on them.
The selection/non_selection visual properties only apply when there is some non-empty selection to begin with. If you make an empty selection that is the same as clearing the selection, in which case the normal glyph is used. I.e. when a plot is first displayed, before any other action, it has an empty selection. Making a new empty selection some time later returns it to that same state from the beginning. I am not sure what else could be done that would not be inconsistent/confusing.
If you really have to have a different behaviour, you could create a custom extension that meets your specialized need.