Skip to content
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

Make restyling arrayOk attribute redo calcdata #1488

Merged
merged 1 commit into from
Mar 16, 2017
Merged

Conversation

etpinard
Copy link
Contributor

fixes #1480

I made a blunder in #1257 where conversion of arrayOk attributes from fullData -> calcdata was moved from the plot step to the calc. I tested restyle, it worked (in some situations) but for the wrong reason. Luckily the fixed wasn't too hard.

I wouldn't mind a @alexcjohnson review.

@etpinard etpinard added status: reviewable bug something broken labels Mar 16, 2017
@etpinard etpinard added this to the v1.25.0 milestone Mar 16, 2017

if(valObject.arrayOk && (Array.isArray(newVal) || Array.isArray(oldVal))) {
flags.docalc = true;
Copy link
Contributor Author

@etpinard etpinard Mar 16, 2017

Choose a reason for hiding this comment

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

Previously, calls like restyle(gd, 'marker.size', [[10, 30, 20]]) worked only when one or several axis autorange were turned on as this too clears gd.calcdata.

This here now ensures that restyling any arrayOk key clears gd.calcdata.

Copy link
Contributor Author

@etpinard etpinard Mar 16, 2017

Choose a reason for hiding this comment

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

@alexcjohnson using _module.attributes here to find the arrayOk keys worked surprisingly well. We could declare a few more keys in the attributes to resolve #648 at some point.


mockDefaultsAndCalc(gd);
Plotly.restyle(gd, 'marker.color', [['red', 'green', 'blue']]);
expect(gd.calcdata).toBeUndefined();
Copy link
Contributor Author

@etpinard etpinard Mar 16, 2017

Choose a reason for hiding this comment

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

this means restyle clears gd.calcdata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that Plotly.plot is mocked in this suite.

@alexcjohnson
Copy link
Collaborator

Nice job tracking this down - fix & tests look spot on! 💃

@etpinard etpinard merged commit d9f6c1b into master Mar 16, 2017
@etpinard etpinard deleted the restyle-docalc branch March 16, 2017 20:33
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.

Marker styles are not updated with Plotly.restyle in zoomed state until double-click to zoom out
2 participants