Articles in this section
Category / Section

How to split the series of pie of pie chart using XlsIO?

3 mins read

A pie of pie can separate the tiny slices from the main pie chart and display them in an additional pie chart, so that the smaller slices are more visible. The data for the secondary pie can be set through 'CommonSerieOptions' in the 'SerieFormat' class, with the properties 'SplitType' and 'SplitValue' as shown in the below code snippet using XlsIO.

C#:

            ExcelEngine excelEngine = new ExcelEngine();
            
            IApplication application = excelEngine.Excel;
 
            application.DefaultVersion = ExcelVersion.Excel2016;
 
            // The workbook is opened.
            workbook = application.Workbooks.Open("Sample.xlsx");
            IWorksheet worksheet = workbook.Worksheets[0];
 
            // Accessing the chart in the worksheet
            IChart chart = worksheet.Charts[0];
            IChartSerie serie = chart.Series[0];
            // Splitting the series of Pie of pie chart by value SplitType.
            serie.SerieFormat.CommonSerieOptions.SplitType = ExcelSplitType.Value;
            serie.SerieFormat.CommonSerieOptions.SplitValue = 13;
            serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;                         
             
            // Save the workbook.
            workbook.SaveAs("Output.xlsx");
 
            // Close the workbook and dispose of the engine.
            workbook.Close();
            excelEngine.Dispose();

 

VB:

            Dim excelEngine As ExcelEngine = New ExcelEngine
 
            Dim application As IApplication = excelEngine.Excel
 
            application.DefaultVersion = ExcelVersion.Excel2016
 
            'The workbook is Opened.
            Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx")
 
            Dim worksheet As IWorksheet = workbook.Worksheets(0)
 
            'Accessing the chart in the worksheet
            Dim chart As IChart = worksheet.Charts(0)
            
             Dim serie As IChartSerie = chart.Series(0)
 
            'Spliting the series of Pieofpie chart by value SplitType.
            serie.SerieFormat.CommonSerieOptions.SplitType = ExcelSplitType.Value
            serie.SerieFormat.CommonSerieOptions.SplitValue = 13
            serie.DataPoints.DefaultDataPoint.DataLabels.IsValue = True
           
           ' Save the workbook.
            workbook.SaveAs("Output.xlsx")
 
            ' Close the workbook and dispose the engine.
            workbook.Close()
            excelEngine.Dispose()

 

The sample which illustrates the above behavior can be downloaded here.

 

Pie of pie chart’s series splitted by Value SplitType

Chart, pie chart

 

Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and, protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.

 

Conclusion

I hope you enjoyed learning about How to split the series of pie of pie chart using XlsIO.

You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.

If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion® components.

If you have any queries or require clarification, please let us know in the comments below or contact us through our support forumsSupport Tickets, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied