简体   繁体   English

Shiny - 相对于 mainPanel() 调整 sidebarPanel() 的宽度

[英]Shiny - Adjust width of sidebarPanel() relative to mainPanel()

I have the following segment of code which works as part of my shiny UI:我有以下代码段,它作为我闪亮的 UI 的一部分工作:

fluidPage(
      titlePanel("Complaints this month"),
      tabsetPanel(
        tabPanel(
          "Opened",
          sidebarLayout(
            sidebarPanel(
              sliderInput('sampleSize', 'Sample Size', min = 1, max = nrow(ThisMonthCreated),
                          value = 1000, step = 500, round = 0),
              selectInput('Openedx', 'X', choices = nms1, selected = "ActualDateCreated"),
              selectInput('Openedy', 'Y', choices = nms1, selected = "TimeToAcknowledge"),
              selectInput('Openedcolor', 'Color', choices = nms1, selected = "SimpleBusinessArea"),

              selectInput('Openedfacet_row', 'Facet Row', c(None = '.', nms1), selected = "none"),
              selectInput('Openedfacet_col', 'Facet Column', c(None = '.', nms1)),
              sliderInput('OpenedHeight', 'Height of plot (in pixels)', 
                          min = 100, max = 2000, value = 680)
            ),
            mainPanel(
              plotlyOutput("Open", height = "600px")
            )
          )
        )
      )
    )
  )

I tried to adjust the sidebarpanel by messing with the width of the stuff within it but of course that doesn't affect the actual width of the sidebarpanel.我试图通过弄乱其中的东西的宽度来调整侧栏面板,但这当然不会影响侧栏面板的实际宽度。 It only affects the size of the specific things inside, so it doesn't provide the desired outcome:它只影响内部特定事物的大小,因此它不会提供所需的结果:

sidebarLayout(
            sidebarPanel(
              sliderInput('sampleSize', 'Sample Size', min = 1, max = nrow(ThisMonthCreated),
                          value = 1000, step = 500, round = 0, width = "50%"),
              selectInput('Openedx', 'X', choices = nms1, selected = "ActualDateCreated", width = "50%"),
              selectInput('Openedy', 'Y', choices = nms1, selected = "TimeToAcknowledge", width = "50%"),
              selectInput('Openedcolor', 'Color', choices = nms1, selected = "SimpleBusinessArea", width = "50%"),

              selectInput('Openedfacet_row', 'Facet Row', c(None = '.', nms1), selected = "none", width = "50%"),
              selectInput('Openedfacet_col', 'Facet Column', c(None = '.', nms1), width = "50%"),
              sliderInput('OpenedHeight', 'Height of plot (in pixels)', 
                          min = 100, max = 2000, value = 680, width = "50%")
            ),
            mainPanel(
              plotlyOutput("Open", height = "600px")
            )
          )

I want it so that the sidebar panel is 1/3 (I may wan't to adjust this depending on how it looks) of the main panel.我想要它,以便侧边栏面板是主面板的 1/3(我可能不想根据它的外观来调整它)。 Would this be doable or would I have to provide specific width arguments (eg 1000px) for both panels in each tab I make?这是可行的还是我必须为我制作的每个选项卡中的两个面板提供特定的宽度参数(例如 1000 像素)?

Thanks in advance提前致谢

简单的 sidebarPanel(..., width = 2) 对我有用,如 R 文档所示。

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

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