☰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

Draggin a Span bar

Community Supportbokeh
SamTov
SamTov

I am trying to have a span bar on my bokeh plot that can be dragged across a plot by a user. As I slides it would show a different value, e.g. the cumulative integral of the function.

⌁   Link to post
Bryan
Bryan

There are PanStart, Pan, and PanEnd events in bokeh.events that you could respond to with either JavaScript or (in a Bokeh server app) Python callbacks to update the coordinates of a span (and also trigger some computation, etc). I don’t have any complete example to share offhand.

I will say if you can settle for a user clicking somewhere, and moving the span in response to the click. that’s probably considerably simpler logic than handling the click/drag interactions.

Alternatively, the PolyDrawTool will let users drag and move a multi-line out of the box, however:

  • you may not want the other features it provides, e.g. deleting the line
  • it cannot be infinite like a span
⌁   Link to post

End of archived discussion · Replies are disabled