Skip to content

Commit 72bd60f

Browse files
committed
inform instance.[width/height] about new layout data, closes #1068
1 parent cb10cda commit 72bd60f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

inst/htmlwidgets/plotly.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,15 @@ HTMLWidgets.widget({
166166

167167
} else {
168168

169+
// new x data could contain a new height/width...
170+
// attach to instance so that resize logic knows about the new size
171+
instance.width = x.layout.width || instance.width;
172+
instance.height = x.layout.height || instance.height;
173+
169174
// this is essentially equivalent to Plotly.newPlot(), but avoids creating
170175
// a new webgl context
171176
// https://github.com/plotly/plotly.js/blob/2b24f9def901831e61282076cf3f835598d56f0e/src/plot_api/plot_api.js#L531-L532
172-
177+
173178
// TODO: restore crosstalk selections?
174179
Plotly.purge(graphDiv);
175180
// TODO: why is this necessary to get crosstalk working?

0 commit comments

Comments
 (0)