如何向 R Shiny 添加 css 文件以改进我的应用程序?

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

我尝试构建一个闪亮的R。我已经成功使用堆栈溢出成员。然而,我们鼓励自己添加更多问题。我的应用程序有几个问题:

  1. 如您所见,我的地图没有占据整个屏幕。有可能得到吗?如何? (我已经用这一点更新了问题)

这是我所取得的成就:

library(shiny)
library(tidyverse)
library(leaflet)

fake_data <- read.csv("https://raw.githubusercontent.com/gabrielburcea/stackoverflow_fake_data/master/gather_divided.csv")

# Define UI for application that draws a histogram
ui <- fluidPage(
    
    # Application title
    h1("Symptoms accross the world"),
    
    # Sidebar with a slider input for number of bins 
    leafletOutput("map"), 
    
    #Floating panel 
    absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
                  draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
                  width = 330, height = "auto",
                  
                  shiny::selectInput("symptom", "Select Symptom", c("Chills",
                                                                    "Cough",
                                                                    "Diarrhoea",
                                                                    "Fatigue",
                                                                    "Headache",
                                                                    "Loss of smell and taste",
                                                                    "Muscle ache",
                                                                    "Nasal congestion",
                                                                    "Nausea and vomiting",
                                                                    "Shortness of breath",
                                                                    "Sore throat",
                                                                    "Sputum",
                                                                    "Temperature"), multiple = TRUE)
                  
    )
    
)

server <- function(input, output) {
    
    filtered_data <- reactive({
        fake_data %>% 
            dplyr::filter(Symptom %in% input$symptom)
    })
    
    output$map <- renderLeaflet({
        leaflet() %>%
            addTiles() %>%
            addMarkers(data = filtered_data(), clusterOptions = markerClusterOptions())
        
    })
    
}


# Run the application 
shinyApp(ui = ui, server = server)
css r shiny
1个回答
0
投票

我已经用这段代码解决了第一个问题:

leafletOutput("map", width = "100%", height = "95vh")
© www.soinside.com 2019 - 2024. All rights reserved.