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

Bidirectional Org Chart ( Two Layouts at a time ) #419

Open
bhavyakelp opened this issue Jul 16, 2024 · 8 comments
Open

Bidirectional Org Chart ( Two Layouts at a time ) #419

bhavyakelp opened this issue Jul 16, 2024 · 8 comments

Comments

@bhavyakelp
Copy link

bhavyakelp commented Jul 16, 2024

Hi

I am wanting to create a bidirectional org chart ( similar to a family tree), which has the root node at the center, its children below it and parents above it with each node having a fixed height and width.
If I further expand my parent nodes they open upwards and if I open child node they open downwards.

In the org chart example that is posted (here),

  • If the layout is bottom : It opens the chart in bottom up direction ( upwards )
Screenshot 2024-07-16 at 4 20 08 PM
  • and if the layout is top : It opens the chart in top down direction (downwards)
Screenshot 2024-07-16 at 4 20 31 PM

what I aim to do is have both of these in one single chart and create something similar to this:

  • with the yellow node being the root
  • purple being the children
  • green being the parent
  • and a expand (+)/ collapse(-) icon to toggle between expanded states

image

How will be able to achieve this ? I tried multiple ways but am unable to attain this behaviour.......

@bumbeishvili
Copy link
Owner

Hi, it's not easily possible with this library, and not sure how to approach it at the moment

@bhavyakelp
Copy link
Author

@bumbeishvili are there any algorithms / packages that can help me achieve this ?

@bumbeishvili
Copy link
Owner

No idea

@bhavyakelp
Copy link
Author

@bumbeishvili , no worries, and thank you for your assistance.

If I use your codebase to achieve this behavior, I understand that I need to position the parent nodes at the top. Could you please guide me on which functions I should look into to make these changes?

@bumbeishvili
Copy link
Owner

I am guessing it will be along these lines

if (attrs.compact) {
this.calculateCompactFlexDimensions(attrs.root);
}
// Assigns the x and y position for the nodes
const treeData = attrs.flexTreeLayout(attrs.root);
// Reassigns the x and y position for the based on the compact layout
if (attrs.compact) {
this.calculateCompactFlexPositions(attrs.root);
}

@bhavyakelp
Copy link
Author

That helps, @bumbeishvili!

In the meantime, I was browsing through some of your projects, and I find them truly amazing!
But, I came across your secureLogic visualization, which is very similar to what I need.

Screenshot 2024-07-18 at 10 22 28 PM

If you see this chart is similar to an org chart but works in two directions (LR and RL)
So if I reciprocate this chart, I can then make it TB and BT, add my custom nodes and voila!

Is that a good idea and is it possible? I would like your view and input on this ......

@bumbeishvili
Copy link
Owner

Yes, it's similar, as I remember I did it from scratch, instead of using this library, I don't exactly remember how I did it, but If I were to do it again, I'd use the same Flextree library, I'd probably just change the direction of some branches from positive to negative coordinates

https://observablehq.com/@bumbeishvili/horizontal-collapsible-d3-flextree

@bhavyakelp
Copy link
Author

@bumbeishvili, I was finally able to achieve the chart I wanted. Thank you for your help !

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

No branches or pull requests

2 participants