diff --git a/inst/ShinyApp/server.R b/inst/ShinyApp/server.R index becdaafea8aa92d66f5524b2f5044496edf01bb6..afeb922ff720761439ce75c2a3020b14a1e0efda 100644 --- a/inst/ShinyApp/server.R +++ b/inst/ShinyApp/server.R @@ -280,23 +280,29 @@ server <- function(input, output, session){ ## Fatalities ###~~~~~~~~~~~~~~~~~~~~~~~~~~### observeEvent({ input$fatalities_input_type + input$button_fatalities },{ - output$fatalities_distri_plot <- renderPlot({ plot_gamma(mu = input$fatalities_mean, se = input$fatalities_se) }) - }) + output$title_distri_plot <- renderText({ "Mortalités annuelles" }) + output$distri_plot <- renderPlot({ plot_gamma(mu = input$fatalities_mean, se = input$fatalities_se) }) + }, ignoreInit = TRUE) ## Population size ###~~~~~~~~~~~~~~~~~~~~~~~~~~### observeEvent({ input$pop_size_input_type + input$button_pop_size },{ - output$pop_size_distri_plot <- renderPlot({ plot_gamma(mu = input$pop_size_mean, se = input$pop_size_se) }) - }) + output$title_distri_plot <- renderText({ "Taille de population" }) + output$distri_plot <- renderPlot({ plot_gamma(mu = input$pop_size_mean, se = input$pop_size_se) }) + }, ignoreInit = TRUE) ## Population growth ###~~~~~~~~~~~~~~~~~~~~~~~~~~### observeEvent({ input$pop_growth_input_type + input$button_pop_growth },{ - output$pop_growth_distri_plot <- renderPlot({ plot_gamma(mu = input$pop_growth_mean, se = input$pop_growth_se) }) - }) + output$title_distri_plot <- renderText({ "Taux de croissance de la population" }) + output$distri_plot <- renderPlot({ plot_gamma(mu = input$pop_growth_mean, se = input$pop_growth_se) }) + }, ignoreInit = TRUE) ###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~### @@ -327,7 +333,8 @@ server <- function(input, output, session){ param$fatalities_eli_result <- func_eli(input$fatalities_mat_expert) ## plot distribution - output$fatalities_distri_plot <- renderPlot({ plot_expert(param$fatalities_eli_result$out) }) + output$title_distri_plot <- renderText({ "Mortalités annuelles" }) + output$distri_plot <- renderPlot({ plot_expert(param$fatalities_eli_result$out) }) } else { print("missing value") @@ -345,7 +352,8 @@ server <- function(input, output, session){ param$pop_size_eli_result <- func_eli(input$pop_size_mat_expert) ## plot distribution - output$pop_size_distri_plot <- renderPlot({ plot_expert(param$pop_size_eli_result$out) }) + output$title_distri_plot <- renderText({ "Taille de population" }) + output$distri_plot <- renderPlot({ plot_expert(param$pop_size_eli_result$out) }) } else { print("missing value") @@ -363,7 +371,8 @@ server <- function(input, output, session){ param$pop_growth_eli_result <- func_eli(input$pop_growth_mat_expert) ## plot distribution - output$pop_growth_distri_plot <- renderPlot({ plot_expert(param$pop_growth_eli_result$out) }) + output$title_distri_plot <- renderText({ "Taux de croissance de la population" }) + output$distri_plot <- renderPlot({ plot_expert(param$pop_growth_eli_result$out) }) } else { print("missing value") @@ -380,9 +389,8 @@ server <- function(input, output, session){ param$carrying_cap_eli_result <- func_eli(input$carrying_cap_mat_expert) ## run elicitation analysis - output$carrying_cap_distri_plot <- renderPlot({ - plot_expert(param$carrying_cap_eli_result$out, show_se = FALSE) - }) + output$title_distri_plot <- renderText({ "Capacité de charge" }) + output$distri_plot <- renderPlot({ plot_expert(param$carrying_cap_eli_result$out, show_se = FALSE) }) } else { print("missing value") diff --git a/inst/ShinyApp/ui.R b/inst/ShinyApp/ui.R index b74dd8d924dd13eba9b2ead71e2095550df1c5a6..85219c7ce5905b5b5aa31ec2da563bba9454a1a2 100644 --- a/inst/ShinyApp/ui.R +++ b/inst/ShinyApp/ui.R @@ -278,6 +278,7 @@ rm(list = ls(all.names = TRUE)) "Elicitation d'expert" = "eli_exp", "Tendance locale ou régionale" = "trend")), + ## Input values: mean and se numericInput(inputId = "pop_growth_mean", label = "Moyenne de la croissance de la population", value = 1.1, @@ -288,6 +289,7 @@ rm(list = ls(all.names = TRUE)) value = 0.01, min = 0, max = Inf, step = 0.01), + ## Input expert elicitation: table matrixInput(inputId = "pop_growth_mat_expert", value = matrix(data = eli_pop_growth, nrow = 4, ncol = 5, dimnames = list(c("#1", "#2", "#3", "#4"), @@ -299,13 +301,22 @@ rm(list = ls(all.names = TRUE)) actionButton(inputId = "pop_growth_run_expert", label = "Utiliser valeurs experts"), - radioButtons(inputId = "pop_trend", - label = NULL, - choices = c("Croissance", "Stable", "Déclin")), - - radioButtons(inputId = "pop_trend_strength", - label = NULL, - choices = c("Faible", "Moyen", "Fort")), + ## Input trend: radio buttons + {fluidRow( + # Trend + column(6, + radioButtons(inputId = "pop_trend", + label = "Tendance", + choices = c("Croissance", "Stable", "Déclin")), + ), + + # Strength of trend + column(6, + radioButtons(inputId = "pop_trend_strength", + label = "Force", + choices = c("Faible", "Moyen", "Fort")), + ), + )}, # close fluidRow )}, # close wellPanel @@ -423,23 +434,9 @@ rm(list = ls(all.names = TRUE)) br(), hr(), - h3("Mortalités annuelles", align = "center"), - plotOutput(outputId = "fatalities_distri_plot"), - br(""), - hr(), - - h3("Taille de la population", align = "center"), - plotOutput(outputId = "pop_size_distri_plot"), - br(""), - hr(), - - h3("Taux de croissance de la population", align = "center"), - plotOutput(outputId = "pop_growth_distri_plot"), - br(""), - hr(), - - h3("Capacité de charge: Elicitation d'expert", align = "center"), - plotOutput(outputId = "carrying_cap_distri_plot"), + #h3("Mortalités annuelles", align = "center"), + span(textOutput(outputId = "title_distri_plot"), style="font-size:24px; font-weight:bold"), + plotOutput(outputId = "distri_plot"), ), # End tabPanel