-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* time plot table * renaming and default latitude longitude * apply dataExport from shinyTools, remove code (#24) --------- Co-authored-by: Antonia Runge <[email protected]>
- Loading branch information
Showing
13 changed files
with
253 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: MapR | ||
Title: Display temporal and temperature graphical files for Isomemo | ||
Version: 24.2.0 | ||
Version: 24.3.0 | ||
Authors@R: c(person("Lukas", "Fuchs", email = "[email protected]", role = c("aut", "cre"))) | ||
Description: An App to display temporal and temperature graphical files for Isomemo. | ||
License: GPL (>= 3) | ||
|
@@ -10,12 +10,13 @@ RoxygenNote: 7.2.3 | |
Imports: | ||
colourpicker, | ||
DataTools (>= 23.12.2), | ||
DT, | ||
magrittr, | ||
pastclim, | ||
rjson, | ||
shiny, | ||
shinyjs, | ||
shinyTools, | ||
shinyTools (>= 24.03.1), | ||
shinyWidgets, | ||
terra, | ||
yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#' UI function of table module | ||
#' | ||
#' @param id id of module | ||
tableUI <- function(id) { | ||
ns <- NS(id) | ||
DT::dataTableOutput(ns("table"), height = "800px", width = "80%") | ||
} | ||
|
||
|
||
#' Server function of table module | ||
#' | ||
#' @param id id of module | ||
#' @param df data frame to be displayed in table | ||
tableServer <- function(id, df) { | ||
moduleServer( | ||
id, | ||
function(input, output, session) { | ||
output$table <- DT::renderDataTable({ | ||
DT::datatable(df, | ||
rownames = FALSE, | ||
# escape = FALSE, | ||
# filter = "top", | ||
style = "bootstrap", | ||
options = list( | ||
pageLength = 25 | ||
), | ||
selection = list(mode = "single", target = "cell") | ||
) | ||
}) | ||
} | ||
) | ||
} | ||
|
||
#' Observer to show table when display button is clicked | ||
#' | ||
#' @param input input object from server function | ||
#' @param output output object from server function | ||
#' @param session session from server function | ||
#' @param image_list reactive image list | ||
#' @param table_data reactive table data | ||
observeShowTable <- function(input, output, session, image_list, table_data) { | ||
observe({ | ||
shinyjs::hide(id = "title-options") | ||
shinyjs::hide(id = "plot_title") | ||
shinyjs::hide(id = "mainplot-plot") | ||
shinyjs::show(id = "maintable-table") | ||
shinyjs::show( | ||
id = "download-export", | ||
anim = TRUE, | ||
animType = "fade", | ||
time = 1 | ||
) | ||
imageInfos <- prepareImageListImage(input = input, image_list = image_list) | ||
locations <- data.frame(latitude = input[["latitude"]], longitude = input[["longitude"]]) | ||
path <- paste0(tempdir(), "/data/", imageInfos$address) | ||
if (imageInfos$file_type[[1]] != "nc") { | ||
shinyjs::alert("file_type specified in json must be nc for time plot.") | ||
} else { | ||
df <- pastclim::location_series( | ||
x = locations, | ||
bio_variables = imageInfos$variable, | ||
dataset = "custom", | ||
path_to_nc = path | ||
) | ||
# Not sure if time column is always called time_bp. If not we need a different approach for filtering. | ||
df <- df[df$time_bp >= min(input[["time_range-slider"]]) & | ||
df$time_bp <= max(input[["time_range-slider"]]), ] | ||
df$name <- NULL | ||
table_data(df) | ||
tableServer( | ||
id = "maintable", | ||
df = df | ||
) | ||
} | ||
}) %>% | ||
bindEvent(input[["display_table-button"]], | ||
ignoreInit = TRUE | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.