Providing Data

  • 2 minutes to read

This topic describes Data Adapters that can specify data for visualization using the TreeMap control, and consists of the following sections.

Overview

The TreeMap control allows you to specify how provide groups and leafs that should be visualized. To do this, assign an object of a class implementing the ITreeMapDataAdapter interface to the TreeMapControl.DataAdapter property.

Lesson2_TreeMapFlatDataAdapter

All Data Adapters shipped with the TreeMap control are described below.

Create Tree Map Items Manually

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.

TreeMapItemStorageSample

Refer to the How to: Manually Add Items to a TreeMap 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.

The flat data adapter allows you to aggregate generated tree map items into groups. To do this, add a data member name whose values should be used to group items in the TreeMapFlatDataAdapter.GroupDataMembers collection.

The following image demonstrates the use of the data adapter.

TreeMapFlatDataAdapter Sample

Refer to the How to: Provide Flat Data to a TreeMap example to learn more.

Adapt Hierarchical Data

It is possible to visualize hierarchical data using the TreeMapHierarchicalDataAdapter adapter. Using the TreeMapHierarchicalDataAdapter.Mappings collection, it is possible to specify which data members should be used as item labels, values or children items.

The following image shows hierarchical data visualized using the TreeMap.

TreeMapHierarchicalDataAdapterSample

Refer to the How to: Provide Hierarchical Data to a Tree Map example to learn more.

See Also