documentationfor yFiles for HTML 2.6

FillAreaLayout

This layout algorithm tries to fill a specified area with graph elements by moving nearby elements towards it, with the goal to make the existing layout more compact and not changing it too much.

Inheritance Hierarchy
FillAreaLayout
Implemented Interfaces

Remarks

Layout Style

The algorithm can make an existing layout more compact in the region of the defined area. It moves nearby graph elements, while keeping the given layout style as much as possible. Ideally, only local changes around the marked area are made such that the mental map for the user is preserved. The best applications are those where it shall be avoided to calculate a completely new layout after local changes have been made to an already existing and good layout. Also not that the results for this application are much better when the edge paths are already good orthogonal, polyline or octilinear paths. For straight-line edge routes, the shape and overall mental map of the layout can not be preserved that well and the changes may be more global.

An example application is the use case that nodes were removed from the graph. The region where the nodes have been removed can then be defined as the area so that the algorithm can try to fill/use this free space and make the layout more compact. This way it can be avoided to compute a completely new layout for such cases. Another use case would be when a group node is collapsed and converted to a smaller folder node. In that case the folder node should be marked as fixed. Note that it isn't guaranteed that the area is filled with elements after calling the algorithm.

Sample input graph where the gray area should be filled with elements.

Result layout after applying this algorithm - the drawing was made much more compact and the free area is used.

Concept

The area (see area) defines a region in the given graph which should be filled with elements, with the goal to make the overall layout more compact. To do so, graph elements must be moved. This includes nodes, edges and their labels. Whether node labels and edge labels should be considered can be controlled via settings considerNodeLabels and considerEdgeLabels.

Keep in mind that the goal is to make the layout more compact. Therefore, if the area is located such that it brings no advantage to move elements towards it, the algorithm may also do nothing - based on a heuristic decision. This means that it does not fill the specified area in any case.

Features

The algorithm is able to consider a specified PartitionGrid as long as there are no group nodes that span multiple grid cells. For this feature to work properly it is required that the values of the properties originalPosition, originalPosition originalWidth and originalHeight are correctly specified. This is usually automatically the case when executing the FillAreaLayout as a standalone algorithm via layout execution convenience methods (e.g. the values are taken from the table visualization of the grid). However, if the FillAreaLayout is applied as part of a more complex layout pipeline it may be necessary to specify the values manually. For example, if another algorithm previously computed the grid position values and stored them in the respective 'computed' properties (e.g. computedPosition), and afterwards FillAreaLayout should be applied, then the 'computed' values of the first algorithm should be written to the 'original' values prior to the run of the FillAreaLayout.

Default Values of Properties

areanullThere is no area to be filled.
componentAssignmentStrategyCUSTOMIZEDComponents can be user-defined and if none are defined, each node is a separate component.
considerEdgeLabelstrueEdge labels are considered.
considerNodeLabelstrueNode labels are considered.
gridSpacing0No grid is considered.
layoutOrientationNONEThe layout is considered to have no specific orientation.
maximumDuration<code>0x7FFFFFFF</code>
spacing10

Type Details

yfiles module
layout-area
yfiles-umd modules
layout-area, layout
Legacy UMD name
yfiles.partial.FillAreaLayout

See Also

This algorithm is not meant to be a general layout compaction algorithm. It focuses on the defined area but may also do nothing if, for example, moving elements would heavily affect the mental map of the existing layout or not make the layout more compact.
The input graph should already have a rather good layout for this algorithm to produce sophisticated results. The reason is that it analyzes the existing layout to decide how to change it. Overlapping nodes, edges intersecting nodes and other suboptimal arrangements can cause that this algorithm generates unexpected results. Furthermore, it is not meant to repair things like that in the input layout.

Constructors

Properties

Methods

Constants