plot
plot copied to clipboard
brush interaction
- [x] tests that show the input events
- [x] ~~put the brush on top of the svg?~~
- [x] can we make it work if multiple marks are brushed? otherwise, error?
- [x] ~~add an option to make viewof the geometric selection (vs. data selection)?~~
- [x] remove the intersection option, unless we have another intersection to offer?
- [x] ~~could a brush span multiple facets? (but then, no geometric selection…)~~
- [x] fix aria-label
- [x] ~~Using a RAF to append the brushable g elements to the top of the svg seems unpredictable~~
- [x] documentation
- [x] how to display unselected vs selected
- [x] document unselected/selected
- [ ] types for unselected/selected
- [x] fix the bug with markerEnd
- [ ] document that brush doesn't yet work with line, area, contour marks etc. Is there a way we could auto-detect where it will work?
- [x] set initial value to data, even for figures
- [x] respect a render transform option
- [ ] make it possible to have a brush with no data
- [ ] understand why a brush with data: [{}] is slow
- [ ] make the grey rect optional, or even opt-in with a rect mark?
- [ ] a way to do something on gesture start and end?
nice to have:
- [x] cross-filter example (#1711)
- [ ] What does brush: true do? I'm tempted to say that it adds
{unselected:{opacity: 0.1}} - [ ] possible optimization 1: do not generate s and u if unselected and selected are undefined
- [ ] possible optimization 2: faster filter by sorting the index along Xl, Xm, Yl, Ym
- [ ] double-click to cancel, or click outside to cancel
demo: https://observablehq.com/@observablehq/plot-brush-interaction-1653
closes #5
supersedes #71 and (probably?) #721
Note that this produces a slightly different value during brushing and when brush ends; we should unify this pattern with pointer (#1832).
I am exploring the use of render transforms to override mark appearance during interaction in the mbostock/pointer-highlight branch.
This branch now adopts the creator() API. I still have to figure how to type the selected and unselected options, though.