☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Problem in using p.x_range.on_change

Community Support
ahmettemiz88
ahmettemiz88

Hi,

I used p.x_range.on_change(‘start’, callback) for boxzoom event.
But this calback also runs when I pan as well. I do not want callback to run when I pan.

How can I prevent callback from running panning?
Or
Is there any event for boxzooming?
regards

⌁   Link to post
Bryan
Bryan

There is not an even for box zoom. There is a box Selection event. The BoxSelectionTool emits a SelectionGeometry event that you could use with on_event. The event data will contain a geometry object that reports both screen and data space extents of the box:

{"type":"rect","sx0":348,"sx1":493,"sy0":172,"sy1":341,"x0":59.69,"y0":40.28,"x1":89.26,"y1":72.8}

But you would also need to update the ranges yourself manually in the event callback since a box selection will not cause a zoom to happen.

⌁   Link to post
Bryan
Bryan

There are only events, not “js” events or “python” events". You can use any event with either js_on_event (JS) or on_event (Python)

⌁   Link to post

End of archived discussion · Replies are disabled