plotly / plotly/react-plotly.js
Updating single trace of many: changing `revision` prop does not improve performance (compared to redrawing all)
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 138
- 平均合併
- 3 天 2 小時
- 30 天內合併 PR
- 4
描述
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?
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先使用 100-trace sample 重現回報的案例,並比較變更單一 trace 與變更所有 trace 的情況。結合所引用的 react-plotly.js 和 Plotly.js 文件,檢查 Plot 元件的 data 和 revision 更新路徑;完成標準是確定是否支援單一 trace 重繪,並記錄或修正觀察到的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, react
- 領域
- data-visualization, frontend, performance
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100