Visualizing hierarchical data with a three‑dimensional effect can make reports more engaging. In this guide you will learn how to create a PyramidColumn3D chart in Excel programmatically using C# and Aspose.Cells for .NET. The example demonstrates adding data, inserting the chart, tweaking series settings and exporting the workbook to an Excel file.
This article covers the following topics:
- Aspose.Cells .NET Library for PyramidColumn3D Charts
- Create a Basic PyramidColumn3D Chart
- Customize the PyramidColumn3D Chart (Colors, Axis, Legend)
- Free License Information
- Additional Resources
- Conclusion
- See Also
Aspose.Cells .NET Library for PyramidColumn3D Charts
Aspose.Cells for .NET is a powerful, fully managed API that enables developers to create, modify, and render Excel files without Microsoft Office. It supports the full range of Excel chart types, including the PyramidColumn3D chart.
Key advantages of using Aspose.Cells:
- Rich Chart API – Direct access to chart objects, series, axes, legends, and formatting.
- No Interop Dependency – Works in any .NET environment (Desktop, Server, Cloud).
- High Performance – Handles large workbooks with low memory footprint.
- Multiple Formats – Save to XLSX, XLS, CSV, PDF, HTML, and image formats.
To start using Aspose.Cells, install the NuGet package:
PM> Install-Package Aspose.Cells
Create a Basic PyramidColumn3D Chart
The following example creates a simple workbook, populates it with sample data, adds a PyramidColumn3D chart, and saves the file as PyramidColumn3D_Basic.xlsx.
Explanation of key steps
| Step | What it does |
|---|---|
| 1 | Instantiates a Workbook and accesses the first Worksheet. |
| 2 | Populates the sheet with product names and quarterly sales values. |
| 3 | Calls Charts.Add with ChartType.PyramidColumn3D to create the 3‑D pyramid column chart. |
| 4 | Adds the data series (NSeries.Add) and sets the category (X‑axis) labels. |
| 5 | Saves the workbook to an XLSX file that can be opened in Microsoft Excel. |
Running the program produces an Excel file containing a 3‑D pyramid column chart that visualizes the sales data across four quarters.
Customize the PyramidColumn3D Chart (Colors, Axis, Legend)
Often you need to tailor the chart’s appearance to match corporate branding or improve readability. The example below demonstrates:
- Changing column fill colors.
- Adjusting legend position.
- Modifying primary and secondary axes titles.
- Enabling data labels.
What the custom code does
| Customization | Code snippet | Result |
|---|---|---|
| Series colors | chart.NSeries[s].Area.ForegroundColor = palette[s]; | Each year’s column appears in a distinct, brand‑friendly color. |
| Data labels | chart.NSeries[s].DataLabels.IsValueShown = true; | Numeric values are displayed above each column for quick insight. |
| Legend positioning | chart.Legend.Position = LegendPositionType.Bottom; | Legend placed below the chart, freeing up chart area. |
| Axis titles & number format | chart.CategoryAxis.Title.Text, chart.ValueAxis.NumberFormat | Improves readability and conveys units. |
| Border removal | chart.NSeries[s].Border.IsVisible = false; | Gives a cleaner 3‑D appearance. |
Open PyramidColumn3D_Customized.xlsx in Excel to see a polished, presentation‑ready chart.
Get a Free License
Aspose.Cells requires a license for full functionality. You can obtain a temporary free license for evaluation from the Aspose portal:
Free Temporary License for Aspose.Cells
Apply the license before generating charts in a production environment to remove evaluation watermarks.
// Example of applying a license (place this at the start of your program)
var license = new Aspose.Cells.License();
license.SetLicense("Aspose.Total.lic"); // Path to your .lic file
Additional Resources
- Developer’s Guide – Comprehensive walkthrough of all chart features: https://docs.aspose.com/cells/net/
- API Reference – Detailed class and method documentation: https://reference.aspose.com/cells/net/
- Free Online Apps – Try chart generation without code: https://products.aspose.app/cells/family
- Support Forum – Ask questions and share snippets: https://forum.aspose.com/c/cells/9
Conclusion
Creating a PyramidColumn3D chart with Aspose.Cells for .NET is straightforward:
- Populate worksheet data.
- Add a
ChartType.PyramidColumn3Dchart. - Set series, categories, and optional formatting.
- Save the workbook.
The library gives you full control over chart aesthetics, enabling you to produce professional‑grade visualizations directly from your C# applications.
If you need further assistance, feel free to join the Aspose community forums or explore the extensive documentation linked above.