Learn R Programming

g2r (version 0.1.0)

visible-tooltip: Conceal & Reveal Tooltips

Description

Conceal & reveal tooltips.

Usage

conceal_tooltip(proxy)

reveal_tooltip(proxy, x, y)

Arguments

proxy

A g2r proxy as returned by g2Proxy

x, y

Coordinates of tooltip

Examples

Run this code
# NOT RUN {
library(shiny)

ui <- fluidPage(
  actionButton("hide", "hide"),
  actionButton("show", "show"),
  g2Output("chart")
)

server <- function(input, output) {
  output$chart <- renderG2({
    g2(cars, asp(speed, dist)) %>% 
      fig_point() 
  })

  observeEvent(input$hide, {
    g2Proxy("chart") %>% 
      conceal_tooltip()
  })

  observeEvent(input$show, {
    g2Proxy("chart") %>% 
      reveal_tooltip(8, 16)
  })
}

# }
# NOT RUN {
shinyApp(ui, server)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab