Basic Graph Class for iPhone
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.
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