Lesson 1 - Create an Unbound Sunburst
- 3 minutes to read
This tutorial explains how to create an application with a sunburst, populate it with items and configure its tooltip settings.
- Step 1. Create a New Project
- Step 2. Add the Sunburst Control to the Form
- Step 3. Dock the SunburstControl in the Form
- Step 4. Add Items to the Sunburst
- Step 5. Configure Item Tooltip Options
- Step 6. Rotate the Sunburst
- Result
Step 1. Create a New Project
Run the Microsoft® Visual Studio. Select the File | New | Project… menu item. The New Project dialog appears. In this dialog, select Windows Desktop | Windows Forms App (.NET Framework). Click OK to create a project.
Step 2. Add the Sunburst Control to the Form
Open the Toolbox window. Drag the SunburstControl component from the DX.24.1: Data & Analytics section to the Form.
Step 3. Dock the SunburstControl in the Form
Click the Sunburst control’s smart tag and select the Dock in Parent Container link in the menu.
Step 4. Add Items to the Sunburst
Click the sunburst’s smart tag. Select the Set Data Adapter… item in the menu.
The Data Adapter Editor appears.
Choose the SunburstItemStorage item in the drop-down list to assign a SunburstItemStorage object to the SunburstControl.DataAdapter property.
Click the SunburstItemStorage.Items property’s ellipsis button to invoke the Sunburst Item Collection Editor. Click the Add SunburstItem button to add the first item to the top-level items’ collection.
Specify the SunburstItem.Label property to USA.
Click the SunburstItem.Children property’s ellipsis button to populate the item’s Children collection with items.
Add five items using the Add SunburstItem button and specify their SunburstItem.Label and SunburstItem.Value properties using the following table’s data.
Label | Value |
---|---|
Nuclear | 187.9 |
Oil | 937.6 |
Natural Gas | 582 |
Hydro Electric | 59.8 |
Coal | 564.3 |
Click the Close button to hide the Children collection editor and return to the top-level items’ collection editor.
Add a new item and specify its Label property to China. Populate its Children collection with items. For this, add five items and specify their Label and Value properties using the following table’s data.
Label | Value |
---|---|
Nuclear | 11.3 |
Oil | 308.6 |
Natural Gas | 74.2 |
Hydro Electric | 74.2 |
Coal | 956.9 |
Click Close to return to the top-level items’ collection editor.
Add a new item and specify its Label property to Germany. Populate its Children collection with items. To do this, add five items and specify their Label and Value properties using the following table’s data.
Label | Value |
---|---|
Nuclear | 37.8 |
Oil | 123.6 |
Natural Gas | 77.3 |
Hydro Electric | 6.1 |
Coal | 85.7 |
Click Close to return to the top-level items’ collection editor.
Click Close to hide the Sunburst Item Collection Editor.
Click Close to accept the Data Adapter’s configuration and close the editor.
Step 5. Configure Item Tooltip Options
A tooltip is shown when an end user hovers over a sunburst item. Specify the SunburstControl.ToolTipTextPattern property to {L}: {V:F2} Mt to format tooltips text.
Step 6. Rotate the Sunburst
Set the SunburstControl.StartAngle property to 50 to specify the sunburst’s rotation.
Result
Run the project to see the result.