Server logic for the Figure Builder module
Source:R/figureBuilder_module_server.R
figureBuilderServer.RdPowers the multi-panel Figure Builder module rendered by
figureBuilderUI(). Users can add any VizModules plot module to a free-form
A4 canvas, drag and resize each plot, filter each plot's data independently,
label panels automatically, and export the whole figure as a single editable
SVG (or bundle every plot's source data, HTML plot, and statistics into one
.zip).
Arguments
- id
The ID for the Shiny module. Must match the
idgiven tofigureBuilderUI().- data_list
An optional named list of data frames that seed the dataset registry. If
NULL(the default), the bundled example datasets (plus asales_by_productsummary suited to the pie plot) are used. At least one element is required and every element must be a data frame.- module_registry
An optional named list describing the plot modules to offer. If
NULL(the default), all bundled VizModules modules are offered. Each entry is itself a list with components:label(character, shown in the picker),dataset(character, the dataset name itsdefaultswere written for),inputs_ui,output_ui, andserver_fn(the module's three functions), anddefaults(a named list of input defaults applied only whendatasetis the chosen dataset).
Value
Invisibly returns NULL; called for its side effects (wiring up the
Figure Builder module's reactive logic).
Details
Call this from your app's server with the same id you passed to
figureBuilderUI(). Because it is a proper Shiny module, several Figure
Builders can coexist on one page, each with its own namespace and canvas.
Examples
library(VizModules)
if (interactive()) {
ui <- fluidPage(figureBuilderUI("figure_builder"))
server <- function(input, output, session) {
figureBuilderServer("figure_builder")
}
shinyApp(ui, server)
}