Skip to content

Commit 66719ca

Browse files
committed
use a disk for now
1 parent 3bf9f04 commit 66719ca

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

R/plotly.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ plot_ly <- function(data = data.frame(), ..., type = NULL,
144144
# sane margin defaults (mainly for RStudio)
145145
margin = list(b = 40, l = 60, t = 25, r = 10)
146146
),
147-
config = list(modeBarButtonsToRemove = I("sendDataToCloud")),
148-
base_url = get_domain(),
149-
# TODO: make this trace specific when we merge with crosstalk branch
150147
source = source
151148
)
152149

R/plotly_build.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ plotly_build.plotly <- function(p) {
323323
p <- verify_hovermode(p)
324324
# try to convert to webgl if toWebGl was used
325325
p <- verify_webgl(p)
326+
327+
328+
# TODO: avoid overwritting user specified args
329+
p <- config(p,
330+
modeBarButtonsToRemove = I("sendDataToCloud"),
331+
modeBarButtonsToAdd = list(sharingButton())
332+
)
333+
p$x$base_url <- get_domain()
334+
326335
p
327336
}
328337

R/sharingButton.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
sharingButton <- function() {
2+
url <- 'https://cpsievert.github.io/plotly_book/plot-ly-for-collaboration.html'
3+
list(
4+
name = "Collaborate",
5+
icon = list(
6+
width = 1000,
7+
ascent = 850,
8+
descent = -150,
9+
path = sharingPath
10+
),
11+
click = htmlwidgets::JS(sprintf(
12+
"function(gd) {
13+
// is this being viewed in RStudio?
14+
if (location.search == '?viewer_pane=1') {
15+
alert('To learn about sharing options, visit:\\n %s');
16+
} else {
17+
window.open('%s', '_blank');
18+
}
19+
}", url, url))
20+
)
21+
}
22+
23+
sharingPath <- 'm214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z'

0 commit comments

Comments
 (0)