writeCode: Generate JavaScript code to draw plots

Description Usage Arguments Value Author(s) See Also

Description

This function is not necessarily called directly by the R user but is used in jsCanvas and htmlCanvas as the wrapup function when the graphics device is closed. This processes the different "pages" of plots and generates JavaScript functions from these "pages".

This is documented so that users can understand the arguments that can be passed to it via the ... in jsCanvas and htmlCanvas and also so programmers can use it in other devices or wrapup functions. For example, see htmlWrapup.

Usage

1
writeCode(pages, file = character(), canvasId = "canvas", funName = "rdraw", multiCanvas = FALSE, jsURLs = JSCode(), inlineJS = TRUE)

Arguments

pages

a list of

file

the name of the file or a connection to which the code is written. If this is missing or has length 0, the code is written to a local text connection and the resulting code returned as a character vector.

canvasId

a character vector giving the identifiers/names of the canvases. This can be a single value which is used as a prefix in the case of multiple plots.

funName

the name of the JavaScript functions to create. A single value is used as a prefix in the case of multiple plots.

multiCanvas

a logical value indicating whether the plots are to be drawn on separate canvases or all plots are to be drawn on the same canvas, at different times.

jsURLs

character vector giving the names of the files or URLs of supporting JavaScript code that needs to be loaded by the Web browser for the plots to be rendered.

inlineJS

a logical valued indicating whether to inline the contents of the jsURLs files.

Value

Either the names of the functions that were created or if file has length 0, the code itself.

Author(s)

Duncan Temple Lang

See Also

jsCanvas htmlCanvas


omegahat/RJSCanvasDevice documentation built on May 24, 2019, 1:54 p.m.