How i draw the graph including X- and Y-axis lines?
Posted
by Rajendra Bhole
on Stack Overflow
See other posts from Stack Overflow
or by Rajendra Bhole
Published on 2010-03-31T09:05:51Z
Indexed on
2010/03/31
12:53 UTC
Read the original article
Hit count: 310
iphone
Hi, I want to make an application in which i want to make simple graph using NSObject class and using CGContext method. All lines should be displaying dynamically in X and Y-axis interval text also, i trying develop something like following code,
CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0);
CGContextSetLineWidth(ctx, 2.0);
//(number of lines)
CGContextMoveToPoint(ctx, 30.0, 230.0);
CGContextAddLineToPoint(ctx, 30.0, 440.0);
//CGContextAddLineToPoint(ctx, 320.0, 420.0);
//CGContextStrokePath(ctx);
for(float x = 20.0; x <= 320.0; x++)
{
CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0);
CGContextMoveToPoint(ctx, x, 420.0);
CGContextAddLineToPoint(ctx, x+45.0, 420.0);
CGContextStrokePath(ctx);
}
How i develop using above functions? Thanks.
© Stack Overflow or respective owner