Skip to content

Commit

Permalink
Retain brush selection on plot resize (#192)
Browse files Browse the repository at this point in the history
Closes #174
  • Loading branch information
vedhav authored Sep 27, 2023
1 parent e16d95b commit 8d6f83c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL
object_usage_linter = NULL,
indentation_linter = NULL
)
12 changes: 6 additions & 6 deletions R/plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ plot_with_settings_ui <- function(id) {
#' shinyApp(
#' ui = fluidPage(
#' useShinyjs(),
#' actionButton("button", "Show/Hide"),
#' plot_with_settings_ui(
#' id = "plot_with_settings"
#' ),
#' actionButton("button", "Show/Hide")
#' )
#' ),
#' server = function(input, output, session) {
#' plot_r <- reactive(ggplot2::qplot(x = 1, y = 1))
#' plot_r <- reactive(ggplot2::qplot(data = faithful, x = waiting, y = eruptions))
#'
#' show_hide_signal_rv <- reactiveVal(TRUE)
#'
Expand Down Expand Up @@ -388,13 +388,13 @@ plot_with_settings_srv <- function(id,
)

output$plot_out_main <- renderUI({
req(plot_r())
div(
align = graph_align,
plotOutput(
ns("plot_main"),
height = p_height(),
width = p_width(),
brush = `if`(brushing, brushOpts(ns("plot_brush"), resetOnNew = TRUE), NULL),
height = "100%",
brush = `if`(brushing, brushOpts(ns("plot_brush"), resetOnNew = FALSE), NULL),
click = `if`(clicking, clickOpts(ns("plot_click")), NULL),
dblclick = `if`(dblclicking, dblclickOpts(ns("plot_dblclick")), NULL),
hover = `if`(hovering, hoverOpts(ns("plot_hover")), NULL)
Expand Down
6 changes: 3 additions & 3 deletions man/plot_with_settings_srv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d6f83c

Please sign in to comment.