Can someone give me some good tutorials on Creating a 2D plot on IPhone given a variable number of x,y coordinates?
I dont really see an example on there. Dont really understand how to interpret that in making a 2D graph. Can you please help?
Nick LaMarca
2010-06-08 20:56:33
In an iPhone application, you set up a UIView object to draw path with the CGContextAddLineToPoint. That page includes a lot of information and you should start at the beginning. Its not that hard.
Shyam
2010-06-09 07:58:22
+1
A:
If you're looking for something beyond just plotting the points, check out the open source Core Plot framework for Mac and iPhone. It's still a young project, but it can handle a scatter plot (with or without lines between the points) along with labeled axes just fine. There are a number of example programs included with the framework that demonstrate some of its capabilities.
Eric Skroch
2010-06-09 03:18:55
+1, we used Core Plot to great effect on my last iPhone project - it's definitely not super polished but it's pretty well-architected
Daniel DiPaolo
2010-06-09 03:24:41
I checked that out but there isnt any sample code on how to make a 2D graph. Do you have any good tutorials?
Nick LaMarca
2010-06-09 05:36:10
Look at CPTestApp in the examples folder for scatter plot demos. The Mac, iPhone, and iPad versions all use them, as do several of the other examples. Everything in Core Plot is 2D only right now. If you want to only plot the points and not a line chart, be sure to set a plot symbol (either on the plot itself or using the datasource) and set the line style for the plot to nil.
Eric Skroch
2010-06-09 11:41:57