@@ -13,14 +13,14 @@ api_create_plot <- function(x = last_plot(), filename = NULL,
1313 # in v2, traces must reference grid data, so create grid references first
1414 # http://moderndata.plot.ly/simple-rest-apis-for-charts-and-datasets/
1515 for (i in seq_along(x $ data )) {
16- x $ data [[i ]] <- api_srcify(x $ data [[i ]])
16+ x $ data [[i ]] <- api_srcify(x $ data [[i ]], sharing = sharing )
1717 }
1818
1919 # same for animation frames
2020 for (i in seq_along(x $ frames )) {
2121 frame <- x $ frames [[i ]]
2222 for (j in seq_along(frame $ data )) {
23- x $ frames [[i ]]$ data [[j ]] <- api_srcify(frame $ data [[j ]])
23+ x $ frames [[i ]]$ data [[j ]] <- api_srcify(frame $ data [[j ]], sharing = sharing )
2424 }
2525 }
2626
@@ -125,7 +125,7 @@ api_trash_file <- function(file) {
125125
126126# upload a grid of data array attributes, attach src references to the trace,
127127# and remove the actual data from trace
128- api_srcify <- function (trace ) {
128+ api_srcify <- function (trace , sharing = " public " ) {
129129 Attrs <- Schema $ traces [[trace [[" type" ]]]]$ attributes
130130 isArray <- vapply(
131131 Attrs , function (x ) tryFALSE(identical(x [[" valType" ]], " data_array" )), logical (1 )
@@ -134,7 +134,7 @@ api_srcify <- function(trace) {
134134 grid <- trace [names(trace ) %in% names(Attrs )[isArray | arrayOK ]]
135135 # create the grid and replace actual data with "src pointers"
136136 if (length(grid )) {
137- resp <- api_create_grid(grid , filename = new_id())
137+ resp <- api_create_grid(grid , filename = new_id(), sharing = sharing )
138138 fid <- resp [[" fid" ]]
139139 cols <- resp [[" cols" ]]
140140 for (j in seq_along(cols )) {
0 commit comments