我必须在我的iPhone项目折线图中绘制小椭圆,但仅限于起点,终点和峰值点

时间:2013-04-22 07:58:18

标签: iphone ios linechart cgrect

在我的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点的椭圆即 起点, 终点, 折线图的峰值点

0 个答案:

没有答案