闪亮的仪表板多个图表 - 重叠

Shiny dashboard multiple charts - overlapping

我正在为我的应用程序使用 shiny dashboard 包。 当试图在同一页上显示 2 个图时(每个图都在一个框中),它们是重叠的。 还尝试对每个图使用 fluidRow - 但似乎两个图都连接到同一个框(并且重叠)

这是我的代码:

 mainPanel(
  fluidRow( 
     box(showOutput("MeasuresPlot","morris"),width=6,title="Graph"),
     box(showOutput("ImportPlot","morris"),width=6,title="Graph2")
   )      
  )

你快完成了,在你的流动行中你可以使用这样的列:

library(shiny)
library(shinydashboard)


ui <-dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
      fluidRow(
        column(6,box(plotOutput("plt1"),width=12,title="Graph",background ="green") ),
        column(6,box(plotOutput("plt2"),width=12,title="Graph2",background="yellow") )
      ),
      fluidRow( actionButton("plot","plot") )
    )
)

server <- shinyServer(function(input, output, session) {
  observeEvent(input$plot,{
    output$plt1 <- renderPlot({plot(runif(100),runif(100))})
    output$plt2 <- renderPlot({plot(runif(100),runif(100))})
  })
})

shinyApp(ui = ui, server = server)

fluidRow 的最大宽度为 12,因此将每列的宽度设置为 6 会给出 2 个等宽的图。