Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Sankey.Path Highlight full path #2

Open
mnelsonCASE opened this issue Apr 8, 2016 · 3 comments
Open

Sankey.Path Highlight full path #2

mnelsonCASE opened this issue Apr 8, 2016 · 3 comments

Comments

@mnelsonCASE
Copy link

Is there anyway with the Sankey.Path variant to highlight the full path from the first source to the last target? Right now, i am unable to get it to function as such.

image

I really would need the path to highlight as indicated by the red arrow in the above picture.

Thanks for any advice

@wvengen
Copy link
Member

wvengen commented Jun 9, 2016

Sorry for not responding earlier, somehow I've missed these notifications. At the moment, this is not supported. Even in the example above, Hazelnuts has small lines to all mid-nodes, which would highlight but the most right non-Hazelnut paths; so with this data, the feature wouldn't be of much use.

When not all right endnodes would be connected to all mid-nodes, this would be a useful feature. Or, it would be possible to select highlighted paths exceeding a threshold value. I haven't been able to find a solution that would work for the general case with many connections.

A starting point would be path.js, if you'd like to experiment, e.g. by making getConnectionsNode a bit smarter.

@nvogler
Copy link

nvogler commented Apr 3, 2019

Changing this statement in getConnectionsNode in d3.chart.sankey.js worked for me.

if ((direction == "source" && o.sourceLinks.length > 2) || direction == "both") { o.targetLinks.forEach(function(p) { links = links.concat(getConnectionsLink(p, direction)); }); }

to

if ((direction == "source" && o.sourceLinks.length > 0) || direction == "both") { o.targetLinks.forEach(function(p) { links = links.concat(getConnectionsLink(p, direction)); }); }

@karayakar
Copy link

addition to that @nvogler you can include;

if ((direction == "source" && o.sourceLinks.length > 0) || direction == "both") {
o.targetLinks.forEach(function (p) { links = links.concat(getConnectionsLink(p, direction)); });
}
if ((direction == "target" && o.targetLinks.length > 0) || direction == "both") {
o.sourceLinks.forEach(function (p) { links = links.concat(getConnectionsLink(p, direction)); });
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants