我将多个输入字段放入box()
中的fluidRow()
中。但是,不是将所有这些都放到一行中,而是将它们呈现在一列中。我找不到任何有关在FluidRow中格式化字段的信息.....
我想要一个用于对非反应性输入字段进行分组的大盒子。将有另一个框用于反应性输入字段的另一组。我尝试将盒子放在盒子里,但无法正常工作。我看到它在这里完成:https://gallery.shinyapps.io/DEApp/
此闪亮的图库应用程序的代码是否可供查看?我似乎在一个盒子里有一个盒子。
代码如下:
# Plex dashboard
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Plexogram"),
## Sidebar content
dashboardSidebar(
sidebarMenu(
menuItem("Configure", tabName = "config", icon = icon("tachometer-alt"),
menuSubItem("View input data", tabName = "input", icon = icon("database"))),
menuItem("Results", tabName = "results", icon = icon("digital-tachograph "),
menuSubItem("Results Plot", tabName = "resultsP", icon = icon("chart-line")),
menuSubItem("Results Table", tabName = "resultsT", icon = icon("table"))),
menuItem("About Plexogram", tabName = "about", icon = icon("info")),
menuItem("Documentation", tabName = "document", icon = icon("readme"))
)
),
## Body content
dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "input",
fluidRow(
box(
radioButtons(inputId="header", label="Header in data file?",
choices=c("True" = TRUE,
"False" = FALSE), selected = NULL,
inline = FALSE, width = '80px'),
numericInput(inputId="skip", label="Skip rows before data?", value=0, min = 0, width = '80px'),
textInput(inputId="timeFormat", label="Time format (R syntax)", value = "", width = '80px', placeholder = "%Y%m%d%MM%HH"),
title="File-related parameters", status="primary", width=12, solidHeader = TRUE, collapsible = TRUE) # end outer box
), # close fluidrow
fluidRow(
box(plotOutput("plot1", height = 250)),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
),
# Second tab content
tabItem(tabName = "resultsP",
h2("Results tab content")
)
) # end of tabItems
) # end of dashboardBody
) # end if UI
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
答案 0 :(得分:0)
您需要使用列将每个元素分配给fluidRow中的某个水平空间。每个fluidRow的默认宽度为12。我为每列分配的宽度为4,因此它们之间的间距相等。如果没有列和宽度分配,则每个项目的宽度均为12,导致它们彼此堆叠。
ui <- dashboardPage(
dashboardHeader(title = "Plexogram"),
## Sidebar content
dashboardSidebar(
sidebarMenu(
menuItem("Configure", tabName = "config", icon = icon("tachometer-alt"),
menuSubItem("View input data", tabName = "input", icon = icon("database"))),
menuItem("Results", tabName = "results", icon = icon("digital-tachograph "),
menuSubItem("Results Plot", tabName = "resultsP", icon = icon("chart-line")),
menuSubItem("Results Table", tabName = "resultsT", icon = icon("table"))),
menuItem("About Plexogram", tabName = "about", icon = icon("info")),
menuItem("Documentation", tabName = "document", icon = icon("readme"))
)
),
## Body content
dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "input",
fluidRow(
box(
column(width=4,
radioButtons(inputId="header", label="Header in data file?",
choices=c("True" = TRUE,
"False" = FALSE), selected = NULL,
inline = FALSE, width = '80px')
),
column(width=4,
numericInput(inputId="skip", label="Skip rows before data?", value=0, min = 0, width = '80px')
),
column(width=4,
textInput(inputId="timeFormat", label="Time format (R syntax)", value = "", width = '80px', placeholder = "%Y%m%d%MM%HH")
),
title="File-related parameters", status="primary", width=12, solidHeader = TRUE, collapsible = TRUE) # end outer box
), # close fluidrow
fluidRow(
box(plotOutput("plot1", height = 250)),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
),
# Second tab content
tabItem(tabName = "resultsP",
h2("Results tab content")
)
) # end of tabItems
) # end of dashboardBody
) # end if UI