Skip to content

Commit 8f00e01

Browse files
committed
tidy up R docs
1 parent d32b86f commit 8f00e01

File tree

4 files changed

+10
-53
lines changed

4 files changed

+10
-53
lines changed

R/layout.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
101101
#' (see [here](https://github.com/ropensci/plotly/blob/master/inst/examples/rmd/MathJax/index.Rmd)
102102
#' for an **rmarkdown** example and
103103
#' [here](https://github.com/ropensci/plotly/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example).
104-
#' @param priority the priority of shiny input events. If `NULL` (the default), then
105-
#' [event_data()] becomes invalidated only when the input value changes. If `"event"`,
106-
#' then the event will always fire, regardless of whether the value has changed.
107104
#' @author Carson Sievert
108105
#' @export
109106
#' @examples
@@ -134,7 +131,7 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
134131
#' config(p, locale = "zh-CN")
135132
#'
136133

137-
config <- function(p, ..., collaborate = TRUE, cloud = FALSE, locale = NULL, mathjax = NULL, priority = NULL) {
134+
config <- function(p, ..., collaborate = TRUE, cloud = FALSE, locale = NULL, mathjax = NULL) {
138135

139136
if (!is.null(locale)) {
140137
p$dependencies <- c(
@@ -173,7 +170,6 @@ config <- function(p, ..., collaborate = TRUE, cloud = FALSE, locale = NULL, mat
173170
}
174171

175172
p$x$config$cloud <- cloud
176-
p$x$config$priority <- priority
177173

178174
p
179175
}

R/shiny.R

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ prepareWidget <- function(x) {
6262
#' with the `source` argument in [plot_ly()] (or [ggplotly()]) to respond to
6363
#' events emitted from that specific plot.
6464
#' @param session a shiny session object (the default should almost always be used).
65+
#' @param priority the priority of the relevant shiny input. If equal to `"event"`,
66+
#' then [event_data()] always triggers re-execution, instead of re-executing
67+
#' only when the relevant shiny input value changes (the default).
6568
#' @export
6669
#' @references
6770
#' * <https://plotly-book.cpsievert.me/shiny-plotly-inputs.html>
@@ -105,45 +108,3 @@ event_data <- function(
105108

106109
if (is.null(val)) val else fromJSONfunc(val)
107110
}
108-
109-
110-
111-
#
112-
#
113-
# event_data_reactive <- function(
114-
# event = c(
115-
# "plotly_hover", "plotly_unhover", "plotly_click", "plotly_doubleclick",
116-
# "plotly_selected", "plotly_selecting", "plotly_brush", "plotly_brushing",
117-
# "plotly_deselect", "plotly_relayout", "plotly_restyle", "plotly_legendclick",
118-
# "plotly_legenddoubleclick", "plotly_clickannotation", "plotly_afterplot"
119-
# ),
120-
# source = "A",
121-
# session = shiny::getDefaultReactiveDomain(),
122-
# priority = "input"
123-
# ) {
124-
# if (is.null(session)) {
125-
# stop("No reactive domain detected. This function can only be called \n",
126-
# "from within a reactive shiny context.")
127-
# }
128-
#
129-
# # obtain the input value
130-
# event <- match.arg(event)
131-
#
132-
# # register event on client-side
133-
# session$sendCustomMessage(
134-
# "plotly-register-event",
135-
# list(event = event, source = source, priority = priority)
136-
# )
137-
#
138-
# # get input_value
139-
# src <- sprintf(".clientValue-%s-%s-%s", event, source, priority)
140-
#
141-
# # legend clicking returns trace(s), which shouldn't be simplified...
142-
# fromJSONfunc <- if (event %in% c("plotly_legendclick", "plotly_legenddoubleclick")) from_JSON else jsonlite::fromJSON
143-
#
144-
# # return reactive
145-
# reactive({
146-
# val <- session$rootScope()$input[[src]]
147-
# if (is.null(val)) val else fromJSONfunc(val)
148-
# })
149-
# }

man/config.Rd

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/event_data.Rd

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)