Commit fa83aa12 authored by Jean-Francois Rey's avatar Jean-Francois Rey
Browse files

shiny add tooltips

parent 3ae222a5
......@@ -10,7 +10,7 @@ runShinyApp <- function() {
stop("Could not find example directory. Try re-installing `landsepi`.", call. = FALSE)
}
needed_packages <- c("shiny","DT", "shinyjs", "gridExtra", "png", "grid", "future", "promises", "tools")
needed_packages <- c("shiny", "shinyBS", "DT", "shinyjs", "gridExtra", "png", "grid", "future", "promises", "tools")
if( sum(needed_packages %in% utils::installed.packages()[,1] == FALSE) != 0) {
stop('Install packages : install.packages(c("shiny","DT", "shinyjs", "gridExtra", "png", "grid", "future", "promises", "tools"))')
}
......
#library(shinycssloaders)
library(shiny)
library(shinyBS)
library(DT)
library(shinyjs)
#library(slickR)
......@@ -396,3 +397,22 @@ PercentageInput <- function(inputId, label, value) {
)
}
#################################################################
### Tooltip message
#################################################################
SIGMOID_SIGMA <- "sigma parameter of the sigmoid contamination function"
SIGMOID_KAPPA <- "kappa parameter of the sigmoid contamination function"
INFECTIOUS_PERIOD_VAR <- "variance of the infectious period duration"
INFECTIOUS_PERIOD_EXP <- "maximal expected duration of the infectious period"
LATENT_PERIOD_VAR <- " variance of the latent period duration"
LATENT_PERIOD_EXP <- "minimal expected duration of the latent period"
PROPAGULE_PROD_RATE <- "maximal expected effective propagule production rate of an infectious host per time step"
INFECTION_RATE <- "maximal expected infection rate of a propagule on a healthy host"
SURVIVAL_PROB <- "probability for a propagule to survive the off-season"
INOCULUM <- "initial probability for the first host (whose index is 0) to be infectious (i.e. state I) at the beginning of the simulation."
GENERATE_LANDSCAPE <- "Generates a landscape composed of fields where croptypes are allocated with controlled proportions and spatio-temporal aggregation."
RUN_SIMULATION <- "Run the simulation, depending of the parameters it can be long"
STOP_SIMULATION <- "Force to stop the simulation"
EXPORT_SIMULATION <- "Download a GPKG containing most of the parameters"
ROTATION_PERIOD <- "Croptypes rotation period in years. Will switch between 0 and 1 croptypes and 0 and 2 croptypes each period time. 0 mean no rotation."
\ No newline at end of file
......@@ -56,6 +56,7 @@ landscapeTab <- {
max = 50
)
),
shinyBS::bsTooltip("rotationPeriod",title=ROTATION_PERIOD, placement = "bottom", trigger="hover"),
column(
width = 3,
align = "left",
......@@ -131,7 +132,8 @@ pathogenTab <- {
min = 0.0,
max = 1.0,
step = 0.0001
)
),
shinyBS::bsTooltip("inoculum",title=INOCULUM, placement = "bottom", trigger="hover"),
),
shiny::fluidRow(
column(
......@@ -144,6 +146,7 @@ pathogenTab <- {
max = 1.0,
step = 0.0001
),
shinyBS::bsTooltip("patho_survival_prob",title=SURVIVAL_PROB, placement = "right", trigger="hover"),
# shiny::numericInput(
# inputId = "patho_repro_sex_prob",
# label = "Prob. for an infectious host to reporduce via sex rather than clonal",
......@@ -160,13 +163,15 @@ pathogenTab <- {
max = 2.0,
step = 0.1
),
shinyBS::bsTooltip("patho_infection_rate",title=INFECTION_RATE, placement = "right", trigger="hover"),
shiny::numericInput(
inputId = "patho_propagule_prod_rate",
label = "Max expected effective propagule production rate of an infectious host per time step",
value = 3.125,
min = 0.0,
step = 0.4
)
),
shinyBS::bsTooltip("patho_propagule_prod_rate",title=PROPAGULE_PROD_RATE, placement = "right", trigger="hover")
),
column(
width = 4,
......@@ -178,6 +183,7 @@ pathogenTab <- {
max = 100,
step = 1
),
shinyBS::bsTooltip("patho_latent_period_exp",title=LATENT_PERIOD_EXP, placement = "left", trigger="hover"),
shiny::numericInput(
inputId = "patho_latent_period_var",
label = "Variance of the latent period duration",
......@@ -186,6 +192,7 @@ pathogenTab <- {
max = 100,
step = 1
),
shinyBS::bsTooltip("patho_latent_period_var",title=LATENT_PERIOD_VAR, placement = "left", trigger="hover"),
shiny::numericInput(
inputId = "patho_infectious_period_exp",
label = "Max expected duration of the infectious period",
......@@ -194,6 +201,7 @@ pathogenTab <- {
max = 365,
step = 1
),
shinyBS::bsTooltip("patho_infectious_period_exp",title=INFECTIOUS_PERIOD_EXP, placement = "left", trigger="hover"),
shiny::numericInput(
inputId = "patho_infectious_period_var",
label = "Variance of the infectious period duration",
......@@ -201,6 +209,7 @@ pathogenTab <- {
min = 0,
step = 1
),
shinyBS::bsTooltip("patho_infectious_period_var",title=INFECTIOUS_PERIOD_VAR, placement = "left", trigger="hover")
),
column(
width = 4,
......@@ -212,6 +221,7 @@ pathogenTab <- {
max = 10,
step = 0.01
),
shinyBS::bsTooltip("patho_sigmoid_kappa",title=SIGMOID_KAPPA, placement = "left", trigger="hover"),
shiny::numericInput(
inputId = "patho_sigmoid_sigma",
label = "Sigma parameter of the sigmoid contamination function",
......@@ -219,7 +229,8 @@ pathogenTab <- {
min = 0.0,
max = 100,
step = 1
)
),
shinyBS::bsTooltip("patho_sigmoid_sigma",title=SIGMOID_SIGMA, placement = "left", trigger="hover")
#,
# shiny::numericInput(
# inputId = "patho_sigmoid_plateau",
......@@ -296,6 +307,7 @@ ui <- {
titlePanel("Landsepi : Landscape Epidemiology and Evolution"),
actionButton("About", "About"),
actionButton("Mode", "Advanced Mode On/Off", icon = icon("exchange-alt")),
shinyBS::bsTooltip("Mode",title="Edit parameters", placement = "top", trigger="hover"),
align="center"),
shiny::br(),
fluidRow(
......@@ -314,17 +326,21 @@ ui <- {
shiny::actionButton(inputId = "generateLandscape", label = "Generate the landscape"),
align = "center"
)),
shinyBS::bsTooltip("generateLandscape",title=GENERATE_LANDSCAPE, placement = "top", trigger="hover"),
shiny::br(),
shiny::fluidRow(shiny::div(
shiny::actionButton(inputId = "runSimulation", label = "Run simulation"),
shiny::actionButton(inputId = "stopSimulation", label = "Stop simulation"),
align = "center"
)),
shinyBS::bsTooltip("runSimulation",title=RUN_SIMULATION, placement = "top", trigger="hover"),
shinyBS::bsTooltip("stopSimulation",title=STOP_SIMULATION, placement = "top", trigger="hover"),
shiny::br(),
shiny::fluidRow(shiny::div(
shiny::downloadButton(outputId = "export", label = "Export simulation"),
align = "center"
)),
shinyBS::bsTooltip("export",title=EXPORT_SIMULATION, placement = "top", trigger="hover"),
shiny::br()
)
}
Supports Markdown
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