Chart is a graphical representation of data that enables user to easily understand the large quantity of data and relationships between parts of data. There are many types of charts available in Microsoft Excel and almost all of them are supported by Aspose.Cells for .NET. Aspose.Cells can be used to create, edit and manipulate Excel spreadsheets almost in any platform without any need to install Microsoft Excel or without using any sort of Microsoft Office automation.
The purpose of this article is to explain how developers can create Microsoft Excel Line Chart in C#.NET.
There are various types of Line charts, some of them are listed below.
- Line Stacked
- Line 100% Stacked
- Line with Data Markers
- Line Stacked with Data Markers
- Line 100% Stacked with Data Markers
For demonstration, we will use the following sample input Microsoft Excel document that contains the chart data. Here, column A contains the category axis data and other columns B, C and D contain chart series data.
Caption: Sample Input Microsoft Excel Document containing Chart Data.
The following sample code creates Microsoft Excel Line Chart by performing these steps.
- Load sample input Microsoft Excel document containing the chart data.
- Create Line chart with specified dimensions.
- Apply the two color gradient on the chart area.
- Set the chart title and format it.
- Add three vertical series, set their names and line weights.
- Format various chart items e.g. plot area, value axis, category axis, major tick marks etc.
- Save the workbook in XLSX format. You can also save it in other formats e.g. XLS, XLSB, XLSM etc.
The following snapshot shows the Output Microsoft Excel Line Chart generated by Aspose.Cells with the code given above. Similarly, you can create all sorts of Line charts with Aspose.Cells API easily.
Caption: Microsoft Excel Line Chart created by Aspose.Cells API.