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.

Download Graph View Source Code Here.

About these ads


6 Responses to “Basic Graph Class for iPhone”

  1. 1 Malar

    Can you re-upload your source code please?

  2. 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?

  3. 3 aikhan

    Hey I want to create a simple horizontal bar graph with 2 bars what do you recommend on iPad & on iPhone both.

  4. 4 aikhan

    Two big fat bars presumably should work on all orientations


  1. 1 iPhone development Samples, Issues, Forums,Resources. For every coca developer. « My Bank of Knowledge
  2. 2 Quick Start iPhone and Objective C development | Cybernated

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: