Commit 7f080bed authored by unknown's avatar unknown
Browse files

v.0.0.3 new diagram plotting in the GR shiny api

parent 3e0741b2
This diff is collapsed.
# server.R
shinyServer(function(input, output) {
shinyServer(function(input, output, session) {
output$myPlot <- renderPlot({
......@@ -22,12 +22,20 @@ shinyServer(function(input, output) {
RunOptions <- SIM$OptionsSimul
getplotType <- reactive({
switch(input$plotType,
"time series" = 1,
"synthesis" = 2)#,
switch(input$plotType,
"time series" = 1,
"synthesis" = 2,
"diagram" = 3)#,
# "user-defined" = 3)
})
observe({
# Control the value, min, max, and step.
# Step size is 2 when input value is even; 1 when value is odd.
updateSliderInput(session, inputId = "Event", value = input$Event,
min = input$Period[1L], max = input$Period[2L])
})
# LLL <- length(OutputsModel$Qsim)
# PosInd <- round(input$WindowPosition*LLL)
# WinInd <- round(input$WindowFraction*LLL)
......@@ -56,9 +64,11 @@ shinyServer(function(input, output) {
mtext(side = 3, line = 1, paste("Period ", format(OutputsModel$DatesR[IndPlot[1]], "%d/%m/%Y"), " - ", format(OutputsModel$DatesR[tail(IndPlot, 1)], "%d/%m/%Y"), sep = ""))
# dyplot(SIM)
}
if (getplotType() == 2) {
plot_OutputsModel(OutputsModel = OutputsModel, Qobs = SIM$Qobs, IndPeriod_Plot = IndPlot)
}
# if (getplotType() == 3) {
# Tmp <- FALSE
# if (exists("plot_UserDefined")) {
......@@ -74,7 +84,10 @@ shinyServer(function(input, output) {
# text(0, 0, "Error: the function 'plot_UserDefined' has not been defined")
# }
# }
if (getplotType() == 3) {
airGRscholar:::DiagramGR4J(OutputsModel = OutputsModel, Param = Param, SimPer = input$Period, EventDate = input$Event)
}
})
......
......@@ -9,16 +9,22 @@ shinyUI(fluidPage(
img(src = "logo_irstea_hydro.svg", height = 500/10),
img(src = "logo_irstea.svg" , height = 500/12))),
sidebarLayout(position = "left",
sidebarPanel(selectInput("TypeModel", label = "Model:", choices = c("GR4J", "GR5J", "GR6J")),
selectInput("CemaNeige", label = "Snow module:", choices = c("No", "CemaNeige")),
br(""),strong("Free parameters values:"), br(""),
sidebarPanel(width = 3,
h4("Choose a model:"),
fluidRow(
column(6, selectInput("TypeModel", label = "Hydrological model", choices = c("GR4J", "GR5J", "GR6J"))),
column(6, selectInput("CemaNeige", label = "Snow module", choices = c("No", "CemaNeige")))
),
h4("Free parameters values:"),
conditionalPanel(condition = "input.TypeModel =='GR4J' || input.TypeModel =='GR5J' || input.TypeModel =='GR6J'",
sliderInput("X1", label = "X1 (production store capacity)",
......@@ -78,12 +84,12 @@ shinyUI(fluidPage(
value = .SimGR.args$Param[length(.SimGR.args$Param)]))
)
,
mainPanel(
mainPanel(width = 9,
fluidRow(
column(2,
selectInput("plotType", label = "Choose a type of plot:",
choices = c("synthesis", "time series"))#, "user-defined"))
selectInput("plotType", label = "Choose a plot:",
choices = c("synthesis", "time series", "diagram"))#, "user-defined"))
),
# column(1,
# sliderInput("WindowFraction",
......@@ -100,7 +106,7 @@ shinyUI(fluidPage(
# value = 0.5,
# animate = TRUE)
# ),
column(9, offset = 1,
column(4, offset = 1,
sliderInput("Period", label = "Period:",
min = as.POSIXct(.SimGR.args$SimPer[1L], tz = "UTC"),
max = as.POSIXct(.SimGR.args$SimPer[2L], tz = "UTC"),
......@@ -108,10 +114,19 @@ shinyUI(fluidPage(
timeFormat = "%F",
timezone = "+0000",
animate = TRUE)
)
),
column(4, offset = 0,
sliderInput("Event", label = "Event date:",
min = as.POSIXct(.SimGR.args$SimPer[1L], tz = "UTC"),
max = as.POSIXct(.SimGR.args$SimPer[2L], tz = "UTC"),
value = as.POSIXct(.SimGR.args$SimPer[1L], tz = "UTC"),
timeFormat = "%F",
timezone = "+0000",
animate = TRUE)
)
),
plotOutput("myPlot")
plotOutput("myPlot", width = "100%", height = "600px")
# output$dateText <- renderText({
# paste("Efficiency criteria", as.character(XXXX))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment