- (void)drawPlot

{
	
	[self preparePlot];
	[self drawPlotBitmaps];
	
}

- (void)preparePlot

{
	
	[plotBitmaps removeAllObjects];
	
	for (NSString * key in [data keyEnumerator])
		
	{
		
		NSInvocationOperation * operation = [[NSInvocationOperation alloc]
											 initWithTarget:self
											 selector:@selector(prepareBitmapForSeriesWithKey:)
											 object:key];
		
		[queue addOperation:operation];
		
	}
	
	[queue waitUntilAllOperationsAreFinished];
	
}

- (void)prepareBitmapForSeriesWithKey:(NSString *)key

{
	
	//... I cut this short to expose important parts ...
	//... here I create a path for given series, then ...
	
	NSBitmapImageRep * bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
																		 pixelsWide:self.frame.size.width 
																		 pixelsHigh:self.frame.size.height
																	  bitsPerSample:16 
																	samplesPerPixel:4 
																		   hasAlpha:YES 
																		   isPlanar:NO 
																	 colorSpaceName:@"NSCalibratedRGBColorSpace" 
																		bytesPerRow:0 
																	   bitsPerPixel:0] autorelease];
	
	NSGraphicsContext * context = [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];
	
	[NSGraphicsContext setCurrentContext:context];
	
	[color setStroke];
	[path stroke];
	
	//... I add all the bitmaps to an array ...
	
	[plotBitmaps addObject:bitmap];
	
}

//... and finally, draw all the bitmaps ...

- (void)drawPlotBitmaps

{
	
	for (NSBitmapImageRep * bitmap in plotBitmaps)
		
	{
		
		[bitmap drawInRect:self.frame
				  fromRect:self.frame
				 operation:NSCompositeSourceOver
				  fraction:1.0
			respectFlipped:NO
					 hints:nil];
		
	}
	
}

@end