-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
d3-sankey-circular with grouping #3426
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
Conversation
@@ -62,7 +100,7 @@ module.exports = function(trace) { | |||
label: l, | |||
color: hasNodeColorArray ? nodeSpec.color[i] : nodeSpec.color | |||
}); | |||
} else removedNodes = true; | |||
} else removedNodes = false; |
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.
d3-sankey
already does that downstream (ie. removing unlinked nodes) and it's useful to keep the unlinked nodes if you want to render something associated to them. For example, I use it with d3 to render and animate ghost nodes on grouping.
x1: groupingNode.x1, | ||
y0: groupingNode.y0, | ||
y1: groupingNode.y1, | ||
partOfGroup: true, |
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.
partOfGroup === true
means that this node is included in another node and is a children. It looks as if it's unliked and was deleted by the d3-sankey*
engines.
var nodes = d.graph.nodes.filter(function(n) {return n.originalX === d.node.originalX;}); | ||
var nodes = d.graph.nodes | ||
.filter(function(n) {return n.originalX === d.node.originalX;}) | ||
.filter(function(n) {return !n.partOfGroup;}); |
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.
Take the children nodes out of the force simulation
Implementing grouping is a feature that is orthogonal to implementing circular links. Therefore, the current branch could be rebased off #3355. |
This PR shows that grouping is doable with both Therefore, I will rebase this branch on master after we merge in #3406. I will keep this PR open in the meantime but there's no need to review it yet. |
Closed in favor of PR #3556 |
Very rough attempt at closing #3321
This prototype implements grouping via a new
group
attribute. For now, it can be called viaPlotly.restyle
.This PR is based off PR #3406
Live demo: https://codepen.io/anon/pen/gZBMKp