Skip to contents

Add a variable parameter to a spec. See vl_add_point_selection() and vl_add_interval_selection() for adding selection parameters.

Usage

vl_add_parameter(
  spec,
  name = NULL,
  bind = NULL,
  expr = NULL,
  value = NULL,
  .object = NULL
)

Arguments

spec

An input vega-lite spec

name

A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or "$", or "_") and may not start with a digit. Reserved keywords that may not be used as parameter names are "datum", "event", "item", and "parent".

bind

Binds the parameter to an external input element such as a slider, selection list or radio button group.

expr

An expression for the value of the parameter. This expression may include other parameters, in which case the parameter will automatically update in response to upstream parameter changes.

value

The initial value of the parameter.

Default value: undefined

.object

Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than spec. Objects can be of type: VariableParameter

Value

A modified Vega-Lite Spec