@@ -51,30 +51,15 @@ export class RenderedPlotly extends Widget implements IRenderMime.IRenderer {
51
51
| any
52
52
| IPlotlySpec ;
53
53
// const metadata = model.metadata[this._mimeType] as any || {};
54
- return Plotly . newPlot ( this . node , data , layout , config ) . then ( plot => {
54
+ return Plotly . react ( this . node , data , layout , config ) . then ( plot => {
55
+ this . update ( ) ;
55
56
if ( frames ) {
56
- return Plotly . addFrames ( this . node , frames ) . then ( ( ) => {
57
+ Plotly . addFrames ( this . node , frames ) . then ( ( ) => {
57
58
Plotly . animate ( this . node ) ;
58
- this . update ( ) ;
59
- if ( this . node . offsetWidth > 0 && this . node . offsetHeight > 0 ) {
60
- return Plotly . toImage ( plot , {
61
- format : 'png' ,
62
- width : this . node . offsetWidth ,
63
- height : this . node . offsetHeight
64
- } ) . then ( ( url : string ) => {
65
- const imageData = url . split ( ',' ) [ 1 ] ;
66
- if ( model . data [ 'image/png' ] !== imageData ) {
67
- model . setData ( {
68
- data : { ...model . data , 'image/png' : imageData }
69
- } ) ;
70
- }
71
- } ) ;
72
- }
73
59
} ) ;
74
60
}
75
- this . update ( ) ;
76
61
if ( this . node . offsetWidth > 0 && this . node . offsetHeight > 0 ) {
77
- return Plotly . toImage ( plot , {
62
+ Plotly . toImage ( plot , {
78
63
format : 'png' ,
79
64
width : this . node . offsetWidth ,
80
65
height : this . node . offsetHeight
0 commit comments