plotly / plotly/react-plotly.js

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

オープン
#243 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
1.1k
フォーク
138
平均マージ
3日 2時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、100-trace sample を使って報告されたケースを再現し、1 つの trace を変更した場合とすべての trace を変更した場合を比較します。参照されている react-plotly.js および Plotly.js のドキュメントと併せて、Plot コンポーネントの data と revision の更新経路を調査します。1 つの trace の再描画がサポートされているかを確認し、観測された動作を文書化または修正できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
data-visualization, frontend, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。