WEB开发网
开发学院手机开发iPhone 开发 iphone上如何绘制点状图 阅读

iphone上如何绘制点状图

 2010-10-19 20:45:23 来源:WEB开发网   
核心提示:067 points[2] = CGPointMake(_rect.size.width-16, _rect.size.height-MARGIN_BOTTOM_SIDE-5);068 CGContextSetAllowsAntialiasing(context, NO);069 CGContextSetLineWid

067 points[2] = CGPointMake(_rect.size.width-16, _rect.size.height-MARGIN_BOTTOM_SIDE-5);

068 CGContextSetAllowsAntialiasing(context, NO);

069 CGContextSetLineWidth(context,1);

070 CGContextAddLines(context, points, 3);

071

072

073

074 points[0] = CGPointMake(MARGIN_LEFTSIDE-10, _rect.size.height/2);

075 points[1] = CGPointMake(_rect.size.width-10, _rect.size.height/2);

076 CGContextSetLineDash(context, 0, NULL, 0);

077 CGContextAddLines(context, points, 2);

078 CGContextSetLineWidth(context,2);

079 CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:3/255.0 green:198.0/255.0 blue:196.0/255.0 alpha:1.0].CGColor);

080 CGContextDrawPath(context, kCGPathStroke);

081

082 CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);

083

084 for (int i=0; i< ++i)>

085 float averagevalue = [[dataSourceAfterPorcess objectAtIndex:i] floatValue];

086 NSLog(@"averagevalue=%f", averagevalue);

087 int distance = standardValue-averagevalue;

088 float offsetValue = (abs(distance)*_rect.size.height/2)/standardValue;

089 float pointAtX, pointAtY;

090 if (distance>=0) {

091 pointAtX = (i+1)*columnWidth+MARGIN_LEFTSIDE-10;

092 pointAtY = (_rect.size.height/2-offsetValue);

093 }else {

094 pointAtX = (i+1)*columnWidth+MARGIN_LEFTSIDE-10;

095 pointAtY = (_rect.size.height/2+offsetValue);

096 }

097 [ballImage drawAtPoint:CGPointMake(pointAtX, pointAtY)];

098

099 NSString* scaleStr = nil;

100 if(numberOfPlayedTimes<=5)

101 {

102 scaleStr = [NSString stringWithFormat:@"%d", IntervalValue*(i+1)];

103 }

104 else {

上一页  1 2 3 4 5  下一页

Tags:iphone 如何 绘制

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接