Where to Find Up-to-date yFiles Information

This page is from the outdated yFiles for Java 2.13 documentation. You can find the most up-to-date documentation for all yFiles products on the yFiles documentation overview page.

Please see the following links for more information about the yFiles product family of diagramming programming libraries and corresponding yFiles products for modern web apps, for cross-platform Java(FX) applications, and for applications for the Microsoft .NET environment.

More about the yFiles product family Close X

Compact Orthogonal Layout

Class CompactOrthogonalLayouter is a specialized variant of the orthogonal layout algorithm. It uses a divide-and-conquer approach to achieve compact orthogonal layouts that fit into, respectively are near, a desired aspect ratio.

In contrast to the majority of yFiles layout algorithms, class CompactOrthogonalLayouter does not inherit from CanonicMultiStageLayouter, but is instead an extension of abstract class AbstractLayoutStage.

CompactOrthogonalLayouter combines different phases that:

  1. find partitions in the node set of the graph
  2. calculate the orthogonal layout for the partitions
  3. arrange the partitions in a compact manner
  4. route the connecting edges between partitions

Figure 5.71. Sample layout produced by class CompactOrthogonalLayouter

Sample layout produced by class CompactOrthogonalLayouter
A compact orthogonal diagram with an aspect ratio of 1.0

Layout Options

This specialized layout algorithm provides only few options by itself. However, the respective classes that are used for the different layout phases can be customized individually. In particular, this also includes the orthogonal layout algorithm which is used as the core layouter.

Grid Spacing
API
void setGridSpacing(int gridSpacing)
Description

Defines the virtual grid spacing used by the layouter. Each node is placed in such a way that its center point lies on a grid point.

Aspect Ratio
API
void setAspectRatio(double aspectRatio)
Description

Specifies the desired aspect ratio that the resulting diagram should fit into. The algorithm tries to reach this value, depending on the actual graph structure, however, this may not always be feasible.

Applicable Layout Stages

Table 5.55, “Layout Stages” lists layout stages that can be used to enhance the layout process of class CompactOrthogonalLayouter.

Table 5.55. Layout Stages

Classname Description
PolylineLayoutStage With class CompactOrthogonalLayouter as the core layouter, this stage adds octilinear edge routing to the diagram that results from the orthogonal layout calculation.

Tutorial Demo Code

Layout module CompactOrthogonalLayoutModule.java presents the setup of class CompactOrthogonalLayouter in an application context.