Standard htmlwidgets output/render helpers so a vellumwidget widget can appear in
a Shiny app or an interactive R Markdown document.
Usage
vellumwidgetOutput(outputId, width = "100%", height = "400px")
renderVellumwidget(expr, env = parent.frame(), quoted = FALSE)Value
vellumwidgetOutput(): a Shiny output UI element. renderVellumwidget(): a Shiny
render function.
Reading interactions server-side
A widget rendered as vellumwidgetOutput("plot") reports the user's interactions back
to the server as reactive inputs, keyed by the output id. All values are the
element data keys (the data_id a vellumplot mark declares); map them back to
your data by that key.
input$plot_selectedCharacter vector of the currently selected keys (click / brush / keyboard, and any selection arriving from a linked widget). Updates as state — re-selecting the same set is a no-op.
character(0)when nothing is selected.input$plot_clickA list
list(key=)for each click;keyisNULLfor a click on empty space. An event input — fires on every click, even the same mark twice.input$plot_hoverThe hovered key, or
NULLwhen the pointer leaves a mark. Updates as state (re-fires only when the hovered key changes).input$plot_brushA list
list(keys=, x0=, y0=, x1=, y1=)when a brush gesture completes: the selected keys and the brushed rectangle in the scene's device-pixel (viewBox) coordinates. An event input.
These are emitted only inside a live Shiny session; a static render (knitr,
pkgdown, htmltools::save_html()) produces identical output and no input
traffic. Driving the widget from the server (setting selection without a
re-render) is a planned addition.
