Skip to content

Commit 256ed20

Browse files
author
jefshe
committed
Revert "Use react instead of newPlot as it is more efficient"
This reverts commit 0a909c8.
1 parent 0a909c8 commit 256ed20

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

inst/htmlwidgets/plotly.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ HTMLWidgets.widget({
113113
flex.appendChild(container);
114114
}
115115
}
116-
116+
117117
// finally, insert the flexbox inside the htmlwidget container,
118118
// but before the plotly graph div
119119
graphDiv.parentElement.insertBefore(flex, graphDiv);
@@ -179,7 +179,13 @@ HTMLWidgets.widget({
179179
// this is essentially equivalent to Plotly.newPlot(), but avoids creating
180180
// a new webgl context
181181
// https://github.com/plotly/plotly.js/blob/2b24f9def901831e61282076cf3f835598d56f0e/src/plot_api/plot_api.js#L531-L532
182-
var plot = Plotly.react(graphDiv, x);
182+
183+
// TODO: restore crosstalk selections?
184+
Plotly.purge(graphDiv);
185+
// TODO: why is this necessary to get crosstalk working?
186+
graphDiv.data = undefined;
187+
graphDiv.layout = undefined;
188+
var plot = Plotly.plot(graphDiv, x);
183189
}
184190

185191
// Trigger plotly.js calls defined via `plotlyProxy()`

0 commit comments

Comments
 (0)