Skip to content

why Plotly.react() is as slow as Plotly.newPlot()? updating single trace of many #5674

Open
@KestutisMa

Description

@KestutisMa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething brokenperformancesomething is slow

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions