Blocks for data visualization using base R graphics can be created via
new_plot_block().
new_plot_block(server, ui, class, ctor = sys.parent(), ...)new_scatter_block(x = character(), y = character(), ...)
All blocks constructed via new_plot_block() inherit from
plot_block.
A function returning shiny::moduleServer()
A function with a single argument (ns) returning a shiny.tag
Block subclass
String-valued constructor name or function/frame number (mostly for internal use or when defining constructors for virtual classes)
Forwarded to new_plot_block() and new_block()
Columns to place on respective axes
Mainly for demonstration purposes, this block draws a scattter plot using
base::plot(). In its current simplistic implementation, apart from axis
labels (fixed to the corresponding column names), no further plotting
options are available and for any "production" application, a more
sophisticated (set of) block(s) for data visualization will most likely be
required.
Due to the current block evaluation procedure, where block evaluation is
separated from block "rendering" (via shiny::renderPlot()) integration of
base R graphics requires some mechanism to achieve this decoupling. This
is implemented by adding a plot attribute to the result of
block_eval(), generated with grDevices::recordPlot() and containing the
required information to re-create the plot at a later time. As part of
block_output(), the attribute is retrieved and passed to
grDevices::replayPlot(). Consequently, any block that inherits from
plot_block is required to support this type of decoupling.