Document Solutions for Excel, .NET Edition | Document Solutions
Features / Chart / Chart Types / Specialized Chart / Sunburst
In This Topic
    Sunburst
    In This Topic

    Sunburst, also known as a multi-level pie chart, is ideal for visualizing multi-level hierarchical data depicted by concentric circles. The circle in the center represents the root node surrounded by the rings representing different levels of hierarchy. Rings are divided based on their relationship with the parent slice with each of them either divided equally or proportional to a value. This type of chart helps users in breaking down data into different entities for identifying and visualizing multilevel parent child relationships in different business scenarios quickly and efficiently.

    Using Code

    Refer to the following code to add a Sunburst chart:

    C#
    Copy Code
    public void SunburstChart()
    {
        // Initialize workbook
        Workbook workbook = new Workbook();
        // Fetch default worksheet 
        IWorksheet worksheet = workbook.Worksheets[0];
    
        // Prepare data for chart
        worksheet.Range["A1:D16"].Value = new object[,]
     {
       {"Region", "Subregion", "Country", "Population"},
       {"Asia", "Southern", "India", 1354051854},
       {null, null, "Pakistan", 200813818},
       {null,null , "Bangladesh", 166368149},
       {null,null , "Others", 170220300},
       {null, "Eastern", "China", 1415045928},
       {null, null, "Japan", 127185332},
       {null,null , "Others", 111652273},
       {null, "South-Eastern", null, 655636576},
       {null, "Western", null, 272298399},
       {null, "Central", null, 71860465},
       {"Africa", "Eastern",null , 433643132},
       {null, "Western",null , 381980688},
       {null, "Northern", null, 237784677},
       {null, "Others",null , 234512021},
       {"Europe", null, null, 742648010},
       {"Others",null ,null , 1057117703}
    };
        worksheet.Range["A:D"].Columns.AutoFit();
        // Add Sunburst Chart
        IShape sunburstChartShape = worksheet.Shapes.AddChart(ChartType.Sunburst, 250, 20, 360, 330);
    
        // Adding series to SeriesCollection
        sunburstChartShape.Chart.SeriesCollection.Add(worksheet.Range["A1:D16"], RowCol.Columns, true, true);
    
        // Configure Chart Title 
        sunburstChartShape.Chart.ChartTitle.Text = "World Population";
    
        // Saving workbook to Xlsx
        workbook.Save(@"32-SunburstChart.xlsx", SaveFileFormat.Xlsx);
    }