Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad development: Circular and Linear Gauges

I have created a desktop (winforms) and web based (asp.net) dashboard application that uses the Dundas circular and linear gauges.

e.g. enter image description here

I need to recreate these gauges using the xcode ui and objective c (or something that can be imported into a view based project)

Are there any frameworks available that can create these types of gauges? I had a look at core plot, but it doesn't have this type of functionality.

like image 718
Thomas Avatar asked May 23 '26 18:05

Thomas


1 Answers

They are not as difficult as they seem. You simply need the graphic assets then distinguish the static vs animatable graphics assets.

The animation can be done fairly easily using Core animation. So let's say you have the first gadget (though Quartz2D will be much more performant - but it will be a good start to make it using simple UIViews).

The first gadget has just the needle that animates (or rotates based on a given value). rest of the image can be a simple UIImageView.

Do something like:

needleView.layer.anchorPoint = BOTTOM_RIGHT_POINT;//to not rotate at center but bottom right or whatever

...
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
CGAffineTransform transform = CGAffineTransformMakeRotation(angle_in_radians);
needleView.transform = transform;
[UIView commitAnimations];

This will rotate the needle.

Similarly for the two needles in second gauge. For the horizontal bars, do the same but using FRAME to set the size of bars relative to min_value and max_value.

like image 129
zakishaheen Avatar answered May 25 '26 07:05

zakishaheen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!