bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
927 stars 330 forks source link

How can I init the chart with all the nodes expanded? #226

Closed nau12345 closed 1 year ago

nau12345 commented 1 year ago

When the chart inits only shows 2 nodes levels, if I want to see more levels, I have to expand the nodes.

How can I init the chart with all the nodes expanded?

When the chart inits:

image

What I'm looking for when the chart inits:

image

bumbeishvili commented 1 year ago

Currently, there is no straightforward way. For now, I'd suggest assigning _expanded property to nodes you want to be expanded

nau12345 commented 1 year ago

Thanks for the response.

But if I add _expanded, the nodes don't appear expanded.

image

bumbeishvili commented 1 year ago

@nau12345 add that before you pass the data to the org chart

nau12345 commented 1 year ago

Can you give me an example?

bumbeishvili commented 1 year ago

Roughly

data.forEach(d=>d._expanded=true)

new OrgChart().data(data)...render()
nau12345 commented 1 year ago

Thanks!