Visualizing data that combines categorical proportions with absolute values often calls for a PieBar chart—a combination of a pie chart and a bar chart displayed together. With Aspose.Cells for .NET you can create such hybrid charts programmatically in just a few lines of code. This guide walks you through the process, explains the key API members, and provides a complete, compile‑ready C# example.

This article covers the following topics:

C# Excel Library to Create PieBar Charts

Aspose.Cells for .NET is a comprehensive Excel manipulation library that enables developers to create, edit, and render Excel files without Microsoft Excel installed. It provides first‑class support for all native Excel chart types, including combination charts such as PieBar (a pie chart combined with a bar chart).

Key advantages of using Aspose.Cells for this scenario:

  • Full API control – Create charts, set series types, and customize axes programmatically.
  • No COM interop – Works on any .NET platform (Windows, Linux, macOS) and in headless environments.
  • High performance – Handles large workbooks and data sets with minimal memory overhead.
  • Multiple output formats – Save the result as XLSX, PDF, PNG, or other supported formats.

Getting started is straightforward:

  1. Download the latest release from the Aspose.Cells releases page.

  2. Install the NuGet package:

    PM> Install-Package Aspose.Cells
    

Create a PieBar Chart in Excel using C#

Below is a complete, ready‑to‑run C# example that demonstrates how to:

  1. Populate a worksheet with sample data.
  2. Add a Pie series (primary axis) to represent percentages.
  3. Add a Bar series (secondary axis) to show absolute values.
  4. Combine the two series in a single chart area, resulting in a PieBar chart.
  5. Save the workbook to an XLSX file (or any other format you require).

Explanation of the key steps

StepWhat it doesImportant API members
1‑2Creates a workbook and fills it with sample data.Workbook, Worksheet, Cells
3Adds a chart object whose base type is PieBar. This gives us a chart container that can host multiple series of different types.Worksheet.Charts.Add, ChartType.Pie
4Inserts the pie series that visualises Revenue as a share of the total.Chart.NSeries.Add, Chart.NSeries[].Type = ChartType.Pie
5Inserts the bar series that visualises Units Sold on a secondary axis, achieving the classic PieBar combination.Chart.NSeries[].Type = ChartType.Bar, PlotOnSecondAxis = true
6‑7Fine‑tunes axis titles, legend placement, and data label display for a professional look.Chart.ValueAxis, Chart.SecondValueAxis, Chart.Legend, DataLabels
8Saves the workbook. The result can be opened in Microsoft Excel, Google Sheets, or any other spreadsheet viewer.Workbook.Save

You can change the output format simply by altering the file extension in Workbook.Save. For example, use "PieBarChart_Output.pdf" to generate a PDF file.

Get a Free License

Aspose.Cells requires a license for full functionality. You can obtain a temporary free license for evaluation purposes:

  1. Visit the Aspose temporary license page.

  2. Fill out the short form and click Get License.

  3. Download the Aspose.Total.lic file and place it in your project folder.

  4. Load the license at the start of your application:

    var license = new Aspose.Cells.License();
    license.SetLicense("Aspose.Total.lic");
    

PieBar Chart Excel: Free Resources

Conclusion

This article demonstrated how to create a PieBar chart—a powerful hybrid visualization that combines the proportional insight of a pie chart with the quantitative clarity of a bar chart—using Aspose.Cells for .NET. The provided sample program can be adapted to any data set, allowing you to embed professional‑grade charts directly into your Excel automation workflows.

If you encounter any issues or have further questions, feel free to visit the Aspose.Cells community forum for support.

See Also