Skip to content

Plotly.update replot fixes #3825

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

Merged
merged 2 commits into from
May 8, 2019
Merged

Plotly.update replot fixes #3825

merged 2 commits into from
May 8, 2019

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented May 1, 2019

fixes #3824


Plotly.update calls like

Plotly.update(gd, {visible: false}, {annotations: [{text: 'a'}]});

that lead to restyle flag fullReplot:true and relayout flag layoutReplot:true erroneously resulted in a makePlotFramework call, which (among other things) cleared the modebar container (added in #3589).

In brief, makePlotFramework on "empty" graph divs, I suspect other Plotly.update bugs went undetected because of this.


cc @plotly/plotly_js I'll ask @antoinerg to review this thing. Thanks!

etpinard added 2 commits May 1, 2019 11:50
... during Plotly.update. Clearing gd.data lead to an erroneous
    makePlotFramework call which lead to modebar buttons not displaying
    (and potentially other bugs)
@etpinard etpinard added bug something broken status: reviewable labels May 1, 2019
// clear existing data/layout on gd
// so that Plotly.plot doesn't try to extend them
gd.data = undefined;
gd.layout = undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B. This block was added in 9bad608 - with proper test coverage.

@antoinerg
Copy link
Contributor

Codepen after the fix: https://codepen.io/antoinerg/pen/YbyevG

Looks good to me 💃

@etpinard etpinard merged commit 6ae0349 into master May 8, 2019
@etpinard etpinard deleted the modebar-after-update-fix branch May 8, 2019 16:18
@sermeor
Copy link

sermeor commented Jun 13, 2020

I know the issue is closed, but it happens the same when using restyle method, which can be seen in the demos online (https://plotly.com/javascript/custom-buttons/). I was wondering if that can also be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using "update" method in button created using updatemenus removes the modebar
3 participants