We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e5746ae + ba4b936 commit 900f7c8Copy full SHA for 900f7c8
inst/examples/map_click/app.R
@@ -0,0 +1,33 @@
1
+# git checkout feature/transmit
2
+# R CMD install ./
3
+
4
+library(shiny)
5
+library(plotly)
6
7
+ui <- fluidPage(
8
+ plotlyOutput("plot"),
9
+ verbatimTextOutput("click")
10
+)
11
12
+server <- function(input, output, session) {
13
14
+ output$plot <- renderPlotly({
15
+ # specify some map projection/options
16
+ g <- list(
17
+ scope = 'usa',
18
+ projection = list(type = 'albers usa'),
19
+ lakecolor = toRGB('white')
20
+ )
21
+ plot_ly(z = state.area, text = state.name, locations = state.abb,
22
+ type = 'choropleth', locationmode = 'USA-states') %>%
23
+ layout(geo = g)
24
+ })
25
26
+ output$click <- renderPrint({
27
+ d <- event_data("plotly_click")
28
+ if (is.null(d)) "Click on a state to view event data" else d
29
30
31
+}
32
33
+shinyApp(ui, server)
0 commit comments