Hi,
I am using BokehJS, and I am trying to attach a callback to some figure. Below is a minimal example:
var plt = Bokeh.Plotting;
var x = Bokeh.LinAlg.linspace(-0.5, 20.5, 10);
var y = x.map(function (v) { return v * 0.5 + 3.0; });
var source = new Bokeh.ColumnDataSource({ data: { x: x, y: y } });
// make the plot and add some tools
var tools = "pan,wheel_zoom,box_zoom,reset,save";
var p = plt.figure({ title: "Bla Bla", tools: tools });
// add a line with data from the source
const line = p.line(
{ field: "x" },
{ field: "y" },
{ source: source, line_width: 2}
);
p.js_event_callbacks['tap'] = new Bokeh.CustomJS({args: [], code: "console.log('Tap event occurred at x-position: ' + cb_obj.x)"});
// show the plot
plt.show(p);
I am expecting to get some output in the console (when pressing with the LMB on the figure), but nothing happens. What am I missing here?
Thanks in advance,
Amit



