plotly / plotly/react-plotly.js
Updating single trace of many: changing `revision` prop does not improve performance (compared to redrawing all)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 138
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
Hi, I am trying to redraw only single trace in a plot of many traces (biophysical data). I tried to follow instructions in react-plotly and plotlyjs documentation. Plot is updated but I don't see any performance improvement if I change only single element of data or all data elements, if I change revision as described in following:
https://github.com/plotly/react-plotly.js/#refreshing-the-plot
https://plotly.com/javascript/plotlyjs-function-reference/#plotlyreact
Important Note: In order to use this method to plot new items in arrays under data such as x or marker.color etc, these items must either have been added immutably (i.e. the identity of the parent array must have changed) or the value of layout.datarevision must have changed.
I generate sample data 100 traces of 10000 points with:
const data = useRef([...Array(100).keys()].map( c=> (
{ x: [...Array(10000).keys()],
y: [...Array(10000).keys()].map( c=> c/10000.0 + Math.random()/5)
} ) ))
const revision = useRef(0)
Also, I change data with:
revision.current++
data.current[0].x = [...Array(100).keys()].map( v => v*100)
data.current[0].y = [...Array(100).keys()].map( c=> Math.random())
setState({...state, data:data.current, revision:revision.current})
Plot is generated using data.current for it's data prop
<Plot
data={state.data}
revision={state.revision}
...
Drawing plot containing single trace takes just a split of second, but if I had already drawn many traces and I want to redraw only single trace, it takes same time as to redraw all traces (few seconds).
Am I doing something wrong?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện trường hợp đã được báo cáo với 100-trace sample và so sánh việc thay đổi một trace với việc thay đổi tất cả các trace. Kiểm tra đường dẫn cập nhật data và revision của thành phần Plot cùng với tài liệu react-plotly.js và Plotly.js được tham chiếu; công việc được xem là hoàn tất khi xác định được liệu việc vẽ lại một trace có được hỗ trợ hay không, đồng thời hành vi quan sát được đã được ghi lại hoặc sửa.
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, react
- Lĩnh vực
- data-visualization, frontend, performance
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100