Skip to content

Commit

Permalink
Show only datasets used (#1309)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcin <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 16, 2025
1 parent 0876b31 commit 42135a1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
8 changes: 7 additions & 1 deletion R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ tm_g_barchart_simple <- function(x = NULL,
)

ui_args <- as.list(environment())

data_extract_list <- list(
x = x, fill = fill,
x_facet = x_facet, y_facet = y_facet
)

module(
label = label,
server = srv_g_barchart_simple,
Expand All @@ -204,7 +210,7 @@ tm_g_barchart_simple <- function(x = NULL,
ggplot2_args = ggplot2_args,
decorators = decorators
),
datanames = "all"
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
}

Expand Down
11 changes: 10 additions & 1 deletion R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ tm_g_ci <- function(label,
checkmate::assert_class(y_var, classes = "data_extract_spec")
checkmate::assert_class(x_var, classes = "data_extract_spec")
checkmate::assert_class(color, classes = "data_extract_spec")
x_var <- teal.transform::list_extract_spec(x_var, allow_null = TRUE)
y_var <- teal.transform::list_extract_spec(y_var, allow_null = TRUE)
color <- teal.transform::list_extract_spec(color, allow_null = TRUE)
teal.transform::check_no_multiple_selection(x_var)
teal.transform::check_no_multiple_selection(y_var)
teal.transform::check_no_multiple_selection(color)

checkmate::assert_class(conf_level, "choices_selected")
checkmate::assert_numeric(plot_height, len = 3, any.missing = FALSE, finite = TRUE)
checkmate::assert_numeric(plot_height[1], lower = plot_height[2], upper = plot_height[3], .var.name = "plot_height")
Expand All @@ -306,6 +313,8 @@ tm_g_ci <- function(label,

args <- as.list(environment())

data_extract_list <- list(x_var = x_var, y_var = y_var, color = color)

module(
label = label,
server = srv_g_ci,
Expand All @@ -321,7 +330,7 @@ tm_g_ci <- function(label,
),
ui = ui_g_ci,
ui_args = args,
datanames = "all"
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ select_decorators <- function(decorators, scope) {

#' Convert flat list of `teal_transform_module` to named lists
#'
#' @param decorators (list of `teal_transformodules`) to normalize.
#' @param decorators (list of `teal_transform_module`) to normalize.
#' @return A named list of lists with `teal_transform_module` objects.
#' @keywords internal
normalize_decorators <- function(decorators) {
Expand Down
2 changes: 1 addition & 1 deletion man/normalize_decorators.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/srv_decorate_teal_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 42135a1

Please sign in to comment.