-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Don't mutate colorscale, cmin/cmax and zmin/zmax into user traces #3341
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8046bb6
move all colorscale helpers to ./helpers.js and ./scales.js
etpinard 0a686dd
flip scale when reversescale:true just before making scaleFn
etpinard c9d92d7
fixes #3273 - add Colorscale.crossTraceDefaults
etpinard 39639c0
:hocho: now unused updateStyle method in transformed full traces
etpinard a6517a8
add a :boat: load of auto-colorscale tests
etpinard 6a47d66
fixes #3100 - make colorscales work from templates
etpinard e8973fa
closes #2873 - add line colorscale + markers mock
etpinard 73c66a9
:hocho: obsolete comment
etpinard 175626b
fix legend items of marker.colorscale traces
etpinard fc884a7
fix baselines that suffer from erroneous colorscale.slice()
etpinard 7c21eab
fixup variable names for consistency
etpinard 596bb47
improve gl3d line colorscales with markers mock
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixes #3273 - add Colorscale.crossTraceDefaults
- to 'relink' zmin/zmax, cmin/cmax and auto colorscale, these values are computed in 'calc' in need to be relinked in 'supply-defaults' in order to work properly after edits that don't go through 'calc'.
- Loading branch information
commit c9d92d7942d6eae4eaf7e204e43c5dbf90441369
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var Lib = require('../../lib'); | ||
var hasColorscale = require('./helpers').hasColorscale; | ||
|
||
module.exports = function crossTraceDefaults(fullData) { | ||
function replace(cont, k) { | ||
var val = cont['_' + k]; | ||
if(val !== undefined) { | ||
cont[k] = val; | ||
} | ||
} | ||
|
||
function relinkColorAtts(trace, cAttrs) { | ||
var cont = cAttrs.container ? | ||
Lib.nestedProperty(trace, cAttrs.container).get() : | ||
trace; | ||
|
||
if(cont) { | ||
var isAuto = cont.zauto || cont.cauto; | ||
var minAttr = cAttrs.min; | ||
var maxAttr = cAttrs.max; | ||
|
||
if(isAuto || cont[minAttr] === undefined) { | ||
replace(cont, minAttr); | ||
} | ||
if(isAuto || cont[maxAttr] === undefined) { | ||
replace(cont, maxAttr); | ||
} | ||
if(cont.autocolorscale) { | ||
replace(cont, 'colorscale'); | ||
} | ||
} | ||
} | ||
|
||
for(var i = 0; i < fullData.length; i++) { | ||
var trace = fullData[i]; | ||
var _module = trace._module; | ||
|
||
if(_module.colorbar) { | ||
relinkColorAtts(trace, _module.colorbar); | ||
} | ||
|
||
// TODO could generalize _module.colorscale and use it here? | ||
|
||
if(hasColorscale(trace, 'marker.line')) { | ||
relinkColorAtts(trace, { | ||
container: 'marker.line', | ||
min: 'cmin', | ||
max: 'cmax' | ||
}); | ||
} | ||
|
||
if(hasColorscale(trace, 'line')) { | ||
relinkColorAtts(trace, { | ||
container: 'line', | ||
min: 'cmin', | ||
max: 'cmax' | ||
}); | ||
} | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.