create excel charts C#

Excel charts are used to visualize the data in spreadsheets. MS Excel supports a variety of charts such as line, bar, pie, doughnut, pyramid, bubble, etc. In this article, you will learn how to create charts in Excel files using C#.

C# API to Create Charts in Excel

In order to work with Excel charts, we’ll use Aspose.Cells for .NET. It is a powerful API that lets you implement Excel automation in .NET applications. Furthermore, it allows you create a variety of charts seamlessly. To use the API, you can either download the DLL or install it using NuGet.

Install-Package Aspose.Cells

Supported Excel Chart Types

Aspose.Cells for .NET provides a complete set of standard chart types. The list includes, but not limited to:

  • Column
  • ColumnStacked
  • Column100PercentStacked
  • Column3DClustered
  • Column3DStacked
  • Column3D100PercentStacked
  • Column3D
  • Bar
  • BarStacked
  • Bar100PercentStacked
  • Bar3DClustered
  • Bar3DStacked
  • Bar3D100PercentStacked
  • Line
  • LineStacked
  • Line100PercentStacked
  • LineWithDataMarkers
  • LineStackedWithDataMarkers
  • Line100PercentStackedWithDataMarkers
  • Line3D
  • Pie
  • Pie3D
  • PiePie
  • PieExploded
  • Pie3DExploded
  • PieBar
  • Scatter
  • ScatterConnectedByCurvesWithDataMarker

For a complete list of supported Excel charts, visit this article.

Create Charts in Excel using C#

The following are the steps to create a chart in Excel using C#.

The following code sample shows how to create an Excel chart using C#.

create column chart in C#

Create a Line Chart in Excel using C#

In order to insert a line chart, you only need to specify the ChartType.Line type in Worksheet.Charts.Add() method. The rest of the steps will be the same as mentioned in the previous section.

The following code sample shows how to create a line chart in Excel using C#.

line chart in in Excel C#

Create a Pyramid Chart in Excel using C#

For adding a pyramid chart, simply pass ChartType.Pyramid type while adding the chart to the worksheet. The following are the steps to add a pyramid chart in Excel using C#.

The following code sample shows how to insert a pyramid chart in an Excel worksheet using C#.

create pyramid chart in Excel

To learn more about working with Excel charts, read this documentation article.

Get a Free API License

You can try Aspose.Cells for .NET without evaluation limitations by requesting a temporary license.


In this article, you have seen how to create charts in Excel worksheets using C#. Particularly, you have learned how to create column, line, and pyramid charts in Excel. Furthermore, you can also create other types of charts seamlessly using Aspose.Cells for .NET. For more details, visit the documentation of the API. In case you would have any queries, contact us via our forum.

See Also