Skip to content
Snippets Groups Projects
Commit b17d2855 authored by Franck.Gaspard's avatar Franck.Gaspard
Browse files

mise en oeuvre de shinygouv::withSpinner_dsfr()

reste un problème de sélection de plusieurs SAGE pour la page "Explorer les mesures"

0 errors :heavy_check_mark: | 2 warnings :heavy_multiplication_x: | 3 notes :heavy_multiplication_x:

── R CMD check results ──────────────────── pesticides.pdl 0.0.0.9000 ────
Duration: 3m 24.1s

❯ checking R files for syntax errors ... WARNING
  Avis dans le fichier ''R/mod_visualisation_explorer_mesures.R'' :
    impossible de traduire 'Fr<U+00E9>quence de d<U+00E9>passement de 0,1 <U+00B5>g/l' dans l’encodage natif
    impossible de traduire 'Fr<U+00E9>quence de quantification' dans l’encodage natif
    impossible de traduire 'Fr<U+00E9>quence de d<U+00E9>passement de 0,1 <U+00B5>g/l' dans l’encodage natif
    impossible de traduire 'Fr<U+00E9>quence de quantification' dans l’encodage natif
    impossible de traduire 'Recherch<U+00E9>e mais pas trouv<U+00E9>e' dans l’encodage natif
    impossible de traduire 'Trouv<U+00E9>e' dans l’encodage natif
    impossible de traduire 'Recherch<U+00E9>e mais pas trouv<U+00E9>e' dans l’encodage natif
    impossible de traduire 'Trouv<U+00E9>e' dans l’encodage natif
    impossible de traduire 'Inf<U+00E9>rieur <U+00E0> 0,5 <U+00B5>g/l' dans l’encodage natif
    impossible de traduire 'Sup<U+00E9>rieur <U+00E0> 0,5 <U+00B5>g/l' dans l’encodage natif
    impossible de traduire 'Inf<U+00E9>rieur <U+00E0> 0,1 <U+00B5>g/l' dans l’encodage natif
    impossible de traduire 'Sup<U+00E9>rieur <U+00E0> 0,1 <U+00B5>g/l' dans l’encodage natif

❯ checking LazyData ... WARNING
    LazyData DB of 7.1 MB without LazyDataCompression set
    See §1.1.6 of 'Writing R Extensions'

❯ checking package dependencies ... NOTE
  Imports includes 23 non-default packages.
  Importing from so many packages makes the package vulnerable to any of
  them becoming unavailable.  Move as many as possible to Suggests and
  use conditionally.

❯ checking installed package size ... NOTE
    installed size is  7.9Mb
    sub-directories of 1Mb or more:
      data   7.1Mb

❯ checking top-level files ... NOTE
  Non-standard file/directory found at top level:
    'pesticides.RData'
