Can't remove legend entry

There is some bug in Aspose.Cells.

I want to remove legend entry for series, but in case when column is hidden it doesn’t works.

Here is an example:

var workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

worksheet.Cells[“K1”].PutValue(50);
worksheet.Cells[“K2”].PutValue(120);
worksheet.Cells[“K3”].PutValue(160);
worksheet.Cells[“K4”].PutValue(200);

worksheet.Cells[“L1”].PutValue(4);
worksheet.Cells[“L2”].PutValue(20);
worksheet.Cells[“L3”].PutValue(40);
worksheet.Cells[“L4”].PutValue(120);

worksheet.Cells.Columns[10].IsHidden = true; // column K
worksheet.Cells.Columns[11].IsHidden = true; // column L

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 0, 0, 20, 7);

Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

chart.PlotVisibleCells = false;

int index = chart.NSeries.Add(“K1:K4”, true);

chart.NSeries[index].LegendEntry.IsDeleted = true;

chart.NSeries.Add(“L1:L4”, true);

workbook.Save(“test.xlsx”);

Here is the result:



result


Expected result is:

expectedResult

Hi,


Thanks for providing us sample code and screen shots.

After an initial test, I observed the issue as the user has mentioned by using his sample code. I found that chart’s legend entry is not removed when the data source column is hidden. If we make the hidden column visible, it works fine though.
e.g
Sample code:

var workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

worksheet.Cells[“K1”].PutValue(50);
worksheet.Cells[“K2”].PutValue(120);
worksheet.Cells[“K3”].PutValue(160);
worksheet.Cells[“K4”].PutValue(200);

worksheet.Cells[“L1”].PutValue(4);
worksheet.Cells[“L2”].PutValue(20);
worksheet.Cells[“L3”].PutValue(40);
worksheet.Cells[“L4”].PutValue(120);

worksheet.Cells.Columns[10].IsHidden = true; // column K
worksheet.Cells.Columns[11].IsHidden = true; // column L

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 0, 0, 20, 7);

Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

chart.PlotVisibleCells = false;

int index = chart.NSeries.Add(“K1:K4”, true);

chart.NSeries[index].LegendEntry.IsDeleted = true;

chart.NSeries.Add(“L1:L4”, true);

workbook.Save(“test.xlsx”);

I have logged a ticket with an id “CELLSNET-44062” for your issue. We will look into your issue to figure it out soon.

Thank you.
Hi again,

This is to update you that we have fixed the problem logged earlier as CELLSNET-44062. We will shortly provide the fix here after ensuring the quality of the build and incorporating other enhancements.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET (Latest Version)
and let us know your feedback.

Thanks!

Now everything works good!

Hi,

Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to get in touch if you need our further assistance with Aspose APIs.

The issues you have found earlier (filed as CELLSNET-44062) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.