Graphing!

Discussion in 'iPhone/iPad Programming' started by dgdosen, Jul 16, 2008.

  1. macrumors 65816

    dgdosen

    Joined:
    Dec 13, 2003
    Location:
    Seattle
    #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...
     
  2. macrumors member

    Joined:
    Mar 23, 2008
    #2
    Take a look at the Accelerometer Graph sample code.
     
  3. macrumors member

    davedelong

    Joined:
    Sep 9, 2007
    Location:
    Right here.
    #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];
     
  4. thread starter macrumors 65816

    dgdosen

    Joined:
    Dec 13, 2003
    Location:
    Seattle
    #4
    Anyone have sample code that mimics the stock application graphing? That's pretty clean...
     
  5. macrumors Nehalem

    GoCubsGo

    Joined:
    Feb 19, 2005
    #5
    Kinda off topic but I sure wish they'd bring out a graphing calculator like the TI ones. :D
     
  6. macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #6
    NSBezierPath does not exist on the iPhone platform. I believe the way to do drawing like that is with CoreGraphics and a CGPath.
     

Share This Page