Posts Tagged ‘graph’

iPhone SDK – Implementing the Tapku Graph In your application

March 7th, 2010 iPhone SDK Tips

One of the simpler and nicer available graph controllers your iPhone app is from the Tapku library. The tapku library is created by the team at http://tapku.com/ at hosted at http://github.com/devinross/tapkulibrary.

The graph view controller I find as a good mix between a simple SparkLine (http://key-solutions.ca/cksparkline.html) and the full-on core-plot.

Implementing the whole Tapku library is overkill to just use the chart and in fact can be a little difficult for beginners too.

To implement the graph follow the following steps:

Screenshot2010-03-08at10.05.25.OmxZv34TWnLc.jpg

1.Copy the following files out of the Tapku Library and copy into your project:

GraphController.h & GraphController.m
TKGraphController.h & TKGraphController.m
TKGraphView.h & TKGraphView.m
TKGlobal.h & TKGlobal.m
UIImageAdditions.h & UIImageAdditions.m
UIViewAdditions.h & UIImageAdditions.m
TapkuLibrary.bundle (for the graphics)

2. Add the framework QuartzCore

#import <QuartzCore/QuartzCore.h>


3. In GraphController.h, remove the line to import the full Tapku Library and import TKGraphController.h and TKGraphView.h.

Alter GraphController.h to:

//#import <TapkuLibrary/TapkuLibrary.h>
#import “TKGraphController.h”
#import “TKGraphView.h”


4. Now to call the graph, we display it as a modal view controller. Use the following code in your project to push the view onto the screen:

In your header file add:
#import
“GraphController.h”

In the main add

UIViewController *vc = [[GraphController alloc] init];

[vc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[
self presentModalViewController:vc animated:YES];
[vc
release];
return;


And thats it!

I have a sample xcode project available too.

iPhone OS Development – deSimpleChart

February 20th, 2010 iPhone SDK Tips

iPhone SDK Simple Charting Class

Throughout my current project I’ve been looking for a simple chart that I can place inside my iPhone Application. There is the best framework around core-plot, but I found is extremely complicated and a little unmanageable for experienced programmers. I then came across CKSparkLine which is a fantastic and simple way of plotting an array of data to a uiview.

In my work I have lead to a slightly adapted CKSparkLine which would be useful enough to help someone else who wants a simple chart plot in an iPhone App.

Introducing the sample code: deSimpleChart. A ’simple’ chart plot based  off CKSparkLine to help a programmer new to iPhone development out. Below a screenshot of the complete output of the application. Keeping the idea simple and easy to learn from.


deSimpleChart 0.01  
Build “Keeping charts simple”

Download at Github
->”git clone git://github.com/duivesteyn-enterprises/deSimpleChart.git”