8000 Contour restyle zmin zmax by etpinard · Pull Request #1653 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

8000 Contour restyle zmin zmax #1653

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 5 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
replace 'recalc' flag with 'editType' flaglist
  • Loading branch information
etpinard committed May 8, 2017
commit 413e5459960c4b4c2c4c6212919e3a5c3183f981
4 changes: 2 additions & 2 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,8 @@ function _restyle(gd, aobj, _traces) {
flags.docalc = true;
}

// some attributes declare a 'recalc' flag
if(valObject.recalc) {
// some attributes declare an 'editType' flaglist
if(valObject.editType === 'docalc') {
flags.docalc = true;
Copy link
Contributor Author
@etpinard etpinard May 8, 2017

Choose a reason for hiding this comment

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

... slowly migrating to something better than those ugly recalcAttrs lists in restyle and relayout.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Down the line, this is going to require valObject.dostyle, .doplot, .doCamera etc etc... would we be better off with something like valObject.editType = 'docalc' etc? Which presumably we could use like a flaglist (and validate as such in plotschema_test)?

💯 🍻 for getting this effort going!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

valObject.editType = 'docalc'

Right. I guess that scales better. Thanks 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 413e545

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍
I guess later this can change to something like

if(valObject.editType) {
    valObject.editType.split('+').forEach(function(flag) {
        flags[flag] = true;
    });
}

But don't need to do that now - lets wait until we have validation of editType, perhaps in plotschema_test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But don't need to do that now - lets wait until we have validation of editType, perhaps in plotschema_test?

Yep, that's what I was thinking. Referencing #648


Expand Down
4 changes: 2 additions & 2 deletions src/traces/contour/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ module.exports = extendFlat({}, {
},
colorscaleAttrs, {
autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}),
zmin: extendFlat({}, colorscaleAttrs.zmin, {recalc: true}),
zmax: extendFlat({}, colorscaleAttrs.zmax, {recalc: true})
zmin: extendFlat({}, colorscaleAttrs.zmin, {editType: 'docalc'}),
zmax: extendFlat({}, colorscaleAttrs.zmax, {editType: 'docalc'})
},
{ colorbar: colorbarAttrs }
);
4 changes: 2 additions & 2 deletions src/traces/histogram2dcontour/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ module.exports = extendFlat({}, {
line: contourAttrs.line
},
colorscaleAttrs, {
zmin: extendFlat({}, colorscaleAttrs.zmin, {recalc: true}),
zmax: extendFlat({}, colorscaleAttrs.zmax, {recalc: true})
zmin: extendFlat({}, colorscaleAttrs.zmin, {editType: 'docalc'}),
zmax: extendFlat({}, colorscaleAttrs.zmax, {editType: 'docalc'})
},
{ colorbar: colorbarAttrs }
);
2 changes: 1 addition & 1 deletion test/jasmine/tests/plotschema_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('plot schema', function() {
var valObject = valObjects[attr.valType],
opts = valObject.requiredOpts
.concat(valObject.otherOpts)
.concat(['valType', 'description', 'role', 'recalc']);
.concat(['valType', 'description', 'role', 'editType']);

Object.keys(attr).forEach(function(key) {
expect(opts.indexOf(key) !== -1).toBe(true, key, attr);
Expand Down
0