Diagonal Tick Labels



I currently have a column chart with a Category X axis.

I have set: chart.xAxis.style.majorTickStyle.tickLabelOrientation = TickLabelOrientationDiagonal;

However I notice that the anchor point for each of the labels in about the center of the label, as shown below:

However when I have different text label lengths, this does not quite look right. I want the end of the label to be directly aligned and just below the tick mark, as is common with diagonal label charts, so it is easy to see which label the mark relates to.

In the alterTickMark method I am able to alter: tickMark.tickLabel.layer.anchorPoint =  CGPointMake(1, 0);

But then trying to reposition/translate the label has no effect.

Any help would be greatly appreciated. Thanks!


@apopat: Did you manage to find a solution to your problem?

I am currently evaluating the product and ran into the exact problem.


I’m running into this problem as well, does anyone have a solution to position diagonal labels properly?


Instead of setting the anchorPoint, have you tried setting tickMark.tickLabel.center to be offset to the left by a bit? A bit of trig says that the x-offset should be tickLabel.width/(2 * arccos(pi/8))


@tkelly Thank you, adjusting the center of the tickLabel did the trick!


I’m trying to resolve this problem using the Xamarin iOS Chart component. I am not sure where the equivalent of the alterTickMark method is located. Maybe it is not exposed. Please advise me on how to resolve this problem on Xamarin.iOS. Thank you!


Hi MobileDan - the method is exposed via the SChartDelegate method OnAddingTickMark(…).

Best regards,

Jan Akerman