以下仪表板页面包含左侧和右侧对齐的操作按钮以及另外两个缩放和重置按钮。我想将盒子放在屏幕中央,然后将按钮缩放并重置到最右上方。休息所有按钮都很好。我试图使用标签$ div但没有帮助。请提前帮助和非常感谢。
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
tags$br(actionButton("go", "Log")),
tags$br(),
tags$br(actionButton("go", "Case")),
tags$br(),
tags$br(actionButton("go", "Resource")),
tags$br(),
tags$br(actionButton("go", "Activity")),
tags$br(),
tags$br(actionButton("go", "Resource-activity")),
box(),
tags$br(actionButton("go", "Zoom")),
tags$br(actionButton("go", "Reset"))
))
server <- function(input, output)
{
}
shinyApp(ui, server)
答案 0 :(得分:1)
这样的事情吗?
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
fluidRow(
column(1,
tags$br(actionButton("go", "Log")),
tags$br(),
tags$br(actionButton("go1", "Case")),
tags$br(),
tags$br(actionButton("go2", "Resource")),
tags$br(),
tags$br(actionButton("go3", "Activity")),
tags$br(),
tags$br(actionButton("go4", "Resource-activity"))),
br(),
column(10,
box(width=12,plotOutput("plot"))),
column(1,
tags$br(actionButton("go5", "Zoom")),
tags$br(),
tags$br(actionButton("go6", "Reset"))))
))
server <- function(input, output){
output$plot <- renderPlot(hist(mtcars$disp))
}
shinyApp(ui, server)
答案 1 :(得分:0)
您可以使用fluidRow
和column
:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "My Dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
fluidRow(
column(2, offset = 1,
actionButton("go", "Log")
),
column(2, offset = 7,
actionButton("go", "Zoom")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Case")
),
column(2, offset = 7,
actionButton("go", "Reset")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Resource")
),
column(8, offset = 1,
box()
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Activity")
)
),
fluidRow(
column(2, offset = 1,
actionButton("go", "Resource-activity")
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
但可能有更好的选择。