Dear all,
As BokehJS is relatively new, I am struggling to find a working example showing CustomJS usage with BokehJS. I expect things to be different from using CustomJS in python as is should be possible to provide directly a javascript function as argument to CustomJS in BokehJS instead of a javascript code snippet when using CustomJS in python.
In the absence of any further information, my best guess was the following bit of code which is meant to print in the console the lower bound of the x axis whenever it is updated upon panning or zooming user action, and it does not work.
Can anyone correct this and show the correct usage of CustomJS in BokehJS?
For the sake of sharing this basic demo with a larger audience, I also created a stackoverflow entry. Feel free to respond to it as well.
Thanks in advance!
Cheers,
A.
// make the plot and add some tools
var tools = "pan,crosshair,wheel_zoom,box_zoom,reset,save";
var plot = Bokeh.Plotting.figure({
title:"demo plot",
tools: tools,
toolbar_location:"above",
sizing_mode:"stretch_both"
});
var scatterData = plot.line({ field: "x" }, { field: "y" }, {
source: source,
line_width: 2
});
plot.x_range.callback=Bokeh.CustomJS({args:{plot:plot},code:"console.log(plot.x_range.start);"});
// Show the plot, appending it to the end of the current
// section of the document we are in.
Bokeh.Plotting.show(plot,document.getElementById("myPlot"));
</script>
``