How to access Bokeh figure object and data source directly from javascript?

I am developing an application using Bokeh and Flask.
Using server-side python code, it produces a plot embedded in a web page
which contains a variety of user input elements aiming at configuring the plot.

I know that starting from Bokeh v0.12.1, there is an API allowing to create and manipulate plots directly from javascript.

The bit I am missing here is, starting from the Bokeh javascript object, how to access the already instantiated figure objects and attached data source?

Using the BokehJS API, I would then be able to write javascript code translating webpage user events (checkbox, button click, text input, …) into actions on the plot (change line color, hide lines, update data point values, …).

Any help or hints on this would be much appreciated!

I also posted this question on stackoverflow as it is very generic and most likely useful to anybody getting started with BokehJS (but if anybody find this is bad practice to post both here and on stackoverflow, just let me know):

Thanks in advance!



  • PS: I could indeed build the entire figure directly from javascript, but current limitations on the BokehJS API library (which is
    under heavy development at the moment) does not make it yet the best option. It looks somewhat more efficient to build/configure the figure using the python server-side code and then make small update using the javascript API.*