Constructs a new FamilyTree instance.
The family tree data object.
The HTML element to render the tree into.
Optional
opts: Partial<FamilyTreeOptions>Optional configuration for layout, rendering, and styling.
The raw family tree data object.
The importer instance used to convert raw data into nodes.
The layout calculator instance used to assign coordinates to the nodes.
The renderer instance used to draw the tree.
Returns the current array of nodes.
Returns the current root node.
Adds a new link (edge) between two nodes in the family tree data. Optionally re-renders.
The source node ID.
The target node ID.
If true, re-imports and re-renders the tree (default: true).
Adds a new person to the family tree data and optionally re-renders. Assigns a
random ID if data
doesn't contain one.
The person data to add.
If true, re-imports and re-renders the tree (default: true).
Adds a new union (family) to the family tree data and optionally re-renders. Assigns a
random ID if data
doesn't contain one.
The union data to add.
If true, re-imports and re-renders the tree (default: true).
Removes a link (edge) between two nodes in the family tree data. Optionally re-renders.
The source node ID.
The target node ID.
If true, re-imports and re-renders the tree (default: true).
Removes a person and all associated links from the family tree data. Optionally re-renders.
The ID of the person to remove.
If true, re-imports and re-renders the tree (default: true).
Removes a union and all associated links from the family tree data. Optionally re-renders.
The ID of the union to remove.
If true, re-imports and re-renders the tree (default: true).
Handles a click event on a node. Expands or collapses the node and re-renders the tree.
The node that was clicked.
Re-imports the data and re-renders the tree. Useful after modifying the underlying data (e.g. adding or removing nodes and links).
Renders the visible parts of the graph.
Optional
clickedNode: LayoutedNodeThe node that was clicked, if any (used for transitions).
Main class for managing, rendering, and interacting with a family tree. Handles data import, layout calculation, rendering, and runtime modifications.