Skip to content

Commit

Permalink
MOD: use Double.pi instead of M_PI
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnywjy committed May 5, 2017
1 parent b7c5b9f commit 9e95a66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions JYRadarChartSwiftDemo/JYRadarChartSwiftDemo/JYLegendView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@ class JYLegendView: UIView {
c.addArc(center: CGPoint(x: rect.origin.x + radiusAux,
y: rect.origin.y + radiusAux),
radius: radiusAux,
startAngle: CGFloat(M_PI),
endAngle: CGFloat(M_PI) * 1.5,
startAngle: CGFloat(Double.pi),
endAngle: CGFloat(Double.pi) * 1.5,
clockwise: false)

c.addArc(center: CGPoint(x: rect.origin.x + rect.size.width - radiusAux,
y: rect.origin.y + radiusAux),
radius: radiusAux,
startAngle: CGFloat(M_PI) * 1.5,
endAngle: CGFloat(M_PI) * 2.0,
startAngle: CGFloat(Double.pi) * 1.5,
endAngle: CGFloat(Double.pi) * 2.0,
clockwise: false)

c.addArc(center: CGPoint(x: rect.origin.x + rect.size.width - radiusAux,
y: rect.origin.y + rect.size.height - radiusAux),
radius: radiusAux,
startAngle: CGFloat(M_PI) * 2.0,
endAngle: CGFloat(M_PI) * 0.5,
startAngle: CGFloat(Double.pi) * 2.0,
endAngle: CGFloat(Double.pi) * 0.5,
clockwise: false)

c.addArc(center: CGPoint(x: rect.origin.x + radiusAux,
y: rect.origin.y + rect.size.height - radiusAux),
radius: radiusAux,
startAngle: CGFloat(M_PI) * 0.5,
endAngle: CGFloat(M_PI),
startAngle: CGFloat(Double.pi) * 0.5,
endAngle: CGFloat(Double.pi),
clockwise: false)

c.addLine(to: CGPoint(x: rect.origin.x, y: rect.origin.y + radiusAux))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ class JYRadarChart: UIView {

override func draw(_ rect: CGRect) {
let colors: Array<UIColor> = legendView.colors
var radPerV: CGFloat = CGFloat(M_PI * 2.0) / CGFloat(numOfV)
var radPerV: CGFloat = CGFloat(Double.pi * 2.0) / CGFloat(numOfV)

if isClockWise {
radPerV = -(CGFloat(M_PI * 2.0) / CGFloat(numOfV))
radPerV = -(CGFloat(Double.pi * 2.0) / CGFloat(numOfV))
}

let context: CGContext? = UIGraphicsGetCurrentContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ViewController: UIViewController {
p.data = [a, b, c]
p.steps = Int(arc4random() % 6) + 1
p.isFillArea = arc4random() % 2 == 0 ? true : false
p.isDrawPoints = arc4random() % 2 == 0 ? true : false
p.isDrawPoints = arc4random() % 2 == 0 ? true : false
p.isShowStepText = arc4random() % 2 == 0 ? true : false
p.titles = ["iPhone", "pizza", "hard drive"]
p.setNeedsDisplay()
Expand Down

0 comments on commit 9e95a66

Please sign in to comment.