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

Free Support Forum - aspose.com

SetChartDataRange did not recognize merged cells

If I drag the range in excel to set the chart data range, it can recognize merged cells.
But SetChartDataRange cannot did it, it always use the first row and first column as series and categories
image.jpg (144.5 KB)

Example code here:
ConsoleApp3.zip (14.0 KB)

@Flithor,
We have logged the issue as “CELLSNET-48067” in our database for investigations. Once we will have some news for you, we will update you in this topic.

Update: Even if the cells of the merged range are not merged and all there be filled with the same value, but the behavior of SetChartDataRange is still different from Excel.
(try unmerge the merged cell and fill them as same value)
It also does not considering the same value cells, not treats them as a group.

@Flithor,
Thank you for the feedback. We have noted it with the ticket for our later reference.

@Flithor
Please try the latest fix 21.5.1.
Aspose.Cells21.5.1 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.5.1 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.5.1 For .NetStandard20.Zip (5.5 MB)

It fixed, this bug fix patch will release in 21.6.0?

@Flithor,
Yes, this fix will be included in Aspose.Cells for .Net 21.6 which will be released around 3rd week of June.

The issues you have found earlier (filed as CELLSNET-48067) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

Still not fixed at all.

ConsoleApp3.zip (13.7 KB)
output.zip (14.0 KB)
I suggest add a method and let user set the first data cell position.
At least it will make you to have a workaround available before you fully completed the “smart” solution.

@Flithor,

You are right. The issue is still there using your newly attached template file and sample code. When I manually created the same chart in MS Excel, it works as expected. I have reopened your issue again and we will look into it soon.

@Flithor,

1). We have fixed your issue now. The fixed version will be shared in the next few days.
2). If you can get the first data cell position, please set the data as the following

Workbook wb = new Workbook(dir + "sample.xlsx");
var chart = wb.Worksheets[0].Charts[1];
// chart.SetChartDataRange("A1:H11", true);
// string outputFile = dir + "dest.xlsx";

chart.NSeries.Add("D2:H11",true);            
chart.NSeries.CategoryData = "=Sheet1!$A$2:$C$11";
for (int c = 3; c <= 7;  c++)
{
                chart.NSeries[c - 3].Name = "=" + CellsHelper.CellIndexToName(0, c); 
}

3). We will add a new method, i.e., `chart.NSeries.SetSeriesNames()` to set the name of all series in next fix.

Please try the latest fix 21.6.2.
Aspose.Cells21.6.2 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.6.2 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.6.2 For .NetStandard20.Zip (5.5 MB)

Unfortunately, this bug still exists in V22.1.0
It can recognize the column as serie data now (IsVertical is true):

image.png (54.6 KB)
But still bugged when IsVertical is false:

image.png (74.9 KB)
Project:
ConsoleApp3.zip (78.0 KB)

@Flithor,

Thanks for the sample files and screenshots.

Please notice, I am able to reproduce the issue as you mentioned by using your template files. I found Chart.SetChartDataRange(area, isVertical) method does not recognize merged cells when “isVertical” Boolean attribute is “false”, it works fine if the Boolean attribute is set to “true” though. I have logged a ticket with an id “CELLSNET-50295” for your issue. We will look into it soon.

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

@Flithor,

This is to inform you that we have fixed your issue (logged earlier as ““CELLSNET-50295””) now. The fix will be included in our regular (upcoming) release: Aspose.Cells for .NET v22.2 which is scheduled to be published in the second week of February, 2022.

The issues you have found earlier (filed as CELLSNET-50295) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

new bug move to here:

We found the issue and you may follow up your thread for reference and for updates.