Skip to main content
All docs
V24.2

SunburstDataMapping.ChildrenDataMember Property

Gets or sets the data member whose values are used to create child sectors at the current Sunburst level.

Namespace: DevExpress.Xpf.TreeMap

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

NuGet Package: DevExpress.Wpf.TreeMap

Declaration

public string ChildrenDataMember { get; set; }

Property Value

Type Description
String

The name of a data member that is a source of Sunburst child sector data.

Example

This example loads data and creates a Sunburst chart based on a hierarchical data source. To do this, follow steps below:

<dxtm:SunburstControl>
  <dxtm:SunburstControl.DataAdapter>
      <dxtm:SunburstHierarchicalDataAdapter
              x:Name="dataAdapter"
              DataSource="{Binding}">
          <dxtm:SunburstHierarchicalDataAdapter.Mappings>
              <dxtm:SunburstDataMapping                             
                      LabelDataMember="CountryName"
                      ChildrenDataMember="CityInfos"
                      Type="{x:Type local:CountryInfo}"/>
              <dxtm:SunburstDataMapping                               
                      LabelDataMember="CityName"
                      ChildrenDataMember="SaleInfos"
                      Type="{x:Type local:CityInfo}"/>
              <dxtm:SunburstDataMapping
                      ValueDataMember="Total"
                      LabelDataMember="Category"                             
                      Type="{x:Type local:ProductInfo}"/>
          </dxtm:SunburstHierarchicalDataAdapter.Mappings>
      </dxtm:SunburstHierarchicalDataAdapter>
  </dxtm:SunburstControl.DataAdapter>
</dxtm:SunburstControl>
using System.Collections.Generic;
using System.Windows;

namespace HierarchicalSunburst {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            DataContext = CreateInfos();
        }
        List<CountryInfo> CreateInfos() {
            List<CountryInfo> infos = new List<CountryInfo>();
            CountryInfo germanyInfo = new CountryInfo { CountryName = "Germany" };
            CityInfo leipzigInfo = new CityInfo { CityName = "Leipzig" };
            leipzigInfo.SaleInfos.AddRange(new List<ProductInfo> {
                new ProductInfo { Category = "Beverages", Total = 2634.5 },
                new ProductInfo { Category = "Baked Goods", Total = 4523.98 },
                new ProductInfo { Category = "Grains and Cereals", Total = 913.85 },
                new ProductInfo { Category = "Milk and Dairy", Total = 4219.98 },
            });
            CityInfo berlinInfo = new CityInfo { CityName = "Berlin" };
            berlinInfo.SaleInfos.AddRange(new List<ProductInfo> {
                new ProductInfo { Category = "Frozen Foods", Total = 900 }
            });
            germanyInfo.CityInfos.AddRange(new List<CityInfo> { leipzigInfo, berlinInfo });

            CountryInfo spainInfo = new CountryInfo { CountryName = "Spain" };
            CityInfo barcelonaInfo = new CityInfo { CityName = "Barcelona" };
            barcelonaInfo.SaleInfos.AddRange(new List<ProductInfo> {
                new ProductInfo { Category = "Baked Goods", Total = 1239.2 },
                new ProductInfo { Category = "Fruits", Total = 450.41 },
                new ProductInfo { Category = "Milk and Dairy", Total = 692.5 },
            });
            CityInfo madridInfo = new CityInfo { CityName = "Madrid" };
            madridInfo.SaleInfos.AddRange(new List<ProductInfo> {
                new ProductInfo { Category = "Spices", Total = 1010.30 },
                new ProductInfo { Category = "Vegetables", Total = 2078 }
            });
            spainInfo.CityInfos.AddRange(new List<CityInfo> { barcelonaInfo, madridInfo });

            infos.AddRange(new List<CountryInfo> { germanyInfo, spainInfo });

            return infos;
        }
    }
    public class CountryInfo {
        public string CountryName { get; set; }
        public List<CityInfo> CityInfos { get; set; } = new List<CityInfo>();
    }
    public class CityInfo {
        public string CityName { get; set; }
        public List<ProductInfo> SaleInfos { get; set; } = new List<ProductInfo>();
    }
    public class ProductInfo {
        public string Category { get; set; }
        public double Total { get; set; }
    }
}

The image below shows the results:

See Also