Hello.
I am interested in embedding a bokeh figure into a webpage.
The code I used to create the figure is as follows:
fig = figure(x_axis_type=“datetime”)
fig.line(x=data[‘dt_tm’], y=data[‘points’])
curdoc().add_root(column(fig))
You can see the end result here:
http://ec2-35-182-226-31.ca-central-1.compute.amazonaws.com:5200/bokeh_1
I tried embedding it using the autoload_server approach as follows:
from bokeh.embed import autoload_server
script = autoload_server(model=None, app_path="/bokeh_1", url=‘http://ec2-35-182-226-31.ca-central-1.compute.amazonaws.com:5200’)
print script
which returns:
<script
src="http://ec2-35-182-226-31.ca-central-1.compute.amazonaws.com:5200/bokeh_1/autoload.js?bokeh-autoload-element=507eee5c-f2a4-4604-a81d-00ebfdacf2c7"
id="507eee5c-f2a4-4604-a81d-00ebfdacf2c7"
data-bokeh-model-id=""
data-bokeh-doc-id=""
></script>
When I embed this into another html doc, the figure loads but with two issues:
1) the widgets (box zoom, save etc) that are present in standalone site don't load properly
2) the figure insists on loading in the top left corner
See end result here:
http://ec2-35-182-226-31.ca-central-1.compute.amazonaws.com/index.html
When inspecting the source code, I saw the following associated with the figure:
element {
position: absolute;
left: 0px;
top: 0px;
width: 600px;
height: 600px;
}
I'm wondering if there's something I've done wrong/can change to improve the way it loads inline in the document.
Thanks for your help!