How to achieve a Heart-rate-monitor styled plot in Coreplot

117 Views Asked by At

I'm using the Real Time Plot (in CorePlotGallery) to graph incoming ECG heart data. This works, but since it autoscrolls the X axis horizontally as new data arrives (which I don't want) I've modified the "-newData:" method in RealTimePlot.m with:

if (self.currentIndex >= kMaxDataPoints) self.currentIndex = 0;

This allows the plot to "chase" itself over & over on the graph. Great.

Problem: When the plot wraps back to the start, Coreplot connects the plot end point with the new start point, resulting in a horizontal plot line cutting through the entire graph, from the last point back to the first.

Q1: Is there a way I can get Coreplot to not connect these two data points?

Q2: Alternatively, is there another way of achieving a "heart rate monitor" styled plot in Coreplot with a real time data stream?

1

There are 1 best solutions below

3
Eric Skroch On

Add a dummy data point between the two where you want the break and give it a value of NAN or nil. You'll end up with one more data index than points you want displayed.

Alternatively, use two scatter plots to display the data. Add data points to one and remove them from the other and then switch when you get to the end.