Visualizing hierarchical data with a Pyramid Bar Stacked chart can make your reports more compelling and easier to understand. In this article, you’ll learn how to create such a chart in Excel using C# and Aspose.Cells for .NET. The guide includes two complete, ready‑to‑run code snippets:
- Basic creation – build a Pyramid Bar Stacked chart from scratch.
- Updating an existing built‑in chart – change the chart type of a pre‑existing chart to Pyramid Bar Stacked.
Whether you are generating financial dashboards, inventory reports, or any dataset that benefits from a pyramid‑style stacked bar visual, the steps below will get you there quickly.
Topics Covered
- C# Excel Library to Create Pyramid Bar Stacked Charts
- Create a Pyramid Bar Stacked Chart in Excel using C#
- Free License & Resources
- See Also
C# Excel Library to Create Pyramid Bar Stacked Charts
Aspose.Cells for .NET is a powerful, dependency‑free library that enables developers to create, modify, and render Excel files programmatically. Its extensive API covers every Excel feature, including the full range of chart types such as PyramidBarStacked.
Key benefits of using Aspose.Cells for chart generation:
| Feature | Benefit |
|---|---|
| Comprehensive API | Direct access to workbook, worksheet, cells and chart objects. |
| High Performance | Handles large data sets with minimal memory footprint. |
| No Excel Required | Operates completely on the server‑side without Microsoft Office. |
| Multiple Output Formats | Save as XLSX, PDF, HTML, PNG, JPEG, etc. |
| Rich Customisation | Fine‑tune series, axes, legends, colors, markers, and more. |
Getting Started
Download the latest release from the Aspose.Cells downloads page.
Install the NuGet package:
PM> Install-Package Aspose.CellsAdd a reference to
Aspose.Cellsin your C# project.
Now you are ready to start building Pyramid Bar Stacked charts.
Create a Pyramid Bar Stacked Chart in Excel using C#
1️⃣ Basic Pyramid Bar Stacked Chart
The following example creates a new workbook, populates sample data, adds a Pyramid Bar Stacked chart, customises its appearance, and saves the file as PyramidBarStackedChart.xlsx.
Explanation of key steps
| Step | What it does |
|---|---|
| 1 | Creates a new Workbook and references the first Worksheet. |
| 2 | Writes header and sample data for four regions across four quarters. |
| 3 | Adds a Chart of type ChartType.PyramidBarStacked. |
| 4 | Adds four series – one for each quarter – using the NSeries.Add method. |
| 5 | Assigns custom colors, axis titles, and moves the legend to the right. |
| 6 | Saves the workbook to an XLSX file. |
Run the program and open PyramidBarStackedChart.xlsx – you will see a pyramid‑shaped stacked bar chart that clearly compares quarterly sales across the four regions.
Get a Free License
Aspose.Cells requires a license for full functionality. To evaluate the library without restrictions, obtain a temporary free license from the Aspose temporary license page. Apply the license as shown below:
// Apply the temporary license (once per application start)
var license = new Aspose.Cells.License();
license.SetLicense("Aspose.Total.lic"); // Path to your .lic file
Free Resources
- Developer’s Guide – https://docs.aspose.com/cells/net/
- Online Demo & Converter – https://products.aspose.app/cells/family
- API Reference – https://reference.aspose.com/cells/net/
- How‑to Articles & Blog – https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
Creating a Pyramid Bar Stacked chart with Aspose.Cells for .NET is straightforward: populate your data, add a chart of type ChartType.PyramidBarStacked, configure series and aesthetics, and save the workbook. Whether you start from a fresh workbook or modify an existing template, the library provides a clean, server‑side solution that works without Microsoft Excel installed.
Feel free to experiment with additional customisations—data labels, gradient fills, or exporting the chart as an image. For any questions, the Aspose community and support forums are ready to help.