plotly_relayout does not always fire
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
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:

Specifically for the rectangle draw:

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 plotly::event_data("plotly_relayout") observer 和 Firefox 开发者控制台中的 websocket 输出开始,将绘图操作与 socket 消息以及报告的浏览器错误进行比较。完成的标准是得到一个可复现的案例,能够确定矩形或其他绘图事件为何无法触发 Shiny 事件。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100