Dear all,
I am looking for a way to trigger a responsive BokehJS plot to resize upon jquery-ui resize event.
The use case is as per the following code snippet where I have two divs side by side, one containing a BokehJS plot and an other one (“myMenu”, a container for a future menu) that is made resizable using jquery-ui.
The plot resizes as expected when I manually resize the web-browser window, but it does not resize when I manipulate the resizable div “my Menu”.
Is there a BokehJS method that can be called to trigger the overall resizing of the plot?
If so, my plan is to use it in a custom callback to jquery-ui resize event.
I also posted this on stackoverflow, in order to share this with a larger audience and possibly also get some insights from jquery experts.
https://stackoverflow.com/questions/46956603/how-to-trigger-bokehjs-plot-resize-upon-jquery-ui-resize-event
Alternatively, I would also be interested to know how I could figure out that by myself. I not a professional developer so there could be some tricks and documentation I don’t know about. This could save this forum for some of trivial questions of mine…
Thanks in advance for sharing!
Cheers,
A.
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-0.12.10.css" type="text/css" />
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-0.12.10.js"></script>
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-api-0.12.10.js"></script>
<!-- The order of CSS and JS imports above is important. -->
// data to plot
var source = new Bokeh.ColumnDataSource({
data: { x: [0,1,2,3,4,5,6,7,8,9], y: [0,1,4,-2,2,5,0,2,1,1] }
});
// 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
});
// 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"));
//resizable left menu container
$('#myMenu').resizable({handles:'e'});
</script>
``