如何将 Shiny 应用程序的图像尺寸调整为屏幕尺寸?

问题描述 投票:0回答:1

抱歉,我无法分享最小的可重现示例。我有一个非常大的数据库和一个很长的代码。 这是我的侧边栏面板的代码:

  dashboardSidebar(width = 250,
                   div(style="font-size:10px;",
                                   sidebarMenu(
                                     menuItem( "Analyse de la concurrence",
                                               menuSubItem("Cartographie sur les hopitaux", tabName = "StatHopital"),
                                               menuSubItem("Cartographie sur les communes",tabName = "StatCommune"),

                                                           div(style="font-size:12px;",


                                                               
                                                               selectInput("LibGHM", 
                                                                           label = div(style = "display: flex; align-items: center;",
                                                                                       HTML(paste0('<i class="fas fa-user-md" style="color: white; margin-right: 5px;" title="Doctor"></i>')),
                                                                                       "Spécialités"),
                                                                           choices = c("Total",levels(as.factor(sejdig$Libéllé.CHIC))),
                                                                           selected="Total"
                                                               ),
                                                              

                                                               uiOutput("ui"),

                                                              
                                                               
                                                               selectInput("Urgence", 
                                                                           label = div(style = "display: flex; align-items: center;",
                                                                                       HTML(paste0('<i class="fas fa-ambulance" style="color: white; margin-right: 5px;" title="Ambulance"></i>')),
                                                                                       "Urgence"),
                                                                           choices = c("Total",levels(as.factor(sejdig$Urgence))),
                                                                           selected="Total"
                                                               ),

                                                               # selectInput(inputId = "Majorite",label="Catégories d'âge",choices = c("Total",levels(as.factor(sejdig$Majorite))),
                                                               #             selected="Total"),
                                                               
                                                               selectInput("Majorite", 
                                                                           label = div(style = "display: flex; align-items: center;",
                                                                                       HTML(paste0('<i class="fas fa-user" style="color: white; margin-right: 10px;" title="Doctor"></i>')),
                                                                                       HTML(paste0('<i class="fas fa-child" style="color: white; margin-right: 5px;" title="Child"></i>')),
                                                                                       "Majorité"),
                                                                           choices = c("Total",levels(as.factor(sejdig$Majorite))),
                                                                           selected="Total"
                                                               ),

                                                               selectInput(inputId = "Zone",
                                                                           label=div(style = "display: flex; align-items: center;",
                                                                                  HTML(paste0('<i class="fas fa-bullseye" style="color: white; margin-right: 5px;" title="Child"></i>')),
                                                                                  "Seuil de Zone de récrutement"),
                                                                           choices = c("Ensemble des patients","Zone de recrutement","Zone d'attraction"),
                                                                           selected="Zone de recrutement"),
                                                               

                                                               selectInput(inputId ="indicateur",div(style = "display: flex; align-items: center;",
                                                                           HTML(paste0('<i class="fas fa-chart-line" style="color: white; margin-right: 5px;" title=""></i>')),
                                                                           "Indicateurs"),
                                                                           choices = c("Nombre de patients"="nb_patient_tot",
                                                                                       "Nombre de patients rapporté à la population"="nb_patient_pop")))



                                                           )







                                   )
  )
  )

还有仪表板主体:

  dashboardBody(
    tags$style(type = "text/css",
               "html, body {width:100%;height:100%}",

               ".leaflet .legend {
                                         font-size: 8px;
                                       line-height: 6px;}",

               ".leaflet .legend i{
                                       width: 8px;
                                       height: 8px;
                                       }"
    ),

    tabItems(

      tabItem(
        tabName = "StatHopital",div(style="font-size:11px;width: 1200px; height: 700px",

                                    fluidRow(box(selectInput(inputId = "Hopital1",choices = c(listeHop),
                                                             label = "Choisir l'hôpital 1"),
                                                 width = 6,height = 70,
                                                 solidHeader = TRUE),
                                             box(selectInput(inputId = "Hopital2",choices = rev(c(listeHop)),
                                                             label = "Choisir l'hôpital 2"),
                                                 width = 6,height = 70,
                                                 solidHeader = FALSE)),
                                    fluidRow( tabsetPanel(
                                      tabPanel("Zone de recrutement",
                                               box(leafletOutput("ZoneHop1",height = 500,width = "100%")),
                                               box(leafletOutput("ZoneHop2",height = 500,width = "100%"))
                                      ),
                                      tabPanel("Part de marché", 
                                               box(leafletOutput("MktShareZ1",height = 500,width = "100%")),
                                               box(leafletOutput("MktShareZ2",height = 500,width = "100%"))
                                               ),
                                      tabPanel("Concurrence", leafletOutput("Comp1",height = 600,width = "100%"))
                                    ))
        )),

      tabItem(
        tabName = "StatCommune",div(style="font-size:11px;",

                                    fluidRow(box(selectInput(inputId = "Commune",choices = c(levels(as.factor(LibCom$libgeo_cp))),
                                                             label = "Choisir la commune"),
                                                 width = 6,height = 70,
                                                 solidHeader = TRUE)),
                                    fluidRow( tabsetPanel(
                                      tabPanel("Nombre de séjours par communes",
                                               leafletOutput("sejourCom",height = 550)
                                      ),
                                      tabPanel("Concurrence au sein de la commune",
                                               leafletOutput("HHI_IDF",height = 550)
                                      ),
                                      tabPanel("Flux des communes vers les hopitaux",
                                               leafletOutput ("Commune2",height = 550)),
                                      tabPanel("Flux des communes vers les hopitaux",
                                               dataTableOutput ("Commune3"))
                                    ))
        ))
    )



    )
)

。即使我切换到更大的屏幕,图形的大小也保持不变。有什么办法让我的绘图适合屏幕尺寸吗?

这是我在 PC 上制作闪亮效果的图(屏幕:19020x1080)。

这是大屏幕上的闪亮效果

r shiny shinydashboard
1个回答
0
投票

您可以尝试使用明确的宽度规格(每个fluidRow

总共最多12
):

fluidRow(column(width = 6,
                ## elements of left column
                ),
         column(width = 6,
                ## elements of right column
                )
        )       

和/或从

fluidPage
更改为
fillPage

© www.soinside.com 2019 - 2024. All rights reserved.