d3-plugins icon indicating copy to clipboard operation
d3-plugins copied to clipboard

Sankey Chart: Add a parameter which allows nodes to be manually placed horizontally.

Open speedplane opened this issue 11 years ago • 3 comments

The automatic horizontal placement of nodes in the Sankey chart is nice, but sometimes you need a bit more specificity. This commit adds a parameter which allows nodes to be manually placed horizontally. If xpos is specified as a parameter to each node object, then it will override the default calculated x-position.

speedplane avatar Sep 25 '14 13:09 speedplane

This is an excellent idea, I hope it gets included. As far as I understand, the x position value is an integer “step number”, not an actual horizontal coordinate?

Thanks for proposing this enhancement!

NPC avatar Sep 25 '14 21:09 NPC

@NPC yes, xpos is a step number, we leave it to d3 to figure out the actual x-pixel location.

speedplane avatar Sep 25 '14 23:09 speedplane

This is a dupe of #88.

As for xpos, while it is an integer "step number", I have found that it also works with any kind of positive number, d3 will scale it nicely to fit the page, so you could have steps "wider" than others (At least if you specify it for all nodes, it might mess up the normal step calculations otherwise)

thiloplanz avatar Dec 17 '14 06:12 thiloplanz