plotly / plotly/plotly.R

plotly_relayout does not always fire

Open
#1,909 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

I will try and create a reprex if needed however I'm still trying to pin down an exact cause of this, for now I'll include relevant snippets.

In one of my projects I have been using the drawing capabilities of plotly.js:

    plotly::plot_ly(.......) %>%
      plotly::config(modeBarButtonsToAdd = list("drawclosedpath", "drawrect", "eraseshape")) %>%
      plotly::config(displayModeBar = TRUE)

I am listening to the plotly relayout event:

  observeEvent(plotly::event_data("plotly_relayout", session = session$rootScope()), {
    relayout <- plotly::event_data("plotly_relayout", session = session$rootScope())
    dplyr::glimpse(relayout)
    #.... rest of the code omitted
  })

The issue I am seeing is not all of the drawing events are triggering a shiny event. I have used the websocket viewer of Firefox developer console and the socket contains gaps where the relayout even should be. Hover events are being produced as the mouse is moved for the drawing of the shape however.

I'm seeing series of errors in the browser console:
image

Specifically for the rectangle draw:
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the plotly::event_data("plotly_relayout") observer and Firefox developer console websocket output, comparing drawing actions with socket messages and the reported browser errors. Done means a reproducible case that identifies why rectangle or other drawing events fail to trigger the Shiny event.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.