vellumwidget_proxy() is the server-to-client counterpart of the input
read-back documented in vellumwidget-shiny. It returns a lightweight handle to a
widget that is already on the page, so the server can change what the
widget shows — set the selection, cross-filter it, zoom it — without
re-rendering it (no renderVellumwidget() round-trip, no full redraw, no lost
pan/zoom). This mirrors leaflet::leafletProxy() / DT::dataTableProxy() /
plotly::plotlyProxy().
Arguments
- outputId
The id of the
vellumwidgetOutput()to control (the un-namespaced id, as passed tovellumwidgetOutput(); module namespacing is handled for you).- session
The Shiny session; defaults to the current reactive domain, so you rarely pass it explicitly.
Value
An object of class "vellumwidget_proxy" (invisibly from the verbs), to be
piped into vw_select() and the other proxy verbs.
Details
Call it inside an observe() / observeEvent() with the same outputId you
gave vellumwidgetOutput(), then pipe the handle through one or more of the verbs
below. Each verb sends a single custom message to the browser and returns the
proxy invisibly, so calls chain with the pipe.
vw_select()Replace the widget's selection with
keys(the elementdata_ids). Selecting projects across a mark'shover_groupand propagates to any linked / crosstalk widgets, exactly as a user click would, and updatesinput$<id>_selected.vw_clear_selection()Clear the selection.
vw_filter()Cross-filter: show only the elements whose key is in
keysand dim/hide the rest (display tier — the data is untouched).vw_clear_filter()Remove the filter (show everything).
vw_zoom()Zoom/pan the view to frame the elements in
keys.vw_reset_zoom()Restore the original (full) view.
All keys are the element data keys — the data_id a vellumplot mark
declares — the same identifiers you receive back through input$<id>_selected
and friends.
See also
vw_select(), vw_filter(), vw_zoom(); vellumwidgetOutput() and
vellumwidget-shiny for reading interactions back.
Examples
if (FALSE) { # \dontrun{
library(shiny)
server <- function(input, output, session) {
output$plot <- renderVellumwidget(my_widget)
# A server-side control drives the plot without redrawing it:
observeEvent(input$highlight, {
vellumwidget_proxy("plot") |> vw_select(input$highlight)
})
observeEvent(input$reset, {
vellumwidget_proxy("plot") |> vw_clear_selection() |> vw_reset_zoom()
})
}
} # }
