Good day, I'm relatively new using D3. I have created a Org Chart using D3 and JQuery/Javascript.
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-org-chart@2"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/d3-flextree.js"></script>
However, I am trying to figure out how can I open my chart with all the branches expanded by default. Also, because there are so many people in our group, is there a way to group items in a single node based on office and/or division?
Thank you in advance!
CodePudding user response:
As per source code of the d3-org, you will have to use chart.expandAll(); where chart is your created chart. There are other methods like collapseAll, downloadImage, exportSVG etc. You can refer this file https://github.com/bumbeishvili/org-chart/blob/master/src/d3-org-chart.js to find out which method you want to use.