Back to Devexpress

StripedLayoutAlgorithm Class

wpf-devexpress-dot-xpf-dot-treemap-e196dd30.md

latest5.1 KB
Original Source

StripedLayoutAlgorithm Class

A class representing the Strip layout algorithm.

Namespace : DevExpress.Xpf.TreeMap

Assembly : DevExpress.Xpf.TreeMap.v25.2.dll

NuGet Package : DevExpress.Wpf.TreeMap

Declaration

csharp
public class StripedLayoutAlgorithm :
    TreeMapLayoutAlgorithm
vb
Public Class StripedLayoutAlgorithm
    Inherits TreeMapLayoutAlgorithm

Remarks

Under this algorithm, for each item to layout, check whether adding the item to the current strip improves the average aspect ratios of the rectangles in the current strip. If the average aspect ratio is improved, the rectangle is added to the current strip, otherwise, the current strip is fixed and a new strip is created, to which the item is added.

The following image demonstrates the layout calculated using this algorithm.

Example

To customize the layout algorithm, do the following.

xaml
<dxtm:TreeMapControl x:Name="treeMap"
                     LayoutAlgorithm="{Binding ElementName=lbLayoutAlgorithm, Path=SelectedValue}">
    <!-- endregion #LayoutAlgorithm-->
    <dxtm:TreeMapControl.Colorizer>
        <dxtm:TreeMapPaletteColorizer/>
    </dxtm:TreeMapControl.Colorizer>
    <dxtm:TreeMapItemStorage>
        <dxtm:TreeMapItem Label="Americas">
            <dxtm:TreeMapItem Label="United States" Value="17.418"/>
            <dxtm:TreeMapItem Label="Brazil" Value="2.353"/>
        </dxtm:TreeMapItem>
        <dxtm:TreeMapItem Label="Europe">
            <dxtm:TreeMapItem Label="Germany" Value="3.859"/>
            <dxtm:TreeMapItem Label="United Kingdom" Value="2.945"/>
            <dxtm:TreeMapItem Label="France" Value="2.846"/>
            <dxtm:TreeMapItem Label="Italy" Value="2.147"/>
            <dxtm:TreeMapItem Label="Russia" Value="1.857"/>
        </dxtm:TreeMapItem>
        <dxtm:TreeMapItem Label="Asia">
            <dxtm:TreeMapItem Label="China" Value="10.380"/>
            <dxtm:TreeMapItem Label="Japan" Value="4.616"/>
            <dxtm:TreeMapItem Label="India" Value="2.049"/>
        </dxtm:TreeMapItem>
    </dxtm:TreeMapItemStorage>
    <!--region #CloseTag-->
</dxtm:TreeMapControl>
<!--endregion #CloseTag-->
<Grid Grid.Column="1" Margin="4">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <TextBlock Grid.Row="0" 
               Margin="0,0,0,4"
               Text="Layout Algorithm:"/>
    <!--region #LayoutAlgorithmList-->
    <ListBox x:Name="lbLayoutAlgorithm"
             Grid.Row="1"
             DisplayMemberPath="LayoutAlgorithmName"
             SelectedValuePath="LayoutAlgorithm"
             SelectedIndex="0">
        <local:LayoutAlgorithmWarapper LayoutAlgorithmName="Slice and Dice">
            <dxtm:SliceAndDiceLayoutAlgorithm/>
        </local:LayoutAlgorithmWarapper>
        <local:LayoutAlgorithmWarapper LayoutAlgorithmName="Squarified">
            <dxtm:SquarifiedLayoutAlgorithm/>
        </local:LayoutAlgorithmWarapper>
        <local:LayoutAlgorithmWarapper LayoutAlgorithmName="Striped">
            <dxtm:StripedLayoutAlgorithm/>
        </local:LayoutAlgorithmWarapper>
    </ListBox>

Inheritance

Object DispatcherObject DependencyObject Freezable TreeMapDependencyObject TreeMapLayoutAlgorithmBase TreeMapLayoutAlgorithm StripedLayoutAlgorithm

See Also

StripedLayoutAlgorithm Members

DevExpress.Xpf.TreeMap Namespace