Visualizing data as a three‑dimensional pie chart helps highlight the proportional relationships between categories in a compelling way. With Aspose.Cells for .NET, you can create, customize, and export a Pie3D chart in just a few lines of C# code—no Excel installation required. This guide walks you through the complete process, from adding sample data to fine‑tuning the chart’s style.
The article covers the following topics:
- C# Excel Library to Create Pie3D Charts
- Create a Pie3D Chart in Excel using C#
- Customize a Pie3D Chart (Colors, Explosion, Rotation)
- Get a Free License
- Free Resources
- Conclusion
- See Also
C# Excel Library to Create Pie3D Charts
Aspose.Cells for .NET is a high‑performance Excel manipulation library that enables developers to work with spreadsheets without relying on Microsoft Office. It offers a rich set of APIs for creating charts, applying styles, and exporting workbooks to multiple formats.
Key advantages of Aspose.Cells for .NET:
- Comprehensive API – Full control over worksheets, cells, and chart objects.
- Advanced 3‑D Chart Support – Create Pie3D, Bar3D, Surface, and more.
- High Throughput – Efficient handling of large datasets.
- Cross‑Platform – Works on Windows, Linux, and macOS with .NET Core/5/6+.
Get started quickly:
PM> Install-Package Aspose.Cells
Create a Pie3D Chart in Excel using C#
Below is a minimal, fully‑runnable example that demonstrates how to:
- Create a new workbook.
- Populate sample data.
- Insert a Pie3D chart.
- Save the workbook to an XLSX file.
Explanation of key steps
| Step | Purpose |
|---|---|
Workbook | Creates an in‑memory Excel file. |
Cells["A1"].PutValue(...) | Writes headers and data into the worksheet. |
Charts.Add(ChartType.Pie3D, ...) | Inserts a 3‑D pie chart at the specified location. |
NSeries.Add(...).CategoryData = ... | Binds the numeric values and category labels to the series. |
Explosion | Highlights a slice by pulling it out from the pie. |
Save | Writes the workbook to disk (XLSX, XLS, CSV, etc.). |
Running the program produces Pie3DChart_Output.xlsx, which contains a 3‑D pie chart representing the fruit distribution.
Customize a Pie3D Chart (Colors, Explosion, Rotation)
A Pie3D chart often requires visual tweaks to match corporate branding or improve readability. The following example shows how to:
- Set individual slice colors.
- Explode multiple slices.
What the code does
- Slice colors – Directly assign
Colorobjects to each slice viaSlice[index].Color. - Multiple explosions – Different slices can have distinct
Explosionvalues, creating a “pop‑out” effect.
Open CustomizedPie3DChart.xlsx to see a quarter‑wise revenue pie chart with branded colors, selective explosions, and a tilted 3‑D view.
Get a Free License
Aspose.Cells offers a temporary free license that removes evaluation limitations. Visit the temporary license page, download the license file, and load it in your application:
var license = new Aspose.Cells.License();
license.SetLicense("Aspose.Cells.lic");
Using a license grants full access to all chart types, including 3‑D visualizations.
Free Resources
Enhance your Excel automation skills with these complimentary resources:
- Developer’s Guide – https://docs.aspose.com/cells/net/
- Online Apps – https://products.aspose.app/cells/family (try chart creation in the browser)
- API Reference – https://reference.aspose.com/cells/net/
- How‑To Articles – https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
Creating a Pie3D chart with Aspose.Cells for .NET is straightforward and highly customizable. The library lets you:
- Generate the chart programmatically.
- Apply slice‑level styling, explosions, and 3‑D rotations.
- Export the workbook to any supported format without Microsoft Excel.
Feel free to experiment with different data sets, colors, and layout options to produce compelling visual reports for your applications.
For further assistance, visit our free support forum.