Scatter <g textpoint> join fixup#1672
Merged
Merged
Conversation
- return false when sel is removed i.e. when its x/y coords are non-numeric - this is helpful for clearing associated <g textpoint> - return true otherwise
etpinard
commented
May 11, 2017
| var g = d3.select(this); | ||
| var sel = transition(g.select('text')); | ||
| var hasTextPt = Drawing.translatePoint(d, sel, xa, ya); | ||
| if(!hasTextPt) g.remove(); |
Contributor
Author
There was a problem hiding this comment.
Each <text> node is wrapped in a <g class="textpoint"> group. It is on this group that the data-join happens so we must make sure that group is removed whenever <text> node are removed to obtain the correct enter and merge selections on updates.
Collaborator
There was a problem hiding this comment.
Drawing.translatePoint gets used in line 436 above too, and could short-circuit the lines after it if it removed the node.
Contributor
Author
There was a problem hiding this comment.
Good eyes 👁️ thanks!
etpinard
commented
May 11, 2017
| return Plotly.restyle(gd, { | ||
| x: [[null, undefined, NaN]], | ||
| y: [[NaN, null, undefined]] | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
On master, this restyle call results in
d3.selectAll('.point').size() // => 0 (as desired)
d3.selectAll('.textpoint').size() // => 3 (which messes up subsequent updates)| * @return {boolean} : | ||
| * true if selection got translated | ||
| * false if selection got removed | ||
| */ |
Collaborator
|
Great! 💃 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fixes #1666
cc @rreusser and @n-riesco
Continuing on #1666 (comment), I found a case (see 310e67a ) where
restylewas failing on blankx,yarrays without using filter transforms, so the patch had to be made inscatter/plot.js(see 49e5da5)After this patch: