0

Is it possible to adjust the heights of all plots in a shiny dashboard that are included in boxes to any screen resolution. As you can I try using css but the plots are getting bigger. If I reduce from 100vh manually then they fit better but I would like a generic solution since the result differs from screen to screen resolution.

library(shiny)
library(shinydashboard)
shinyApp(
  ui = dashboardPagePlus(
    header = dashboardHeaderPlus(
      enable_rightsidebar = TRUE,
      rightSidebarIcon = "gears"
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(
      tags$head(tags$style(".shiny-plot-output{height:100vh !important;}")),
      navbarPage("Navbar!",
                 tabPanel("Plot",
                          boxPlus(
                            plotOutput("plot1")
                          )

                 ),
                 tabPanel("Summary",
                          boxPlus(
                            plotOutput("plot2")
                          )
                 ))
    ),
    title = "Right Sidebar"
  ),
  server = function(input, output) {
    output$plot1 <- renderPlot({
      plot(cars, type=input$plotType)
    })
    output$plot2 <- renderPlot({
      plot(cars, type=input$plotType)
    })

  }
)
firmo23
  • 7,490
  • 2
  • 38
  • 114
  • [This question](https://stackoverflow.com/questions/55244840/place-elements-in-shiny-app-in-order-they-resize-for-mobile-and-desktop-monito/55245640#55245640) asked something similar, but not in the dashboard context. Do either of the approaches help (one in comments, one in answer)? – phalteman Nov 06 '19 at 23:28
  • none seems to work – firmo23 Nov 07 '19 at 00:00

0 Answers0