0

I have looked all over the web and can't come up with anything that satisfies what I'm trying to write.

I have a syringe that causes this silicon tubing to either have no pressure or the max-capacity pressure. I represent this pressure in volts, the value of which I send to my iPhone in order for me to display a line graph of this fluctuating voltage (using Core Plot 2.2).

However, I also want to implement one of those horizontal pressure bar graphs, where (initially with 0 pressure), the bar is empty, but when I apply pressure to the syringe, the bar begins to fill up with a horizontally-flexible blue rectangle, depending on the pressure. How do I do this? Is there a process that Core Plot adopts? Or another framework? Or do I just have to improvise and learn CoreAnimation beyond my current knowledge so that I can just draw this bar graph up?

I'm using Objective-C, Xcode 7.3.1, and deploying to iOS 8.3.

1 Answers1

0

Core Plot can draw bar plots, too. It can be part of the same graph with the scatter plot or in a separate graph, depending on the desired layout.

Different plot types use different names for the data fields but otherwise the datasource works the same way for all of them.

Eric Skroch
  • 27,381
  • 3
  • 29
  • 36
  • Can it also be used as a real-time "fullness" tracker, where depending on how much pressure is in the syringe, the bar graph reacts continuously? – Anthony Baldini of the SMEPOH Feb 21 '17 at 11:53
  • Yes. Call `-reloadData` on the plot whenever a new measurement is available and pass the new value to the plot via the datasource. The only restriction is that any interaction with Core Plot should happen on the main thread. – Eric Skroch Feb 21 '17 at 12:42
  • Ok, great that makes sense. One more question, would there be any issues in terms of conflicting real-time graphs? I was thinking of using the line graph plot display data with the bar tracker underneath in my View controller...both using the same data but performing (hopefully) synchronously. I don't know how fast everything works so if noticeable delays occur, then I'd work around them. Thanks Eric. – Anthony Baldini of the SMEPOH Feb 21 '17 at 13:10