diff --git a/app.R b/app.R index 580970d..9a9a604 100644 --- a/app.R +++ b/app.R @@ -132,28 +132,37 @@ server <- function(input, output, session) theme(axis.title = element_blank()) }) - # observe({ - # output$plot_age <- renderPlotly({ - # filteredData() %>% - # ( - # ggplot() + - # aes(x = Age, y = ..density..) + - # geom_histogram() + - # geom_density() - # ) %>% ggplotly - # }) - # }) - # observe({ - # leafletProxy("map", data = in_bounds()) %>% - # clearShapes() %>% - # }) - # Use a separate observer to recreate the legend as needed. - # observe({ - # Remove any existing legend, and only if the legend is - # enabled, create a new one. - # leafletProxy("map", data = quakes) %>% - # clearControls() - # if (input$legend) { + # Sexe + data_sexe <- reactive({ + if (input$choice_ghm %>% is.null) + { + GHM %>% + filter(Age <= input$slider_age[2] & Age >= input$slider_age[1], + date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1], + CP %in% in_bounds()$Codepos) + } else + { + GHM %>% + filter(Age <= input$slider_age[2] & Age >= input$slider_age[1], + GHM %in% input$choice_ghm, + date_entree <= input$slider_date[2] & date_sortie >= input$slider_date[1], + CP %in% in_bounds()$Codepos) + } + }) + + output$plot_sexe <- renderPlot({ + data_sexe() %>% + ggplot() + + aes(x = 1, fill = Sexe) + + geom_bar() + + coord_flip() + + scale_fill_manual(values = c("Homme" = "lightblue", "Femme" = "pink")) + + theme(axis.title = element_blank(), + legend.position = "none", + axis.text.y = element_blank(), + axis.ticks.y = element_blank()) + }) + # pal <- colorpal() # proxy %>% addLegend(position = "bottomright", # pal = pal, values = ~mag