I'm trying to use the tool_lasso_select feature in rbokeh. What I would like is for the user to use the tool to select a group of points in a scatterplot and summary statistics of the group of points selected would be created as a result in the next panel of a shiny tabBox. My primary question is:
What exactly is captured by the shiny_callback option?
This is an example of the type of figure I'm creating:
figure() %>%
ly_points(x = cty, y = hwy, data = mpg,
hover = c(cty, hwy), lname = "points") %>%
tool_hover(shiny_callback(id = "hover_info"), "points") %>%
tool_tap(shiny_callback(id = "tap_info"), "points") %>%
tool_box_select(shiny_callback(id = "selection_info"), "points")
What exactly are the contents placed in the "selection_info" id and how could I extract that information? I'm just not sure what the next block of code I could write that would take the information captured by the lasso_tool. The most I can find in the documentation is the example used but output seems to only be an index number.
UPDATE:
Thanks for adding a reproducible example. My apologies. I've added a little more to it below:
library("dplyr")
library("rbokeh")
library("shiny")
attach(mtcars)
server <- shinyServer(function(input,output){
output$myChart <- renderRbokeh({
print(paste0("now rendering!"," ",date()))
input$myText
figure() %>%
ly_points(x = mtcars$cyl, y = mtcars$hp, data = mtcars,
hover = c(mtcars$cyl, mtcars$hp), lname = "points") %>%
tool_hover(callback = shiny_callback(id = "hover_info"), "points") %>%
tool_tap(callback = shiny_callback(id = "tap_info"), "points") %>%
tool_box_select(callback = shiny_callback(id = "selection_info"), "points")
})
output$selection_summary <- renderText({
input$selection_info
})
})
ui <- shinyUI(
fluidPage(
rbokehOutput(outputId = "myChart", width = "400px", height = "400px"),
textInput(inputId="myText",label="Input Text please."),
textInput(inputId="selection_info",label="Selection info"),
textOutput("selection_summary")
)
)
shinyApp(server = server, ui = ui)
So the above output$selection_summary
does provide some type of info that is given by the tool_box_select. I'm just not sure what it is. I'd eventually like to produce a table or summary statistics on the attributes associated with the points selected by the tool. But I don't know how to figure out what it is the callback feature is capturing. I couldn't find anymore details in the documentation, unless I've missed something.
Thanks.