Got the answer after trying a bit.
First of all, I built a Custom CPTLayer and inside it used the image to be filled.
CustomImageForScatterPlot.h file
#import "CPTLayer.h"
@interface CustomImageForScatterPlot : CPTLayer
{
UIImage *_image;
}
-(id)initWithImage:(UIImage *)image;
@end
CustomImageForScatterPlot.m file
#import "CustomImageForScatterPlot.h"
#import "CPTLayer.h"
@implementation CustomImageForScatterPlot
-(void)dealloc{
[_image release];
[super dealloc];
}
-(id)initWithImage:(UIImage *)image{
CGRect f = CGRectMake(0, 0, image.size.width, image.size.height);
if (self = [super initWithFrame:f]) {
_image = [image retain];
}
return self;
}
-(void)drawInContext:(CGContextRef)ctx{
CGContextDrawImage(ctx, self.bounds, _image.CGImage);
}
@end
NOW, in the Scatter plot graph file, I used the following delegate method to return the images
- (CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index
{
CustomImageForScatterPlot* layer = [[CustomImageForScatterPlot alloc] initWithImage:[UIImage imageNamed:@"dots.png"]];
layer.frame = CGRectMake(2, 0, 34, 6);
return layer;
}
ENJOY CODING.... :)