Skip to content

Commit 0a55669

Browse files
committed
make sure the layout is always defined
1 parent 51de36c commit 0a55669

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

inst/htmlwidgets/plotly.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ HTMLWidgets.widget({
88
},
99

1010
resize: function(el, width, height, instance) {
11-
if (el.layout.autosize || true) {
11+
var layout = el.layout || {};
12+
if (layout.autosize || true) {
1213
// User specified height/width overrides htmlwidgets height/width
13-
var width = el.layout.width || width;
14-
var height = el.layout.height || height;
14+
var width = layout.width || width;
15+
var height = layout.height || height;
1516
Plotly.relayout(el.id, {width: width, height: height});
1617
}
1718
},

0 commit comments

Comments
 (0)