CorePlot axisLine and gridLine length too long - ios

I'm using CorePlot for my current project and its amazing.
The only problem I came across is the length of the axis and grids.
I'm only using a positiv coordinate system with labels on the left and bottom side.
And my problem is the length of the axis and grids in direction to my labels.
I tried to use:
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"-value");
axisSet.yAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"-value");
or
x.labelOffset = value;
y.labelOffset = value;
but this is only setting the distance of my labels different and not affecting the grids length.
In my example the y-axis and there grid overlaps my label:#{1,2,3,4,5,6,7,8}
Did somebody dealed with the same problem? THX for all answer to the right way!

Use the visibleRange and gridLinesRange to limit the axes and grid lines, respectively. See the "Control Chart" in the Plot Gallery example app for sample code.

Related

How to shift data on xAxis to right on Daniel Gindi charts?

I have a data chart DataChart would like to shift data of xAxis along with data lines to right by certain value.
DataChart Screen Shot
Please help me out which property to use from the library that would be able to solve this purpose.
I am using Daniel Gindi line charts for this purpose.
I use this to create an offset to the left of my chart
myChart.xAxis.spaceMin = 10
maybe it'll do for you
And to align the yAxis lines in front of the labels, i think you could remove the background grid and create your own limit lines if you don't find any other way around
is it viable to subtract the distance d from the x values? that would shift it rightward.
d = 7.0
rightShifted = newGraphData.values.map{ChartDataEntry(x:$0.x-d, y:$0.y)}

Coreplot Y axis cut off / no numbers?

I am having issues with my implementation of CorePlot. I have a subview in my UIViewController than contains the chart. Most of the data shows up fine but no increments / values are showing up on the y axis.
This is what I am seeing now:
If I shift the x axis start point by subtracting 10 (to better see the left half of the chart) I see this:
For the record, I do not have any values outside of the (positive x, positive y) quadrant on the chart and have logged out my data to verify this. Any input / advice would be appreciated, thank you!
http://www.raywenderlich.com/13271/how-to-draw-graphs-with-core-plot-part-2
This guy does a great job explaining that about halfway down... search for "You're Getting There!" to find exactly where he talks about the weird lines in the Y axis.
Hope this helps!
Set the leftPadding on the graph.plotAreaFrame to leave room for the axis labels at the left side of the graph.
The smeared y-axis is caused by too many tick marks and labels—they overlap and become illegible and negatively impact drawing performance. You need to adjust the labeling parameters to reduce the number of ticks and labels. By default, the axis draws major tick marks and labels one unit apart. The properties that need to be changed depend on the labeling policy you want to use.

coreplot Xaxis start value iOS 7

I am developing an Area chart like the following and facing the following issue.
curve shape is not looking proper, i need a smooth curve.
X-axis values are Dynamic, it May start with 40 or May be 60 or
any other value.how to calculate that ?
Any Help will be greatly Appreciated.
To make the line smoother, either give it more data points or make a curved plot.
plot.interpolation = CPTScatterPlotInterpolationCurved;
If you know the range of data values, just set the xRange directly. Remember to set the location to the min value and the length to (max - min). You can also have the graph scale the plot space for you.
[plotSpace scaleToFitPlots:[graph allPlots]];

Non-scaling / absolute gradient for scatter plots in CorePlot?

I've added a gradient to my scatter plot in the usual manner:
CPTFill areaGradientFill = [CPTFill fillWithGradient:areaGradient1];
boundLinePlot.areaFill = areaGradientFill;
boundLinePlot.areaBaseValue = 0;
Setting the minimum for the gradient is easy to do with the areaBaseValue property. However, the gradient will always stretch such that the entire range of color defined by areaGradient1 appears below the line plot.
What I'd like to do is set an absolute y-axis range (e.g., 0 to 100) and have the gradient always be set to that range. So if my line is at y=50, only the bottom 50% of the gradient would be rendered below the line. I thought setting boundLinePlot.areaBaseValue2 = 100; would do this, but it doesn't have any effect.
Does CorePlot support this? If not, what's the 'right' way to go about implementing it?
(This is my first question so apologies if I'm not clear. Be gentle. :) )
While there's no direct way to make this happen you could use a trick. Make your horizontal global range wider than what you would show normally and do not make the graph horizontally scrollable. Add a value to the graph in the hidden area that is always your maximum value. This will be filled with the full gradient. Other parts however will only get a partial gradient, depending on their height.
I found this trick by accident while looking at one of my graphs. Look:
The overview at the top shows where the big graph is currently (the green limit band). Now compare this with another part:
You can clearly see that the tip of the large value has a different gradient value as the tip of the smaller one.
You can use a "background limit band" to draw a fill at a certain size behind the plots, but that won't be clipped to the plot line.

Core-Plot X-Axis Label Position Offset

I'm trying to shift the x-axis labels upwards. Is there a property that I can set to do that? I've tried adding some bottom padding to the plot frame, but all that does is to squeeze the entire plot upwards.
Another question answered on Stack Overflow led me to change 'orthogonalCoordinateDecimal'. For instance:
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"0")
This caused my X-axis to pass through the origin. To raise my X-axis in relation to my graph, I changed the value to '25000', as in:
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"25000")
On thing to be mindful of is scale. My values in this case ranged from 0 - 185,000 so a shift of 25,000 is approximately equivalent to a shift of 4 when the upper value of the axis is 30 (days in my case, just for example). I was originally trying to shift the 0-185,000 axis by 5.0, and wondering why it had no effect, thinking it was a measurement of screen real estate instead of a scaled value.
The property your looking for is axisSet.xAxis.labelOffset
It is not totally clear, may be you need this
x.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];
Or to display labels above axis you can use this:
x.tickDirection = CPTSignPositive;

Resources