Skip to content

Sankey: group nodes #3556

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 13 commits into from
Feb 26, 2019
Merged
1 change: 0 additions & 1 deletion src/traces/sankey/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function convertToD3Sankey(trace) {
}

// if link originates from a node in a group, relink source to that group
// if(group.indexOf(source) !== -1) {
if(groupLookup.hasOwnProperty(source)) {
source = groupLookup[source];
}
Expand Down
10 changes: 5 additions & 5 deletions src/traces/sankey/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function sankeyModel(layout, d, traceIndex) {
}
}

graph.nodes.push({
graph.nodes.unshift({
pointNumber: parseInt(nodePointNumber),
x0: groupingNode.x0,
x1: groupingNode.x1,
Expand Down Expand Up @@ -474,19 +474,19 @@ function attachPointerEvents(selection, sankey, eventSet) {
selection
.on('.basic', null) // remove any preexisting handlers
.on('mouseover.basic', function(d) {
if(!d.interactionState.dragInProgress) {
if(!d.interactionState.dragInProgress && !d.partOfGroup) {
eventSet.hover(this, d, sankey);
d.interactionState.hovered = [this, d];
}
})
.on('mousemove.basic', function(d) {
if(!d.interactionState.dragInProgress) {
if(!d.interactionState.dragInProgress && !d.partOfGroup) {
eventSet.follow(this, d);
d.interactionState.hovered = [this, d];
}
})
.on('mouseout.basic', function(d) {
if(!d.interactionState.dragInProgress) {
if(!d.interactionState.dragInProgress && !d.partOfGroup) {
eventSet.unhover(this, d, sankey);
d.interactionState.hovered = false;
}
Expand All @@ -496,7 +496,7 @@ function attachPointerEvents(selection, sankey, eventSet) {
eventSet.unhover(this, d, sankey);
d.interactionState.hovered = false;
}
if(!d.interactionState.dragInProgress) {
if(!d.interactionState.dragInProgress && !d.partOfGroup) {
eventSet.select(this, d, sankey);
}
});
Expand Down