Shiny has its own built-in interactive plots feature (see this and this to get started). The tableau_select_marks_by_brush_async function lets you take a brush input from a shiny::plotOutput() and, if anything is selected, use it to drive the selection of a Tableau worksheet within the same dashboard. Note that because Tableau's selection model operates on marks, not rows in the underlying data, the x and y dimensions in the originating plot must be represented in the summary data of the target worksheet.

tableau_select_marks_by_brush_async(
  worksheet,
  brush,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

worksheet

Single-element character vector naming the worksheet whose selection we want to set. If your extension's configuration dialog uses choose_data() to allow the user to choose data, then use the tableau_setting(YOUR_SETTING_ID)$worksheet slot to access the worksheet name.

brush

input$YOUR_BRUSH_ID, where YOUR_BRUSH_ID is the identifier passed as plotOutput's brush argument (or passed to shiny::brushOpts(), if you did it that way).

session

The Shiny session object. (You should probably just use the default.)

Value

A promises::promise object. The promise object will not resolve to a useful value, but you can use it to handle errors.

Details

Currently this function only works with plots based on ggplot2, not base graphics plots, because only ggplot2 plots supply the metadata that we need. Future releases of Tableau may make it possible to provide this feature to base plots as well.