I need to get the index of a selected data point in a Bokeh plot, which needs to be the input of another function in my web application.
I am using Bokeh’s Taptool CustomJS Callback. However, I could not find a way to get the actual index of the selected point besides ‘console.log’. Is there some way to return this index to outside the JavaScript?
Below is my code. I am new to Javascript and Bokeh. Thanks for any help in advance.
Hi, what do you mean by "outside the JavaScript" ? Do you mean back to Python? In that case you will have to be running a Bokeh server application. Standalone Bokeh output is just static HTML and JS and has no connection to any Python runtime.
On May 22, 2018, at 17:33, Binghui Ouyang <[email protected]> wrote:
I need to get the index of a selected data point in a Bokeh plot, which needs to be the input of another function in my web application.
I am using Bokeh's Taptool CustomJS Callback. However, I could not find a way to get the actual index of the selected point besides 'console.log'. Is there some way to return this index to outside the JavaScript?
Below is my code. I am new to Javascript and Bokeh. Thanks for any help in advance.
codes =
"""
var index_selected = source.selected['1d']['indices'][0];
source.trigger('change');