rk.plotOptions: Create an object for plot options in RKWard plugins

View source: R/rk.plotOptions.R

rk.plotOptionsR Documentation

Create an object for plot options in RKWard plugins

Description

Generates XML and JavaScript code snippets by calling rk.XML.embed and rk.JS.vars with useful presets. The resulting object can be used inside the dialog XML object (to place the plot options button and disable certain tabs), as well as in the JS object (to then insert the actual plot options).

Usage

rk.plotOptions(
  label = "Generic plot options",
  embed = "plot_options",
  namespace = "rkward",
  button = TRUE,
  id.name = "auto"
)

Arguments

label

A character string, text label for the button (only used if button=TRUE).

embed

A character string, registered name (id in pluginmap file) of the plot options component to be embedded.

namespace

An optional character string, XiMpLe node <about> or XiMpLe doc of doctype "rkpluginmap", to prefix the plot options component (embed) with the respective namespace (see rk.XML.embed).

button

Logical, whether the plot options should be embedded as a button and appear if it's pressed.

id.name

Character string, a unique ID for this plugin element. If "auto", an ID will be generated automatically from the label and component strings.

Value

An object of class rk.plot.opts.

See Also

rk.XML.embed, Introduction to Writing Plugins for RKWard

Examples

test.plotOptions <- rk.plotOptions()

# see how differently this object class is treated
# e.g., in the XML context
rk.XML.dialog(test.plotOptions)
# use this in the logic section to disable the "type" slot
rk.XML.set(test.plotOptions, set="allow_type", to=FALSE)

# now in JS context
# manually define the variable
cat(rk.paste.JS(test.plotOptions))
# this is usually not necessary, as rk.paste.JS.graph() can
# define variables automatically
cat(
  rk.paste.JS.graph(
    echo("plot(", test.plotOptions, ")"),
    plotOpts=test.plotOptions
  )
)

# as you can also see in the above example, echo() just
# fills in the JS varaible
echo(test.plotOptions)

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.