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

iphone上如何绘制点状图

 2010-10-19 20:45:23 来源:WEB开发网   
核心提示:105 if (numberOfPlayedTimes!=4) {106 scaleStr = [NSString stringWithFormat:@"%d-%d", IntervalValue*i+1,IntervalValue*(i+1)];107 }else {108 scaleStr =

105 if (numberOfPlayedTimes!=4) {

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

107 }else {

108 scaleStr = [NSString stringWithFormat:@"%d-%d", IntervalValue*i+1,[dataSource count]];

109 }

110

111

112 }

113 [scaleStr drawAtPoint:CGPointMake(pointAtX, _rect.size.height-MARGIN_BOTTOM_SIDE) withFont:[UIFont systemFontOfSize:12]];

114 }

115

116 CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);

117

118 CGContextDrawPath(context, kCGPathStroke);

119 CGContextSetAllowsAntialiasing(context, YES);

120}

121

122

123

124-(void)calcScale:(CGRect)_rect

125{

126 if ([dataSource count]<=5) {

127 IntervalValue = 1;

128 numberOfPlayedTimes = [dataSource count];

129 }else

130 if ([dataSource count]>5) {

131 numberOfPlayedTimes = 5;

132 IntervalValue = [dataSource count]/numberOfPlayedTimes;

133 }

134

135 for(NSNumber* v in dataSource)

136 {

137 if (maxValue<[v floatValue]) {

138 maxValue = [v floatValue];

139 }

140 if (minValue>[v floatValue]) {

141 minValue = [v floatValue];

142 }

143 }

144

145 standardValue = 28.0;

146

147 columnWidth = (_rect.size.width-MARGIN_LEFTSIDE*2)/(numberOfPlayedTimes+1);

148

149 for(int i=0;i< p>

150 {

151 float oneGroupTotalValue = 0.0;

152 float oneGroupAvageValue = 0.0;

153 int startPos = i*IntervalValue;

154 int endPos;

155 if (i!=numberOfPlayedTimes-1) {

上一页  1 2 3 4 5  下一页

Tags:iphone 如何 绘制

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