TreeMapHierarchicalDataMapping Class
Information about data object mapping to a tree map item.
Namespace: DevExpress.XtraTreeMap
Assembly: DevExpress.XtraTreeMap.v18.1.dll
Declaration
[TypeConverter(typeof(TreeMapHierarchicalDataMapping.TreeMapHierarchicalDataMappingConverter))]
public class TreeMapHierarchicalDataMapping :
INotifyPropertyChanged
Example
To provide hierarchical data to a TreeMap, create a TreeMapHierarchicalDataAdapter object and assign it to the TreeMapControl.DataAdapter property. Then, specify the adapter’s data source object using the TreeMapHierarchicalDataAdapter.DataSource property. To configure how hierarchical data should be converted to tree map items, use TreeMapHierarchicalDataMapping objects. The TreeMapHierarchicalDataMapping.LabelDataMember property allows you to specify a label data member, the TreeMapHierarchicalDataMapping.ValueDataMember property - a value data member, the TreeMapHierarchicalDataMapping.ChildrenDataMember property - a data member containing children items, and the TreeMapHierarchicalDataMapping.Type property - the type of items on the current nesting level.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-provide-hierarchical-data-to-treemap-t360961
void CreateTreeMapDataAdapter() {
TreeMapHierarchicalDataAdapter dataAdapter = new TreeMapHierarchicalDataAdapter();
dataAdapter.DataSource = CreateStatistics();
// Fill the Mappings collection using mappings specifying
// how to convert data objects to tree map items.
dataAdapter.Mappings.Add(new TreeMapHierarchicalDataMapping {
Type = typeof(CountryStatistics),
LabelDataMember = "Name",
ChildrenDataMember = "EnergyStatistics"
});
dataAdapter.Mappings.Add(new TreeMapHierarchicalDataMapping {
Type = typeof(EnergyInfo),
LabelDataMember = "Type",
ValueDataMember = "Value"
});
treeMap.DataAdapter = dataAdapter;
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the TreeMapHierarchicalDataMapping class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.