Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
larryonoff committed Apr 28, 2018
1 parent 8a180d0 commit 3b15e9f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,9 @@ open class LineChartRenderer: LineRadarRenderer
let phaseX = CGFloat(animator.phaseX)
let phaseY = CGFloat(animator.phaseY)

var e: ChartDataEntry!

let generatedPath = CGMutablePath()
e = dataSet.entryForIndex(from)
if e != nil

if let e = dataSet.entryForIndex(from)
{
generatedPath.move(to: CGPoint(x: CGFloat(e.x), y: CGFloat(e.y) * phaseY), transform: matrix)
}
Expand All @@ -801,7 +799,8 @@ open class LineChartRenderer: LineRadarRenderer
return generatedPath
}

for i in (from + 1)..<to
// enumerate from `from + 1` since the first entry was already used
for i in stride(from: (from + 1), to: to, by: 1)
{
guard let e = dataSet.entryForIndex(i) else { continue }
generatedPath.addLine(to: CGPoint(x: CGFloat(e.x), y: CGFloat(e.y) * phaseY), transform: matrix)
Expand Down

0 comments on commit 3b15e9f

Please sign in to comment.