4848# '
4949# ' @section Decorating `tm_outliers`:
5050# '
51- # ' This module creates below objects that can be modified with decorators:
51+ # ' This module generates the following objects, which can be modified in place using decorators:
5252# ' - `plot` (`ggplot2`)
5353# '
5454# ' For additional details and examples of decorators, refer to the vignette
@@ -300,8 +300,8 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
300300 ui_args = args ,
301301 server_args = c(
302302 data_extract_list ,
303- list (plot_height = plot_height , plot_width = plot_width , ggplot2_args = ggplot2_args , decorators = decorators ),
304-
303+ list (plot_height = plot_height , plot_width = plot_width , ggplot2_args = ggplot2_args ),
304+ decorators = decorators
305305 ),
306306 datanames = teal.transform :: get_extract_datanames(data_extract_list )
307307 )
@@ -663,9 +663,21 @@ srv_g_bivariate <- function(id,
663663 }
664664 }
665665
666+ teal.code :: eval_code(merged $ anl_q_r(), substitute(expr = plot <- cl , env = list (cl = cl )))
667+ })
668+
669+ decorated_output_q <- srv_teal_transform_data(" decorate" , data = output_q , transformators = decorators )
670+
671+ decorated_output_q_facets <- reactive({
672+
673+ ANL <- merged $ anl_q_r()[[" ANL" ]]
674+ row_facet_name <- as.vector(merged $ anl_input_r()$ columns_source $ row_facet )
675+ col_facet_name <- as.vector(merged $ anl_input_r()$ columns_source $ col_facet )
676+
666677 # Add labels to facets
667678 nulled_row_facet_name <- varname_w_label(row_facet_name , ANL )
668679 nulled_col_facet_name <- varname_w_label(col_facet_name , ANL )
680+ facetting <- (isTRUE(input $ facetting ) && (! is.null(row_facet_name ) || ! is.null(col_facet_name )))
669681 without_facet <- (is.null(nulled_row_facet_name ) && is.null(nulled_col_facet_name )) || ! facetting
670682
671683 print_call <- if (without_facet ) {
@@ -687,15 +699,13 @@ srv_g_bivariate <- function(id,
687699 env = list (nulled_col_facet_name = nulled_col_facet_name , nulled_row_facet_name = nulled_row_facet_name )
688700 )
689701 }
690-
691- teal.code :: eval_code(merged $ anl_q_r(), substitute(expr = plot <- cl , env = list (cl = cl ))) %> %
702+ decorated_output_q() %> %
692703 teal.code :: eval_code(print_call )
693704 })
694705
695- decorated_output_q <- srv_teal_transform_data(" decorate" , data = output_q , transformators = decorators )
696706
697707 plot_r <- reactive({
698- decorated_output_q ()[[" plot" ]]
708+ decorated_output_q_facets ()[[" plot" ]]
699709 })
700710
701711 pws <- teal.widgets :: plot_with_settings_srv(
@@ -707,7 +717,7 @@ srv_g_bivariate <- function(id,
707717
708718 teal.widgets :: verbatim_popup_srv(
709719 id = " rcode" ,
710- verbatim_content = reactive(teal.code :: get_code(req(decorated_output_q ()))),
720+ verbatim_content = reactive(teal.code :: get_code(req(decorated_output_q_facets ()))),
711721 title = " Bivariate Plot"
712722 )
713723
@@ -726,7 +736,7 @@ srv_g_bivariate <- function(id,
726736 card $ append_text(" Comment" , " header3" )
727737 card $ append_text(comment )
728738 }
729- card $ append_src(teal.code :: get_code(output_q( )))
739+ card $ append_src(teal.code :: get_code(req( decorated_output_q_facets )))
730740 card
731741 }
732742 teal.reporter :: simple_reporter_srv(" simple_reporter" , reporter = reporter , card_fun = card_fun )
0 commit comments