C# |
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
|