Back to Devexpress

SunburstItemStorage Class

windowsforms-devexpress-dot-xtratreemap-5d4a651a.md

latest6.0 KB
Original Source

SunburstItemStorage Class

Stores a collection of sunburst items and provides them to the SunburstControl.

Namespace : DevExpress.XtraTreeMap

Assembly : DevExpress.XtraTreeMap.v25.2.dll

NuGet Package : DevExpress.TreeMap

Declaration

csharp
public class SunburstItemStorage :
    SunburstDataAdapterBase,
    IXtraSupportDeserializeCollectionItem
vb
Public Class SunburstItemStorage
    Inherits SunburstDataAdapterBase
    Implements IXtraSupportDeserializeCollectionItem

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

Implements

ISunburstDataAdapter

Inheritance

Object HierarchicalElement SunburstElement SunburstDataAdapterBase SunburstItemStorage

See Also

SunburstItemStorage Members

Provide Data

DevExpress.XtraTreeMap Namespace