In this example, we will understand how to create Pie chart in Excel file using C++. You can insert Pie chart in Excel worksheet on Microsoft Windows, Linux, etc. programmatically in C++.
Steps to Create Pie Chart in Excel File using C++
- Configure the Aspose.Cells.Cpp package with NuGet package Manager
- Add reference to the Aspose::Cells namespace
- Initialize the Workbook class object to create new Excel file
- Add sample values to the cells
- Add series collection and set category data
- Format the datalabels by using the IDataLabels interface
- Save the output Excel file after inserting a Pie chart in C++
In the example below, you will learn how to insert Pie chart in Excel with C++. Initialize a blank workbook and make pie chart in Excel file using C++ simply by using a few API calls.
Code to Insert Pie Chart in Excel with C++
You can add pie chart in Excel file with C++ by inserting the chart values and formatting the datalabels programmatically. You can easily create the pie chart without needing to install MS Excel or any other tool. In previous example, we explored How to Remove Formula from Excel File in C++ which contains the example for removing formula from Excel file.