Skip to main content

TreeMapItemGroupInfo Struct

This class stores information about a group of a tree map item.

Namespace: DevExpress.Xpf.TreeMap

Assembly: DevExpress.Xpf.TreeMap.v24.1.dll

NuGet Package: DevExpress.Wpf.TreeMap

Declaration

public struct TreeMapItemGroupInfo

Remarks

This class is used by the TreeMapColorizerBase.GetItemColor method to provide information about a group, which the item whose color is obtained, contains.

Example

To implement the custom colorizer, inherit the TreeMapColorizerBase or its descendant class, and override the TreeMapColorizerBase.GetItemColor method. Sent as parameters, the TreeMapItem and TreeMapItemGroupInfo objects contain all the required information to colorize items.

Imports DevExpress.Xpf.TreeMap
Imports System.Windows.Media


Namespace CustomColorizerSample
    Friend Class CustomColorizer
        Inherits TreeMapPaletteColorizerBase

        Public Overrides Function GetItemColor(ByVal item As TreeMapItem, ByVal group As TreeMapItemGroupInfo) As Color?
            If item.Children.Count = 0 Then
                Dim itemColor As Color = Palette(group.ItemIndex Mod Palette.Count)
                Dim groupColor As Color = Palette(group.GroupIndex Mod Palette.Count)
                Dim proportion As Double = (item.Value - group.MinValue) / (group.MaxValue - group.MinValue)

                Return New Color With {.A = 255, .R = CByte(proportion * itemColor.R + (1-proportion)*groupColor.R), .G = CByte(proportion * itemColor.G + (1 - proportion) * groupColor.G), .B = CByte(proportion * itemColor.B + (1 - proportion) * groupColor.B)}
            Else
                Return Palette(Palette.Count - 1 - group.GroupLevel Mod Palette.Count)
            End If
        End Function

        Protected Overrides Function CreateObject() As TreeMapDependencyObject
            Return New CustomColorizer()
        End Function
    End Class
End Namespace
See Also