PDA

View Full Version : Need some Advice on Status Indicator




pilotError
Jun 4, 2012, 06:10 PM
I'm working on an Open Source project to interface to a battery charger.

This particular charger only comes with Windows Software, and that's just not right...

Either way, I've reverse engineered a large part of the communications protocol and have a basic front end up and running.

I wanted to get fancy with it, but I have two issues. I'm not a front end developer by any means. I don't have a lot of coding time on Mac / Xcode and the various libraries.

Given that, I have two things I would like to accomplish.

I want to create a Battery Charge Indicator, similar to what the iPhone has when it's plugged in. That giant green battery, not the one on the status bar. I don't even know how to begin / what API's to use; create a set of jpg's and display them?, core graphics? Any good tutorials for this type of thing? It's asking a lot, I know...


The second issue is I want to create real time graphs of various variables. Anyone recommend a good open source charting library?



Sydde
Jun 5, 2012, 01:01 PM
For the charge display, you want NSLevelIndicator (http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSLevelIndicator_Class/), which produces a green image just like Apple's battery display (which you would have to embed in a battery graphic).

Seems to me that NSBezierPath would handle most of the grunt work you would need for graphing. You might define a class that contains a path object and a color that updates and draws itself in its view. Bear in mind, though, that the view for paths should be flipped so that its Y value increases visibly upward instead of downward.