Introduction

Visualizing cumulative data trends with markers can make reports more insightful. The LineStackedWithDataMarkers chart type combines a stacked line series with data markers, allowing you to see both the aggregated flow and individual data points at a glance. This article demonstrates how to create such a chart programmatically with Aspose.Cells for .NET and C#.

In this guide you will learn:

  • How to set up a workbook and populate sample data.
  • How to add a LineStackedWithDataMarkers chart.
  • How to customize series, axes, and data markers.
  • How to save the workbook in various formats.

C# Excel Library to Create LineStackedWithDataMarkers Chart

Aspose.Cells for .NET is a powerful, free‑of‑COM Excel automation library. It supports all chart types offered by Microsoft Excel, including LineStackedWithDataMarkers.

Key advantages of using Aspose.Cells:

  • Rich API – full control over workbook structure, cells, and chart objects.
  • No Excel installation required – works on any platform that supports .NET.
  • High performance – optimized for large datasets.
  • Multiple output formats – XLSX, XLS, CSV, PDF, images, etc.

Getting started:

PM> Install-Package Aspose.Cells

Create a LineStackedWithDataMarkers Chart in Excel using C#

Step‑by‑step implementation

  1. Create a Workbook instance.
  2. Add sample data that will be displayed in the chart.
  3. Insert a chart of type ChartType.LineStackedWithDataMarkers.
  4. Configure the series – set the data range, name, and marker style.
  5. Customize axes and title (optional but recommended).
  6. Save the workbook to the desired location.

Below is a complete, ready‑to‑run example.

Explanation of the key steps

StepWhat it does
Create workbook & worksheetInitializes an empty Excel file.
Populate dataWrites month names and three product series that will be stacked.
Add chartInserts a LineStackedWithDataMarkers chart object at the specified cell range.
Add seriesLinks each product column to a separate series and assigns a unique marker style and colour.
Axis titles & formattingImproves readability by labeling axes and forcing integer display on the Y‑axis.
SavePersists the workbook to disk (.xlsx). The file can also be saved as PDF or image by changing the format in workbook.Save.

You can run the sample as a console application after installing the Aspose.Cells NuGet package.


Get a Free License

Aspose.Cells provides a temporary free license that removes evaluation watermarks and unlocks full functionality. Grab yours from the Aspose temporary license page. Apply the license before saving large workbooks:

License lic = new License();
lic.SetLicense("Aspose.Total.lic");   // Path to your temporary license file

LineStackedWithDataMarkers Chart: Free Resources


Conclusion

The LineStackedWithDataMarkers chart is ideal for visualizing cumulative trends while still highlighting individual data points. With just a few lines of C# code, Aspose.Cells for .NET lets you create, style, and export such charts without needing Microsoft Excel installed. Use the provided example as a template and adapt it to your own data sources and branding requirements.

If you encounter any issues or have questions, visit our free support forum: https://forum.aspose.com/c/cells/9.


See Also