
Bokeh 2.1.0.
Is there a way to get callback when user clicks axis? The documentation led me in this direction (below), but none of the callbacks triggered. Minimal example,
from bokeh.layouts import layout
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.events import ButtonClick, Tap, DoubleTap, Press, MouseEnter
source = ColumnDataSource(data={
"t": [0, 1, 2, 3, 4],
"i": [1, 10, 20, 30, 40],
})
plot = figure(toolbar_location="above", y_range=(0, 50), x_range=(0, 5))
line = plot.line(x="t", y="i", line_width=2, source=source, color="green", legend_label="SRC")
callback = CustomJS(code="console.log('tap event occurred')")
plot.yaxis.js_on_event(Tap, callback)
plot.yaxis.js_on_event(ButtonClick, callback)
plot.yaxis.js_on_event(DoubleTap, callback)
plot.yaxis.js_on_event(Press, callback)
plot.yaxis.js_on_event(MouseEnter, callback)
doc_layout = layout()
doc_layout.children.append(plot)
show(doc_layout)
