sa-lee/easel

dataflow post signal propagation

Opened this issue · 0 comments

I've got this mostly working (at least in the case of highlighting brush)
per the last couple of commits, now just need to wrap into our API.

The idea here is that any changes that reference a control dataset need to in turn become reactive. To be more concrete, here's our canonical brush example

mtcars %>%
  visualise(x = hp, y = mpg) %>%
  draw_points() %>%
  control_drag() %>%
  draw_rect() 

Now control_drag emits a reactive (currently stored as a list column in the tibble) based on the signals that are listened to from the Vega spec. By design, we emit these in data space rather than pixel space. Now to generate where we've selected, we really want to do something like

mutate(.,  selected = c(aes_x, aes_y) %in% control_data, aes_colour = ifelse(selected, "red", "blue"))

Where control_data is just the scalars from our reactive values. In this mutate call all the expressions generated need to be reactive as well, and any reactive that's previously referenced needs to instantiated. Things get tricky fast.

On the render side, any new mark from a signal to be added to the spec and the data sent to the viz upon observation.