Skip to content Skip to sidebar Skip to footer

R Remove Marked Rectangle After Plotly Selection Reset

I use @shosaco solution from here to reset selection in plotly: library(shiny) library(plotly) library(shinyjs) library(V8) ui <- shinyUI( fluidPage( useShinyjs(), ex

Solution 1:

A bit late to answer, but as I was facing the same problem just now, I thought I'd post my solution here. You can reset the selection with:

Plotly.restyle(plot, {selectedpoints: [null]});

Adding that to the extendShinyjs call will deselect the points and remove the rectangle, so something like this:

extendShinyjs(
  text = "shinyjs.resetClick = function() { 
    Shiny.onInputChange('.clientValue-plotly_selected-A', 'null'); 
    Plotly.restyle('plot', {selectedpoints: [null]});
  }"
),

Post a Comment for "R Remove Marked Rectangle After Plotly Selection Reset"