openPage
starts a server, establishes a web socket connection between it and the current
R session and loads linked-charts JS library with all the dependencies. This function initializes
an instance of class LCApp
and stores it in the namespace of the package. If another
instance has already been stored (i.e. another app has been started with this function), the existing
app will be closed.
openPage(
useViewer = TRUE,
rootDirectory = NULL,
startPage = NULL,
layout = NULL,
port = NULL,
browser = NULL,
onlyServer = FALSE,
...
)
A new instance of class LCApp
.
If TRUE
, a page will be opened in the RStudio Viewer. If FALSE
,
a default web browser will be used.
A path to the root directory for the server. Any file, requested by the server
will be searched for in this directory. If rootDirectory
is not
defined, the http_root
in the package directory will be used as a root directory.
A path to an HTML file that should be used as a starting page of the app.
It can be an absolute path to a local file, or it can be relative to the rootDirectory
or to the current R working directory. If startPage
is not defined, an empty page will be used.
The file must have .html extension.
Adds one of the defaults layouts to each new page. Currently, only tables of arbitrary
size are supported. To add a table, this parameter must be equal to "tableNxM"
, where N
is the
number of rows and M
is the number of columns. Each cell will get an ID that consists of
a letter (indicating the row) and a number (indicating the column) (e.g. B3
is an ID of
the second row and third column).
Defines which TCP port the server will listen to. If not defined, random available port
will be used (see randomPort
).
A browser in which to open a new web page.
If not defined, default browser will be used. For more information check browseURL
.
If this argument is specified, useViewer
will be ignored.
If TRUE
, then an app will initialise without trying to open a new page in a browser.
Further arguments passed to openPage
. Check details for more information.
Argument onStart
of jrc
openPage
function is replaced in rlc
with beforeLoad
and afterLoad
. The reason for that is when the page opens, rlc
has to put there all the existing charts. Different situations may require some code be loaded before or after
that happens. beforeLoad
and afterLoad
provide a way to define two callback functions, each
receiving a Session
object as an argument and is called once for each new page.
beforeLoad
runs before anything else has happened, while afterLoad
is called after all the
existing charts have been added to the page.
This function initializes a new instance of class LCApp
and wraps around methods
startServer
and openPage
of its parent class App
.
if (FALSE) openPage()
openPage(useViewer = FALSE, layout = "table2x3")
Run the code above in your browser using DataLab