Line chart is not shown in custom chart

Dear Aspose,


I am currently trying to change a series of column to line in my chart.

If I am to change a chart type of a series (from column to line),
the line is not shown correctly.

I have tried to add another series afterwards which worked fine.

Have I missed anything that?

Please find the attached excel templates I used, and code below.


============================Code======================
Workbook wb = new Workbook(“Test.xlsx”);
Worksheet ws = wb.Worksheets[“test”];

Aspose.Cells.Charts.Chart chart = ws.Charts[0];

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

chart.NSeries.Add(chart.NSeries[0].Values, true);
chart.NSeries[2].Type = Aspose.Cells.Charts.ChartType.Line;

wb.Save(“Out.xlsx”);

======================End of Code======================

Many many thanks,
Jonathan Lau

Hi,


Thanks for the template files, screenshots and details.

Please change your sample code as following (see the line in bold), it would work fine for your needs.
e.g
Sample code:

Workbook wb = new Workbook(“e:\test2\Test.xlsx”);
Worksheet ws = wb.Worksheets[“test”];

Aspose.Cells.Charts.Chart chart = ws.Charts[0];

// Setting the chart type of 2nd NSeries to display as line chart
chart.NSeries[1].Type = Aspose.Cells.Charts.ChartType.Line;
chart.NSeries[1].Border.IsVisible = true;
/*//If you want to re-add a new line series (as per the second series), so you may remove the second one.
chart.NSeries.Add(chart.NSeries[1].Values, true);
chart.NSeries[2].Type = Aspose.Cells.Charts.ChartType.Line;
chart.NSeries[2].Border.Color = Color.Red;
chart.NSeries[2].Name = chart.NSeries[1].Name;
//Remove the second series.
chart.NSeries.RemoveAt(1);
*/

wb.Save(“e:\test2\out1.xlsx”);

Hope, this helps a bit.

Thank you.