@@ -73,7 +73,11 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
73
73
74
74
# find the relevant plotly.js bundle
75
75
plotlyjs <- plotlyjsBundle(b )
76
- plotlyjs_file <- file.path(plotlyjs $ src $ file , plotlyjs $ script )
76
+ plotlyjs_path <- file.path(plotlyjs $ src $ file , plotlyjs $ script )
77
+ # package field means src file path should be relative to pkg dir
78
+ if (! is.null(plotlyjs $ package )) {
79
+ plotlyjs_path <- system.file(plotlyjs_path , package = plotlyjs $ package )
80
+ }
77
81
78
82
tmp <- tempfile(fileext = " .json" )
79
83
cat(to_JSON(b $ x [c(" data" , " layout" )]), file = tmp )
@@ -82,7 +86,7 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
82
86
" graph" , tmp ,
83
87
" -o" , file ,
84
88
" --format" , format ,
85
- " --plotlyjs" , plotlyjs_file ,
89
+ " --plotlyjs" , plotlyjs_path ,
86
90
if (debug ) " --debug" ,
87
91
if (verbose ) " --verbose" ,
88
92
if (safe ) " --safe-mode" ,
@@ -143,12 +147,16 @@ orca_serve <- function(port = 5151, mathjax = FALSE, safe = FALSE, request_limit
143
147
144
148
# use main bundle since any plot can be thrown at the server
145
149
plotlyjs <- plotlyMainBundle()
146
- plotlyjs_file <- file.path(plotlyjs $ src $ file , plotlyjs $ script )
150
+ plotlyjs_path <- file.path(plotlyjs $ src $ file , plotlyjs $ script )
151
+ # package field means src file path should be relative to pkg dir
152
+ if (! is.null(plotlyjs $ package )) {
153
+ plotlyjs_path <- system.file(plotlyjs_path , package = plotlyjs $ package )
154
+ }
147
155
148
156
args <- c(
149
157
" serve" ,
150
158
" -p" , port ,
151
- " --plotly" , plotlyjs_file ,
159
+ " --plotly" , plotlyjs_path ,
152
160
if (safe ) " --safe-mode" ,
153
161
if (orca_version() > = " 1.1.1" ) " --graph-only" ,
154
162
if (keep_alive ) " --keep-alive" ,
0 commit comments