Reputation: 18754
For the image below
Does anyone know how to get those horizontal lines with the numbers on top of them ? All I can get so fat is to color the ticks themselves and the numbers standing to the right of them. Any ideas how this can be achieved ?
Upvotes: 1
Views: 1290
Reputation: 23278
You need to use the majorGridLineStyle
properties on your axes. Also check the minorGridLineStyle
property. You can see an example in the CPTestApp. For more details check this google forum.
for eg:-
CPTMutableLineStyle *yMajorGridLineStyle = [CPTLineStyle lineStyle];
yMajorGridLineStyle.lineCap = kCGLineCapRound;
yMajorGridLineStyle.lineColor = CPTColor whiteColor];
yMajorGridLineStyle.lineWidth = 1.0;
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *yAxis = axisSet.yAxis;
yAxis.majorGridLineStyle = yMajorGridLineStyle;
In order to move the numbers to the right side of the axis, you can use,
yAxis.tickDirection = CPTSignPositive;.
Also use,
yAxis.labelAlignment = CPTAlignmentBottom;
Upvotes: 1