Skip to content

leverage Plotly.react() #1220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions inst/htmlwidgets/plotly.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,12 @@ HTMLWidgets.widget({
instance.height = x.layout.height;

} else {

// new x data could contain a new height/width...
// attach to instance so that resize logic knows about the new size
instance.width = x.layout.width || instance.width;
instance.height = x.layout.height || instance.height;

// this is essentially equivalent to Plotly.newPlot(), but avoids creating
// a new webgl context
// https://github.com/plotly/plotly.js/blob/2b24f9def901831e61282076cf3f835598d56f0e/src/plot_api/plot_api.js#L531-L532

// TODO: restore crosstalk selections?
Plotly.purge(graphDiv);
// TODO: why is this necessary to get crosstalk working?
graphDiv.data = undefined;
graphDiv.layout = undefined;
var plot = Plotly.plot(graphDiv, x);
var plot = Plotly.react(graphDiv, x);

}

Expand Down