<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,20 +32,9 @@
 #import &lt;QuartzCore/QuartzCore.h&gt;
 
 @class TKTimeGraph, TKTimeGraphPointsView, TKTimeGraphIndicator;
-
-@protocol TKTimeGraphDelegate &lt;NSObject&gt;
-@optional
-- (NSString*) titleForTimeGraph:(TKTimeGraph*)graph;
-- (NSNumber*) goalValueForTimeGraph:(TKTimeGraph*)graph;
-@required
-- (int) numberofPointsOnTimeGraph:(TKTimeGraph*)graph;
-- (NSNumber*) timeGraph:(TKTimeGraph*)graph yValueForPoint:(int)x;
-- (NSString*) timeGraph:(TKTimeGraph*)graph xLabelForPoint:(int)x;
-- (NSString*) timeGraph:(TKTimeGraph*)graph yLabelForValue:(float)value;
+@protocol TKTimeGraphDataSource;
 
 
-@end
-
 
 @interface TKTimeGraph : UIView {
 	
@@ -55,7 +44,7 @@
 	BOOL goal;
 	float goalValue;
 	NSMutableArray *data;
-	id&lt;TKTimeGraphDelegate&gt; delegate;
+	id&lt;TKTimeGraphDataSource&gt; delegate;
 	
 	
 	// View
@@ -68,7 +57,7 @@
 	
 }
 @property (retain,nonatomic) NSMutableArray *data;
-@property (assign) id&lt;TKTimeGraphDelegate&gt; delegate;
+@property (assign) id&lt;TKTimeGraphDataSource&gt; delegate;
 - (void) setTitle:(NSString*)str;
 @end
 
@@ -86,3 +75,18 @@
 }
 - (id)initWithFrame:(CGRect)frame title:(NSString*)str sideUp:(BOOL)up;
 @end
+
+
+
+@protocol TKTimeGraphDataSource &lt;NSObject&gt;
+@optional
+- (NSString*) titleForTimeGraph:(TKTimeGraph*)graph;
+- (NSNumber*) goalValueForTimeGraph:(TKTimeGraph*)graph;
+@required
+- (int) numberofPointsOnTimeGraph:(TKTimeGraph*)graph;
+- (NSNumber*) timeGraph:(TKTimeGraph*)graph yValueForPoint:(int)x;
+- (NSString*) timeGraph:(TKTimeGraph*)graph xLabelForPoint:(int)x;
+- (NSString*) timeGraph:(TKTimeGraph*)graph yLabelForValue:(float)value;
+
+
+@end
\ No newline at end of file</diff>
      <filename>TapkuLibrary/TKTimeGraph.h</filename>
    </modified>
    <modified>
      <diff>@@ -88,48 +88,7 @@
     return self;
 }
 
-- (void)drawRect:(CGRect)rect {
-	//NSLog(@&quot;drawRect&quot;);
-    // Drawing code
-	if ([delegate respondsToSelector:@selector(titleForTimeGraph:)])
-		title.text = [delegate titleForTimeGraph:self];
 
-	
-	if(data == nil){
-		
-		activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
-		activity.center = CGPointMake(self.bounds.origin.x + self.bounds.size.width/2,self.bounds.origin.y + self.bounds.size.height/2);
-		[self addSubview:activity];
-		[activity startAnimating];
-		
-		[NSThread detachNewThreadSelector:@selector(getDelegateData) toTarget:self withObject:nil];
-		
-	}else{
-		CGContextRef context = UIGraphicsGetCurrentContext();
-		[self drawBackground:context];
-		[self drawBottomLine:context];
-		[self drawHorizontalLines:context];
-		
-		float width = ([data count] + 1) * pointDistance;
-		float height = scrollView.frame.size.height;
-		
-		scrollView.contentSize = CGSizeMake(width,height);
-		
-		pointsView = [[TKTimeGraphPointsView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
-		[pointsView setData:data];
-		pointsView.backgroundColor = [UIColor clearColor];
-		[scrollView addSubview:pointsView];
-		
-		if(goal)
-			[self drawGoalLine:context];
-		
-		border = [[UIImageView alloc] initWithImage:[UIImage imageFromPath:TKBUNDLE(@&quot;TapkuLibrary.bundle/Images/graph/mask.png&quot;)]];
-		[self addSubview:border];
-		
-	}
-	
-	
-}
 
 
 - (void) loadDelegateDataComplete{
@@ -197,6 +156,8 @@
 			if(yValue &lt; lowValue) lowValue = yValue;
 		}
 		[data addObject:point];
+		
+		[point release];
 	}
 	goal = NO;
 	NSNumber *g;
@@ -229,6 +190,49 @@
 	[pool release];
 }
 
