I want to correct the axes so that they are always left and left of my plot. My current implementation does not allow userInteraction, so there is no need to worry about scrolling.
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.allowsUserInteraction = NO;
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
CPXYAxis *x = axisSet.xAxis;
x.orthogonalCoordinateDecimal = CPDecimalFromString(@"0.5");
x.minorTicksPerInterval = 0;
x.labelingPolicy = CPAxisLabelingPolicyAutomatic;
CPXYAxis *y = axisSet.yAxis;
y.minorTicksPerInterval = 0;
y.orthogonalCoordinateDecimal = CPDecimalFromString(@"0");
y.labelingPolicy = CPAxisLabelingPolicyAutomatic;
...
[plotSpace scaleToFitPlots:[NSArray arrayWithObject:boundLinePlot]];
CPPlotRange *xRange = plotSpace.xRange;
[xRange expandRangeByFactor:CPDecimalFromDouble(1.25)];
plotSpace.xRange = xRange;
CPPlotRange *yRange = plotSpace.yRange;
[yRange expandRangeByFactor:CPDecimalFromDouble(1.1)];
plotSpace.yRange = yRange;
Edit: I want to figure out how to fix my x axis and y axis at the bottom of the graph and the left of the graph, respectively. I do not have SS, but I basically want to display a graph with axes that are locked in a given position. Alternatively, is there a way to completely remove the x axis so that I can just have the y axis? If so, it is much easier to lock the y axis in a fixed position.
source
share