【问题标题】:How to add header to a bokeh dashboard in python?如何在python中将标题添加到散景仪表板?
【发布时间】:2020-09-17 01:34:00
【问题描述】:

我在散景中创建了一个仪表板,但我如何向它添加一个通用标题?

我之前做过很多研究,但似乎以前没有人问过这个简单的问题。

谢谢你帮助我:)

【问题讨论】:

    标签: python header bokeh dashboard


    【解决方案1】:

    正如 Eugene 所说,您可以使用 div 容器来设置标题,然后在列输出中设置它。

    这里有一些可能有助于理解的示例代码:

    output_file("slider.html")
    title = Div(text='<h1 style="text-align: center">Example Header</h1>')
    p1 = figure(plot_width=300, plot_height=300)
    p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
    tab1 = Panel(child=p1, title="circle")
    
    p2 = figure(plot_width=300, plot_height=300)
    p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color="navy", alpha=0.5)
    tab2 = Panel(child=p2, title="line")
    
    tabs = Tabs(tabs=[tab1, tab2])
    
    layout = column(title, tabs, sizing_mode='scale_width')
    
    curdoc().add_root(layout)
    

    【讨论】:

      【解决方案2】:

      只需将您的仪表板包装在 column 中,其中第一项是带有标题文本的 Div

      【讨论】:

        猜你喜欢
        • 2019-09-26
        • 2013-09-28
        • 2019-12-26
        • 1970-01-01
        • 2018-10-10
        • 1970-01-01
        • 1970-01-01
        • 2015-05-08
        • 2020-07-06
        相关资源
        最近更新 更多