Skip to content

Commit

Permalink
add debounce to input data for plots
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Oct 3, 2024
1 parent 7b068d1 commit 662c054
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ srv_g_boxplot <- function(id,
iv
})

create_plot <- reactive({
create_plot <- debounce(reactive({
teal::validate_inputs(iv_r())

req(anl_q())
Expand Down Expand Up @@ -468,7 +468,7 @@ srv_g_boxplot <- function(id,
)
})
)
})
}), 800)

create_table <- reactive({
req(iv_r()$is_valid())
Expand Down
5 changes: 2 additions & 3 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ srv_g_correlationplot <- function(id,
vertical_line <- srv_arbitrary_lines("vline_arb")

# plot
plot_q <- reactive({
plot_q <- debounce(reactive({
req(plot_data_transpose())
# nolint start
xaxis_param <- input$xaxis_param
Expand Down Expand Up @@ -814,8 +814,7 @@ srv_g_correlationplot <- function(id,
print(p)
})
)
}) |>
debounce(800)
}), 800)

plot_r <- reactive(plot_q()[["p"]])

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
})


create_plot <- reactive({
create_plot <- debounce(reactive({
teal::validate_inputs(iv_r())
req(anl_q())

Expand Down Expand Up @@ -369,7 +369,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
)
})
)
})
}), 800)

create_table <- reactive({
req(iv_r()$is_valid())
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ srv_lineplot <- function(id,
)
})

plot_q <- reactive({
plot_q <- debounce(reactive({
teal::validate_inputs(iv_r())
req(anl_q(), line_color_selected(), line_type_selected())
# nolint start
Expand Down Expand Up @@ -766,7 +766,7 @@ srv_lineplot <- function(id,
print(p)
})
)
})
}), 800)

plot_r <- reactive(plot_q()[["p"]])

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ srv_g_scatterplot <- function(id,
keep_data_const_opts_updated(session, input, anl_q, "xaxis_param")

# plot
plot_q <- reactive({
plot_q <- debounce(reactive({
req(anl_q())
# nolint start
xlim <- xrange_slider$state()$value
Expand Down Expand Up @@ -359,7 +359,7 @@ srv_g_scatterplot <- function(id,
print(p)
})
)
})
}), 800)

plot_r <- reactive(plot_q()[["p"]])

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ srv_g_spaghettiplot <- function(id,
})


plot_q <- reactive({
plot_q <- debounce(reactive({
teal::validate_inputs(iv_r())
req(anl_q())
# nolint start
Expand Down Expand Up @@ -515,7 +515,7 @@ srv_g_spaghettiplot <- function(id,
print(p)
})
)
})
}), 800)

plot_r <- reactive({
plot_q()[["p"]]
Expand Down

0 comments on commit 662c054

Please sign in to comment.