Visualizing hierarchical data in a compact, eye‑catching way is often required for business presentations and reports. A Pyramid chart (also known as a funnel chart) helps you illustrate the relative contribution of each category. In this guide you will learn how to create a Pyramid chart in Excel using C# with Aspose.Cells for .NET. The examples are fully functional and can be compiled directly in Visual Studio or any .NET IDE.
This article covers the following topics:
- C# Excel Library to Create Pyramid Charts
- Create a Pyramid Chart in Excel using C#
- Free Resources
- Other Topics
C# Excel Library to Create Pyramid Chart
Aspose.Cells for .NET is a comprehensive Excel manipulation library that allows developers to create, modify, and render Excel files without Microsoft Office. Its rich charting API supports all modern chart types, including the Pyramid chart.
Key benefits of using Aspose.Cells for .NET:
- Extensive API – Access to more than 200 Excel features.
- Full Format Support – Works with XLSX, XLS, CSV, ODS and many more.
- High Performance – Handles large workbooks efficiently.
- No External Dependencies – No need for Excel installation on the server.
Get started quickly:
PM> Install-Package Aspose.Cells
Create a Pyramid Chart in Excel using C#
1. Simple Pyramid Chart from a Data Table
The following example demonstrates how to:
- Create a new workbook.
- Populate a worksheet with sample data.
- Add a Pyramid chart.
- Configure the series and chart title.
- Save the workbook to an XLSX file.
Explanation of important lines
| Line | Purpose |
|---|---|
ChartType.Pyramid | Specifies the pyramid chart type. |
pyramidChart.NSeries.Add("=SalesData!$B$2:$B$6", true) | Adds the data series (values). The true flag indicates that the series has a name row. |
pyramidChart.NSeries.CategoryData = "=SalesData!$A$2:$A$6" | Assigns the category labels (the funnel levels). |
ShowValue | Enables data labels so each segment displays its numeric value. |
Running the code produces PyramidChart_Output.xlsx with a clean pyramid representation of the sales funnel.
2. Customizing the Pyramid Chart – colors and legend
Sometimes you need a more polished look. The snippet below builds on the previous example and demonstrates:
- Setting individual slice colors.
- Showing legend and set legend position.
Result: A visually richer pyramid chart with distinct colors and a legend, saved as Styled_PyramidChart.xlsx.
Get a Free License
Explore Aspose products with a temporary license at the Aspose free license page. The license removes evaluation watermarks and unlocks the full feature set of Aspose.Cells for .NET.
Pyramid Chart Excel: Free Resources
Boost your Excel automation skills with these official Aspose resources:
- Developer’s Guide: https://docs.aspose.com/cells/net/
- Free Online Apps: https://products.aspose.app/cells/family
- API Reference: https://reference.aspose.com/cells/net/
- How‑to Articles & Blog Posts: https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
Creating a Pyramid chart with Aspose.Cells for .NET is straightforward—just a few lines of C# code are needed to generate, style, and export the chart. The library’s exhaustive API gives you full control over data binding, visual appearance, and workbook output formats, enabling you to embed professional‑grade graphics into any .NET application.
If you encounter any challenges or have questions, visit the Aspose Cells community forum for free support.