Free Support Forum - aspose.com

Major Grid lines disappear and series legend comes on center on removing series and adding one back

Hi,


If you run the following on sample.xls, value axis’ major gridlines aren’t affected.

Dim n As Long
With ActiveChart
For n = 1 To .SeriesCollection.Count Step 1
.SeriesCollection(n).Delete
Next n
End With

’ then run the following…

ActiveChart.SeriesCollection.Add _
Source:=Worksheets(“Sheet1”).Range(“D7:D31”)

But running the following with aspose on the same file makes the major gridlines of value axis disappear:

var chart = w1.Worksheets[0].Charts[0];
chart.NSeries.Clear();
chart.NSeries.Add(“Sheet1!D7:D31”, true);


Also, the vba code adds the new series legend exactly in the place where the first series was before(far left), whereas aspose adds the new series legend at the center.

Please look into this

Thanks

Hi,


Sorry , it should be

.SeriesCollection(1).Delete

Thanks

Hi,


Sorry , just found out, the gridlines are fine, but the color has changed from (51,51,51) to black.
Please check.

Thanks

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to replicate this issue after loading and saving your source xls file using the following code with the latest version: Aspose.Cells for .NET 8.4.0. We found the major gridlines of value axis disappear and legend is also displaced from its original position.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43502 - Major Grid lines disappear and series legend comes on center after resaving source xls file.

I have also attached the output xls file and the screenshot highlighting this issue for a reference.

C#

string filePath = @“F:\Shak-Data-RW\Downloads\sample.xls”;


Workbook workbook = new Workbook(filePath);

workbook.Save(“output.xls”);

Hi,


Thanks for acknoledging the issue. The gridlines actually changed colour. They didnt disappear

Hi,

Thanks for your feedback and using Aspose.Cells.

You are right. Gridlines are still present but their colors have changed so they look invisible. We have logged your comment in our database against this issue. Please spare us some time. Once, it will be fixed, we will let you know asap.

Hi,

Please try our latest version/ fix: Aspose.Cells for .NET v8.4.1.1


We have fixed your issue now.

Let us know your feedback.

Thank you.

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


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

Hi,


The major gridlines issue got solved. Thanks!

The legend still appears in the center though.

Please look into this…

Thanks!

Hi,


I have tested your scenario/ case using our latest version/fix: Aspose.Cells for .NET v8.4.2, it works fine. I could not find the issue related to legend entries. I am using the following sample code and please find attached the output Excel file here for your reference:
e.g
Sample code:

string filePath = @“e:\test2\sample.xls”;


Workbook workbook = new Workbook(filePath);

workbook.Save(“e:\test2\outsample1.xls”);

Thank you.

Hi,


Please use :

The following adds the one new series legend at the far left corner

Dim n As Long
With ActiveChart
For n = 1 To .SeriesCollection.Count Step 1
.SeriesCollection(1).Delete
Next n
End With
ActiveChart.SeriesCollection.Add _
Source:=Worksheets(“Sheet1”).Range(“D7:D31”)

And compare with…

var chart = w1.Worksheets[0].Charts[0];
chart.NSeries.Clear();
chart.NSeries.Add(“Sheet1!D7:D31”, true); // adds new added series at center

Thanks


Hi,


Please try our latest version/ fix: Aspose.Cells for .NET v8.4.2.5

I have tested your scenario/ case using the following sample code with your template file using v8.4.2.5, it works fine. I remove all the existing data series and adds a new series based on the cells range “D7:D31”:
e.g
Sample code:

string filePath = @“e:\test2\sample.xls”;


Workbook workbook = new Workbook(filePath);

var chart = workbook.Worksheets[0].Charts[0];
chart.NSeries.Clear();
chart.NSeries.Add(“Sheet1!D7:D31”, true); //adds the new data series fine.
workbook.Save(“e:\test2\out1.xls”);

Let us know if you still find any issue.

Thank you.

Hi


I am sorry the series should be added at the far left corner instead of the center.
Please find my previous post edited to reflect the correct problem

Thanks

Hi,


Do you mean to say the Legend entry “Series1” which is rendered at the center below the plot area of the chart and it should be rendered @ bottom left?

Thank you.

Hi,


Yes, exactly that!

Thanks!

Hi,


Thanks for your confirmation.

I observed the issue as you mentioned by using the following sample code with your template file. I found Legend entry “Series1” is rendered at bottom center instead of bottom left position after removing all the data series and then adding a new one.
e.g
Sample code:

string filePath = @“e:\test2\sample.xls”;


Workbook workbook = new Workbook(filePath);

var chart = workbook.Worksheets[0].Charts[0];
chart.NSeries.Clear();
chart.NSeries.Add(“Sheet1!D7:D31”, true); //adds the new data series fine but the legend entry is at bottom center (instead of bottom left) position below the plot area.

workbook.Save(“e:\test2\out1.xls”);

I have logged a separate ticket with an id “CELLSNET-43689” for your issue. We will look into it soon.

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

Thank you.


Hi,


We have evaluated your issue further.

Well, it is not an issue with the product. The legend
is not changed. If you could run the following code segment with your template file, you will find the entry
item looks center as the entry item is one and cannot fill the area of
the whole legend.<o:p></o:p>

e.g

Sample code:


string dir = @"D:\test2\";

Workbook workbook = new Workbook(dir + "sample.xls");

var chart = workbook.Worksheets[0].Charts[0];

chart.NSeries.Clear();

chart.NSeries.Add("Sheet1!D7:D31", true);

chart.Legend.Border.Color = Color.Red;

workbook.Save(dir + "output1.xls");

chart.Legend.Width = 4000 / 4;

chart.Legend.X = 4000 - chart.Legend.Width - 4000 / 40;

workbook.Save(dir + "output2.xls");

Thank you.