Skip to content

Commit ae17cef

Browse files
committed
Merge pull request #446 from ropensci/fix/config
Pass plot configuration using ... to avoid conflicts in defaults/documentation
2 parents f6093bb + a4ec3b8 commit ae17cef

File tree

6 files changed

+59
-110
lines changed

6 files changed

+59
-110
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library
3-
Version: 2.3.4
3+
Version: 2.4.0
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "[email protected]"),
66
person("Chris", "Parmer", role = c("aut", "cph"),

NEWS

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.4.0 -- 1 Feb 2015
2+
3+
* Pass plot configuration using ... to avoid conflicts in defaults/documentation
4+
* Upgrade to plotly.js 1.5.1
5+
16
2.3.4 -- 1 Feb 2015
27

38
Added a plotly_api_domain environment variable for configuring the API domain. Fixes #441

R/plotly.R

+7-37
Original file line numberDiff line numberDiff line change
@@ -178,46 +178,16 @@ layout <- function(p = last_plot(), ...,
178178
#' Set the default configuration for plotly
179179
#'
180180
#' @param p a plotly object
181-
#' @param staticPlot for export or image generation
182-
#' @param workspace we're in the workspace, so need toolbar etc (TODO describe functionality instead)?
183-
#' @param editable edit titles, move annotations, etc
184-
#' @param autosizable respect layout.autosize=true and infer its container size?
185-
#' @param fillFrame if we DO autosize, do we fill the container or the screen?
186-
#' @param scrollZoom mousewheel or two-finger scroll zooms the plot
187-
#' @param doubleClick double click interaction (false, 'reset', 'autosize' or 'reset+autosize')
188-
#' @param showTips see some hints about interactivity
189-
#' @param showLink link to open this plot in plotly
190-
#' @param sendData if we show a link, does it contain data or just link to a plotly file?
191-
#' @param linkText text appearing in the sendData link
192-
#' @param displayModeBar display the modebar (T, F, or 'hover')
193-
#' @param displaylogo add the plotly logo on the end of the modebar
194-
#' @param plot3dPixelRatio increase the pixel ratio for 3D plot images
181+
#' @param ... these arguments are documented at
182+
#' \url{https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js}
195183
#' @author Carson Sievert
196184
#' @export
185+
#' @examples \dontrun{
186+
#' config(plot_ly(), displaylogo = FALSE, modeBarButtonsToRemove = list('sendDataToCloud'))
187+
#' }
197188

198-
# TODO: use htmlwidgets::JS() to specify setBackground function?
199-
# https://github.com/ropensci/plotly/issues/284#issue-108153160
200-
config <- function(p = last_plot(), staticPlot = F, workspace = F, editable = F,
201-
autosizable = F, fillFrame = F, scrollZoom = F,
202-
doubleClick = 'reset+autosize', showTips = F, showLink = T,
203-
sendData = T, linkText = 'Edit chart', displayModeBar = 'hover',
204-
displaylogo = T, plot3dPixelRatio = 2) {
205-
conf <- list(
206-
staticPlot = staticPlot,
207-
workspace = workspace,
208-
editable = editable,
209-
autosizable = autosizable,
210-
fillFrame = fillFrame,
211-
scrollZoom = scrollZoom,
212-
doubleClick = doubleClick,
213-
showTips = showTips,
214-
showLink = showLink,
215-
sendData = sendData,
216-
linkText = linkText,
217-
displayModeBar = displayModeBar,
218-
displaylogo = displaylogo,
219-
plot3dPixelRatio = plot3dPixelRatio
220-
)
189+
config <- function(p = last_plot(), ...) {
190+
conf <- list(...)
221191
p <- last_plot(p)
222192
p$config <- c(p$config, conf)
223193
hash_plot(if (is.data.frame(p)) p else list(), p)

inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js

+37-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/htmlwidgets/plotly.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dependencies:
22
- name: plotlyjs
3-
version: 1.4.1
3+
version: 1.5.1
44
src: "htmlwidgets/lib/plotlyjs"
55
script: plotly-latest.min.js

man/config.Rd

+8-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)