TickLabels.Offset does not work

Hi guys,

I am trying to add offset to my value axis ticklabel but it does not work.
The purpose would be to add space between the end of the curve and the ticklabels to display the end point value (datalabels) correctly:
image.png (12.4 KB)

Could you have a look to this piece of code:

var pathWorkbook = @“C:\Users\hormancey\OneDrive - FactSet\Documents\TestHadrienMarker.xlsx”;
var pathWorkbookNew = @“C:\Users\hormancey\OneDrive - FactSet\Documents\TestHadrienMarkerBis.xlsx”;
var wbtest = new Workbook(pathWorkbook);
Worksheet sheettest = wbtest.Worksheets[0];
Chart charttest = sheettest.Charts[0];

        //Change the color to blue for the data labels.
        charttest.ValueAxis.TickLabels.Offset = 1000;
        // charttest.ValueAxis.TickLabels.RotationAngle = 90;

        wbtest.Save(pathWorkbookNew);

TestHadrienMarker.7z (11.9 KB)

Thanks,

@hormancey,

Thanks for the sample file and screenshot.

As far I know, in MS Excel, value axis labels on charts are positioned automatically, and you cannot directly set the distance between axis labels and the chart/plot area corner/end. Could you please provide a sample Excel file with a chart where the labels are positioned at your preferred offset? We will check on how to achieve this using Aspose.Cells APIs.

I am not able to do it in excel but I thought it was possible via code:

@hormancey,

Unfortunately, if a feature is unavailable for charts in MS Excel, it will also be unavailable when using Aspose.Cells APIs.

@hormancey

TickLabels.Offset only works for the tick labels of Category (X) Axis.

It seems that Excel do not allow to change offset of the value axis.
We will update description about this API.

Thanks for your quick Reply

@hormancey
You are welcome.
If you have any questions, please feel free to contact us at any time.

If I can’t set offset, do you think I can check if my datalabels intersect the axis ticklabels and move them accordingly ?
I don’t think it is possible. I don’t see any X, Y properties for the ticklabels.
Same for the Axis…

@hormancey,

Axis tick labels and axes do not expose direct X, Y, Width and Height properties, so apparently, there is no direct way to check if the data labels overlap axis tick labels. Anyways, we will further evaluate it and get back to you.

1 Like