Back to Devexpress

SunburstItem.Children Property

windowsforms-devexpress-dot-xtratreemap-dot-sunburstitem.md

latest5.9 KB
Original Source

SunburstItem.Children Property

Returns the current item’s collection of child items.

Namespace : DevExpress.XtraTreeMap

Assembly : DevExpress.XtraTreeMap.v25.2.dll

NuGet Package : DevExpress.TreeMap

Declaration

csharp
[XtraSerializableProperty(XtraSerializationVisibility.Collection, true)]
public SunburstItemCollection Children { get; }
vb
<XtraSerializableProperty(XtraSerializationVisibility.Collection, True)>
Public ReadOnly Property Children As SunburstItemCollection

Property Value

TypeDescription
SunburstItemCollection

A collection of SunburstItem objects.

|

Example

This example shows how to manually add items to a sunburst.

Assign a SunburstItemStorage object to the SunburstControl.DataAdapter property. The SunburstItemStorage stores manually created items using the SunburstItemStorage.Items property that returns a collection of SunburstItem objects.

Each object can have a child items’ collection that is available using the SunburstItem.Children property.

Use the SunburstItem.Value property to specify an item value.

The SunburstItem.Label property allows you to modify the text the item shows.

csharp
private void OnFormLoad(object sender, EventArgs e) {
    SunburstItemStorage itemStorage = new SunburstItemStorage();
    SunburstItem usaItem = new SunburstItem();
    usaItem.Label = "USA";
    usaItem.Children.AddRange(new List<SunburstItem> {
        new SunburstItem { Label = "Nuclear", Value = 187.9 },
        new SunburstItem { Label = "Oil", Value = 937.6 },
        new SunburstItem { Label = "Natural Gas", Value = 582 },
        new SunburstItem { Label = "Hydro Electric", Value = 59.8 },
        new SunburstItem { Label = "Coal", Value = 564.3 },
    });
    SunburstItem chinaItem = new SunburstItem();
    chinaItem.Label = "China";
    chinaItem.Children.AddRange(new List<SunburstItem> {
        new SunburstItem { Label = "Nuclear", Value = 11.3 },
        new SunburstItem { Label = "Oil", Value = 308.6 },
        new SunburstItem { Label = "Natural Gas", Value = 35.1 },
        new SunburstItem { Label = "Hydro Electric", Value = 74.2 },
        new SunburstItem { Label = "Coal", Value = 956.9 },
    });
    SunburstItem russiaItem = new SunburstItem();
    russiaItem.Label = "Russia";
    russiaItem.Children.AddRange(new List<SunburstItem> {
        new SunburstItem { Label = "Nuclear", Value = 32.4 },
        new SunburstItem { Label = "Oil", Value = 128.5 },
        new SunburstItem { Label = "Natural Gas", Value = 361.8 },
        new SunburstItem { Label = "Hydro Electric", Value = 40 },
        new SunburstItem { Label = "Coal", Value = 105.9 },
    });
    itemStorage.Items.AddRange(new List<SunburstItem> { usaItem, chinaItem, russiaItem });
    sunburstControl.DataAdapter = itemStorage;
    sunburstControl.CenterLabel.TextPattern = "{TV}";
    sunburstControl.StartAngle = 60;
}
vb
Private Sub OnFormLoad(ByVal sender As Object, ByVal e As EventArgs)
    Dim itemStorage As SunburstItemStorage = New SunburstItemStorage()
    Dim usaItem As SunburstItem = New SunburstItem()
    usaItem.Label = "USA"
    usaItem.Children.AddRange(New List(Of SunburstItem) From {
        New SunburstItem With { .Label = "Nuclear", .Value = 187.9 },
        New SunburstItem With { .Label = "Oil", .Value = 937.6 },
        New SunburstItem With { .Label = "Natural Gas", .Value = 582 },
        New SunburstItem With { .Label = "Hydro Electric", .Value = 59.8 },
        New SunburstItem With { .Label = "Coal", .Value = 564.3 }
    })
    Dim chinaItem As SunburstItem = New SunburstItem()
    chinaItem.Label = "China"
    chinaItem.Children.AddRange(New List(Of SunburstItem) From {
        New SunburstItem With { .Label = "Nuclear", .Value = 11.3 },
        New SunburstItem With { .Label = "Oil", .Value = 308.6 },
        New SunburstItem With { .Label = "Natural Gas", .Value = 35.1 },
        New SunburstItem With { .Label = "Hydro Electric", .Value = 74.2 },
        New SunburstItem With { .Label = "Coal", .Value = 956.9 }
    })
    Dim russiaItem As SunburstItem = New SunburstItem()
    russiaItem.Label = "Russia"
    russiaItem.Children.AddRange(New List(Of SunburstItem) From {
        New SunburstItem With { .Label = "Nuclear", .Value = 32.4 },
        New SunburstItem With { .Label = "Oil", .Value = 128.5 },
        New SunburstItem With { .Label = "Natural Gas", .Value = 361.8 },
        New SunburstItem With { .Label = "Hydro Electric", .Value = 40 },
        New SunburstItem With { .Label = "Coal", .Value = 105.9 }
    })
    itemStorage.Items.AddRange(New List(Of SunburstItem) From {
        usaItem,
        chinaItem,
        russiaItem
    })
    sunburstControl.DataAdapter = itemStorage
    sunburstControl.CenterLabel.TextPattern = "{TV}"
    sunburstControl.StartAngle = 60
End Sub

See Also

Provide Data

SunburstItem Class

SunburstItem Members

DevExpress.XtraTreeMap Namespace