We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chart Series Remove

Hi,
I am using Cells version 4.5.1.0.
I have got a pre-configured chart with 4 data series. At runtime, I setup the data ranges for the 4 series. In some cases, I only have 3 datasets at runtime, so I remove the 4th series using objChart.NSeries.RemoveAt(lastIndex);. Debugging right after this statement shows that the number of NSeries is now down to 3, but when the chart is viewed legend entries have the 4th Series as a blank series.
Can you please help?
Thanks.
Lama

Hi,

Could you post your template file here, we will check your issue soon.

Thank you.

Hi,
Please find attached the template file.
thanks.
lama

Hi,

Thanks for providing us the template file.

Could you try the attached version. I have tested with it using your template file and the output file is fine, the fourth series and its legend entry is removed altogether. My sample code is given below:

Sample code:

Workbook wb1 = new Workbook();
Chart chart;
wb1.Open("f:\\test\\CurveReport.xls");
chart = wb1.Worksheets[0].Charts[0];
MessageBox.Show(chart.NSeries.Count.ToString()); //4
chart.NSeries.RemoveAt(3);
MessageBox.Show(chart.NSeries.Count.ToString()); //3
wb1.Save("f:\\test\\out_CurveReport.xls");

Thank you.

Thank you. It works very well.