View source: R/rk.paste.JS.graph.R
rk.paste.JS.graph | R Documentation |
This function is similar to rk.paste.JS
,
but adds some code parts to its output which
are commonly used to generate plots with RKWard.
rk.paste.JS.graph( ..., plotOpts = NULL, printoutObj = NULL, level = 2, indent.by = rk.get.indent(), empty.e = rk.get.empty.e(), useIsPreview = TRUE )
... |
The actual plot code, passed through to |
plotOpts |
An object generated by |
printoutObj |
An |
level |
Integer, which indentation level to use, minimum is 1. |
indent.by |
A character string defining the indentation string to use. |
empty.e |
For |
useIsPreview |
Logical,
defines which variable name shoud be used to toggle previews. If |
The contents of the ...
argument are evaluated by rk.paste.JS
and encapsulated
between if(!is_preview){rk.graph.on()} try({
and }) if(!is_preview){rk.graph.off()}
. If generic
plot options are supplied,
their "code.preprocess"
and "code.calculate"
modifiers are
also automatically taken care of,
so you only need to include "code.printout"
inside of
...
.
A character string.
rk.paste.JS
tmp.var.selectVars <- rk.XML.varselector(label="Select data") tmp.var.x <- rk.XML.varslot(label="My data", source=tmp.var.selectVars, required=TRUE) # let this be the embedded generic plot options in yout plot dialog tmp.plot.options <- rk.plotOptions() # you can now generate the plot code using generic plot options js.prnt <- rk.paste.JS.graph( echo("\t\tplot("), echo("\n\t\t\tx=", tmp.var.x), echo(tmp.plot.options), echo(")"), plotOpts=tmp.plot.options) cat(js.prnt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.