events: Events

Description Usage Arguments Examples

Description

Capture how users interact with the chart.

Usage

1
2
3
4
5
6
c_events(
  c,
  events = c("mousemove", "mouseout", "click", "touchstart", "touchmove")
)

c_events_capture(c, events = c("click", "hover"))

Arguments

c

An object of class charter as returned by c_hart.

events

Events to register in the tooltip (c_events) or events to capture in Shiny server c_events_capture.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(shiny)
ui <- fluidPage(
  charterOutput("chart"),
 verbatimTextOutput("ev")
)

server <- function(input, output){

 output$chart <- render_charter({
   chart(cars, caes(speed, dist)) %>% 
     c_scatter() %>% 
     c_events_capture("hover")
 })

 output$ev <- renderPrint({
   input$chart_hovered
 })
}

if(interactive())
 shinyApp(ui, server)

JohnCoene/charter documentation built on Feb. 20, 2022, 11:07 p.m.