Re: XY Graph
Re: XY Graph
- Subject: Re: XY Graph
- From: David Remahl <email@hidden>
- Date: Sat, 20 Apr 2002 18:15:33 +0200
>
Can anyone point me to some sample code that shows how to knock out a quick
>
xy graph plot using cocoa.
>
>
TIA
>
>
Brya Rieger
>
email@hidden
Gnuplot for Aqua
http://aquaterm.sourceforge.net
:)
That may be a tiny bit more advanced than you were asking for...
But the point is that this is not really a question suitable for this forum.
A suitable question for cocoa-dev would be "How do I draw a line between two
points.", not "How to draw a xy graph plot.". But since the question was
brought up...A simple (read: simplistic) way to do it, is to sample the
function for a few evenly spaced x values, and get the corresponding y
values. Then you can use NSBezierPath to draw: [bezier
lineTo:NSMakePoint(aSampleX,aSampleY)]. It is really quite easy once you've
got a set of corresponding points. It is made even simpler because Cocoa,
unlike some other API's have screen (and view) coordinates with the origin
in the lower left corner, like the first quadrant of a carthesian coordinate
system.
If you need more help on using NSBezierPath I suggest you post a more
specific question.
/ david
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >XY Graph (From: Bryan Rieger <email@hidden>) |