0
votes

I am plotting a bar graph using core plot for both positive and negative values.I want a line at x=0 seperating the positive and negative values .Can anyone tell me how to set the axis line

thanks

2
Have you looked at the Core Plot example apps? Can you post a mockup image of the effect you're trying to achieve? - Eric Skroch
I am trying to plot bars in both directions-positive and negative so I want only one horizontal line and vertical line to cut each other at the origin.The mock image is (0,0) ________________________ I want this line only on x=0 and y=0 - user1216304

2 Answers

0
votes

You need to set the orthogonalCoordinateDecimal property of the axes. So for example:

        yAxis.orthogonalCoordinateDecimal = CPTDecimalFromDouble(0); 

will make 0 the point of the yAxis where the yAxis crosses the xAxis.

0
votes

In addition to using the orthogonalCoordinateDecimal as @pe60t0 mentioned, set the plot range of the y-axis so it covers both positive and negative values. For example to make the y-axis span from -10 to 10,

plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(-10.0)
                                                length:CPTDecimalFromDouble(20.0)];