Linked brushing not refreshing with ggvis and shiny

こ雲淡風輕ζ 提交于 2019-12-12 00:27:56

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!