液体盒,基本光泽

时间:2019-02-21 12:38:59

标签: r shiny

是否可以在经典闪亮的应用程序中使用box()元素?作为经典应用程序,我的意思是仪表盘没有光泽。

1 个答案:

答案 0 :(得分:3)

是的,您可以使用库(useShinydashboard)中的shinyWidgets()

这里是一个例子:

library(shiny)
library(shinyWidgets)
library(shinydashboard)

ui <- fluidPage(

  useShinydashboard(),

   titlePanel("Old Faithful Geyser Data"),

   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),

      mainPanel(
         box(plotOutput("distPlot"), title = "My box title", footer = "My box footer", collapsible = TRUE, status = "success")
      )
   )
)

server <- function(input, output) {

   output$distPlot <- renderPlot({
      x    <- faithful[, 2] 
      bins <- seq(min(x), max(x), length.out = input$bins + 1)
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })
}

shinyApp(ui = ui, server = server)