From cbb063f959aac328a495d66999131e5670a81f7b Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Tue, 14 Apr 2020 07:54:21 +0200 Subject: [PATCH] v0.2.10.5 UPDATE: Period and Event sliders are now displayed monthly dates in the GUI when GR2M is used #14 --- DESCRIPTION | 2 +- NEWS.md | 2 +- inst/ShinyGR/server.R | 27 ++++++++++++++++++--------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0efd672..4853f35 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGRteaching Type: Package Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included) -Version: 0.2.10.4 +Version: 0.2.10.5 Date: 2020-04-14 Authors@R: c( person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"), diff --git a/NEWS.md b/NEWS.md index fca9f21..575fa9e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ -### 0.2.10.4 Release Notes (2020-04-14) +### 0.2.10.5 Release Notes (2020-04-14) #### New features diff --git a/inst/ShinyGR/server.R b/inst/ShinyGR/server.R index 30ad773..1dce7a1 100644 --- a/inst/ShinyGR/server.R +++ b/inst/ShinyGR/server.R @@ -442,9 +442,10 @@ shinyServer(function(input, output, session) { # } # } else { if (dateWindow[1L] != dateWindow[2L]) { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = dateWindow, ### + .TypeModelGR(input$HydroModel)$TimeLag, - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") } # } } @@ -476,49 +477,57 @@ shinyServer(function(input, output, session) { ## Reset period slider responds to dygraphs to mouse clicks observeEvent({input$dyPlotTSq_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotTSe_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotSVs_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotSVq_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotMDp_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotMDe_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) observeEvent({input$dyPlotMDq_click}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") }, priority = +10) ## Time window slider and dataset choosen on the Summary sheet panel observeEvent({input$Dataset}, { + timeFormat <- ifelse(input$HydroModel == "GR2M", "%Y-%m", "%F") updateSliderInput(session, inputId = "Period", min = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][1L], tz = "UTC"), max = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]][2L], tz = "UTC"), value = as.POSIXct(.ShinyGR.args$SimPer[[input$Dataset]], tz = "UTC"), - timeFormat = "%F", timezone = "+0000") + timeFormat = timeFormat, timezone = "+0000") updateSelectInput(session, inputId = "DatasetSheet", choices = .ShinyGR.args$NamesObsBV, selected = input$Dataset) -- GitLab