【发布时间】:2018-06-16 19:35:14
【问题描述】:
我正在尝试在我的烧瓶应用程序中加载散景图,但无法在模板中渲染该图。我使用 bokeh.embed 组件的方式与在所有示例中完全相同:
script1, div1 = components(p)
cdn_js = CDN.js_files[0]
cdn_css = CDN.css_files[0]
然后我像这样将组件传递给 render_template:
return render_template("plot.html", script1=script1, div1=div1, cdn_css=cdn_css, cdn_js=cdn_js )
当 plot.html 加载时,其中包含所有组件,但由于某种原因,绘图根本没有显示。以下是脚本在渲染模板中的样子:
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cyborg/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href=https://cdn.bokeh.org/bokeh/release/bokeh-0.12.13.min.js type="text/css" />
<script type="text/javascript" src=https://cdn.bokeh.org/bokeh/release/bokeh-0.12.13.min.css></script>
脚本和 div 都在正文中并且看起来正确。但是我在 javascript 中遇到错误:
Uncaught ReferenceError: Bokeh is not defined
at HTMLDocument.fn
如果我在头部加载散景库,为什么会出现此错误?请帮忙。
【问题讨论】:
标签: javascript python flask embed bokeh