[BUG]: 3D scatter plot randomly freezes or heavily lags after hovering in plot
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
Description
I'm using Python but decided to post an issue here because I tracked the issue back to the source javascript code, so please bear with this description.
I created a 3D scatter plot using the plotly.express line_3d function in Python Dash that gets updated in real time every 3 seconds. The data that gets plotted is from multiple dataframes where individual points of the same dataframe are generally very close together and linear. When I go to interact with the plot initially, everything works fine. The camera is able to rotate, pan, etc., and the hover text shows up as you would expect. However, after some amount of time (not consistent, but usually happens for me anywhere between 3-30sec of interacting with the plot), an error will trigger in the dev console and then the plot will suddenly stop allowing user interaction (this was the case when I was re-rendering the plot every update) or it will take 5+ seconds to render an interaction (this is the case when using Dash's Patch() feature to make updates to the plot). It seems to trigger from hovering over the graph regardless of if hovermode=False is set in the layout or not.
Screenshots/Video
Here is the error:
Code tracing:
I was able to trace the minified code back to the plotly.js/src/plots/gl3d/scene.js and plotly.js/src/plots/gl3d/project.js files:
Also helpful is gl-plot3d/scene.js from the gl-plot3d GitHub that shows how MouseSelect is initialized:
From what I can see, it seems like the selection variable was initialized but never set to a proper value before being used, which causes this error to be thrown & the plot to freeze up.
Steps to reproduce
- Create a Scatter3d plot populated with over 100 traces where most data points are very close (+-0.0001 or so) and linear
- Update the plot with new data every 1-5 seconds -> in my case, this includes appending data, adding new traces, and setting some existing traces to visible=False
- Make sure Pause on uncaught exceptions is set in your DevTools
- Interact with the plot while it updates, including moving the camera, zooming in, and hovering over the traces quickly for up to 30 seconds
Notes
Side note: I realized that the var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate) line is declared outside of the if(scene.fullSceneLayout.hovermode) check but only used within the Fx.loneHover call, which may be the reason why this error triggers regardless of if hovermode=False is set.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
plotly.js/src/plots/gl3d/scene.js と plotly.js/src/plots/gl3d/project.js から始め、参照されている gl-plot3d/scene.js で選択がどのように初期化されるかを調べます。説明されている、頻繁に更新される Scatter3d の再現例を実行し、ホバーしながらカメラを移動します。操作の応答性が維持され、hovermode を無効にした場合も含めて、捕捉されない選択または投影エラーが発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 66/100