[英]How do I include more than one fluidRow function when using tabBox in semantic.dashboard package in R
Under dashboardBody
I have a tabs
function where I need to specify an argument to put under content
.在
dashboardBody
下,我有一个tabs
function ,我需要在其中指定要放在content
下的参数。 I am trying to put two fluidRows
so that I have 2 rows each with 2 plots, however the other row is not showing.我正在尝试放置两个
fluidRows
,以便我有2行,每行有2个图,但是另一行没有显示。 I have tried using div(fluidRows(), fluidRows())
but the plots end up being arranged in one column instead of two.我尝试使用
div(fluidRows(), fluidRows())
但这些图最终被排列在一列而不是两列中。
How do I make the content
portion of tabs
to accept multiple fluidRows
so that I can arrange the plots in rows and columns as desired?如何使
tabs
的content
部分接受多个fluidRows
行,以便我可以根据需要在行和列中排列图?
Included is a code snippet of what I had done so far.包括到目前为止我所做的代码片段。
library(shiny)
library(shiny.semantic)
library(semantic.dashboard)
ui <- dashboardPage(
dashboardHeader(color = "black",
title = "Dashboard Demo",
inverted = TRUE),
dashboardSidebar(
size = "",
color = "teal",
sidebarMenu(
menuItem(tabName = "main", "Main", icon = icon("car")),
menuItem(tabName = "extra", "Extra", icon = icon("table"))
)
),
dashboardBody(
tabBox(width = 16,
tabs = list(list(menu = "Section 1",
content = fluidRow(box(width = 8, plotOutput("norm")),
box(width = 8, plotOutput("unif"))),
fluidRow(box(width = 8, plotOutput("chisq")),
box(width = 8, plotOutput("unif2")))),
list(menu = "Section 2", content = plotOutput("norm2"))
)
)
), theme = "cerulean"
)
server <- function(input, output) {
output$norm <- renderPlot({hist(rnorm(500))})
output$unif <- renderPlot({hist(runif(500))})
output$chisq <- renderPlot({hist(rchisq(500,2))})
output$norm2 <- renderPlot({hist(rnorm(500))})
output$unif2 <- renderPlot({hist(runif(500))})
}
shinyApp(ui = ui, server = server)
Perhaps you should try fillRow
and column()
.也许您应该尝试
fillRow
和column()
。
ui <- dashboardPage(
dashboardHeader(color = "black",
title = "Dashboard Demo",
inverted = TRUE),
dashboardSidebar(
size = "",
color = "teal",
sidebarMenu(
menuItem(tabName = "main", "Main", icon = icon("car")),
menuItem(tabName = "extra", "Extra", icon = icon("table"))
)
),
dashboardBody(
semantic.dashboard::tab_box(width = 12,
tabs = list(list(menu = "Section 1",
content = fillRow(column(12, semantic.dashboard::box(width=6, plotOutput("norm")),
semantic.dashboard::box(width=6, plotOutput("unif"))) ,
column(12, semantic.dashboard::box(width = 5, plotOutput("chisq")),
semantic.dashboard::box(width = 5, plotOutput("unif2"))) ) ),
list(menu = "Section 2", content = plotOutput("norm2"))
)
)
), theme = "cerulean"
)
server <- function(input, output) {
output$norm <- renderPlot({hist(rnorm(500))})
output$unif <- renderPlot({hist(runif(500))})
output$chisq <- renderPlot({hist(rchisq(500,2))})
output$norm2 <- renderPlot({hist(rnorm(500))})
output$unif2 <- renderPlot({hist(runif(500))})
}
shinyApp(ui = ui, server = server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.