Skip to content

Commit 8e338ac

Browse files
committed
feat: hide widgets using module arg
1 parent 1e5be80 commit 8e338ac

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export(tm_missing_data)
2525
export(tm_outliers)
2626
export(tm_p_bargraph)
2727
export(tm_p_lineplot)
28+
export(tm_p_scatterlineplot)
2829
export(tm_p_scatterplot)
2930
export(tm_p_spiderplot)
3031
export(tm_p_swimlane)

R/tm_p_scatterplot.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ tm_p_scatterplot <- function(label = "Scatter Plot",
66
y_var,
77
color_var,
88
point_colors = character(0),
9-
transformators = list()) {
9+
transformators = list(),
10+
show_widgets = TRUE) {
1011
module(
1112
label = label,
1213
ui = ui_p_scatterplot,
@@ -18,7 +19,8 @@ tm_p_scatterplot <- function(label = "Scatter Plot",
1819
x_var = x_var,
1920
y_var = y_var,
2021
color_var = color_var,
21-
point_colors = point_colors
22+
point_colors = point_colors,
23+
show_widgets = show_widgets
2224
),
2325
transformators = transformators
2426
)
@@ -27,6 +29,7 @@ tm_p_scatterplot <- function(label = "Scatter Plot",
2729
ui_p_scatterplot <- function(id) {
2830
ns <- NS(id)
2931
bslib::page_fluid(
32+
shinyjs::useShinyjs(),
3033
tags$div(
3134
shinyWidgets::prettySwitch(
3235
ns("add_lines"),
@@ -54,7 +57,8 @@ srv_p_scatterplot <- function(id,
5457
x_var,
5558
y_var,
5659
color_var,
57-
point_colors) {
60+
point_colors,
61+
show_widgets) {
5862
moduleServer(id, function(input, output, session) {
5963
color_inputs <- colour_picker_srv(
6064
"colors",
@@ -64,6 +68,11 @@ srv_p_scatterplot <- function(id,
6468
default_colors = point_colors
6569
)
6670

71+
if (!show_widgets) {
72+
shinyjs::hide("add_lines")
73+
shinyjs::hide("colors")
74+
}
75+
6776
plotly_q <- reactive({
6877
req(color_inputs())
6978
within(

0 commit comments

Comments
 (0)