Cemre Mengü
Cemre Mengü

Reputation: 18754

Core Plot drawing a straight y axis line with the labels on top

For the image below

enter image description here

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

Answers (1)

iDev
iDev

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

Related Questions