Visualizing hierarchical data with a Pyramid Stacked chart helps users quickly grasp proportionate contributions across categories. In this article you will learn how to create a Pyramid Stacked chart in Excel using C# and Aspose.Cells for .NET. The guide includes a full, compile‑ready code sample that creates a workbook, populates it with sample data, adds a Pyramid Stacked chart, customises its appearance and saves the result.
This article covers the following topics:
- C# Excel Library to Create Pyramid Stacked Charts
- Create a Pyramid Stacked Chart in Excel using C#
- Get a Free License
- Pyramid Stacked Chart Excel: Free Resources
- Conclusion
- See Also
C# Excel Library to Create Pyramid Stacked Charts
Aspose.Cells for .NET is a powerful, feature‑rich library that enables developers to create, modify, and render Excel files without Microsoft Office. It fully supports the PyramidStacked chart type, allowing you to generate professional‑looking pyramid stacked visuals programmatically.
Key advantages of using Aspose.Cells for .NET:
- Extensive API – Access to the full Excel feature set, including all chart types.
- High Performance – Efficient processing of large workbooks and data sets.
- No COM/Interop – Works on any platform that supports .NET Standard/.NET 6+.
- Multiple Formats – Save to XLSX, XLS, CSV, PDF, HTML, images, and more.
Tip: Install the library via NuGet to keep your project up‑to‑date.
PM> Install-Package Aspose.Cells
Create a Pyramid Stacked Chart in Excel using C#
Overview
The following example demonstrates how to:
- Create a new
Workbook. - Populate a worksheet with sample data.
- Insert a Pyramid Stacked chart.
- Assign series, set the chart title, and customize axis labels.
- Save the workbook to an
.xlsxfile.
Complete C# Code
Explanation of key steps
| Step | Purpose |
|---|---|
| 1 | Instantiates a fresh Workbook and accesses the default worksheet. |
| 2 | Inserts sample data that represents sales across three quarters for three product categories. |
| 3 | Adds a ChartType.PyramidStacked chart positioned below the data table. |
| 4 | Links the chart to the worksheet data. Each quarter becomes a separate series, while the categories form the X‑axis labels. |
| 5 | Improves readability by adding axis titles and data labels. |
| 6 | Saves the workbook as an .xlsx file that can be opened in Excel, Google Sheets, or any compatible viewer. |
Running the program produces PyramidStackedChart_Output.xlsx with a fully formatted Pyramid Stacked chart.
Get a Free License
Aspose offers a temporary free license that removes evaluation limitations for a limited period. Visit the Aspose temporary license page to obtain one and unlock the full capabilities of Aspose.Cells for .NET.
Pyramid Stacked Chart Excel: Free Resources
Enhance your Excel automation skills with these free resources:
- Developer’s Guide – Comprehensive documentation: https://docs.aspose.com/cells/net/
- Online Demo & Converter – Try chart creation without coding: https://products.aspose.app/cells/family
- API Reference – Full class and member list: https://reference.aspose.com/cells/net/
- How‑To Articles – Real‑world scenarios and best practices: https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
Creating a Pyramid Stacked chart with Aspose.Cells for .NET is straightforward and requires only a few lines of C# code. The library handles all low‑level Excel details, letting you focus on data and visual design. Use the sample code as a foundation for your own reporting, dashboards, or data‑visualisation solutions.
If you have questions or need assistance, feel free to post on the Aspose.Cells free support forum.