Hi, you could use Free Spire.XLS for .NET to create a combination chart in Excel. The following code snippet shows you how to.
using Spire.Xls;
using Spire.Xls.Charts;
namespace CreateCombinationExcel
{
class Program
{
static void Main(string[] args)
{
Workbook workbook = new Workbook();
workbook.LoadFromFile("data.xlsx");
Worksheet sheet = workbook.Worksheets[0];
//add a chart based on the data from A1 to D5
Chart chart = sheet.Charts.Add();
chart.DataRange = sheet.Range["A1:D5"];
chart.SeriesDataFromRange = false;
//set position of chart
chart.LeftColumn = 6;
chart.TopRow = 1;
chart.RightColumn = 12;
chart.BottomRow = 13;
//apply different chart type to different series
var cs1 = (ChartSerie)chart.Series[0];
cs1.SerieType = ExcelChartType.ColumnClustered;
var cs2 = (ChartSerie)chart.Series[1];
cs2.SerieType = ExcelChartType.ColumnClustered;
var cs3 = (ChartSerie)chart.Series[2];
cs3.SerieType = ExcelChartType.LineMarkers;
//add a secondary axis to chart
chart.SecondaryCategoryAxis.IsMaxCross = true;
cs3.UsePrimaryAxis = false;
//save and launch the file
workbook.SaveToFile("result.xlsx", ExcelVersion.Version2010);
}
}
}
More details can be found here.