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);
}
I the above code goes in to debugger at the line of CGPoint point = [[coordinate objectAtIndex:intIndex] CGPointValue]. How i drawing the line in the graph using above code????????
Now i changing the above code as fllows,
Hi,glorifiedHacker,I already guessing above sentence. But, now i changing the my code like,
CGContextSetRGBFillColor(ctx, 255, 0, 0, 1.0);
CGContextSetLineWidth(ctx, 8.0);
NSArray *coordinate1 = [[NSArray alloc] initWithObjects:@"42",@"75",@"108",@"141",@"174",@"207",@"240",nil];
NSLog(@"The points of coordinate1: %@", coordinate1);
NSArray *coordinate2 = [[NSArray alloc] initWithObjects:@"213",@"173",@"153",@"133",@"113",@"73",@"33",nil];
for(int intIndex = 0; intIndex < [coordinate1 count], intIndex < [coordinate2 count]; fltX1+=33, intIndex++)
{
CGContextMoveToPoint(ctx, fltX1+37, fltY2+18);
NSString *arrayDataForCoordinate1 = [coordinate1 objectAtIndex:intIndex];
NSString *arrayDataForCoordinate2 = [coordinate2 objectAtIndex:intIndex];
CGContextAddLineToPoint(ctx, (float *)arrayDataForCoordinate1, (float *)arrayDataForCoordinate2);
//NSLog(@"CGPoints of drawing the bar: %@", point);
}
CGContextClosePath(ctx);
CGContextStrokePath(ctx)
But it still given me error on same line.