Visualizing relationships between two numerical variables is a common requirement in data analysis, reporting, and scientific research. A Scatter chart (also known as an XY‑Scatter) is ideal for highlighting trends, clusters, and outliers. This guide demonstrates how to create a Scatter chart in Excel using C# and Aspose.Cells for .NET. With a few lines of code you can programmatically generate, customize, and export Scatter charts that are ready for presentation, dashboards, or further processing.
This article covers the following topics:
- C# Excel Library to Create Scatter Charts
- Create a Scatter Chart in Excel using C#
- Get a Free License
- Scatter Chart Excel: Free Resources
- Conclusion
- See Also
C# Excel Library to Create Scatter Charts
Aspose.Cells for .NET is a comprehensive Excel manipulation library that enables developers to create, modify, and render Excel files without requiring Microsoft Office. It offers a rich API for chart creation, including full support for Scatter charts.
Key advantages of using Aspose.Cells for creating Scatter charts:
- Full‑featured Chart API – Add multiple series, set marker styles, define axis properties, and switch chart types at runtime.
- No COM Interop – Works in server environments, cloud services, and desktop applications.
- High Performance – Handles large datasets with minimal memory overhead.
- Cross‑format Support – Save to XLSX, XLS, CSV, PDF, PNG, and more.
Get started quickly:
PM> Install-Package Aspose.Cells
Or download the latest release from the Aspose.Cells releases page.
Create a Scatter Chart in Excel using C#
Below is a complete, self‑contained C# example that demonstrates how to:
- Create a new workbook.
- Populate a worksheet with X‑Y data.
- Insert a Scatter chart.
- Customize series markers, axis titles, and chart appearance.
- Save the workbook to an XLSX file.
Note – The code uses the
Aspose.Cellsnamespace only. No additional libraries are required.
Explanation of the Code
| Step | What it does |
|---|---|
| 1 | Instantiates a new Workbook and obtains the first Worksheet. |
| 2 | Populates columns A and B with X and Y numeric values. |
| 3 | Adds a Chart of type ChartType.Scatter to the worksheet. |
| 4 | Creates a single series that references the Y‑range (B2:B9) and explicitly sets the X‑range (A2:A9). |
| 5 | Customizes the series markers (red circles, size 10) and removes the border line. |
| 6 | Sets readable axis titles and optional axis limits. |
| 7 | Saves the workbook as ScatterChart_Output.xlsx. |
Running the program produces an Excel file that contains a neatly formatted Scatter chart, ready for further analysis or publishing.
Get a Free License
Aspose offers a temporary free license that removes evaluation watermarks and enables full API access for development and testing. Acquire yours from the Aspose temporary license page. Apply the license in your code before using any Aspose.Cells classes:
var license = new Aspose.Cells.License();
license.SetLicense("Aspose.Cells.lic");
Scatter Chart Excel: Free Resources
Continue learning and mastering Excel automation with these free resources:
- Developer’s Guide – Comprehensive API documentation: https://docs.aspose.com/cells/net/
- Online Apps – Try Aspose.Cells features directly in the browser: https://products.aspose.app/cells/family
- API Reference – Detailed method, property, and enum listings: https://reference.aspose.com/cells/net/
- How‑to Articles – Practical examples and step‑by‑step guides: https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
This tutorial demonstrated how to programmatically create a Scatter chart in Excel using C# and Aspose.Cells for .NET. By leveraging the robust charting API, you can build sophisticated visualizations, customize marker styles, and control axis behavior—all without requiring Microsoft Office. Incorporate this approach into reporting tools, analytical dashboards, or any solution that needs dynamic chart generation.
If you have questions, need assistance, or want to share your feedback, please visit our free support forum.