Skip to content

Commit 5ffb9cb

Browse files
committed
update shiny example to use customdata and avoid warnings
1 parent c3388a6 commit 5ffb9cb

File tree

1 file changed

+3
-3
lines changed
  • inst/examples/shiny/event_data_persist

1 file changed

+3
-3
lines changed

inst/examples/shiny/event_data_persist/app.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ server <- function(input, output, session) {
1414
# On hover, the key field of the event data contains the car name
1515
# Add that name to the set of all "selected" cars
1616
observeEvent(event_data("plotly_hover"), {
17-
car <- event_data("plotly_hover")$key
17+
car <- event_data("plotly_hover")$customdata
1818
cars_old_new <- c(cars(), car)
1919
cars(unique(cars_old_new))
2020
})
@@ -32,8 +32,8 @@ server <- function(input, output, session) {
3232
mtcars %>%
3333
plot_ly(
3434
x = ~wt, y = ~mpg,
35-
key = row.names(mtcars),
36-
color = I(cols)
35+
customdata = row.names(mtcars),
36+
marker = list(color = cols)
3737
) %>%
3838
add_markers()
3939
})

0 commit comments

Comments
 (0)