Skip to content
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

nodeAlign not aligning the nodes properly #104

Open
jacksonngoo opened this issue Dec 24, 2021 · 1 comment
Open

nodeAlign not aligning the nodes properly #104

jacksonngoo opened this issue Dec 24, 2021 · 1 comment

Comments

@jacksonngoo
Copy link

I am trying to fix the nodes' position in my sankey diagram by using a field called position.

Then I will call the nodeAlign with custom function where it return the position.

sankey.nodeAlign(
        (node) => {
            return node.position;
        }
    );

However the diagram does not render the expected result.

Please refer to the below diagram.

image

@jeremy-sylvis
Copy link

I've run into similar issues.

As of 0.12.3, this is due how computeNodeDepths calculates depths for nodes and how computeNodeLayers depends on assumptions made in those depth calculations.

In computeNodeDepths, node depth calculations are done by traversing links. In your expected example, D is a calculated depth of 0, E of 1, F of 2 much like { A, B, C }. It doesn't have any facility for providing an override or alternate.

In computeNodeLayers, the calculation of the max number of columns is done using the max depth calculated in computeNodeDepths and is further constrained to transparently through a min of that max column count and your alignment result, resulting in an upper bound of its computed columns regardless of what you say - the exact behavior you see with Result { E, F }.

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

No branches or pull requests

2 participants