bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

feature request: return bubble index to shiny on bubble click

Open FrissAnalytics opened this issue 9 years ago • 1 comments

Hi,

in some Shiny contexts it would be useful to know on which bubble a user has clicked. This can be added quite easily by adding something like this to the code in bubble.js


    newNode.append("circle")
        .style("fill", "#FFFFFF")
        .on("click",function(d,i){
          var id = el.id + "_index";
          Shiny.onInputChange(id,i);
        });

Assuming the chart was rendered via a call like

output$bubbles <- renderBubbles({
...
})

the user can then get the index back via input$bubbles_index.

In Shiny this works nicely, but for a stand alone htmlWidget the code probably will be a tad different as the Shiny object in Shiny.onInputChange doesn't exist. Added the d (data) content, together with the index i could also be useful of course.

kind regards, Herman

FrissAnalytics avatar Oct 17 '15 11:10 FrissAnalytics

Maybe a way to interact with the input?

zhilongjia avatar Dec 27 '15 11:12 zhilongjia