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
- Create a
Workbookinstance. - Add sample data that will be displayed in the chart.
- Insert a chart of type
ChartType.LineStackedWithDataMarkers. - Configure the series – set the data range, name, and marker style.
- Customize axes and title (optional but recommended).
- Save the workbook to the desired location.
Below is a complete, ready‑to‑run example.
Explanation of the key steps
| Step | What it does |
|---|---|
| Create workbook & worksheet | Initializes an empty Excel file. |
| Populate data | Writes month names and three product series that will be stacked. |
| Add chart | Inserts a LineStackedWithDataMarkers chart object at the specified cell range. |
| Add series | Links each product column to a separate series and assigns a unique marker style and colour. |
| Axis titles & formatting | Improves readability by labeling axes and forcing integer display on the Y‑axis. |
| Save | Persists 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
- Developer’s Guide – https://docs.aspose.com/cells/net/
- Online demo & editor – https://products.aspose.app/cells/family
- API Reference – https://reference.aspose.com/cells/net/
- How‑to articles & tutorials – https://blog.aspose.com/categories/aspose.cells-product-family/
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.