画椭圆型

 

 

               let testRad = circleRadius * 40

//                let clip : UIBezierPath = UIBezierPath(arcCenter: pt, radius:

//                    CGFloat(testRad), startAngle: 0, endAngle: 180, clockwise: true)

//                

//                clip.addLineToPoint(pt)

//                clip.closePath()

//                clip.addClip()

                let width = testRad * 2

                let height  = testRad

                let originRect = CGRectMake(pt.x - width/2 , pt.y-height/2 , testRad*2, testRad)

                var arc :UIBezierPath = UIBezierPath(ovalInRect:originRect)

                

                UIColor.redColor().setStroke()

                arc.stroke()

  

let testRad = circleRadius * 20
   
   
  let width = testRad * 2
   
  let height  = testRad
   
  let originRect = CGRectMake(pt.x - width/2 , pt.y-height/2 , testRad*2, testRad)
   
  let arc :UIBezierPath = UIBezierPath(ovalInRect:originRect)
  
  let dashes: [CGFloat] = [2, 2]
  arc.setLineDash(dashes, count: 2, phase: 0)
   
  UIColor.redColor().setStroke()
   
  arc.stroke()

  

  

ios-chart写标签

                    let valOffset = Int(dataSet.circleRadius * 1.75 + height/2)
                                        ChartUtils.drawText(context: context, text:displayLabel, point: CGPoint(x: pt.x, y: pt.y - CGFloat(valOffset) - valueFont.lineHeight), align: .Center, attributes: [NSFontAttributeName: valueFont, NSForegroundColorAttributeName: valueTextColor])

  

你可能感兴趣的:(画椭圆型)