Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fb1397

Browse files
committed
Using Plotlyjs.react instead of newPlot when updating
1 parent c98393d commit 2fb1397

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/app/plotly/plot/plot.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,12 @@ export class PlotComponent implements OnInit, OnChanges, OnDestroy, DoCheck {
210210
throw error;
211211
}
212212

213-
return this.createPlot().then(() => {
213+
return this.plotly.update(this.plotlyInstance, this.data, this.layout, this.config).then(() => {
214214
const figure = this.createFigure();
215215
this.update.emit(figure);
216+
}, err => {
217+
console.error('Error while updating plot:', err);
218+
this.error.emit(err);
216219
});
217220
}
218221

src/app/plotly/plotly.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class PlotlyService {
5959
}
6060

6161
public update(div: Plotly.PlotlyHTMLElement, data: Plotly.Data[], layout?: Partial<Plotly.Layout>, config?: Partial<Plotly.Config>) {
62-
return this.getPlotly().update(div, data, layout, config);
62+
return this.getPlotly().react(div, data, layout, config);
6363
}
6464

6565
public resize(div: Plotly.PlotlyHTMLElement): void {

0 commit comments

Comments
 (0)