windowsforms-devexpress-dot-xtratreemap-7c289bb9.md
A data adapter that allows you to provide hierarchical data to the SunburstControl.
Namespace : DevExpress.XtraTreeMap
Assembly : DevExpress.XtraTreeMap.v25.2.dll
NuGet Package : DevExpress.TreeMap
public class SunburstHierarchicalDataAdapter :
SunburstDataAdapterBase,
IGroupIndexProvider
Public Class SunburstHierarchicalDataAdapter
Inherits SunburstDataAdapterBase
Implements IGroupIndexProvider
This class introduces the SunburstHierarchicalDataAdapter.DataSource property that allows you to specify the sunburst’s data source and the SunburstHierarchicalDataAdapter.Mappings collection that contains data mappings that specify how to convert data source objects to sunburst items.
This example demonstrates how to visualize hierarchical data using the SunburstControl.
Create a SunburstHierarchicalDataAdapter object and assign it to the SunburstControl.DataAdapter property to provide hierarchical data to a Sunburst. Then, specify the adapter’s data source object using the SunburstHierarchicalDataAdapter.DataSource property. Populate the SunburstHierarchicalDataAdapter.Mappings collection with SunburstHierarchicalDataMapping objects to configure how the SunburstControl should convert hierarchical data to sunburst items. The HierarchicalDataMapping.LabelDataMember property allows you to specify a label data member, the HierarchicalDataMapping.ValueDataMember property - a value data member, the HierarchicalDataMapping.ChildrenDataMember property - a data member that contains children items and the HierarchicalDataMapping.Type property - types of items at the current level.
private void OnFormLoad(object sender, EventArgs e) {
SunburstHierarchicalDataAdapter dataAdapter = new SunburstHierarchicalDataAdapter();
dataAdapter.Mappings.Add(new SunburstHierarchicalDataMapping {
Type = typeof(CountryInfo),
LabelDataMember = "CountryName",
ChildrenDataMember = "CityInfos"
});
dataAdapter.Mappings.Add(new SunburstHierarchicalDataMapping {
Type = typeof(CityInfo),
LabelDataMember = "CityName",
ChildrenDataMember = "SaleInfos"
});
dataAdapter.Mappings.Add(new SunburstHierarchicalDataMapping {
Type = typeof(ProductInfo),
ValueDataMember = "Total",
LabelDataMember = "Category",
});
dataAdapter.DataSource = CreateInfos();
sunburstControl.DataAdapter = dataAdapter;
}
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
Dim dataAdapter As SunburstHierarchicalDataAdapter = New SunburstHierarchicalDataAdapter()
dataAdapter.Mappings.Add(New SunburstHierarchicalDataMapping With {
.Type = GetType(CountryInfo),
.LabelDataMember = "CountryName",
.ChildrenDataMember = "CityInfos"
})
dataAdapter.Mappings.Add(New SunburstHierarchicalDataMapping With {
.Type = GetType(CityInfo),
.LabelDataMember = "CityName",
.ChildrenDataMember = "SaleInfos"
})
dataAdapter.Mappings.Add(New SunburstHierarchicalDataMapping With {
.Type = GetType(ProductInfo),
.ValueDataMember = "Total",
.LabelDataMember = "Category"
})
dataAdapter.DataSource = CreateInfos()
sunburstControl.DataAdapter = dataAdapter
End Sub
Object HierarchicalElement SunburstElement SunburstDataAdapterBase SunburstHierarchicalDataAdapter
See Also