在散景图中嵌入散景图和数据表

Bjo*_*nL. 2 python flask bokeh

我正在尝试使用Bokeh文档中提供的一些示例,在一个烧瓶生成的网站(同一页面)中嵌入散景图和散景数据表.两个组件都是独立运行的.我试图通过gridplot将它们放在一起,但这似乎只适用于绘图,而数据表是一个'小部件'.我可能错过了一些非常基本的概念,但任何指针或示例链接都会受到赞赏

bir*_*rah 6

我喜欢这样做的方法是使用方法的全部功能embed.components并传入一个绘图对象的字典,然后在我的html模板中的任何地方渲染它们.

我将组件称为如下:

from bokeh.embed import components
script, div_dict = components({"plot": plot, "table": table})
Run Code Online (Sandbox Code Playgroud)

div_dict看起来像这样:

# {"plot": plot_div, "table": table_div})
Run Code Online (Sandbox Code Playgroud)

然后我将这个dict和脚本传递给我的模板上下文并使用它:

<body>
   {{ plot_div }}
   {{ table_div }}
   {{ script }}
</body>
Run Code Online (Sandbox Code Playgroud)

以下是散景示例中的示例:https://github.com/bokeh/bokeh/blob/master/examples/embed/embed_multiple_responsive.py#L26