The Syncfusion .NET Excel (XlsIO) Library supports creating charts from Excel data, empowering users to generate visual representations of their data effortlessly. With XlsIO, users can create and customize charts using over 80+ Excel chart types, including Excel 2016 charts.
This example code shows how to create a chart in Excel using the Syncfusion .NET Excel Library with just a few lines of code in C#.
// Initialize Excel engine and application
using ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
// Open the existing workbook
using FileStream inputStream = new FileStream("InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorksheet worksheet = workbook.Worksheets[0];
// Create a Chart
IChartShape chart = worksheet.Charts.Add();
// Set the Chart Type
chart.ChartType = ExcelChartType.Column_Clustered;
// Set data range in the worksheet
chart.DataRange = worksheet.Range["A1:C6"];
chart.IsSeriesInRows = false;
// Set Datalabels
IChartSerie serie1 = chart.Series[0];
IChartSerie serie2 = chart.Series[1];
serie1.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie2.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie1.DataPoints.DefaultDataPoint.DataLabels.Position = ExcelDataLabelPosition.Outside;
serie2.DataPoints.DefaultDataPoint.DataLabels.Position = ExcelDataLabelPosition.Outside;
// Set Legend
chart.HasLegend = true;
chart.Legend.Position = ExcelLegendPosition.Bottom;
// Positioning the chart in the worksheet
chart.TopRow = 8;
chart.LeftColumn = 1;
chart.BottomRow = 23;
chart.RightColumn = 8;
// Save the Excel document
using FileStream outputStream = new FileStream("Chart.xlsx", FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
Discover how the charting capabilities in the Excel Library enable the easy creation, customization, and integration of charts within Excel worksheets.
Generate charts using data directly entered into Excel cells, allowing for quick visualization without pre-existing datasets.
Create charts by adding data series, enabling greater flexibility and customization for comparing multiple datasets.
Includes the new chart types introduced in Excel 2016, emphasizing advanced data visualization options like funnel, box and whisker, waterfall, histogram, Pareto, Treemap, and sunburst charts and treemaps. This is relevant for users looking to leverage modern chart types.
Configure key chart components (plot area, chart area, axis, legends, data labels, and series) for clear and effective data representation.
Discover valuable resources in our blog and knowledge base to enhance your skills in using Excel charts.
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
Yes. Syncfusion Excel Library provides extensive formatting options for charts, enabling users to customize chart elements such as axis, chart area, plot area, data labels, data series, titles, and legends.
Yes, the Syncfusion Excel Library supports 3D settings like rotation, side wall, back wall, and floor settings for charts in Excel.
Yes, you can export charts as images in formats like PNG, JPG, and BMP.
Yes, the Syncfusion Excel Library allows users to fill the plot area and chart area with images, enhancing visual representation in Excel.
Yes, the Syncfusion Excel Library supports the addition of a data table to a chart in Excel. The data table, which is located beneath the chart, presents the chart content in table format.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.