- 2 minutes to read
The TreeMap Control visualizes groups and leafs that should be provided to the TreeMap control using the TreeMapControl.DataAdapter property. This topic describes ways to provide tree map items for displaying. The following approaches are supported.
Manually Create Tree Map Items
The TreeMapItemStorage is used to provide map items manually. To display an item, add it to the TreeMapItemStorage.Items collection.To manually provide a group to the TreeMap, add a tree map item to the storage items collection and populate the item's TreeMapItem.Children collection.
The following image shows a TreeMap populated with items manually.
Refer to the How to: Manually Add Items to a Tree Map example to learn more.
Adapt Flat Data
To visualize flat data, use the TreeMapFlatDataAdapter adapter. This adapter converts data members specified using the TreeMapFlatDataAdapter.DataMember property to tree map items with values obtained from a data member specified using the TreeMapFlatDataAdapter.ValueDataMember property and labels obtained from a data member specified using the TreeMapFlatDataAdapter.LabelDataMember property.
To group automatically generated items, add TreeMapGroupDefinition object to the TreeMapFlatDataAdapter.Groups collection. Using group definition, you can specify which data member values should be used to group items. Use the TreeMapGroupDefinition.GroupDataMember property for that.
The following image demonstrates the use of the data adapter.
Refer to the How to: Provide Flat Data to a Tree Map example to learn more.
Adapt Hierarchical Data
It is possible to visualize hierarchical data using the TreeMapHierarchicalDataAdapter adapter. This adapter visualizes your data members using the explicit data adapters. Using the TreeMapHierarchicalDataAdapter.ValueDataMember property, it is possible to specify which data member values should be used as item values.
The following image shows hierarchical data visualized using the TreeMap.
Refer to the How to: Provide Hierarchical Data to a Tree Map example to learn more.