R ggvis linked_brush is not reactive -


i have following code in server.r

data_agg_plot1<- reactive({      brush1 <- linked_brush(keys = data_agg()$id, "navy" )      data_agg <- data_agg()     plot1<-data_agg%>%       ggvis(x = ~dates_all) %>%       group_by(factor(dates_all.1)) %>%       layer_points(y =  ~ value, fill =~dates_all.1, shape =~dates_all.1) %>%       layer_paths(y =  ~ value, stroke = ~dates_all.1 , strokeopacity := 0.5) %>%       scale_ordinal("fill", range = c("green", "red", "blue"))%>%       scale_ordinal("shape", range = c("triangle-up","triangle-down","circle")) %>%       scale_ordinal("stroke",range=c("green","red","blue")) %>%       brush1$input() %>%       hide_legend(c('stroke','fill'))%>%       add_legend(c('shape','fill'),                  title = "symbol", orient = "left",                  values = c("new hires", "attrition" , "net growth"),                  properties = legend_props(                    title = list(fontsize = 16))) %>%       add_axis("x",properties= axis_props(labels = list(angle=60,align = "left")),                tick_padding =0,                title = "") %>%       add_axis("y", title = "total count") %>%       set_options(width = "auto",height = 400) %>%       scale_numeric('y',clamp = true)      return(list(plot1,brush1))   }) 

so reactive function returns me list of 2 functions, plot , brush object.

the purpose of doing so can make keys reactive - can make additional plot based on user's selection. think of second plot depends on first user highlights in first plot.

this following code:

  plot1_data<-reactive({     data_agg_plot1()[[1]]   })   plot1_data%>%bind_shiny("plot1")     selected_plot1 <- reactive({     data_agg_plot1()[[2]]   })    output$test <- renderprint({     temp <- selected_plot1()$selected()     print(temp)   }) 

however, when print out selection, false,

please refer image below:

enter image description here can explain me how overcome this?

i highly suspect have re-write linkedbrush function,

i have tried both solutions from:

linked_brush in ggvis cannot work in shiny when data change

but not work.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -