Francis Malloch
Francis Malloch

Reputation: 1094

D3 V5 Tree link source position is incorrect

I have been making a tree hierarchy graph, there are two filters, one shows the full hierarchy and one shows just the lineage to a set node in the tree.

When changing to the lineage view, it seems like the source node position of the links is incorrect and keeps its old position.

In this photo below we are displaying the full hierarchy. enter image description here

And in this photo below we are displaying just the lineage for one user. enter image description here

As you can see, the source position for the links is quite off.

I reduce the graph to the lineage view by reducing the elements that are in the children's array object of each node.

Example of the issue: https://blockbuilder.org/frazboyz/dc5a4f77e9c61acc996f2efc5d00d3cd

Upvotes: 0

Views: 286

Answers (1)

Francis Malloch
Francis Malloch

Reputation: 1094

The bug was caused due to me cloning the object and assigning that as the children in Node which changes its object.

Original https://blockbuilder.org/frazboyz/dc5a4f77e9c61acc996f2efc5d00d3cd

Fixed https://blockbuilder.org/frazboyz/9d0c834e5c99e1da9481ea6c922cf9ca

See line 216.

Upvotes: 1

Related Questions