Hi everyone,
I built a dashboard containing a datatable, two figures with cicrle glyphs (all with the same ‘source’ data source) and an extra figure made for plotting images. The logic is the following:
When a row from the datatable is selected or a glyph from either of the figures is selected, the corresponding index of the data source is retrieved, allowing to get the correpsonding path stored in the same data source in order to load the image in that extra plot.
With Bokeh 0.12.16,
the following code was working perfectly, allowing to select rows and glyphs alternatively in order to update the image:
···
def update_img():
try:
selected_index = source.selected[“1d”][“indices”][0]
new_path=source.data[‘Path’][selected_index]
url=’%s.png’ %new_path
img = plot.image_url(url=[url])
except IndexError:
pass
source.on_change(‘selected’, lambda attr, old, new: update_img())
When switching to Bokeh 0.13.0, I updated the code, based on that thread (https://github.com/bokeh/bokeh/issues/8014) as follows:
def update_img():
try:
selected_index = source.selected[“1d”][“indices”][0]
new_path=source.data[‘Path’][selected_index]
url=’%s.png’ %new_path
img = plot.image_url(url=[url])
except IndexError:
pass
source.selected.on_change(‘indices’,lambda attr, old, new: update_img())
With 0.13.0, source.selected ‘source.selected.on_change(‘indices’,callback)’ works fine, but only when selecting alternatively rows in the datatable.
When selecting glyphs from the figures, the callback is not triggered anymore (checked with a basic print) and also prevents the callback from working when selecting rows in the datatable afterwards.
There seems to be a link issue between the datable and the glyphs, but I’m really not sure of this…
Do you know what could be the reason and how this could be fixed ?
Don’t hesitate if you need more precisions,
Thanks for your help,
Jim