0

The stackoverflow community has a great solution for moving nodes in a sankey chart along the x axis (link here).

However, I noticed one cannot manually change the position of sink nodes (i.e. those nodes auto-assigned to the far-right). Because I am incorporating time into the sankey graph, I need to have certain sink nodes fixed at manually specified x positions.

Here is a JSFiddle example that needs this capability. Specifically, I need node "6": "Departed (6 mo.)" to be fixed to the x position '1'.

"nodes":[
    ...
    {"node":6,"name":"Departed (6 mo.)","xPos":1},  // <-- need to move to position x=1; manual override not taking effect
    ...

Per the above-mentioned solution, I have updated computeNodeBreadths() within d3.sankey() and have included "xPos":1 within the node of interest; but the change is not taking effect.

Does anyone have a recommended update to the above-mentioned solution that allows one to manually adjust sink node x positions?

Community
  • 1
  • 1
NickBraunagel
  • 1,559
  • 1
  • 16
  • 30

1 Answers1

0

After some research, the answer is to comment out the line moveSinksRight(x) within the d3.sankey() method computeNodeBreadths(). Credit goes to Greg Ross: https://stackoverflow.com/a/21540569/4245462

Community
  • 1
  • 1
NickBraunagel
  • 1,559
  • 1
  • 16
  • 30