@@ -63,17 +63,25 @@ class RenderedPlotly extends Widget implements IRenderMime.IRenderer {
6363 return Plotly . addFrames ( this . node , frames ) . then ( ( ) => {
6464 Plotly . animate ( this . node ) ;
6565 this . update ( ) ;
66+ return Plotly . toImage ( plot , {
67+ format : 'png' ,
68+ width : this . node . offsetWidth ,
69+ height : this . node . offsetHeight
70+ } ) . then ( ( url : string ) => {
71+ const imageData = url . split ( ',' ) [ 1 ] ;
72+ model . setData ( { data : { ...data , 'image/png' : imageData } } ) ;
73+ } ) ;
6674 } ) ;
6775 }
6876 this . update ( ) ;
69- // return Plotly.toImage(plot, {
70- // format: 'png',
71- // width: this.node.offsetWidth,
72- // height: this.node.offsetHeight
73- // }).then(url => {
74- // const imageData = url.split(',')[1];
75- // model.setData({ data: { ...data, 'image/png': imageData } });
76- // });
77+ return Plotly . toImage ( plot , {
78+ format : 'png' ,
79+ width : this . node . offsetWidth ,
80+ height : this . node . offsetHeight
81+ } ) . then ( ( url : string ) => {
82+ const imageData = url . split ( ',' ) [ 1 ] ;
83+ model . setData ( { data : { ...data , 'image/png' : imageData } } ) ;
84+ } ) ;
7785 } ) ;
7886 }
7987
0 commit comments