d3scatter icon indicating copy to clipboard operation
d3scatter copied to clipboard

Bad interaction of selection and filter

Open dmurdoch opened this issue 6 years ago • 0 comments

If I have a d3scatter displaying a cloud of points and filter some of them, the selection acts as though they are still there, i.e. if I select the region containing hidden points it acts as though I've selected something even though nothing is visible in the selection box.

For example, run this code:

library(htmltools)
library(d3scatter)
library(crosstalk)
xy <- SharedData$new(data.frame(x=rnorm(100), y=rnorm(100)))
w1 <- d3scatter(xy, ~x, ~y, width = 300)
w2 <- filter_slider("x", "x", xy, ~x)
browsable(tagList(w1,w2))

then use the slider to hide all the points on the right, then use a selection box there and the remaining points are dimmed as if something was selected.

Edited to add: in this example, if I later move the slider back to show everything, you can see that indeed the hidden points were selected. This is consistent behaviour, but I think it is undesirable from a UI point of view. On the other hand, I'm not sure what should happen when points are revealed: since they are appearing in the brush, they should be selected, but do I really want to send selection messages when I am manipulating the filter?

dmurdoch avatar Dec 23 '17 12:12 dmurdoch