用两个box()分隔fluidRow()?

时间:2018-11-28 08:54:03

标签: r shiny

我想将流体排分为65%和35%。 65%的部分将具有4个信息框,而35%的部分将具有1个图像。

代码:

library(shiny)
ui <- shinyUI(dashboardPage(dashboardHeader("aa"),
dashboardSidebar(),
dashboardBody(
mainPanel(
tabsetPanel(
tabPanel(
fluidRow(
box(width='65%', 
infoBox("Total visits", width = 4, icon = icon("compass"), color = 
"yellow"),
infoBox("Revisits", width = 4, icon = icon("compass"), color = "yellow"), 
infoBox("Uinique Registrations", width = 4,icon = icon("compass"), color = 
"yellow"),
infoBox("Avg. Visits per day", width = 4, icon = icon("compass"), color = 
"yellow") 
))))))))

server <- shinyServer(function(input,output){})

shinyApp(ui, server)

请问有人可以帮我建立这个结构吗?

谢谢。enter image description here

1 个答案:

答案 0 :(得分:0)

以下是使用column()的示例:

library(shiny)
library(shinydashboard)

ui <- shinyUI(dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(fluidRow(
    column(
      width = 8,
      box(
        width = 12,
        infoBox(
          "Total visits",
          width = 6,
          icon = icon("compass"),
          color =
            "yellow"
        ),
        infoBox(
          "Revisits",
          width = 6,
          icon = icon("compass"),
          color = "yellow"
        ),
        infoBox(
          "Uinique Registrations",
          width = 6,
          icon = icon("compass"),
          color =
            "yellow"
        ),
        infoBox(
          "Avg. Visits per day",
          width = 6,
          icon = icon("compass"),
          color =
            "yellow"
        )

      )
    ), column(width = 4, box(
      "myImage", width = 12, height = "233px"
    ))
  ))
))

server <- shinyServer(function(input, output) {

})

shinyApp(ui, server)

有关更多信息,请参见Shiny application layout guide