Client Side Callback

I’m trying to implement a callback on the extra x_ranges and y_ranges of a plot.
The plot was created client side in javascript.
The code for creating the plot looks like this:

 var error_plot = Bokeh.Plotting.figure({
            plot_width: 800,
            plot_height: 600,
            title: seriesM + ': ' + interval + ': ' + metric,
            tools: "pan,box_zoom,reset,save",
            toolbar_location: "below",
            y_axis_label: metric,
            x_axis_label: "Horizons",

In python I can create the callback like this:


I do not see .js_on_change in the javascript API, or anything that works equivalently.

Are there any online resources that demonstrate how to do this?

Any help would be appreciated.

Thanks in advance

I believe the best way to accomplish this would be

range.connect(, () => callback_func())

cc @mateusz

Thanks Bryan!

That was incredibly helpful.
Do you happen to know of any online resources/docs that outline this type of interaction with the Javascript API. I don’t see any on, but maybe I’m missing it.

Again, thanks so much!

Sean Oughton

@seanoughton I am afraid there simply isn’t as much yet. In the very early days, BokehJS was purely a hidden implementation detail, so there were no public docs at all. Over time it’s become more user-facing, and here has been some material added here and there, but it is not nearly as highly developed as “Python Bokeh” is in the area of documentation. We would very much like to make BokehJS a first-class project in its own right, with excellent docs and examples, but are also currently resource-limited and could really use more people helping with that goal.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.