Link interactions of widgets in multiple sessions in js [bokeh1.1.0dev11]

in short: I want to link all widget interactions of multiple bokeh plots (pan, box, wheel, reset).

The plots get generated by inserting multiple autoload scripts into my react application. Therefore I have to use js to access each tool in the toolbar.

My current approach select each plot with “window.Bokeh.documents[plot_Position]”.

model = window.Bokeh.documents[0].get_model_by_id("1000");
// this position is the figure of the first plot

I already was able to change the zoom depth but afterwards I had to push the “reset” tool to make the changes effective.

// Example for changing the zoom
model.attributes.children[17].attributes.children[0].attributes.children[0].y_range.attributes.reset_end = 

Is there a way to trigger the tools solely with js? Or are there ways to link the tools?

Thanks for your help in advance!

okay … I am able to change the value directly with

[model].attributes.children[17].attributes.children[0].attributes.children[0].x_range.start = [value]

This should answer my question.

If someone has any other suggestions let me know.

I’d only note two things:

  • First, that this definitely ventures outside of “intended” usage, so I would expect any potential solution is not going to be fighting against the library and probably not especially pretty. (Seems to be the case above)

  • “dev” releases should not be used for anything outside of release testing. In particular there is no guarantee at all that CDN resources for dev/rc builds will continue to be available in the future. (Which may not specifically be an issue here, if you are having the Bokeh server itself server the JS resources, but the point remains: “dev” releases are 100% unsupported)

Hi Bryan,

thanks for your help. I will try updating my bokeh version.

Can you recommend me another approach to solve my problem?

Well, independent of this question, users should never access or need to access .attributes directly. So at a minimum, something like:

[model].children[17].children[0].children[0].x_range.start = [value]

But if you configure a name property of the model you want to grab, then you could use the global Bokeh.documents[0].get_model_by_name(...) function to query for it. (You might need a newer Bokeh version for that function, not sure)

Hi Bryan,

again, thank you for your support. I have some issues with holoviews when I update Bokeh (issue). Therefore, until this issue is not solved I need to use version ≤ 1.1.0 of Bokeh.

Well, I have to build a dashboard with react and Bokeh plots (holoviews with datashader). To realize this, I load the plot layout with an autoload script in my react app. Here, I hide the parameters of the plot and use react components to access the bokeh parameters.

Basically using the .attributes of the session is the only way I am able to implement Bokeh in react.

As I am still quite new to Bokeh, is there another way to solve this?

fyi: I ended up using a button that adjusts all the zoom settings on click of the plots

@Julian3012 Both Holoviews and Bokeh have had new releases since that issue. Have you tried things again with the latest versions?