Basic Graph Class for iPhone
06May10
NOTE: There is a new and better tutorial about graphing. View my other tutorials to find it.
When i was trying to create a basic line graph for my last project i found that there was neither a solution in the SDK nor much help online from fellow developers. There is a more complicated but very nice solution called CorePlot.
However as basic line drawing is relatively easy with CorGraphic I have made my own GraphView Class.
To use it simply:
- import it in your header
- initialise it with [[GraphView alloc] init];
- Add points to it using its addPoint method.
Note:
At the moment the addPoint method is setup to accept UIAccelerationValues so you will need to modify it to accept float instead.
Also at the moment the maximum number of points is 300. This can also be easily modified.
Filed under: Tutorials | 6 Comments
Can you re-upload your source code please?
Thanks friend. I tried downloading the Source of the CorePlot from the clone they have specified. But seems to be problem. Can you share the download code?
Hey I want to create a simple horizontal bar graph with 2 bars what do you recommend on iPad & on iPhone both.
Two big fat bars presumably should work on all orientations