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

Free Support Forum - aspose.com

Aspose Cells Chart Labels move not correct


I am trying to move labels so they appear below (for negative) or above (for positive) the column’s area. It is NOT for all labels, just a specific few (the red and green areas). I use the following code (which is a method where I pass the Point as pnt variable) :

       switch (posWhere)
            case LabelPositionType.Above:
                pnt.DataLabels.Y = pnt.ShapeY - pnt.DataLabels.Height - 1;
            case LabelPositionType.Below:
                pnt.DataLabels.Y = pnt.ShapeY + pnt.ShapeHeight + 1;

Please note that I am only changing the Y value of the label. However, the labels look as if their X values have slightly moved as well. (See attached file)
SetlabelPosition.zip (14.7 KB)

To help me debug, In column T, from row 20 onwards I printed the labels X position BEFORE I moved any of the labels, and in U I printed them again after all the work was done. The X values did not change, however the display does not seem correct.

I also made only one call to the chart’s Calculate() method - which is right before I started moving the labels, and the only action which happens to the whole sheet after the moving, is the U column for the new X positions.

Any idea where I am going wrong with this ?

I am using Aspose




Could you please try our latest version/fix: Aspose.Cells for .NET v22.1 if it makes any difference. If you still find the issue with the latest version, share your complete (runnable) sample code (or preferably a standalone VS.NET console application) and input Excel file (if any) with us. We will check your issue soon.

PS. please exclude Aspose.Cells.Dll in the application (zipped) archive to minimize the size.