如何响应地调整大小\缩放不均匀的多图散景(1.2.0)布局?

时间:2019-09-10 19:44:12

标签: python html bokeh interactive

我正在尝试以响应方式扩展bokeh服务器应用程序。问题是它的尺寸不正确,即我需要消除某些分辨率(以及不同设备(例如手机\平板电脑))上的滚动条。事实证明,这非常困难,因为我混合使用了不同大小和Divs的图形(并且我非常希望保持其长宽比和关系位置)。

我实际上已经尝试了所有方法,包括sizing_mode选项的所有组合以及一个template \ index.html(基于index.html here,该方法嵌入了根并且包括content =“ width = device-width ,initial-scale = 1.0“或width:width:X%参数,由于容器中的尺寸是固定的,因此可能未应用?)。该应用程序很大,但是我在下面提供了一段代码。

fig1 = figure(plot_height=fig1_height,
              plot_width=fig1_width,...,)
fig2 = figure(plot_height=fig2_height,
              plot_width=fig2_width,...,)
.
fig5 = figure(plot_height=fig5_height,
              plot_width=fig5_width,...,)

div1 = Div(text=open(os.path....).read(),
           height= div1_height,width = div1_width)
div2 = Div(text=open(os.path....).read(),
           height= div2_height, width = div2_width)
.
div6 = Div(text=open(os.path....).read(),
           height= div6_height, width = div6_width)

controls = [widget1, widget2, widget3, widget4]

layout_1 = layout(column(row(column(div1, *controls, div2, fig1),
                  column(fig3, row(div3, figure3, widget5)),
                  column(fig4, fig5),
                  sizing_mode="scale_width")))
tab_1 = Panel(child=layout_1, title='Tab 1')
layout_2 = layout(row(column(div1, div4, div5), div3, div6),
                  sizing_mode='scale_width')
tab_2 = Panel(child=layout_2, title="Tab 2")
tabs = Tabs(tabs=[tab_1, tab_2])
curdoc().add_root(tabs)

我真的很想找到一种方法来使这种响应(即,按照我理解的大小有效,即sizing_model = Stretch_both \ scale_both \ scale_width起作用),但是它在除1080p分辨率以外的任何分辨率下都溢出(生成滚动条)最大化的浏览器(这是我的原型)。我是否忽略了一些明显的东西,这会阻止保留布局中各个元素的纵横比(即,下面的大多数高度和宽度都不相同)? I have also tried setting fig.sizing_mode on each of the Divs and Figures。我需要在这里使用引导样式模板吗?事实证明,这是最具挑战性的,将永远感谢您的帮助!

0 个答案:

没有答案