How to create a Family Tree JS programmatically

There are number of functions to create Family Tree JS programmatically

addParentNode

adds a parent node
 
    
    family.addParentNode(1, "mid", { id: 0, name: "Amber McKenzie's mother", gender: "female" } );


addPartnerNode

adds a partner node
 
        
    family.addPartnerNode( { id: 6, pids: [3], name: "Peter Stevens's wife", gender: "female" } );


addPartnerAndParentNodes

adds a parent which is partner to the other parent
 
        
    family.addPartnerAndParentNodes( 1, [3], { id: 2, pids: [1], name: "Ava Field", gender: "male" } );


addChildNode

adds a child node of two partners
 
        
    family.addChildNode( { id: 6, mid: 1, fid: 2, name: "Amber and Ava's child", gender: "female" } );


addChildAndPartnerNodes

adds a partner snd a child nodes
 
        
    family.addChildAndPartnerNodes(3, 
        { id: 7, mid: 6, fid: 3, name: "Peter's child", gender: "female" },
        { id: 6, pids: [3], tipe: "mid", name: "Peter's wife",  gender: "female" }
    );

removeNode

delete a node from the tree
 
        
    family.removeNode(3);