Skip to content

Commit

Permalink
Fix: gradient lines peaks are truncated when line width > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
larryonoff committed Apr 28, 2018
1 parent 729fb18 commit 617fa81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,13 @@ open class LineChartRenderer: LineRadarRenderer
return
}

// `insetBy` is applied since bounding box
// doesn't take into account line width
// so that peaks are trimmed since
// gradient start and gradient end calculated wrong
let boundingBox = spline.boundingBox
.insetBy(dx: -dataSet.lineWidth / 2, dy: -dataSet.lineWidth / 2)

guard !boundingBox.isNull, !boundingBox.isInfinite, !boundingBox.isEmpty else {
return
}
Expand Down

0 comments on commit 617fa81

Please sign in to comment.