File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ HTMLWidgets.widget({
1717
1818 renderValue : function ( el , x , instance ) {
1919
20- // Make a deep copy of user data that we need for the resize method
21- // (Plotly.relayout() mutates the plot input object -- https://codepen.io/cpsievert/pen/WNeOrjj)
22- instance . width = JSON . parse ( JSON . stringify ( x . layout . width || null ) ) ;
23- instance . height = JSON . parse ( JSON . stringify ( x . layout . height || null ) ) ;
24- instance . autosize = JSON . parse ( JSON . stringify ( x . layout . autosize || true ) ) ;
20+ // Plotly.relayout() mutates the plot input object, so make sure to
21+ // keep a reference to the user-supplied width/height *before*
22+ // we call Plotly.plot();
23+ var lay = x . layout || { } ;
24+ instance . width = lay . width ;
25+ instance . height = lay . height ;
26+ instance . autosize = lay . autosize || true ;
2527
2628 /*
2729 / 'inform the world' about highlighting options this is so other
You can’t perform that action at this time.
0 commit comments