Put a line on zero value of y axis - core-plot

Helo,
Is it possible to put a line on zero value of y axis ?
Because i have negatives values so i changed orthogonal value of my axis to the lowest one on my datasource.
Thanks

Make second x-axis and position it at zero. You can leave off the labels and tick marks to just get the axis line. See the axis demo in the Plot Gallery app for an example of how to add additional axes to a Core Plot graph.

Related

my vertical x axis labels run into my plotted data. Is there a way to compress the graph so I have a little extra room at the bottom

I am plotting my x axis labels vertically, and using the following line to provide a little space under the axis
axisSet.xAxis.axisConstraints = [CPTConstraints constraintWithLowerOffset:40.0];
But now the vertical length of the label bumps into the first value on the y axis. Is there a way to compress the graph a little so the first value on the y axis begins a little higher? Thanks.
Adjust the axis' labelAlignment and/or labelOffset to reposition the labels.

iOS Core Plot "Function transformation" - Y axis only origin

I cannot find how to do this for a while now, my graph is drawn ok every time but I want to move up my graph, like when you have f(x) + n. So, what I want to do actually is change Y origin, so I can draw my (x,0) points. I do not want to draw my points on X axis, I do not see the line that good. I want that my zero Y point actually starts at point three, but not to transform the graph at the same time. Here is picture of what I want to do (see the green line and Y point):
The plot space yRange controls the range of data visible. The image in the question looks like it has a location of negative one (-1) and length of 18. You can use the axisConstraints to keep the x-axis along the bottom of the plot area. If you don't want to use constraints, set the orthogonalPosition to the location of the yRange.

Core Plot Tick Marks on Both Sides of Axis?

Is it possible to position tick marks in the center of an axis?
I don't have enough reps to post images, but here's the general idea...
--|--|--|--|--|--|--|--|--|--|--
Use the tickDirection property of the axis. The default (CPTSignNone) centers the tick marks on the axis as shown in your drawing.

Core Plot - X-Axis moving position when plotting less points

I have a strange problem where my x-axis moves down the plot area when I'm plotting less points. My graph has 2 lines plotted - 1 for previous year and 1 for current year values. My original graph always plotted 12 points for both lines, regardless of which month we are in and this works fine. I have now changed my app so that the current year line only plots points upto the current month. E.g. we are in May so I only plot 5 points. When I do this the x-axis moves down the plot area so that it is detached from the y-axis and the labels are hidden - see screenshots :
Why would simply reducing the number of plot points change the x-axis position? I'm using Core Plot 1.1 (static library) and Xcode 4.6.2.
The yRange of the plot space changed so the point where the x-axis crosses the y-axis is now too close to the bottom edge of the graph. You have two options:
Ensure the yRange always puts the crossing point (the "orthogonal coordinate") far enough from the edge that the labels and title remain visible.
Use the axisConstraints to position the axis a fixed distance from the edge of the graph. This will let the crossing point float along the y-axis.
The plotting library changes the x-axis position because generally core plot take the minimum and maximum range among the values of y axis. You when you provide only 5 points then the lowest value is taken from y axis values and there for x- axis position while when you were providing all 12 months values the lowest value of the rest of the month were 0 and therefore x-axis was at zero. You can change the maximum and minimum values for the y range in core plot.

Setting axis line in core plot in ios

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
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.
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)];

Resources