【发布时间】:2018-05-29 20:35:11
【问题描述】:
我有以下代码段,作为我闪亮的 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(我可能不想根据它的外观进行调整)。这是可行的还是我必须为我制作的每个选项卡中的两个面板提供特定的宽度参数(例如 1000 像素)?
提前致谢
【问题讨论】:
-
我认为你不能。我记得我在某处读过它与引导设置(由闪亮使用)有关,其中侧边栏的宽度为 4 个单位,主面板的宽度为 8 个单位。恐怕你需要切换到
fluidRow+column并做一些手工设计。 -
我明白了 - 在这种情况下,我将使用手动方式并将其编辑到问题中,作为我尝试此以供将来参考的另一种方式
-
你考虑过使用 flexdashboard 吗? rmarkdown.rstudio.com/flexdashboard/shiny.html - 允许控制侧边栏宽度
-
是的,看起来很不错!
-
我从未接触过 flexdashboard(这是我第一个闪亮的项目),所以我必须先学习它,然后才能更新我是否能得到我想要的东西 - 感谢您指出