有没有办法在Bokeh仪表盘布局中添加一个只显示文本的小部件?

问题描述 投票:0回答:1

我只是想在一个widgetbox中以文本的形式显示pandas数据框列的收入中位数,这个widgetbox会随着时间的推移添加更多数据而改变。

编辑:我能够找到这个文档,帮助你添加一个包含DIV元素的widget。

http:/docs.bokeh.orgen1.3.2docsuser_guideinteractionwidgets.html#div。

示例:我只是想把pandas数据框架列的收入中位数作为文本显示在widgetbox中,随着时间的推移,这些数据会发生变化。

from bokeh.io import output_file, show
from bokeh.models import Div

output_file("div.html")

div = Div(text="""Your <a href="https://en.wikipedia.org/wiki/HTML">HTML</a>-supported text is initialized with the <b>text</b> argument.  The
remaining div arguments are <b>width</b> and <b>height</b>. For this example, those values
are <i>200</i> and <i>100</i> respectively.""",
width=200, height=100)

show(div)
python bokeh dashboard
1个回答
0
投票

使用一个 Div 并通过设置更新

my_div.text = new_content
© www.soinside.com 2019 - 2024. All rights reserved.