Add interactor mark selection to vgplot #158
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why is this pull request necessary?
Currently, when using interactors in vgplot, you need to make sure that the mark you interact with is the last one in your mark stack. This only allows to have interactive behavior with rudimentary plots. Several use cases can't be implemented in vgplot, e.g. having interactors with plots that have
text
marks in top layer (charts with labels)What does this pull request cover?
index
attribute for interactors like toggle, highlight, interval and nearest for specific mark selectionpeers
attribute to toggle interactor — analog to interval interactors (makes it possible to use toggle in conjunction with charts with text labels)highlight-toggle.yaml
example (Note: Previously, it was not possible to have toggle behavior for updated chart specification)index
attribute to interactorspeers
attribute to toggle interactorHow does it work?
Still — by default — interactors are used for the most recently added mark. However, when providing an index to an interactor, the corresponding mark in mark stack of plot will be selected.
Breaking changes
None, as existing API has not changed.
Examples
See new
higlight-toggle.yaml
Example
hexbin.yaml
could have an intervalXY interactor (currently not possible because of hex grid overlay)