Hi all,
I see in the bokeh documentation that it is possible to configure a “mode” on the HoverTool to highligth all glyphs on the same vertical or horizontal coordinate.
In the same way, is it possible to highlight several glyphs based on a common criteria taken from the datasource?
Best regards,
Gonzague
I know it is possible with selection using the TapTool. A CustomJS callback can reference all data provided in the ColumnDataSource.
FWIW, here is the code I am using, albeit with a bug in multiple selection across figures.
https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/3NON0vhtuYE
I achieved to do what I wanted by updating the alpha value directly from the datasource. But I am not sure this is really the good way to go…
Here is my hover tool code:
cbk = CustomJS(args={‘vbar’: vbr.data_source}, code=“”"
var indices = cb_data.index[‘1d’].indices
if (indices.length == 0) {
for(var j = 0; j < vbar.data[‘alpha’].length; j++) {
vbar.data[‘alpha’][j] = 1.0
}
}
else
{
for(var i = 0; i < indices.length; i++) {
var ind = indices[i]
var expectedHash = vbar.data[‘hash’][ind]
for(var j = 0; j < vbar.data['hash'].length; j++) {
if (vbar.data['hash'][j] != expectedHash) {
vbar.data['alpha'][j] = 0.5
}
else {
vbar.data['alpha'][j] = 1.0
}
}
}
}
vbar.trigger('change')
“”")
p.add_tools(HoverTool(tooltips=None, callback=cbk, renderers=[vbr]))
``
···
Le lundi 29 mai 2017 19:09:06 UTC+2, Gonzague Reydet a écrit :
Hi all,
I see in the bokeh documentation that it is possible to configure a “mode” on the HoverTool to highligth all glyphs on the same vertical or horizontal coordinate.
In the same way, is it possible to highlight several glyphs based on a common criteria taken from the datasource?
Best regards,
Gonzague