How to rerender figure without page refresh?
So i have a chart that works perfect by default, but I have a button to add the data for a new trace. When clicked it updates the data but my figure/chart does not update/rerender/change. Ideally I want my new trace to be added to the figure when button is clicked, any advice on how to tackle this?
Here's my code:
<Plot data={chartData} layout={chartLayout} style={chartStyle} />
where chatData is the variable I'm updating with the data for the new trace
Thanks.
Have you managed to make this work ? I have a somewhat similar issue: https://github.com/plotly/react-plotly.js/issues/298
You need to make sure chartData is a state variable and you are updating it with setChartData. The answer on this stackoverflow post should be what you are looking for: https://stackoverflow.com/questions/70068221/react-plotly-js-re-draws-graph-component-when-data-point-is-changed/73889261#73889261