1

How can I receive a mouse click event on an icon in a gvisMap in R through Shiny? Very similar to this Leaflet question, but for gvisMap. I would like to get the value of the icon (e.g. ID) to use for further tables and graphs.

Community
  • 1
  • 1

1 Answers1

0

Might be too late, but if anyone else is having a similar problem:

jscode = sprintf("var text = data.getValue(chart.getSelection()[0].row,0);
                 Shiny.onInputChange('%s', text.toString())",
                 session$ns('text'))
gvisMap(df,'locationvar','tipvar',
              options=list(showTip=TRUE, mapType='normal',
                           enableScrollWheel=TRUE,
                           gvis.listener.jscode=jscode))

Include session besides input and output in server. The listener captures mouse clicks on icons and will return the 'locationvar' of the selected icon in input$text.