我正在尝试使用 Bokeh 文档中提供的一些示例将散景图和散景数据表嵌入到烧瓶生成的网站(同一页面)中。两个组件都独立工作。我尝试通过 gridplot 将它们放在一起,但这似乎只适用于绘图,而数据表是一个“小部件”。
我可能缺少一些非常基本的概念,但是任何指向示例的指针或链接都值得赞赏
我喜欢这样做的方式是充分利用embed.components http://bokeh.pydata.org/en/latest/docs/reference/embed.html#bokeh.embed.components方法并传入绘图对象的字典,然后在 html 模板中我需要的任何位置呈现它们。
我按如下方式调用组件:
from bokeh.embed import components
script, div_dict = components({"plot": plot, "table": table})
My div_dict
看起来像这样:
# {"plot": plot_div, "table": table_div})
然后我将这个字典和脚本传递到我的模板上下文中并使用它,如下所示:
<body>
{{ plot_div }}
{{ table_div }}
{{ script }}
</body>
以下是散景示例中的一个示例:https://github.com/bokeh/bokeh/blob/master/examples/embed/embed_multiple_responsive.py#L26 https://github.com/bokeh/bokeh/blob/master/examples/embed/embed_multiple_responsive.py#L26
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)