I would like to have a feature to show a vertical line in my line plot when i click on it. I use that, because i want to zoom in and add the vertical line, zoom out and see where it crosses other line plots in the same figure. The problem with the crosshair tool is, that when i zoom in and afterwoods out i am not exact on the same point because of cursor movement and it would be cool to see the line when i save the plot. Best case would be to be able to set one or more vertical lines and the possibility to delete them afterwoods if needed.
Asked
Active
Viewed 458 times
1
-
Are you using a Bokeh server or a client-side app? – gshpychka Apr 29 '21 at 06:48
-
I solved it with the code below in a client side app. span = Span(dimension='height') callback = CustomJS(args=dict(span=span), code=""" span.location = cb_obj.x """) p.js_on_event('tap', callback) p.add_layout(span) would you have suggested the same solution? – Jimbo Apr 30 '21 at 08:33
-
Yup. You should format the code properly and post the solution as an answer for others. – gshpychka Apr 30 '21 at 08:45
1 Answers
0
span = Span(dimension='height')
callback = CustomJS(args=dict(span=span), code="""
span.location = cb_obj.x
""")
p.js_on_event('tap', callback)
p.add_layout(span)

Jimbo
- 11
- 2