library(BrowserVizDemo)
plotter <- BrowserVizDemo(4000:4024)
## make sure everything is ready to use
while(!ready(plotter)) Sys.sleep(0.1)
## plot a simple set of x-y paris
plot(plotter, 1:10, (1:10)^2)
## learn which port we are using
port(plotter)
## illustrate a "low level" call. This detail is usually hidden from
## the user, implemented and contained (in the case of this example)
## in a getWindowTitle(plotter) method call. This level of detail
## reveals what goes on behind the scenes.
msg <- list(cmd="getWindowTitle", status="request", callback="handleResponse", payload="")
send(plotter, msg)
while(!browserResponseReady(plotter)) Sys.sleep(0.1)
getBrowserResponse(plotter)
## a simpler user-level approach:
getBrowserWindowTitle(plotter)
## set and get the windowTitle
setBrowserWindowTitle(plotter, "new title")
getBrowserWindowTitle(plotter)
## BrowserVizDemo provides another information method which, like the others, will apply
## and maybe be of some use to derived classes
getBrowserWindowSize(plotter)
## finally, you should close BrowserVizDemo when you are done, returning
## the port for use by other applications.
closeWebSocket(plotter)
Run the code above in your browser using DataLab