-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Transformed array on zoom fix #1717
Conversation
- flag fullData traces that passed through calc transforms with `_hasCalcTransform: true` - update calcdata[i][0].trace ref BUT map back transformed arrays so that they match the calcdata[i][j] items on non-recalc updates (e.g. zoom events)
@@ -505,12 +506,38 @@ plots.supplyDefaults = function(gd) { | |||
// update object references in calcdata | |||
if((gd.calcdata || []).length === newFullData.length) { |
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.
This block updates the gd.calcdata[i][0].trace
reference so that the plot step can use the correct fullData
attribute values even in cases where Plots.doCalcdata
isn't called (e.g. on zoom).
src/plots/plots.js
Outdated
|
||
for(i = 0; i < arrayAttrs.length; i++) { | ||
ast = arrayAttrs[i]; | ||
Lib.nestedProperty(cd0.trace, ast).set(transformedArrayHash[ast]); |
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.
Here we make sure that the array attributes in gd.calcdata[i][0].trace
match the transformed array post calc transform. Other non-data-array attributes are left untouched.
src/plots/plots.js
Outdated
var oldTrace = cd0.trace; | ||
var arrayAttrs = PlotSchema.findArrayAttributes(oldTrace); | ||
var transformedArrayHash = {}; | ||
var i, ast; |
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.
🐄 just so I don't get confused, ast
makes me think "abstract syntax tree", elsewhere we call this astr
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.
Oh right, astr
is what I had in mind. Something wrong happened between brain and keyboard.
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.
done in 0a4ce1f
Nice use of Yeah, annoying that we have to do this (for the record from a separate chat: the underlying issue is that a 💃 after #1717 (comment) |
Is it clear what needs to happen with this? I'm still having just a bit of trouble understanding exactly why this is needed and then the downstream problem with animation. |
First look at the added assertions. If that's not clear, slack me. |
fixes #1713
As promised, it's not pretty. cc @n-riesco @alexcjohnson