Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Layout Algorithms

  • 2 minutes to read

This topic describes the layout algorithms used by the TreeMap control, and consists of the following sections.

#Overview

The TreeMap control allows you to specify the algorithm used to layout tree map items. The Squarified algorithm is used by default.

To change the algorithm used to arrange tree map items, assign the required ITreeMapLayoutAlgorithm class descendant object to the TreeMapControl.LayoutAlgorithm property.

LayoutAlgorithm_PropertyGrid

After that, customize algorithm settings. For example, all predefined algorithms support fill direction customization. To do this, use the TreeMapLayoutAlgorithmBase.Direction property.

LayoutAlgorithm_Direction

The following sections describe predefined algorithm behavior.

#Slice and Dice Layout Algorithm

This layout algorithm divides the space between items, slicing it in the specified direction depending on item value.

The following image demonstrates the country GDP tree map with a layout calculated using this algorithm.

LayoutAlgorithm_SliceAndDice

To learn more about this algorithm, refer to the Ordered Treemap Layouts article.

#Squarified Layout Algorithm

The Squarified algorithm lays out items, so that the width/height ratio will be closer to 1. In other words, this algorithm tries to square the layout.

The following image demonstrates the tree map layout calculated using this algorithm.

LayoutAlgorithm_Squarified

For more information about this algorithm, refer to the Squarified Treemaps paper.

#Striped Layout Algorithm

This algorithm is a modified version of the Squarified algorithm. The main distinction of the Striped algorithm consists in preserving tree map item orientation, e.g., item width, calculated using this algorithm, is larger than height.

The following image demonstrates the layout calculated using this algorithm.

LayoutAlgorithms_Striped

#Custom Layout Algorithm

In addition to the predefined layout algorithms, it is possible to implement a custom layout algorithm. To do this, design a class derived from the ITreeMapLayoutAlgorithm and implement the ITreeMapLayoutAlgorithm.Calculate method.

Refer to the How to: Implement a Custom Layout Algorithm example to learn more.

See Also