I would like to use both React JS and plotly in my web app. I want plotly to graph realtime data, but I want to avoid a complete rerender of the graph everytime a new point is added. Plotly graphs have an update function that makes it so the entire graph isn't destroyed/rerendered.
So I have a few questions. 1. Is it possible to use react components to represent a plotly graph and have it update realtime without a full rerender of the graph? 2. If the above is not possible, is there a work around?
Thanks
You can use
shouldComponentUpdateto prevent your component from re-rendering when the data you use to update the plot changes. I'm currently doing exactly this with a canvas based project so it should work with plotly as well.Edit: My shouldComponentUpdate looks like this, basically I only need to re-render the canvas if the size it's given changes not when the data changes.