Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-29-2009, 11:10 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default how do you create a line graph??

hey, im fairly new to developing and have no idea how i would go about creating a line graph, such as the one in the 'ipushups' app. Any body know how i would go about doing this or know of any tutorials that would explain??
eski is offline   Reply With Quote
Old 06-29-2009, 12:12 PM   #2 (permalink)
Registered Member
 
Stitch's Avatar
 
Join Date: Aug 2008
Posts: 398
Default

Quote:
Originally Posted by eski View Post
hey, im fairly new to developing and have no idea how i would go about creating a line graph, such as the one in the 'ipushups' app. Any body know how i would go about doing this or know of any tutorials that would explain??
Check out the AccelGraph Sample Code
Stitch is offline   Reply With Quote
Old 06-29-2009, 05:26 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

i searched for it and it couldnt find it?
eski is offline   Reply With Quote
Old 06-29-2009, 05:28 PM   #4 (permalink)
Registered Member
 
Join Date: Sep 2008
Location: London, UK
Posts: 793
Default

Quote:
Originally Posted by eski View Post
i searched for it and it couldnt find it?
Try AccelerometerGraph in Examples in Dev Center
wuf810 is offline   Reply With Quote
Old 06-29-2009, 05:58 PM   #5 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

found it but the graphs so different to what im trying to do i wouldnt know where to start with that code. thanks any way
eski is offline   Reply With Quote
Old 06-29-2009, 11:05 PM   #6 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 14
Default

FYI to draw a line
This code constructs a triangle from a set of three lines.

// Draw a purple triangle with using lines
CGContextSetRGBStrokeColor(ctx, 255, 0, 255, 1);
CGPoint points[6] = { CGPointMake(100, 200), CGPointMake(150, 250),
CGPointMake(150, 250), CGPointMake(50, 250),
CGPointMake(50, 250), CGPointMake(100, 200) };
CGContextStrokeLineSegments(ctx, points, 6);


u can set any point to draw graph
rkp01_jec is offline   Reply With Quote
Old 06-30-2009, 06:20 AM   #7 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

cool thanks, don't spose you know how id go about making the lines move to the numbers in a label? like in a graph.
eski is offline   Reply With Quote
Old 07-01-2009, 07:06 AM   #8 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: India
Posts: 47
Send a message via Skype™ to anils_das
Default

eski,

Did you find any framework for plotting graph in application? How you managed to add graph in application?

I got one framework for this named core plot. There is one good tutorial on integrating this to iphone application.

Using Core Plot in an iPhone Application | Switch on the Code

Since the project is in starting stage, many bugs and restrictions are there. So any other framework?
anils_das is offline   Reply With Quote
Old 07-01-2009, 07:31 AM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

no luck so far i just found that tutorial like 2mins ago lol, was just about to see if it would work
eski is offline   Reply With Quote
Old 07-01-2009, 07:43 AM   #10 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: India
Posts: 47
Send a message via Skype™ to anils_das
Default

Core plot supports only line graph in iphone OS. I have tried that and its working fine for me.

The main issue i found is in the axis label positioning. I have attached one sample screen shot of this.

When i contacted the project owner, he is working to resolve this issue.
Attached Images
File Type: jpg sample_screen.jpg (17.4 KB, 0 views)
anils_das is offline   Reply With Quote
Old 07-01-2009, 08:20 AM   #11 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

cool its a line graph that i want. the screen shot wont load up

How did you get the code of that site the... 'hg clone Revision ae158fc377: / core-plot"

im well confused, it telling me to download Mercurial, then when i click the link to do that theres not a link to download it to mac os x 10.5 but tells me to download python2.5...iv done that now what???
eski is offline   Reply With Quote
Old 07-01-2009, 11:51 PM   #12 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: India
Posts: 47
Send a message via Skype™ to anils_das
Default

I forgot how i downloaded that file...I have uploaded the 10.5 package for you in rapid share

RapidShare: Easy Filehosting

Download and install that. After that run these two commands

macmiexport LC_ALL=en_US.UTF-8
macmiexport LANG=en_US.UTF-8

Then you can download the source using hg clone command
anils_das is offline   Reply With Quote
Old 07-02-2009, 12:08 AM   #13 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: India
Posts: 47
Send a message via Skype™ to anils_das
Default

Eski,

I found one more method to add graph in our applications. Its using the google chart API

Developer's Guide - Google Chart API - Google Code

I think this will help you...
anils_das is offline   Reply With Quote
Old 07-02-2009, 04:40 PM   #14 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

thanks! that made it a lot easier i managed to get all the code and i follwed the instructions exactly but now it keeps coming up with 1 error basicly saying i need a ';' before '{' but then it dosnt fix it and makes more errors appear then u fix them then it goes back to the first one taking me in circles!! well annoying!

that google api does look helpful but i dnt really understand it and where id put the code. would it mean the user would have to have access to the internet in order for th graph to work??
eski is offline   Reply With Quote
Old 07-02-2009, 04:42 PM   #15 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

the CPLayerHostingView seems to be cousing problems to! did you have this problem?
eski is offline   Reply With Quote
Old 07-03-2009, 12:08 AM   #16 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: India
Posts: 47
Send a message via Skype™ to anils_das
Default

no...i didnt get any error.... There will be one warning in the interface builder for the CPLayerHostingView. No issue with that.

what is the error you are getting?
anils_das is offline   Reply With Quote
Old 07-03-2009, 09:56 AM   #17 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

- (IBAction)pushupViewControllerid)sender
{

//(error:expected ';' before '{' token)

pushupViewController *push = [[pushupViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewControllerush animated:NO];
}


...so from that im gathering i need to put ';' after '(id)sender' ..

- (IBAction)pushupViewControllerid)sender;
{



but then once i do that it it comes up with 2 errors...

- (IBAction)pushupViewControllerid)sender;
{
//(error:expected identifier or '(' before '{' token)

and....

- (void)viewDidLoad {
//(error:expected ' ;' before ' {' token)

[super viewDidLoad];

then basically it passes errors along as i try and fix them.. so im thinking that the actual problem is in the header file

what you think??
eski is offline   Reply With Quote
Old 07-03-2009, 10:11 AM   #18 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

and that googl chart api i get now but ivcreated a UIWebView which works fine but when i try to link it to the google api chart e.g it dosnt load any thing

do you know why this is?

thanks for all the help
eski is offline   Reply With Quote
Old 07-05-2009, 08:32 AM   #19 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

hey, the problem was i had forgot to import the cocoaTouch.h file!

now im just stcuk with 1 error...

CPPlotSymbol *greenCirclePlotSymbol = [CPPlotSymbol ellipsePlotSymbol];
greenCirclePlotSymbol.fill = [CPFill fillWithColor:[CPColor greenColor]];
greenCirclePlotSymbol.size = CGSizeMake(2.0, 2.0);
xSquaredPlot.defaultPlotSymbol = greenCirclePlotSymbol;
//(error:request for member 'defaltPlotSymbol' in something not a structure or a union)

do you know what i need to do or change here??

thanks
eski is offline   Reply With Quote
Old 07-05-2009, 09:10 AM   #20 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 78
Default

ok, i have started from scratch on a new project done everything it says to do, im getting no errors in my code now

but i am getting one error in the targets..

//No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv6, VALID_ARCHS=i386).

what does this mean??
eski is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,113
Threads: 38,883
Posts: 170,571
Top Poster: smasher (2,563)
Welcome to our newest member, taptika
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:38 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0