tippy_plot: Use a plot as tooltip

View source: R/plot.R

tippy_plotR Documentation

Use a plot as tooltip

Description

Use a plot as tooltip

Usage

tippy_plot(
  selector,
  plotId,
  ...,
  .width = 200,
  .height = 200,
  .hidePlot = FALSE,
  .session = shiny::getDefaultReactiveDomain()
)

Arguments

selector

A CSS selector, e.g.: '#id' or '.class'. If it is a bare selector (e.g.: 'sth') then it is assumed to be an id and processed as '#sth'. Set '.is_tag' to 'TRUE' to disable that.

plotId

Id of plot to use.

...

Any other options from the official documentation.

.width, .height

Dimensions of plot.

.hidePlot

Whether to hide the original plot.

.session

A valid shiny session.

Examples

library(shiny)

ui <- fluidPage(
  useTippy(),
  plotOutput("plot"),
  h5("plot tooltip", id = "plotTip")
)

server <- function(input, output) {
  output$plot <- renderPlot({
    on.exit({
      tippy_plot(
        "plotTip", 
        "plot", 
        theme = "light",
        .hidePlot = TRUE,
				 .width = 600,
				 .height = 200,
        maxWidth = 700
      )
    })
    plot(cars)
  })
}

if(FALSE){
  shinyApp(ui, server)
}


JohnCoene/tippy documentation built on April 16, 2023, 2:37 p.m.