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

时间:2017-12-15 15:44:24

标签: r

我有以下代码段作为我闪亮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")
            )
          )
        )
      )
    )
  )

我试图通过弄乱其中的东西的宽度来调整侧边栏,但当然这不会影响侧边栏的实际宽度。它只会影响内部特定事物的大小,因此无法提供所需的结果:

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")
            )
          )

我想要它以使侧面板面板是主面板的1/3(我可能不会根据外观调整它)。这是可行的还是我必须为我制作的每个标签中的两个面板提供特定的宽度参数(例如1000px)?

提前致谢

1 个答案:

答案 0 :(得分:4)

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