plotly / plotly/plotly.js

[BUG]: 3D scatter plot randomly freezes or heavily lags after hovering in plot

Đang mở
#7,999 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P2 size: 3
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

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:
Image
Code tracing:
Image
Image

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:
Image
Image

Also helpful is gl-plot3d/scene.js from the gl-plot3d GitHub that shows how MouseSelect is initialized:
Image

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với plotly.js/src/plots/gl3d/scene.js và plotly.js/src/plots/gl3d/project.js, sau đó kiểm tra cách selection được khởi tạo trong gl-plot3d/scene.js được tham chiếu. Chạy bản tái hiện Scatter3d được mô tả, vốn được cập nhật thường xuyên, trong khi di chuột qua đó và di chuyển camera. Hoàn tất khi thao tác tương tác vẫn phản hồi nhanh và không xảy ra lỗi selection hoặc projection không được bắt, kể cả khi hovermode bị tắt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
66/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.