Here’s a minimal working example, tested in 1.4.0 and 2.2.1:
import bokeh as bk from bokeh.models import CustomJS from bokeh import plotting from bokeh.plotting import figure, output_file, show # prepare some data x = [1, 2, 3, 4, 5] y = [6, 7, 2, 4, 5] # output to static HTML file output_file("lines.html") # create a new plot with a title and axis labels p = figure(title="simple line example", x_axis_label='x', y_axis_label='y') # add a line renderer with legend and line thickness p.line(x, y, legend_label="Temp.", line_width=2) callback = CustomJS(args=dict(xr=p.x_range), code=""" xr.start = 0; xr.end = 3; console.log(xr.bounds) """) p.x_range.js_on_change('start', callback) # This produces the expected behavior, but doesn't allow to modify the x_range on change # p.x_range.start = 0 # p.x_range.end = 3 #show the results show(p)
Is this behavior expected? How can I unlock panning on the x axis?