forked from jbkunst/highcharter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.R
47 lines (29 loc) · 1.16 KB
/
events.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
library(shiny)
if(interactive()){
shinyApp(
ui = fluidPage(
wellPanel("mouseOver and click points for additional information"),
uiOutput("click_ui"),
uiOutput("mouseOver_ui"),
highchartOutput("plot_hc")
),
server = function(input, output) {
df <- data.frame(x = 1:5, y = 1:5, otherInfo = letters[11:15])
output$plot_hc <- renderHighchart({
highchart() %>%
hc_add_series(df, "scatter") %>%
hc_add_event_point(event = "click") %>%
hc_add_event_point(event = "mouseOver")
})
observeEvent(input$plot_hc, print(paste("plot_hc", input$plot_hc)))
output$click_ui <- renderUI({
if(is.null(input$plot_hc_click)) return()
wellPanel("Coordinates of clicked point: ",input$plot_hc_click$x, input$plot_hc_click$y)
})
output$mouseOver_ui <- renderUI({
if(is.null(input$plot_hc_mouseOver)) return()
wellPanel("Coordinates of mouseOvered point: ",input$plot_hc_mouseOver$x, input$plot_hc_mouseOver$y)
})
}
)
}