percent graphical representation as circle - iphone

im planning to do a percentage visualisation using a circle, and am currently trying to figure out what framework / technique to use.
i have used corePlot for graphs so far and have been wondering if it might be an option
my ideas are so far:
1: use a Core Plot piechart and add a covering circle layer in the middle
2: try to use quartz 2d to do it somehow
attached is a mockup how it should look like so you get an idea:
what do you think might be the best approach here? id like avoid using cover-up subviews and such..
is there any simple solution i might be missing?
thanks in advance
sebastian
(PS: i do not hope for any code here, just a general fingerpoint to the right direction)

As more of an alternative than an actual straightforward CorePlot answer, you could display your percentage in a customized version of the UICircularProgressView control which I can personally vouch for.

Related

Graph combining HorizontalBarChart & CubicLineChart?

Is it possible to draw a graph combining a HorizontalBarChart with a CubicLineChart with iOS-charts? The CubicLineChart would be drawn from top to bottom, following the horizontal bars rather than left to right.
If not, can anyone recommend a graph library that would support this please?
Currently, No. But technically, you could, but you need to do a lot of decent study on the framework and rewrite a bunch of methods to get it work.
Check out how combined chart is carried out, and make sure you understand how the ChartTransformer get setup and work. Then you are good to go.
The other way is, use vertical bar chart and normal line chart to get what you want, like a combined chart, and rotate it 90 degree, and customize the axis labels maybe easier for you?
BTW, you need to know that chart is making data easy to understand, I'm not sure would a chart like you said make it easier?

How to create inverted cone graph using iPhone SDK?

I tried to google this but could not find anything.
Do you have any idea how to create inverted cone graph like this?
I don't think that there is any direct API which does this.
But you can try to draw or plot it using
Drawing and Printing Guide for iOS
or
try using CoreGraphics Framework at more basic level to draw something like what you want.
Hope this helps you.

iPhone: An UI question

I want to implement an UI which should look like Speedometer. Is there a way to implement like that? Some of apps i seen that they have implemented. For ex. an app called "TaxCaster" implemented it. Could someone help me how can i achieve it?
Thank you in Advance.
That is possible yes, but it will not be easy. You will have to either use OpenGL or Core Animation. I would suggest the latter if you want something like they have in TaxCaster.
You can find more about Core Animation here.
I hope it helps.
A possibility is to simply have two UIImageViews:
A background that has all the measurement listings (i.e. the ruler part), and another that would act as your needle, pointing to the current measurement. All you would need to do when changing the current measurement would be to use the transform property to rotate it into the correct position.
Not a trivial amount of work, but it shouldn't be too hard.

How to draw a piechart in iPhone

I want to draw a piechart in my application. Do anyone know any code or tutorial to help me out. I found some in the following link
http://rajeev.name/blog/2009/01/18/drawing-pie-charts-using-iphone-sdk/
but if there is any other more efficient way to do it, I want to learn it.
I'm not sure if you know how to do pie charts on other platforms, but there really are some basic techniques that you should be aware of and understand, before embarking on creating pie charts on ANY platform.
See here for a pretty good discussion. There are many more out there, if you want to learn more.
Applying that to the iPhone isn't going to be child's play, but it's not too hard either. If you are looking for a library to do the work for you, look around and you'd probably find something to give you a head start.
KeepEdge offers an iPhone charting/graphing API:
http://www.keepedge.com/products/iphone_charting/
You can also check the source code of AppMobile, which has a pie chart embedded inside it:
http://github.com/omz/AppSales-Mobile/tree/master
I will recommend you to look at the "Animating Pie Slices Using a Custom CALayer" page!.
there is new, nice Pie Chart 3D library. 3D charts which you can rotate and scale with fingers + protocol for getting information about tapped slice
http://iphone.orpi.pl/?p=20

Create lightning in OpenGL ES 1.1

I need to create good looking lightning using OpenGL ES 1.1 (iPhone) and was planning on using shaders. However, when I asked about it in a previous question (OpenGL ES 1.x Shaders) I was informed there that this was probably not an option on the iPhone.
So now I am back at square one, wondering how I might make a lightning animation. It does not need to look ultra-realistic. I have already tried to use things like triangles stripped together. While this method does work, it is not as good as I had hoped it would look.
Does anyone have any ideas on the subject?
Thanks again,
~Eric
Try using a triangle strip textured with a gradient from black to a low-saturation blue or purple, to white. Set your blending to additive (GL_SRC_ALPHA, GL_ONE).
The usual approach is to compute the path of the lightning bolt using a Perlin function, rendering it to a glow buffer, creating a nice looking blur using a Gaussian blur shader and then merge it with your scene.
You could maybe adapt the code from this project. Although it's not ObjC/C, it does use OpenGL.
Here is an article that describes the effect in more detail and provides a VB/DirectX implementation.
Maybe I'm missing something but what's wrong with simply using glLight() and the fixed functionality like everybody else?
Would have to be a very bright light to make it look like lightning and wouldn't you need to shine the light on or through something?