Couple plot and table on a R shiny app

I am trying to look for examples if any where you can couple the plot and the table from which it is being plotted. As in if you hover or select on a line chart it will hightlight the corresponding data on the table.

Thank you.

If your data is small, an easy way to do this is using crosstalk, see this example:

If your data is too large to send to the client all at once, you could consider using server side processing as in this example:


Heres an example using plotly and DT. For more plotly-based examples of 'linking views client-side', see --


# `highlight_key()` is essentially the same as using `SharedData$new()`
tx <- highlight_key(txhousing, ~city)

p <- plot_ly(tx) %>%
  group_by(city) %>%
  add_lines(x = ~date, y = ~median)

bscols(p, DT::datatable(tx))
1 Like