-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Transform react #2577
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
Transform react #2577
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bbe3533
remove no longer needed hack for finance in findArrayAttributes
alexcjohnson ed24765
_commonLength -> _length
alexcjohnson fcc459d
fix #2508, fix #2470 - problems with Plotly.react and aggregate trans…
alexcjohnson 7044a13
standardize transforms handling of _length
alexcjohnson 88b7b43
:racehorse: refactor sort transform from O(n^2) to O(n)
alexcjohnson cf4c9c3
heatmap&carpet/has_columns -> Lib.is1D
alexcjohnson e84d4b9
close #1410 - yes, stop pruning in nestedProperty
alexcjohnson b436d52
ensure every trace defines _length in supplyDefaults, and abort trans…
alexcjohnson 2a41f9e
react+transforms PR review edits
alexcjohnson 965bcfb
fixes and test for checklist in #2508
alexcjohnson 6fae229
some fixes and tests for empty data arrays
alexcjohnson 79295f1
rename violins mock that doesn't contain violin traces
alexcjohnson 5e9aa65
transforms mock
alexcjohnson 690eb95
clean up keyedContainer for possibly missing array
alexcjohnson a244cec
violin should not explicitly set whiskerwidth
alexcjohnson 92bd5d2
add _length and stop slicing in scattercarpet
alexcjohnson dc6de2f
clean up handling of colorscale defaults
alexcjohnson 03956e1
include count aggregates in _arrayAttrs - so they remap correctly
alexcjohnson f439e41
in diffData I had _fullInput in the new trace, but not the old!
alexcjohnson e47e6a9
_compareAsJSON for groupby styles
alexcjohnson aa30ad6
update plot_api_test to :lock: recent changes in react/transforms etc
alexcjohnson 4c70826
lint
alexcjohnson 7279b55
+shapes & annotations3d in react-noop test
alexcjohnson 3e250df
tweak docs & remove commented-out code
alexcjohnson cd08479
reactWith -> reactTo
alexcjohnson 0414147
separate svg and gl traces in react-noop tests
alexcjohnson 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
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
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 |
---|---|---|
|
@@ -274,7 +274,7 @@ var extraFormatKeys = [ | |
// gd._fullLayout._transformModules | ||
// is a list of all the transform modules invoked. | ||
// | ||
plots.supplyDefaults = function(gd) { | ||
plots.supplyDefaults = function(gd, skipCalcUpdate) { | ||
var oldFullLayout = gd._fullLayout || {}; | ||
|
||
if(oldFullLayout._skipDefaults) { | ||
|
@@ -458,24 +458,28 @@ plots.supplyDefaults = function(gd) { | |
} | ||
|
||
// update object references in calcdata | ||
if(oldCalcdata.length === newFullData.length) { | ||
for(i = 0; i < newFullData.length; i++) { | ||
var newTrace = newFullData[i]; | ||
var cd0 = oldCalcdata[i][0]; | ||
if(cd0 && cd0.trace) { | ||
if(cd0.trace._hasCalcTransform) { | ||
remapTransformedArrays(cd0, newTrace); | ||
} else { | ||
cd0.trace = newTrace; | ||
} | ||
} | ||
} | ||
if(!skipCalcUpdate && oldCalcdata.length === newFullData.length) { | ||
plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData); | ||
} | ||
|
||
// sort base plot modules for consistent ordering | ||
newFullLayout._basePlotModules.sort(sortBasePlotModules); | ||
}; | ||
|
||
plots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) { | ||
for(var i = 0; i < newFullData.length; i++) { | ||
var newTrace = newFullData[i]; | ||
var cd0 = oldCalcdata[i][0]; | ||
if(cd0 && cd0.trace) { | ||
if(cd0.trace._hasCalcTransform) { | ||
remapTransformedArrays(cd0, newTrace); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. merged and 🐎 |
||
} else { | ||
cd0.trace = newTrace; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Make a container for collecting subplots we need to display. | ||
* | ||
|
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of this pattern.
At the very least we should turn this into
Plots.supplyDefaults(gd, {skipDefaultsUpdateCalc: 1})
to make it more readable and extendable.Personally, I'd vote for removing the newly added
Plots.supplyDefaultsUpdateCalc()
fromPlots.supplyDefaults
and callPlotly.supplyDefaultsUpdateCalc
afterPlots.supplyDefaults
in the places that new it.On
master
, we have:where the calls in
validate.js
andrangeslider/draw.js
(and maybe more) don't need to update calc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the name
supplyDefaultsUpdateCalc
isn't the best - though you could argue the same aboutcalcTransform
, which happens during thecalc
step but updates the data arrays in_fullData
.supplyDefaultsUpdateCalc
has one simple function when there are no transforms, to attach the new traces to the oldcalcdata
in case we're not going to run a recalc, but when there are transforms it also (first) pulls the transformed array attributes back from the oldfullTrace
to the new one. So I think in fact we do need this in most instances, and there are some external callers (like streambed) that depend on this as well.So I'm going to keep it as part of the default
supplyDefaults
behavior, but I'm happy to make it into an options object for clarity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaner
supplyDefaults
API -> 2a41f9e