+- (void)drawRect:(CGRect)rect {
+
+	
+	if ([delegate respondsToSelector:@selector(titleForTimeGraph:)])
+		title.text = [delegate titleForTimeGraph:self];
+	
+	
+	if(data == nil){
+		
+		activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
+		activity.center = CGPointMake(self.bounds.origin.x + self.bounds.size.width/2,self.bounds.origin.y + self.bounds.size.height/2);
+		[self addSubview:activity];
+		[activity startAnimating];
+		
+		[NSThread detachNewThreadSelector:@selector(getDelegateData) toTarget:self withObject:nil];
+		
+	}else{
+		CGContextRef context = UIGraphicsGetCurrentContext();
+		[self drawBackground:context];
+		[self drawBottomLine:context];
+		[self drawHorizontalLines:context];
+		
+		float width = ([data count] + 1) * pointDistance;
+		float height = scrollView.frame.size.height;
+		
+		scrollView.contentSize = CGSizeMake(width,height);
+		
+		pointsView = [[TKTimeGraphPointsView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
+		[pointsView setData:data];
+		pointsView.backgroundColor = [UIColor clearColor];
+		[scrollView addSubview:pointsView];
+		
+		if(goal)
+			[self drawGoalLine:context];
+		
+		border = [[UIImageView alloc] initWithImage:[UIImage imageFromPath:TKBUNDLE(@&quot;TapkuLibrary.bundle/Images/graph/mask.png&quot;)]];
+		[self addSubview:border];
+		
+	}
+	
+	
+}
+
 - (void) drawBackground:(CGContextRef)context{
 	// GRAY BACKGROUND 
 	CGContextSetRGBFillColor(context, 1, 1, 1, 1.0);
@@ -302,14 +306,20 @@
 	
 }
 - (void) drawGoalLine:(CGContextRef)context{
-	UIImage *img = [UIImage imageFromPath:TKBUNDLE(@&quot;TapkuLibrary.bundle/Images/graph/goalline.png&quot;)];
+	/*UIImage *img = [UIImage imageFromPath:TKBUNDLE(@&quot;TapkuLibrary.bundle/Images/graph/goalline.png&quot;)];
+	
 	UIImageView *image = [[UIImageView alloc] initWithImage:img];
 	int y = [self valueToYCoordinate:goalValue];
 	CGRect r = image.frame;
 	r.origin.y = stageHeight + stageTopMargin - y - 19;
 	image.frame=r;
 	[self addSubview:image];
-	[image release];
+	[image release];*/
+	
+	UIImage *img = [UIImage imageFromPath:TKBUNDLE(@&quot;TapkuLibrary.bundle/Images/graph/goalline.png&quot;)];
+	//481x19
+	[img drawInRect:CGRectMake(0, 0.5 + stageHeight + stageTopMargin - [self valueToYCoordinate:goalValue] - 19, 481, 19)];
+	
 	
 }
 
@@ -340,9 +350,6 @@
 
 @end
 
-
-
-
 @implementation TKTimeGraphPointsView
 @synthesize data;
 
@@ -450,7 +457,6 @@
 	}
 	
 }
-
 - (void) drawRect:(CGRect)rect {
 	
 	CGContextRef context = UIGraphicsGetCurrentContext();</diff>
      <filename>TapkuLibrary/TKTimeGraph.m</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@
 
 #import &quot;TKTimeGraph.h&quot;
 
-@interface TKTimeGraphController : UIViewController  &lt;TKTimeGraphDelegate&gt;  {
+@interface TKTimeGraphController : UIViewController  &lt;TKTimeGraphDataSource&gt;  {
 	UIButton *close;
 	TKTimeGraph *timeGraph;
 	UIStatusBarStyle statusColor;</diff>
      <filename>TapkuLibrary/TKTimeGraphController.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5304772c31c1eee80b0a67c2ae336f5516286e40</id>
    </parent>
  </parents>
  <author>
    <name>tapku</name>
    <email>support@tapku.com</email>
  </author>
  <url>http://github.com/sync/tapkulibrary/commit/37db5c30ff01ffacbff3bb494fadb2f9ac7bc73d</url>
  <id>37db5c30ff01ffacbff3bb494fadb2f9ac7bc73d</id>
  <committed-date>2009-10-25T10:35:09-07:00</committed-date>
  <authored-date>2009-10-25T10:35:09-07:00</authored-date>
  <message>Graph changes</message>
  <tree>faf00566ac121f3779e49785ec2dcddab16a8b32</tree>
  <committer>
    <name>tapku</name>
    <email>support@tapku.com</email>
  </committer>
</commit>
