bumbeishvili / org-chart

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

Start with empty chart #308

Closed DStein4711 closed 1 year ago

DStein4711 commented 1 year ago

I want to start with an empty chart and let the user add node over an interface. I got it working with one node in the data-option and then adding node with the addNode-Function. But if I leave the data empty, it is not working.

Is this possible and how?

bumbeishvili commented 1 year ago

Made relevant changes. You can use 3.1.1 version of the org chart and addNode will be able to add a root node from now on

DStein4711 commented 1 year ago

Thank you. I tried it, but can't get it working.

I'm getting the following Error, when adding the first Node: d3-org-chart_3.1.1.js:69 Uncaught TypeError: a.generateRoot is not a function at t.OrgChart.addNode (d3-org-chart_3.1.1.js:69:7863)

bumbeishvili commented 1 year ago

I've tested it here and it works as expected

https://stackblitz.com/edit/js-bict6t?file=index.html

Clicking add root node adds root node. Clicking add child node adds child node

DStein4711 commented 1 year ago

There was a typo in my code. Now it's working.

Great! Thank you!