[英]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.