@@ -14,9 +14,9 @@ HTMLWidgets.widget({
1414 } ,
1515
1616 resize : function ( el , width , height , instance ) {
17- if ( instance . autosize ) {
18- Plotly . relayout ( el . id , { width : width , height : height } ) ;
19- }
17+ var width = instance . width || width ;
18+ var height = instance . height || height ;
19+ Plotly . relayout ( el . id , { width : width , height : height } ) ;
2020 } ,
2121
2222 renderValue : function ( el , x , instance ) {
@@ -30,14 +30,16 @@ HTMLWidgets.widget({
3030 }
3131
3232 var graphDiv = document . getElementById ( el . id ) ;
33+ var layout = x . layout || { } ;
3334
3435 // if no plot exists yet, create one with a particular configuration
3536 if ( ! instance . plotly ) {
36- var plot = Plotly . plot ( graphDiv , x . data , x . layout , x . config ) ;
37+ var plot = Plotly . plot ( graphDiv , x . data , layout , x . config ) ;
3738 instance . plotly = true ;
38- instance . autosize = x . layout . autosize ;
39+ instance . height = layout . height ;
40+ instance . width = layout . width ;
3941 } else {
40- var plot = Plotly . newPlot ( graphDiv , x . data , x . layout ) ;
42+ var plot = Plotly . newPlot ( graphDiv , x . data , layout ) ;
4143 }
4244
4345 sendEventData = function ( eventType ) {
0 commit comments