[英]Positioning of box and action buttons in R shiny
The following dashboard page consists of action buttons aligned to the left and the plot and two more zoom and reset buttons. 以下仪表板页面包括与左侧和绘图对齐的操作按钮以及另外两个缩放和重置按钮。 I want to position the box at the center of the screen and zoom and reset buttons to the extreme top-right.
我想将盒子放在屏幕中央,然后将按钮缩放并重置到最右上方。 Rest all buttons are fine.
休息所有按钮都很好。 I tried to use tags$div but no help.
我试图使用标签$ div但没有帮助。 Please help and big thanks in advance.
请提前帮助和非常感谢。
## 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)
Something like this do? 这样的事情呢?
## 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)
You could play with fluidRow
and column
: 你可以玩
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)
But there might be better alternatives. 但可能有更好的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.