SunburstItemStorage Class
Stores a collection of sunburst items and provides them to the SunburstControl.
Namespace: DevExpress.XtraTreeMap
Assembly: DevExpress.XtraTreeMap.v24.1.dll
NuGet Package: DevExpress.TreeMap
Declaration
public class SunburstItemStorage :
SunburstDataAdapterBase,
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.
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;
}