This layout algorithm arranges genealogical graphs (family trees).
Remarks
Layout Style
The family trees consist of nodes that represent individuals and nodes that represent families. Individuals are connected via these family nodes. The graph is arranged in layers that describe generations.
Concept
In order to determine whether a node represents an individual or a partnership, a IDataProvider has to be registered with key FAMILY_TYPE_DP_KEY. If this IDataProvider is missing, an ArgumentError will be thrown.
This IDataProvider provides:
- MALE for a node representing a male individual.
- FEMALE for a node representing a female individual.
- FAMILY for a node representing a family.
All other values will be interpreted as if the node represents an individual.
A FAMILY node links all members of a family. It can only have two incoming edges from the parents. Two nodes of the same type (families or individuals) cannot be directly connected. If the input graph violates these specifications, a InvalidGraphStructureError exception will be thrown.
The layout is calculated basically in two steps:
- The families are laid out by the inner layouter in a compact way.
- The relations between these "family groups" and their children and other families are laid out by the top layout algorithm.
Features
The distances between nodes in the same generation as well as between individuals and family nodes can be adjusted.
Nodes in the same generation can be aligned at three different coordinates: top, center, bottom.
The location of FAMILY nodes can be specified in relation to the partners. This placement can be set independently for parents.
Default Values of Properties
alignment | CENTER
| |
familyMembersSortingPolicy | NO_SORTING
| |
familyNodesAlwaysBelow | false | |
hideGroupsStageEnabled | false | The stage responsible for hiding group nodes is activated. |
offsetForFamilyNodes | 10 | |
parallelEdgeRouterEnabled | true | The stage that routes parallel edges is activated. |
partnerlessBelow | true | |
selfLoopRouterEnabled | true | The stage that routes self-loops is activated. |
spacingBetweenFamilyMembers | 30 | |
topLayout | HierarchicLayout
|
Type Details
- yfiles module
- layout-familytree
- yfiles-umd modules
- layout-familytree, layout
- Legacy UMD name
- yfiles.genealogy.FamilyTreeLayout
See Also
Constructors
Creates a new instance of FamilyTreeLayout with default settings.
Parameters
A map of options to pass to the method.
- topLayout - ILayoutAlgorithm
The layout algorithm that is responsible for the layout between family groups. This option sets the topLayout property on the created object.
- spacingBetweenFamilyMembers - number
The spacing between two nodes representing members of the same family in one generation. This option sets the spacingBetweenFamilyMembers property on the created object.
- offsetForFamilyNodes - number
The offset by which a FAMILY node is shifted down if its parents are not direct neighbors. This option sets the offsetForFamilyNodes property on the created object.
- partnerlessBelow - boolean
Whether or not FAMILY nodes of individuals that have only children but no partners are placed below this individual or next to it. This option sets the partnerlessBelow property on the created object.
- familyNodesAlwaysBelow - boolean
Whether or not FAMILY nodes are placed between or below the partners. This option sets the familyNodesAlwaysBelow property on the created object.
- alignment - VerticalNodeAlignment
The vertical alignment of the individual nodes in the same generation. This option sets the alignment property on the created object.
- parallelEdgeRouterEnabled - boolean
Whether or not the ILayoutStage used for routing parallel edges is activated. This option sets the parallelEdgeRouterEnabled property on the created object.
- selfLoopRouterEnabled - boolean
Whether or not the ILayoutStage used for routing self-loops is activated. This option sets the selfLoopRouterEnabled property on the created object.
- familyMembersSortingPolicy - FamilyMembersSortingPolicy
The order of individuals in the same generation (siblings, partners) based on their sex. This option sets the familyMembersSortingPolicy property on the created object.
- labeling - ILayoutStage
The ILayoutStage that places the labels of the input graph. This option sets the labeling property on the created object.
- selfLoopRouter - ILayoutStage
The ILayoutStage that routes self-loops. This option sets the selfLoopRouter property on the created object.
- parallelEdgeRouter - ILayoutStage
The ILayoutStage that routes parallel edges. This option sets the parallelEdgeRouter property on the created object.
- componentLayout - ILayoutStage
The ILayoutStage that arranges the connected components of an input graph. This option sets the componentLayout property on the created object.
- subgraphLayout - ILayoutStage
The ILayoutStage that constrains the layout process to a subgraph of the input graph. This option sets the subgraphLayout property on the created object.
- hideGroupsStage - ILayoutStage
The ILayoutStage that hides the group nodes of the input graph. This option sets the hideGroupsStage property on the created object.
- orientationLayout - ILayoutStage
The ILayoutStage that modifies the orientation of a computed layout. This option sets the orientationLayout property on the created object.
- orientationLayoutEnabled - boolean
Whether or not the ILayoutStage that modifies the orientation of the layout is activated. This option sets the orientationLayoutEnabled property on the created object.
- layoutOrientation - LayoutOrientation
The main orientation of the layout. This option sets the layoutOrientation property on the created object.
- labelingEnabled - boolean
Whether or not the ILayoutStage used for placing the labels of the input graph is activated. This option sets the labelingEnabled property on the created object.
- hideGroupsStageEnabled - boolean
Whether or not the ILayoutStage used for hiding group nodes is activated. This option sets the hideGroupsStageEnabled property on the created object.
- componentLayoutEnabled - boolean
Whether or not the ILayoutStage used for arranging the components of the graph is activated. This option sets the componentLayoutEnabled property on the created object.
- subgraphLayoutEnabled - boolean
Whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This option sets the subgraphLayoutEnabled property on the created object.
Properties
Gets or sets the ILayoutStage that arranges the connected components of an input graph.
Default Value
ComponentLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for arranging the components of the graph is activated.
Remarks
Default Value
true
.The stage that arranges connected graph components is activated.
See Also
Defined in
Gets or sets the order of individuals in the same generation (siblings, partners) based on their sex.
Default Value
NO_SORTING.Throws
- Exception({ name: 'ArgumentError' })
- if the specified order is unknown
Gets or sets whether or not FAMILY nodes are placed between or below the partners.
Default Value
false
.See Also
Sample Graphs
Gets or sets the ILayoutStage that hides the group nodes of the input graph.
Default Value
HideGroupsStage.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for hiding group nodes is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage responsible for hiding group nodes is activated.
See Also
Defined in
Gets or sets the ILayoutStage that places the labels of the input graph.
Default Value
See Also
Defined in
Gets or sets whether or not the ILayoutStage used for placing the labels of the input graph is activated.
Remarks
Default Value
false
.The stage responsible for label placement is deactivated.
See Also
Defined in
Gets or sets the main orientation of the layout.
Remarks
Default Value
TOP_TO_BOTTOM.Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation does not match a default layout orientation
See Also
Defined in
Gets or sets the ILayoutStage that modifies the orientation of a computed layout.
Default Value
OrientationLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage that modifies the orientation of the layout is activated.
Remarks
Default Value
true
.The orientation
See Also
Defined in
Gets or sets the ILayoutStage that routes parallel edges.
Default Value
ParallelEdgeRouter.See Also
Defined in
Sets whether or not the ILayoutStage used for routing parallel edges is activated.
Default Value
true
.The stage that routes parallel edges is activated.
See Also
Overrides
Gets or sets whether or not FAMILY nodes of individuals that have only children but no partners are placed below this individual or next to it.
Default Value
true
.Sample Graphs
Gets or sets the ILayoutStage that routes self-loops.
Default Value
SelfLoopRouter.See Also
Defined in
Sets whether or not the ILayoutStage used for routing self-loops is activated.
Default Value
true
.The stage that routes self-loops is activated.
See Also
Overrides
Gets or sets the spacing between two nodes representing members of the same family in one generation.
Remarks
Default Value
30
.Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing is negative
Sample Graphs
Gets or sets the ILayoutStage that constrains the layout process to a subgraph of the input graph.
Default Value
SubgraphLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
Remarks
Default Value
false
.The stage that constrains the input graph to a subgraph is deactivated.
See Also
Defined in
Gets or sets the layout algorithm that is responsible for the layout between family groups.
Remarks
null
, fallback algorithm HierarchicLayout is used.Default Value
HierarchicLayout.See Also
Methods
Appends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Calculates a layout for the given graph and applies it directly to the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Applies a family tree layout to the given graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Throws
- Exception({ name: 'InvalidOperationError' })
- if no IDataProvider is registered using FAMILY_TYPE_DP_KEY
- Exception({ name: 'InvalidGraphStructureError' })
- if a FAMILY node has more than two parents or two nodes of the same type are linked together
Implements
Checks the sizes of the nodes to be non-zero.
Parameters
A map of options to pass to the method.
- g - LayoutGraph
- The graph to check.
Defined in
Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
Defined in
Prepends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Removes the given ILayoutStage from the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- a ILayoutStage to be removed from the layout pipeline
See Also
Defined in
Constants
A data provider key for assigning a node type for each node.
Remarks
Domain | YNode | |
Values | string | null for other nodes |