Skip to content

Commit

Permalink
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
Browse files Browse the repository at this point in the history
…tsengineering/teal into 1187_decorate_output@main
  • Loading branch information
m7pr committed Nov 14, 2024
2 parents f0b87f8 + e14f9b1 commit b54ebfc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### New features

* Possible to call `ui_teal` and `srv_teal` directly in any application by delivering `data` argument as a `reactive` returning `teal_data` object. #669
* Introduced `teal_transform_module` to provide a way to interactively modify data delivered to `teal_module`'s `server` and to modify module outputs. #1228 #1384
* Introduced `teal_transform_module` to provide a way to interactively modify data delivered to `teal_module`'s `server` and to decorate module outputs. #1228 #1384
* Introduced a new argument `once = FALSE` in `teal_data_module` to possibly reload data during a run time.
* Possibility to download lockfile to restore app session for reproducibility. #479
* Introduced a function `set_datanames()` to change a `datanames` of the `teal_module`.
Expand Down
51 changes: 25 additions & 26 deletions vignettes/decorate-multiple-modules-outputs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ tm_decorated_plot <- function(
})
observeEvent(input$dataname, {
req(input$dataname)
updateSelectInput(inputId = "x", choices = colnames(data()[[input$dataname]]))
updateSelectInput(inputId = "y", label = "select y", choices = colnames(data()[[input$dataname]]))
})
Expand All @@ -72,36 +73,34 @@ tm_decorated_plot <- function(
q1_1 <- reactive({
req(input$dataname, input$x, input$y)
data() |>
within(
{
plot_1 <- ggplot2::ggplot(dataname, ggplot2::aes(x = x, y = y)) +
ggplot2::geom_point() +
ggtitle("plot 1")
},
dataname = as.name(input$dataname),
x = as.name(input$x),
y = as.name(input$y)
)
within(data(),
{
plot_1 <- ggplot2::ggplot(dataname, ggplot2::aes(x = x, y = y)) +
ggplot2::geom_point() +
ggtitle("plot 1")
},
dataname = as.name(input$dataname),
x = as.name(input$x),
y = as.name(input$y)
)
})
q2_1 <- reactive({
req(input$dataname, input$x, input$y)
data() |>
within(
{
plot_2 <- ggplot2::ggplot(dataname, ggplot2::aes(x = x, y = y)) +
ggplot2::geom_point() +
ggtitle("plot 2")
},
dataname = as.name(input$dataname),
x = as.name(input$x),
y = as.name(input$y)
)
within(data(),
{
plot_2 <- ggplot2::ggplot(dataname, ggplot2::aes(x = x, y = y)) +
ggplot2::geom_point() +
ggtitle("plot 2")
},
dataname = as.name(input$dataname),
x = as.name(input$x),
y = as.name(input$y)
)
})
q1_2 <- srv_teal_data("decorate_1", data = q1_1, data_module = decorator_objs[[1]], modules = module())
q2_2 <- srv_teal_data("decorate_2", data = q2_1, data_module = decorator_objs[[2]], modules = module())
q1_2 <- srv_transform_data("decorate_1", data = q1_1, data_module = decorator_objs[[1]], modules = module())
q2_2 <- srv_transform_data("decorate_2", data = q2_1, data_module = decorator_objs[[2]], modules = module())
plot_r <- reactive({
Expand Down Expand Up @@ -144,7 +143,7 @@ interactive_decorator_1 <- teal_transform_module(
moduleServer(id, function(input, output, session) {
reactive({
req(data())
data() |> within(
within(data(),
{
plot_1 <- plot_1 +
xlab(x_axis_title)
Expand All @@ -167,7 +166,7 @@ interactive_decorator_2 <- teal_transform_module(
moduleServer(id, function(input, output, session) {
reactive({
req(data())
data() |> within(
within(data(),
{
plot_2 <- plot_2 +
xlab(x_axis_title)
Expand Down

0 comments on commit b54ebfc

Please sign in to comment.