Skip to content

Commit ff7d3c2

Browse files
committed
feat: tm_g_scatterplotmatrix
1 parent 929f45f commit ff7d3c2

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

R/tm_g_scatterplotmatrix.R

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,15 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
202202

203203
checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
204204
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
205-
checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE)
205+
206+
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
207+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
208+
lapply(decorators, list)
209+
} else {
210+
list(default = decorators)
211+
}
212+
}
213+
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
206214
# End of assertions
207215

208216
# Make UI args
@@ -249,7 +257,7 @@ ui_g_scatterplotmatrix <- function(id, ...) {
249257
is_single_dataset = is_single_dataset_value
250258
),
251259
tags$hr(),
252-
ui_transform_teal_data(ns("decorator"), transformators = args$decorators),
260+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)),
253261
teal.widgets::panel_group(
254262
teal.widgets::panel_item(
255263
title = "Plot settings",
@@ -444,12 +452,14 @@ srv_g_scatterplotmatrix <- function(id,
444452
qenv
445453
})
446454

447-
decorated_output_q_no_print <- srv_transform_teal_data(id = "decorator", data = output_q, transformators = decorators)
448-
decorated_output_q <- reactive(within(decorated_output_q_no_print(), print(plot)))
449-
plot_r <- reactive({
450-
req(output_q()) # Ensure original errors are displayed
451-
decorated_output_q()[["plot"]]
452-
})
455+
decorated_output_q <- srv_decorate_teal_data(
456+
id = "decorator",
457+
data = output_q,
458+
decorators = subset_decorators("plot", decorators),
459+
expr = print(plot)
460+
)
461+
462+
plot_r <- reactive(req(decorated_output_q())[["plot"]])
453463

454464
# Insert the plot into a plot_with_settings module
455465
pws <- teal.widgets::plot_with_settings_srv(

0 commit comments

Comments
 (0)