R remove marked rectangle after plotly selection reset

走远了吗. 提交于 2019-12-10 22:43:28

问题


I use @shosaco solution from here to reset selection in plotly:

library(shiny)
library(plotly)
library(shinyjs)
library(V8)

ui <- shinyUI(
  fluidPage(
    useShinyjs(),
    extendShinyjs(text = "shinyjs.resetClick = function() { Shiny.onInputChange('.clientValue-plotly_selected-A', 'null'); }"),
    actionButton("reset", "Reset plotly click value"),
    plotlyOutput("plot"),
    verbatimTextOutput("clickevent")
  )
)

server <- shinyServer(function(input, output) {

  output$plot <- renderPlotly({
    plot_ly(mtcars, x=~cyl, y=~mpg)
  })

  output$clickevent <- renderPrint({
    event_data("plotly_selected")
  })

  observeEvent(input$reset, {
    js$resetClick()
  })
})

shinyApp(ui, server)

and it works with resetting data but does not reset marked rectangle:

Do you have any ideas how to get rid of that rectangle?

来源:https://stackoverflow.com/questions/48702592/r-remove-marked-rectangle-after-plotly-selection-reset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!