D dgdosen macrumors 68030 Original poster Dec 13, 2003 2,858 1,497 Seattle Jul 16, 2008 #1 Anyone know if there's anything in the SDK about how to draw a simple 2D graph? Kind of like the Stocks Applet uses? Any push in the right direction would be greatly appreciated...
Anyone know if there's anything in the SDK about how to draw a simple 2D graph? Kind of like the Stocks Applet uses? Any push in the right direction would be greatly appreciated...
C chrisesposito macrumors member Mar 23, 2008 97 0 Jul 16, 2008 #2 Take a look at the Accelerometer Graph sample code.
davedelong macrumors member Sep 9, 2007 50 0 Right here. Jul 17, 2008 #3 The basic idea is that it's an NSBezierPath that you add a whole bunch of points to like so: Code: NSBezierPath * myPath = [NSBezierPath bezierPath]; [myPath moveToPoint:NSMakePoint(0,0)]; //the starting point [myPath lineToPoint:NSMakePoint(0,1)]; [myPath lineToPoint:NSMakePint(1,1)]; ... etc... [myPath stroke]; [myPath release];
The basic idea is that it's an NSBezierPath that you add a whole bunch of points to like so: Code: NSBezierPath * myPath = [NSBezierPath bezierPath]; [myPath moveToPoint:NSMakePoint(0,0)]; //the starting point [myPath lineToPoint:NSMakePoint(0,1)]; [myPath lineToPoint:NSMakePint(1,1)]; ... etc... [myPath stroke]; [myPath release];
D dgdosen macrumors 68030 Original poster Dec 13, 2003 2,858 1,497 Seattle Jul 20, 2008 #4 Anyone have sample code that mimics the stock application graphing? That's pretty clean...
GoCubsGo macrumors Nehalem Feb 19, 2005 35,743 155 Jul 20, 2008 #5 Kinda off topic but I sure wish they'd bring out a graphing calculator like the TI ones.
Sbrocket macrumors 65816 Jun 3, 2007 1,250 0 /dev/null Jul 20, 2008 #6 davedelong said: The basic idea is that it's an NSBezierPath that you add a whole bunch of points to like so: Code: NSBezierPath * myPath = [NSBezierPath bezierPath]; [myPath moveToPoint:NSMakePoint(0,0)]; //the starting point [myPath lineToPoint:NSMakePoint(0,1)]; [myPath lineToPoint:NSMakePint(1,1)]; ... etc... [myPath stroke]; [myPath release]; Click to expand... NSBezierPath does not exist on the iPhone platform. I believe the way to do drawing like that is with CoreGraphics and a CGPath.
davedelong said: The basic idea is that it's an NSBezierPath that you add a whole bunch of points to like so: Code: NSBezierPath * myPath = [NSBezierPath bezierPath]; [myPath moveToPoint:NSMakePoint(0,0)]; //the starting point [myPath lineToPoint:NSMakePoint(0,1)]; [myPath lineToPoint:NSMakePint(1,1)]; ... etc... [myPath stroke]; [myPath release]; Click to expand... NSBezierPath does not exist on the iPhone platform. I believe the way to do drawing like that is with CoreGraphics and a CGPath.