Draw graph using accelerometer data in core-plot - iphone

I'm new to this core-plot framework and trying to draw a line graph based on X and Y acceleration. I can already get my X and Y values and have successfully added core-plot in my project. I'm quite lost on how to start this, so basically, I will have X and Y values and how do I plot this using core-plot? any help is suggested. Thanks!

Maybe my answer is a little bit off topic, as it's not using core-plot, but did you look at the "AccelerometerGraph" sample app provided with Xcode?
It provides a nice plot which is dynamically updated while new accelerometer events are registered. The great of this sample is the way CoreAnimation has been used to "speed-up" Quartz2D. And you get all of this using system framework only and no third party code (apart your adaptation of Apple's one).

Look at the Core Plot examples to see how to set up a basic graph. You'll want to use a scatter plot. Call -reloadData on the plot whenever you have new data to display. If only some of the data points change on each frame, you can use the following methods to do a partial update:
-(void)reloadDataInIndexRange:(NSRange)indexRange;
-(void)insertDataAtIndex:(NSUInteger)index
numberOfRecords:(NSUInteger)numberOfRecords;
-(void)deleteDataInIndexRange:(NSRange)indexRange;
The Real Time Plot in the Plot Gallery example app shows one way to use these methods.

Related

How would I replicate graphs like the following in Core Plot?

I would like to use the Core Plot framework to produce a graph that looks like the following:
Additionally, I would like to provide charts within a table view like the following:
How would I set up charts like these using Core Plot?
The first one is easy--it's just a scatter plot with a gradient fill. The examples included with the framework show how to do this.
See this thread on the Core Plot discussion board for ideas on how to approach the second problem: http://groups.google.com/group/coreplot-discuss/browse_thread/thread/00344ef4e0234a51
http://code.google.com/p/core-plot/w/list
You can refer this link for installing core-plot.
http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application. Also read the comments section in the above link for some changes.

IPHONE - Plotting location in UIView with XY coordinates iphone SDK

Here is my question , I want to create a soccer match team formation for an app base on the X and Y coordinates return.
Does anyone have the example or tutorial?
There is a really good framework for plotting called Core Plot. I tried that before, it's a great framework you can draw plot like you deal with TableView. If you serious about plotting the you should have a look at it. If not then it maybe a bit over-kill.

Draw ECG graph dynamically in iphone?

HI All,
Is there any way to draw a 2d graph of ECG (in wave form) in iphone .I am getting a large anount of data in couple of seconds i mean the gap will be of just 1 Secs.then is there any way to draw the graph in iphone or any library (IN c or c++) by which i can use it and it draw a live graph of any heart beat analysis and looks alike a live video.
Thanks
Balraj.
Apple's Accelerometer example app (available on their iOS developer site, and with full source code) shows how to draw a 2D graph animated several times a second.
In addition to the Accelerometer sample that hotpaw2 points to, which is reasonably performant when it comes to graphing realtime data, there is the Core Plot graphing framework. Core Plot can give you a drop-in component with more options when it comes to formatting your graphs, but it may not be the fastest for displaying many data points that change rapidly on the iPhone.

Sample Tutorials Of Plotting A 2D Graph On Phone SDK

Can someone give me some good tutorials on Creating a 2D plot on IPhone given a variable number of x,y coordinates?
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.
You can do this with the CGContextAddLineToPoint method.
http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_paths/dq_paths.html#//apple_ref/doc/uid/TP30001066-CH211

How to make the coordinate of a graph user interactive?

I have tried to plot a graph using Quartz 2D . It looks more like a drawing. But I am fixing the axes and plotting the coordinates according to the axes. But the problem is I want to make the graph user interactive. Each coordinate on the graph will further have to drill down showing the details of the coordinate. So how can I make the coordinates interactive .
Rather than rolling your own Quartz graph with interactivity, you might want to take a look at the Core Plot framework, which is available for Mac and iPhone. The stubs are there to provide user interactivity, but we haven't filled in any implementations of this yet.
If you wish, you can implement
-(BOOL)containsPoint:(CGPoint)thePoint
-(void)mouseOrFingerDownAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerUpAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerDraggedAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerCancelled
within the appropriate CPLayer subclass to make that Core Plot element respond to user interaction. We will also be setting up a delegation pattern so that your controllers can handle the logic for interaction events as well.