Skip to content

Commit 4137aa1

Browse files
committed
hide table when not brushed
1 parent 4321350 commit 4137aa1

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

R/tm_p_swimlane2.r

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ ui_p_swimlane2 <- function(id) {
1616
ns <- NS(id)
1717
shiny::tagList(
1818
plotly::plotlyOutput(ns("plot")),
19-
ui_page_data_table(ns("brush_tables"))
19+
shinyjs::hidden(div(
20+
id = ns("brushing_wrapper"),
21+
ui_page_data_table(ns("brush_tables"))
22+
))
2023
)
2124
}
2225

@@ -58,9 +61,9 @@ srv_p_swimlane2 <- function(id,
5861

5962
brush_filtered_data <- reactive({
6063
if (is.null(brush_filter_call())) {
61-
shinyjs::hide("brush_tables")
64+
shinyjs::hide("brushing_wrapper")
6265
} else {
63-
shinyjs::hide("show_tables")
66+
shinyjs::show("brushing_wrapper")
6467
eval_code(plotly_q(), as.expression(brush_filter_call()))
6568
}
6669
})

inst/poc_adam_plotly.r

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
pkgload::load_all("teal")
2-
pkgload::load_all("teal.widgets")
1+
library(plotly)
32
pkgload::load_all("teal.modules.general")
43

54
# Example data
@@ -10,7 +9,8 @@ data <- within(teal_data(), {
109
EOTSTT2 = case_when(
1110
!is.na(DCSREAS) ~ DCSREAS,
1211
TRUE ~ EOTSTT
13-
)
12+
),
13+
TRTLEN = as.integer(TRTEDTM - TRTSDTM)
1414
)
1515

1616
ADAE <- teal.data::rADAE
@@ -21,21 +21,22 @@ join_keys(data) <- default_cdisc_join_keys
2121

2222

2323
plotly_specs <- list(
24-
list("plotly::add_bars", x = ~EOSDY, y = ~USUBJID, data = quote(ADSL)),
25-
list("plotly::add_markers", x = ~EOSDY, y = ~USUBJID, color = ~EOTSTT2, data = quote(ADSL)),
26-
list("plotly::add_markers", x = ~ADY, y = ~USUBJID, data = quote(ADRS))
24+
list("plotly::add_bars", x = ~TRTLEN, y = ~USUBJID, color = ~ARM, data = quote(ADSL)),
25+
list("plotly::add_markers", x = ~ADY, y = ~USUBJID, color = ~AVALC, symbol = ~AVALC, data = quote(ADRS))
2726
)
2827

29-
3028
app <- init(
3129
data = data,
3230
modules = modules(
3331
tm_data_table(),
34-
tm_p_swimlane2(
32+
tm_p_plotly(
3533
label = "Swimlane",
3634
plotly_specs = plotly_specs,
3735
title = "Swimlane Efficacy Plot"
3836
)
37+
),
38+
filter = teal_slices(
39+
teal_slice("ADSL", "AGE", selected = c(20, 25))
3940
)
4041
)
4142

0 commit comments

Comments
 (0)