I am drawing icons at custom tick locations in an xy graph with a scatter plot using Core Plot 1.0 on iOS 5. I've been having performance issues on the iPad 3 with allowing user interaction and scrolling the graph horizontally. I started looking into using the collapsesLayers property of CPTGraphHostingView as a potential solution. Enabling it works quite well for me except for one particular issue that I have not yet been able to solve. My custom axis labels set up to render images will not display. I'm wondering if anyone has any thoughts about what might be the cause. As near as I can tell the axis labels are still being positioned properly at the correct custom tick locations. The only difference in my external code is swapping collapsesLayers from NO to YES.
Here is how I am constructing the axis labels:
+ (CPTAxisLabel *)buildIconAxisLabelAtLocation:(CGFloat)location withImageNamed:(NSString *)imageName
{
CPTLayer *imageLayer = [[CPTLayer alloc] initWithFrame:CGRectMake(0, 0, 16, 16)];
UIImage *image = [UIImage imageNamed:imageName];
CALayer *imageSubLayer = [[CALayer alloc] init];
imageSubLayer.frame = imageLayer.frame;
imageSubLayer.contents = (id)image.CGImage;
[imageLayer addSublayer:imageSubLayer];
CPTAxisLabel *iconLabel = [[CPTAxisLabel alloc] initWithContentLayer:imageLayer];
iconLabel.offset = 8;
iconLabel.tickLocation = CPTDecimalFromCGFloat(location);
iconLabel.rotation = M_PI;
return iconLabel;
}
Any help is appreciated.