问题
As a part of my shiny app, i am trying to have linked brushing so that i can subset my data via a brush and display that data in a separate ggvis plot
relevant (simple) code is as follows:
lb <- linked_brush(keys = 1:nrow(filteredData()), "red")
observe({filteredData() %>%
ggvis(~id, ~y) %>%
layer_points() %>%
layer_points(fill := lb$fill, size.brush := 400) %>%
lb$input() %>%
bind_shiny("plot")
filteredData() %>%
ggvis(~id, ~y) %>%
lb$input() %>%
layer_points( data = reactive(filteredData()[lb$selected(), ])) %>%
bind_shiny("plot3")
})
Where filtered data is a df which extrcted selected data from an uploaded data with the col's x,y,y2,id. It is held in a reactive({})
My issue is that, when i brush, it selects the data once, but then i cannot re brush without reloading my app, i can draw the brush, but it does not select the data.
Also when i select a large proportion of the data points the brush does not work, in that the points become enlarged, but don't go red and become selected.
This code works in other examples, just on in my app, any help or suggestions on where the issue is stemming from would be greatly appreciated
Thanks!
回答1:
Through and immense amount of fiddling i found that the solutions lied in replacing filteredData()
with either reactive(filteredData())
or filteredData
来源:https://stackoverflow.com/questions/32729655/linked-brushing-not-refreshing-with-ggvis-and-shiny