@Deepak Banavathu , Welcome to Microsoft Q&A,
You could refer to the following code to create a Combo Chart by using microsoft.office.interop dll.
Code:(using Excel = Microsoft.Office.Interop.Excel;)
Excel.Application app = new Excel.Application();
Excel.Workbook workbook = app.Workbooks.Open("D:\\1.xlsx");
Excel.Worksheet worksheet = workbook.Sheets[1];
var charts = worksheet.ChartObjects() as Excel.ChartObjects;
var chartObject = charts.Add(60, 10, 300, 300) as Excel.ChartObject;
var chart = chartObject.Chart;
var range = worksheet.get_Range("A1", "D5");
chart.SetSourceData(range);
chart.FullSeriesCollection(1).ChartType = Excel.XlChartType.xlColumnClustered;
chart.FullSeriesCollection(2).ChartType = Excel.XlChartType.xlColumnClustered;
chart.FullSeriesCollection(3).ChartType = Excel.XlChartType.xlLine;
chart.FullSeriesCollection(3).AxisGroup = Excel.XlAxisGroup.xlSecondary;
chart.ChartWizard(Source: range,
Title: "Graph Title",
CategoryTitle: "X value",
ValueTitle: "Y value");
//Set chart range.
// Save.
workbook.Save();
workbook.Close();
Result:
Hope the code example could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.