why Plotly.react() is as slow as Plotly.newPlot()? updating single trace of many
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
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:
https://plotly.com/javascript/plotlyjs-function-reference/#plotlyreact
Plot is updated but I don't see any performance improvement if I change only single element of data or all data elements:
Here is MWE in codepen
Briefly, I generated sample data 100 traces of 10000 points and changing only first trace with:
data[0].x = [...Array(10).keys()].map( c=> c/10) //change only first trace
data[0].y = [...Array(10).keys()].map( c=> Math.random())
Plotly.react('myDiv', data, layout);
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodePen MWE and compare Plotly.react() with Plotly.newPlot() using the stated 100-trace, 10,000-point data. Read the linked Plotly.react documentation and trace the update path in the repository; the issue names no source file or test. Done would require identifying the cause of the comparable timings and defining the expected optimization or documentation change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization, frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100