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

Free Support Forum - aspose.com

Legends not hidden correctly in combined chart

I have a combined chart and 5 data series, 2 of them are empty, and the last one is shown as Area and plot on 2nd y axis, others are shown as Column plot on primary axis, and I want to hide the legends of empty data but it doesn't seem working correctly. Please see the

Please see the screenshot being attached.

Below is my code:

var workbook = new Workbook();
int sheetIndex = workbook.Worksheets.Add();
Worksheet worksheet = workbook.Worksheets[sheetIndex];

Style style = new Style();
style.Number = 11;

worksheet.Cells["B2"].PutValue(1.4);
worksheet.Cells["C2"].PutValue(1.32);
worksheet.Cells["D2"].PutValue(5.0);
worksheet.Cells["E2"].PutValue(4.9);
worksheet.Cells["F2"].PutValue(3.7);

worksheet.Cells["B3"].PutValue(1.44);
worksheet.Cells["C3"].PutValue(0.2);
worksheet.Cells["D3"].PutValue(3.6);
worksheet.Cells["E3"].PutValue(4.5);
worksheet.Cells["F3"].PutValue(5.17);
// B4:F4 is empty area

worksheet.Cells["B5"].PutValue(1.1);
worksheet.Cells["C5"].PutValue(1.2);
worksheet.Cells["D5"].PutValue(3.5);
worksheet.Cells["E5"].PutValue(4.5);
worksheet.Cells["F5"].PutValue(5.7);

int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 8, 1, 25, 15);
var chart = worksheet.Charts[chartIndex];
chart.NSeries.Add("B2:F2", false);
chart.NSeries.Add("B3:F3", false);
var idx = chart.NSeries.Add("B4:F4", false);
chart.NSeries[idx].LegendEntry.IsDeleted = true;
idx = chart.NSeries.Add("B4:F4", false);
chart.NSeries[idx].LegendEntry.IsDeleted = true;
idx = chart.NSeries.Add("B5:F5", false);
chart.NSeries[idx].Type = ChartType.Area;
chart.NSeries[idx].PlotOnSecondAxis = true;
chart.SecondValueAxis.IsVisible = true;
chart.SecondValueAxis.CrossType = CrossType.Automatic;
chart.PlotArea.Area.ForegroundColor = Color.White;

workbook.Save("book1.xlsx");

Hi,


Thanks for providing us sample code with details.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found that legend entries are not hidden correctly in the combined chart. The Series3 and Series4 should be hidden in the Legend but Series2 and Series3 are made invisible instead. I have logged a ticket with an id “CELLSNET-45298” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

Alright, thanks for the prompt reply.


BTW,
1) I found this issue with v9.0.0 but I later found this issue in 17.3.0 as well
2) This seems only occurred when saving the chart in excel file, it works fine saving into pdf file.

Hi,


We are pleased to inform you that your issue (logged earlier as “CELLSNET-45298”) has been fixed now. We will soon provide you the fixed version (Download link can be shared here in the next 3-5 days or so) after performing QA and incorporating other enhancements and fixes.

Thank you.

The issues you have found earlier (filed as CELLSNET-45298) have been fixed in Aspose.Cells for .NET 17.5.


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

Thanks, we will schedule the update for our products.