Rotate tick labels


#1

Hi,

i’m using Charts to plot some data in my application.

Whereas i need to have the origin of the axis in the bottom right corner (with the yAxis on the right side), i transormed my chart with the following command:

chart.layer.transform = CATransform3DMakeRotation(M_PI,0.0,1.0,0.0);
 
It looks good, but the tick labels on the yAxis are obviously "flipped".
 
 First question: Do you know how can i show them in the correct way or how can i change the origin of the axis in order to put it in the bottom right corner?
 
 Second question: Is there a way to add a string at the end of each tick label without affecting the chart? Something like: "0.2X" - "0.3X" - "0.4X" etc.
 
Thanks in advance.
Cesare

#2

Hi Cesare,

You could do a couple of things here - you could check that the yAxis labels aren’t already transformed, and if so, set a transform to get them in the right orientation. Alternatively you could not transform the chart, and instead move the yAxis to the right hand side, which can be done by setting the .axisPosition property.

To add a string to each tick label you can implement the alterTick: delegate method and append to tickMark.tickLabel.text, if it doesn’t already end with “X”. Note you may need to also implement the longestLabel delegate method in order to inform the chart that your labels will need more space.

Hope this helps!