I'm using core-plot to display data that doesn't pass through zero on x or y axes, and I'd like the axes to be displayed too. The data is displayed correctly but the axes aren't shown at all. I see that the API has changed recently and it appears that the property to use is isFloatingAxis but I still can't get it to display. My code is below, based on the tutorial on switchonthecode.com:
graph = [[CPXYGraph alloc] initWithFrame:self.view.bounds];
CPLayerHostingView *hostingView = (CPLayerHostingView *) self.view;
hostingView.hostedLayer = graph;
graph.paddingLeft = 20.0;
graph.paddingTop = 20.0;
graph.paddingRight = 20.0;
graph.paddingBottom = 20.0;
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
double minTime = [tideLocation minTime];
double maxTime = [tideLocation maxTime];
double range = maxTime - minTime;
float minHeight = [tideLocation minHeight];
float maxHeight = [tideLocation maxHeight];
float range2 = maxHeight - minHeight;
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromDouble(minTime)
length:CPDecimalFromDouble(range)];
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(minHeight)
length:CPDecimalFromFloat(range2)];
CPLineStyle *lineStyle = [CPLineStyle lineStyle];
lineStyle.lineColor = [CPColor blackColor];
lineStyle.lineWidth = 2.0f;
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
CPConstraints xConstraints = {CPConstraintNone};
axisSet.xAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"3600"] decimalValue];
axisSet.xAxis.minorTicksPerInterval = 4;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.minorTickLength = 5.0f;
axisSet.xAxis.majorTickLength = 7.0f;
//axisSet.xAxis.axisLabelOffset = 3.0f;
axisSet.xAxis.constraints = xConstraints;
axisSet.xAxis.isFloatingAxis = YES;
axisSet.yAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"5"] decimalValue];
axisSet.yAxis.minorTicksPerInterval = 4;
axisSet.yAxis.majorTickLineStyle = lineStyle;
axisSet.yAxis.minorTickLineStyle = lineStyle;
axisSet.yAxis.axisLineStyle = lineStyle;
axisSet.yAxis.minorTickLength = 5.0f;
axisSet.yAxis.majorTickLength = 7.0f;
//axisSet.yAxis.axisLabelOffset = 3.0f;
axisSet.yAxis.constraints = xConstraints;
axisSet.yAxis.isFloatingAxis = YES;
CPScatterPlot *tidePlot = [[[CPScatterPlot alloc]
initWithFrame:CGRectMake(90, 12, 200, 25)] autorelease];
tidePlot.identifier = @"Tide Plot";
tidePlot.dataLineStyle.lineWidth = 1.0f;
tidePlot.dataLineStyle.lineColor = [CPColor redColor];
tidePlot.dataSource = self;
[graph addPlot:tidePlot];