| shiny-setters | R Documentation | 
There are two ways to change a Vega chart: by setting
a signal or by setting a dataset; you can also
direct a Vega chart to re-run itself. Any signal or
dataset you set must first be defined and named in the vegaspec.
These functions are called from within
a Shiny server() function, where they act like
shiny::observe() or shiny::observeEvent().
vw_shiny_set_signal(outputId, name, value, run = TRUE, ...)
vw_shiny_set_data(outputId, name, value, run = TRUE, ...)
vw_shiny_run(outputId, value, ...)
| outputId | 
 | 
| name | 
 | 
| value | reactive expression, e.g.  | 
| run | 
 | 
| ... | other arguments passed on to  | 
To see these functions in action, you can run a shiny-demo:
vw_shiny_set_signal(): call vw_shiny_demo("signal-set-get")
vw_shiny_set_data(): call vw_shiny_demo("data-set-get")
vw_shiny_run(): call vw_shiny_demo("data-set-swap-run")
For the signal and data setters, in addition to the chart outputId,
you will need to provide:
 the name of the signal or dataset you wish to keep updated
 the value to which you want to set the signal or dataset;
this should be a reactive expression like input$slider or rct_dataset()
 whether or not you want to run the Vega view again immediately
after setting this value
If you do not set run = TRUE in the setter-function,
you can use the vw_shiny_run() function to control when
the chart re-runs. One possibility is to set its value to a reactive
expression that refers to, for example, a shiny::actionButton().
shiny::observeEvent() function that responds to changes in the
reactive-expression value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.