繁体   English   中英

如何在R Shiny中调整sidebarPanel的宽度而不影响后续的sidebarPanel宽度

[英]How to adjust the width of sidebarPanel without affect subsequent sidebarPanel widths in R Shiny

我试图在R Shiny中更改sidebarPanel的宽度,以便我的mainPanel具有更多的“房间”来并排显示两个图形。 图形显示在mainPanel中它们各自的侧边栏中。 因此,共有三个sidebarPanels:第一个用于数据选择/选择,以显示在其余两个sidebarPanels中。

但是,当我更改第一个sidebarPanel的宽度时,所有sidebarPanels都采用此宽度。 如何防止这种情况发生?

我用作示例的ui.r代码位于: https : //github.com/EconometricsBySimulation/2013-06-11-Shiny-Exploration/blob/master/ui.R

并在以下位置找到server.r代码示例: https : //github.com/EconometricsBySimulation/2013-06-11-Shiny-Exploration/blob/master/server.R

我正在使用以下内容来调整ui.r中第一个sidebarPanel的宽度:

left=sidebarPanel(
         tags$head(
           tags$style(type="text/css", "select { width: 100px; }"), # defines width of dropdown panel
           tags$style(type='text/css', ".span4 { max-width: 150px; }") # defines width of panel containing dropdown panel
           ),

但是,如前所述,这将导致随后的面板采用其宽度。 关于如何保持此宽度或将第一个sidebarPanel的宽度设置为更窄的宽度,并使第二个(中间)和第三个(右)sidebarPanels的宽度分别为剩余空间宽度的一半的任何想法?

提前谢谢了!

使用sidebarPanel看起来有点扭曲, wellPanel可能是一个更好的选择。 请尝试以下操作:

 left=wellPanel(
   tags$style(type="text/css", '#leftPanel { width:200px; float:left;}'),
   id = "leftPanel",
   selectInput .... as before

这将为面板提供一个ID并分配为样式。 对其他面板执行类似的操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM