Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rachalmers

macrumors member
Original poster
Oct 21, 2012
61
5
UK
Does anyone know of some tutorials that show how to draw gauges, dials, graphs and so on. I've just got to rectangles and squares ... but need to get a bit more complex!! Something like this would be good?
There appears to be lots for iPhone apps, but little for Mac programming. maybe I'm missing something here.... it just dawned on me that the drawing part may work just as well on Mac as iPhone. hmm
But I still need a tutorial or a guide.
Thanks
gauge.png
 
Core Graphics code is cross platform, excepting the flipped coordinate space. At the moment I don't recall other issues.

Surprisingly searching for the following didn't come up with much.

core graphic drawing gauges

Still, theses look like they could be helpful to you drawing gauges.

CORE ANIMATION TUTORIAL: SLIDER BASED LAYER ROTATION
http://www.cimgf.com/2008/10/25/core-animation-tutorial-slider-based-layer-rotation/

MSSimpleGauge
http://code4app.net/ios/Simple-Gauge/5204934a6803fa901a000000


Core Plot is popular for graphing so you may find many good examples.
 
Core Plot and the Layer Rotate tutorial

Core Plot, there is a LOT in it, looks a good place to start, and the Core Animation Tutorial as well might get me started. MSSimple gauge is iOS.

Thanks for the pointers, I'll see how I go.

actually, I may just be able to take some good gauge graphics, and then just animate the needle ?

Just discovered the Animation tutorial won't build on 10.9 (It's from 2008) so I'll have to hack about with that one. But coreplot contains some useful information.
 
Last edited:
For simple gauges, look into paintcode:
http://www.paintcodeapp.com/

For more complicated graphs you could use the DataGraph framework:
http://www.visualdatatools.com/DataGraph/

Simply make a graph, save it, and use that as a template where all you do is replace the data using a couple lines of code (4 lines including loading the controller). You have to pay for commercial access to the license, but it is probably faster than learning a plotting framework and it would look better.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.