plotly / plotly/react-plotly.js

Updating single trace of many: changing `revision` prop does not improve performance (compared to redrawing all)

未关闭
#243 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。