How to create Combination Charts

Is it possible to create Combination charts. I.e a combination of Column and Line?

Hi, thanks for your consideration.

Please try the following code:

private void Page_Load(object sender, System.EventArgs e)
{
Excel excel = new Excel();
Cells cells = excel.Worksheets[0].Cells;
cells[“A1”].PutValue(10);
cells[“A2”].PutValue(15);
cells[“A3”].PutValue(20);

cells[“C1”].PutValue(12);
cells[“d1”].PutValue(15);
cells[“e1”].PutValue(18);

Charts charts = excel.Worksheets[0].Charts;


int chartIndex = charts.Add(ChartType.Column, 10,10,20,20);
Chart chart = charts[chartIndex];
chart.NSeries.Add(“A1:A3”, true);
chart.NSeries.Add(“C1:e1”, false);

excel.Save(“SPic.xls”, SaveType.OpenInExcel, FileFormatType.Default, this.Response);


}

Hi, thanks for your quick reply. Unfortunately it does not give the result I am looking for.
When I run your example, both series are shown as columns. I need the second series to be shown as a line.

I know your need now.
Aspose.Excel does not support this feature now. And I don’t find how to create this kind of chart in MS Excel. If you know how to create this chart in MS Excel, please send me a sample excel file. Thus I can investigate how to meet your need.

Dear Jef,

I got your sample file. Thank you very much. Now Aspose.Excel can only support this feature in designer file. You can set it in designer file and use Aspose.Excel to import it.

I will add api support to this feature in near future.

Hello Laurence, just checking to see if Combination charts, or Custom charts, i.e. Line with Column chart has been supported yet.

We need to create a Line/Column combination chart as you can do in excel from the ADI.

Wonder where that is on the list… and when that might be available

thanks!!
Marty

Hi Marty,

Please check detailed document on creating a chart, follow the link below:
Creating and manipulating Charts for your reference

Laurence, thanks! I was using major chart type LineWithDataMarkers.

I changed to Line and Column (for the data series) and it works great.

thanks!!!
Marty

@jef,@MartyOne,
Aspose.Excel is no more available now and is discarded. A new product Aspose.Cells has replaced this product and contains all the features of its predecessor along with the latest features available in MS Excel. This new product also supports creation of combination charts as demonstrated in the following sample code:

// Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["A4"].PutValue(110);
worksheet.Cells["B1"].PutValue(260);
worksheet.Cells["B2"].PutValue(12);
worksheet.Cells["B3"].PutValue(50);
worksheet.Cells["B4"].PutValue(100);

// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);

// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

// Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.NSeries.Add("A1:B4", true);

// Setting the chart type of 2nd NSeries to display as line chart
chart.NSeries[1].Type = Aspose.Cells.Charts.ChartType.Line;

// Saving the Excel file
workbook.Save("output.xls");

A detailed section about working with chart is given below:
Charts

You can download the latest trial version here:
Aspose.Cells for .NET (Latest Version)

Here is a runnable solution which contains variety of examples to test different features of the product.