Does anyone know of any existing code that will draw a graph for me in my iPhone application? I just need a simple line graph without labels or a title or even axis labels for the data.
Or does anyone have ideas about where to start so that I can learn how to draw such a thing? I've never dealt with actual graphics for the iPhone. All my applications are just image based until now.
Thanks!
In Numbers, graphs are created using data from a table. To create any type of graph, you can select the data first, then create a graph that displays the data. When you change the data in the table, the graph updates automatically.
Canva is a popular app which lets users to create graphs or charts with tables, photos and graphics in minutes. All you have to do is enter your data to get instant results. Canva offers a range of free, designer-made templates.
Try out the Core Plot framework http://code.google.com/p/core-plot/
If you would attempt to draw yourself, you'd use the Path functions to draw in a context in Quartz
CGContextBeginPath(context);
CGContextMoveToPoint(context, startX, startY);
CGContextAddLineToPoint(context, nextX, nextY);
// [...] and so on, for all line segments
CGContextSetLineWidth(context, 2);
CGContextSetStrokeColorWithColor(context, [[UIColor blackColor] cgColor]);
CGContextStrokePath(context);
There is a lot of sample code to deal with context and drawing in quartz.
But there are probably some libraries to facilitate drawing graphs... someone else would have to help you with those though, not my cup of tea :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With