Reputation: 685
I would like to add marks with clicks into the Vega view.
For example, in this density plot I would like to set these vertical rules with clicks:
Is that possible?
Upvotes: 1
Views: 258
Reputation: 685
It is possible: Triggers can be used to update the data: https://vega.github.io/vega/docs/triggers
In this example, points can be added by clicking into the Vega View:
Link to Editor. Important are the signal addMark
that listens on clicks and the trigger that is added to the input data source_0
. The signal passes the data as it is stored in the dataset.
Triggers can also be used to drag marks, as in this example that builds on the first:
Applied to the example of my initial question, the final spec looks like:
Upvotes: 1