@@ -71,16 +71,29 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
7171
7272# ' Orca image export server
7373# '
74- # ' @description Compared to [orca], [orca_serve] is more efficient at exporting many plotly
74+ # ' Compared to [orca], [orca_serve] is more efficient at exporting many plotly
7575# ' graphs because the former must startup/shutdown an external process for every image.
7676# ' The server (background) process is launched upon initialization of a [orca_serve] class
7777# ' (i.e., when the `new()` method is called). The `export()` method accepts any valid plotly
7878# ' object as input and spits out an image file to disk. To kill the background server process,
7979# ' use `close()`.
8080# '
81- # ' @section Constructor:
81+ # ' @usage NULL
82+ # ' @format NULL
8283# '
83- # ' \code{orca_serve$new(port = 5151)}
84+ # ' @section Initialization:
85+ # ' A new 'orcaServe'-object is initialized using the new() method on the generator:
86+ # '
87+ # ' \strong{Usage}
88+ # '
89+ # ' \code{
90+ # ' orca_serve$new(
91+ # ' port = 5151, mathjax = FALSE, safe = FALSE, request_limit = NULL, keep_alive = TRUE,
92+ # ' window_max_number = NULL, quiet = FALSE, debug = FALSE, ...
93+ # ' )
94+ # ' }
95+ # '
96+ # ' \strong{Arguments}
8497# '
8598# ' \describe{
8699# ' \item{\code{port}}{Sets the server's port number.}
@@ -106,6 +119,22 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
106119# ' \item{\code{debug}}{Starts app in debug mode.}
107120# ' }
108121# '
122+ # ' @section Methods:
123+ # '
124+ # ' \describe{
125+ # ' \item{\code{export(p, file = "plot.png", format = tools::file_ext(file), scale = NULL, width = NULL, height = NULL)}}{
126+ # ' Export a static image of a plotly graph. Arguments found here are the same as those found in [orca].
127+ # ' }
128+ # ' \item{\code{close()}}{Close down the orca server and kill the underlying node process.}
129+ # ' }
130+ # '
131+ # ' @section Fields:
132+ # '
133+ # ' \describe{
134+ # ' \item{\code{port}}{The port number that the server is listening to.}
135+ # ' \item{\code{process}}{An R6 class for controlling and querying the underlying node process.}
136+ # ' }
137+ # '
109138# ' @export
110139# ' @author Carson Sievert
111140# ' @seealso [orca]
@@ -130,20 +159,19 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file),
130159# ' unlink("test1.pdf")
131160# ' unlink("test2.pdf")
132161# ' }
133- # '
162+
134163orca_serve <- R6 :: R6Class(
135164 " orcaServe" ,
136165 public = list (
137166 process = NULL ,
138167 port = NULL ,
139-
140168 initialize = function (port = 5151 , mathjax = FALSE , safe = FALSE , request_limit = NULL ,
141169 keep_alive = TRUE , window_max_number = NULL , quiet = FALSE ,
142170 debug = FALSE , ... ) {
143171
144172 # make sure we have the required infrastructure
145173 orca_available()
146- try_library(" processx" , " orca " )
174+ try_library(" processx" , " orca_serve " )
147175
148176 # use main bundle since any plot can be thrown at the server
149177 plotlyjs <- plotlyMainBundle()
@@ -175,7 +203,7 @@ orca_serve <- R6::R6Class(
175203 self $ process <- processx :: process $ new(" orca" , args , ... )
176204 self $ port <- port
177205 },
178- export = function (p , file = " plot.png" , format = tools :: file_ext(file ), width = 1000 , height = 500 ) {
206+ export = function (p , file = " plot.png" , format = tools :: file_ext(file ), scale = NULL , width = NULL , height = NULL ) {
179207
180208 # request/response model works similarly to plotly_IMAGE()
181209 bod <- list (
0 commit comments