Programmatically Modify Family Tree JS 2

addChild

The below code adds a child of node with id 3:

 
     
        familyTree.addChild(3).draw();
     

addFather

The below code adds a father of node with id 2:

 
     
        familyTree.addFather(2).draw();
     

addMother

The below code adds a mother of node with id 2:

 
     
        familyTree.addMother(2).draw();
     

addSibling

The below code adds a sibling of node with id 3:

 
     
        familyTree.addSibling(3).draw();
     

addSpouse

The below code adds a spouse of node with id 3:

 
     
        familyTree.addSpouse(3).draw();
     

addUnmerriedPartner

The below code adds a unmerried partner of node with id 3:

 
     
        familyTree.addUnmarriedPartner(3).draw();