在我的iPhone中我有折线图视图,在此图表中我必须在折线图的开始和结束处绘制小椭圆,而且我必须在折线图的选取点上绘制椭圆。
for(int i=0;i<[pointsArray count];i++)
{
NSValue *val = [pointsArray objectAtIndex:i];
CGPoint pointNext = [val CGPointValue];
//draw circle at the end of line
NSInteger colorIndex = mLineView.series ? chartIndex : i;
UIColor* color = [mLineView colorAt:colorIndex];
if (color != nil)
{
CGContextSetFillColorWithColor(_context, color.CGColor);
}
else
CGContextSetFillColorWithColor(_context, mLineDrawColor.CGColor);
CGRect circleRect;
circleRect.origin.x=pointNext.x - circleRadius;
circleRect.origin.y=pointNext.y - circleRadius;
circleRect.size.width=circleRadius*2;
circleRect.size.height=circleRect.size.width;
CGContextFillEllipseInRect(_context, circleRect);
}
以上是我的代码,以绘制椭圆形到图表的所有点我不需要这个我只需要3点的椭圆即 起点, 终点, 折线图的峰值点