parent c3a9e93a
Branches
No related tags found
No related merge requests found
......@@ -28,7 +28,6 @@ Imports:
sf,
shiny (>= 1.7.4.1),
shinybusy,
shinycssloaders,
shinygouv,
shinyWidgets,
stats,
......
......@@ -99,7 +99,7 @@ importFrom(shiny,updateSelectizeInput)
importFrom(shiny,updateSliderInput)
importFrom(shinyWidgets,useShinydashboard)
importFrom(shinybusy,add_busy_spinner)
importFrom(shinycssloaders,withSpinner)
importFrom(shinygouv,withSpinner_dsfr)
importFrom(stats,setNames)
importFrom(tidyr,complete)
importFrom(tidyr,gather)
......
......@@ -8,6 +8,7 @@ utils::globalVariables(
"..density..", "..x..", "Exigenceeaudistribuee", "annee_prelevement", "code1", "code2",
"code_remarque", "color", "date_prelevement", "desc", "freq_depas", "freq_ndepas",
"indicateur", "insee_dep", "nom_parametre", "pas_trouve", "rech", "resultat_analyse",
"taux", "taux_quant", "trouve", "valeur"
"taux", "taux_quant", "trouve", "valeur",
"annee", "classe", "classe_qualite_station", "couleur", "n", "nom"
)
)
......@@ -77,7 +77,7 @@ mod_visualisation_explorer_mesures_ui <- function(id){
#' @importFrom forcats fct_reorder fct_recode fct_rev
#' @importFrom ggplot2 ggplot aes geom_point coord_flip scale_y_log10 scale_x_date scale_color_manual theme labs scale_fill_gradientn scale_x_log10
#' @importFrom ggridges theme_ridges geom_density_ridges_gradient
#' @importFrom highcharter hchart hcaes hc_plotOptions hc_xAxis hc_yAxis hc_tooltip hc_title hc_subtitle hc_exporting renderHighchart hc_colors
#' @importFrom highcharter hchart hcaes hc_plotOptions hc_xAxis hc_yAxis hc_tooltip hc_title hc_subtitle hc_exporting hc_colors renderHighchart
#' @importFrom htmltools HTML
#' @importFrom leafem addHomeButton
#' @importFrom leaflet leaflet addProviderTiles addPolygons fitBounds leafletOptions addCircleMarkers renderLeaflet
......@@ -87,6 +87,7 @@ mod_visualisation_explorer_mesures_ui <- function(id){
#' @importFrom scales date_format rescale
#' @importFrom sf st_coordinates
#' @importFrom shiny reactiveValues observeEvent renderPlot downloadHandler
#' @importFrom shinygouv withSpinner_dsfr
#' @importFrom stats setNames
#' @importFrom tidyr gather
#' @importFrom utils write.csv2
......@@ -104,6 +105,8 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
global$explorer_SelectSage,
global$explorer_SelectStation),{
shinygouv::withSpinner_dsfr({
if(global$explorer_SelectCodeNatureEau == "ESU"){
locale$matrice <- global$matrice_esu
locale$station <- global$station_esu
......@@ -113,7 +116,11 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
locale$station <- global$station_eso
}
explorer_data_fct <- function(explorer_SelectStation, explorer_SelectSage, matrice, explorer_SelectAnnee, explorer_SelectConcentrationmin){
explorer_data_fct <- function(explorer_SelectStation,
explorer_SelectSage,
matrice,
explorer_SelectAnnee,
explorer_SelectConcentrationmin){
if (explorer_SelectStation == "Toutes" & explorer_SelectSage == "Tous") {
matrice %>%
dplyr::filter(
......@@ -152,7 +159,11 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
}
}
}
locale$explorer_data <- explorer_data_fct(global$explorer_SelectStation, global$explorer_SelectSage, locale$matrice, global$explorer_SelectAnnee, global$explorer_SelectConcentrationmin)
locale$explorer_data <- explorer_data_fct(global$explorer_SelectStation,
global$explorer_SelectSage,
locale$matrice,
global$explorer_SelectAnnee,
global$explorer_SelectConcentrationmin)
explorer_data_carte_fct <- function(explorer_data, explorer_SelectParametre, station){
data <- explorer_data %>%
......@@ -252,8 +263,6 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
}
}
locale$explorer_carte <- explorer_carte_fct(locale$explorer_data_carte, locale$explorer_cadre_carte)
output$carte_explorer_mesures <- leaflet::renderLeaflet(locale$explorer_carte)
explorer_quantification_fct <- function(explorer_SelectParametre, explorer_data, explorer_SelectAnnee){
if (explorer_SelectParametre == "cumul") {
......@@ -381,8 +390,9 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
)
}
}
locale$explorer_quantification <- explorer_quantification_fct(global$explorer_SelectParametre, locale$explorer_data, global$explorer_SelectAnnee)
output$graph_barplot_quantification <- highcharter::renderHighchart(locale$explorer_quantification)
locale$explorer_quantification <- explorer_quantification_fct(global$explorer_SelectParametre,
locale$explorer_data,
global$explorer_SelectAnnee)
explorer_recherche_fct <- function(explorer_SelectParametre, explorer_data, explorer_SelectAnnee){
if (explorer_SelectParametre == "cumul"){
......@@ -507,8 +517,9 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
)
}
}
locale$explorer_recherche <- explorer_recherche_fct(global$explorer_SelectParametre, locale$explorer_data, global$explorer_SelectAnnee)
output$graph_barplot_recherche <- highcharter::renderHighchart(locale$explorer_recherche)
locale$explorer_recherche <- explorer_recherche_fct(global$explorer_SelectParametre,
locale$explorer_data,
global$explorer_SelectAnnee)
explorer_cumul_prelevement_fct <- function(explorer_SelectParametre, explorer_data){
if ("cumul" %in% explorer_SelectParametre) {
......@@ -580,7 +591,6 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
}
}
locale$explorer_cumul_prelevement <- explorer_cumul_prelevement_fct(global$explorer_SelectParametre, locale$explorer_data)
output$graph_scatterplot_prelevement <- shiny::renderPlot(locale$explorer_cumul_prelevement)
explorer_distribution_prelevement_fct <- function(explorer_data, explorer_SelectParametre){
explorer_data %>%
......@@ -618,8 +628,8 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
caption = "Sources : Agence de l\'Eau Loire - Bretagne, ARS\nCalculs : Dreal Pays de la Loire"
)
}
locale$explorer_distribution_prelevement <- explorer_distribution_prelevement_fct(locale$explorer_data, global$explorer_SelectParametre)
output$graph_distribution_prelevement <- shiny::renderPlot(locale$explorer_distribution_prelevement)
locale$explorer_distribution_prelevement <- explorer_distribution_prelevement_fct(locale$explorer_data,
global$explorer_SelectParametre)
explorer_data_telecharger_fct <- function(explorer_data, explorer_SelectParametre){
explorer_data %>%
......@@ -633,24 +643,8 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
"Param\u00e8tre", "Concentration mesur\u00e9e en \u00b5g/l")
)
}
locale$explorer_data_telecharger <- explorer_data_telecharger_fct(locale$explorer_data, global$explorer_SelectParametre)
output$tableau_explorer_mesures <- DT::renderDataTable(
locale$explorer_data_telecharger,
filter = "bottom",
options = list(
language = list(url = "//cdn.datatables.net/plug-ins/1.10.11/i18n/French.json"),
autoWidth = T
)
)
output$downloadData <- shiny::downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
utils::write.csv2(locale$explorer_data_telecharger, file, row.names = FALSE)
}
)
locale$explorer_data_telecharger <- explorer_data_telecharger_fct(locale$explorer_data,
global$explorer_SelectParametre)
locale$explorer_data_tout_telecharger <- locale$explorer_data %>%
dplyr::filter(code_remarque == 1) %>%
......@@ -659,16 +653,38 @@ mod_visualisation_explorer_mesures_server <- function(id, global){
c("Ann\u00e9e du pr\u00e9l\u00e8vement", "Date du pr\u00e9l\u00e8vement","Code de la station",
"Station","D\u00e9partement", "Param\u00e8tre", "Concentration mesur\u00e9e en \u00b5g/l")
)
output$downloadDatatout <- shiny::downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
utils::write.csv2(locale$explorer_data_tout_telecharger, file, row.names = FALSE)
}
)
})
})
output$carte_explorer_mesures <- leaflet::renderLeaflet(locale$explorer_carte)
output$graph_barplot_quantification <- highcharter::renderHighchart(locale$explorer_quantification)
output$graph_barplot_recherche <- highcharter::renderHighchart(locale$explorer_recherche)
output$graph_scatterplot_prelevement <- shiny::renderPlot(locale$explorer_cumul_prelevement)
output$graph_distribution_prelevement <- shiny::renderPlot(locale$explorer_distribution_prelevement)
output$tableau_explorer_mesures <- DT::renderDataTable(
locale$explorer_data_telecharger,
filter = "bottom",
options = list(
language = list(url = "//cdn.datatables.net/plug-ins/1.10.11/i18n/French.json"),
autoWidth = T
)
)
output$downloadData <- shiny::downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
utils::write.csv2(locale$explorer_data_telecharger, file, row.names = FALSE)
}
)
output$downloadDatatout <- shiny::downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
utils::write.csv2(locale$explorer_data_tout_telecharger, file, row.names = FALSE)
}
)
})
}
......
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment