How i access the array of CGPoints to draw the graph?
Posted
by Rajendra Bhole
on Stack Overflow
See other posts from Stack Overflow
or by Rajendra Bhole
Published on 2010-04-06T04:55:12Z
Indexed on
2010/04/06
5:03 UTC
Read the original article
Hit count: 287
Hi, I have the code in which i want to develop the graph.The code is,
NSArray *coordinate = [[NSArray alloc] initWithObjects: @"42,213", @"75,173", @"108,153", @"141,133", @"174,113", @"207,73", @"240,33", nil];
CGContextSetRGBFillColor(ctx, 255, 0, 0, 1.0);
CGContextSetLineWidth(ctx, 8.0);
for(int intIndex = 0; intIndex < [coordinate count]; fltX1+=33, intIndex++)
{
CGContextMoveToPoint(ctx, fltX1+37, fltY2+18);
CGPoint point = [[coordinate objectAtIndex:intIndex] CGPointValue];
CGContextAddLineToPoint(ctx, point);
CGContextStrokePath(ctx);
}
The problem is that the function of CGContextAddLineToPoint(ctx, point); not working properly. How i drawing the line in the graph using above code????????
© Stack Overflow or respective owner