Fix chart line rendering

This commit is contained in:
Ilya Laktyushin 2020-03-23 22:23:11 +04:00
parent fce2702c50
commit 0eec0642e3

View File

@ -68,7 +68,8 @@ class LinesChartRenderer: BaseChartRenderer {
context.setAlpha(alpha) context.setAlpha(alpha)
context.setStrokeColor(toLine.color.cgColor) context.setStrokeColor(toLine.color.cgColor)
context.setLineWidth(lineWidth) context.setLineWidth(lineWidth)
context.setLineCap(.round)
context.beginTransparencyLayer(auxiliaryInfo: nil)
if linesShapeAnimator.isAnimating { if linesShapeAnimator.isAnimating {
let animationOffset = linesShapeAnimator.current let animationOffset = linesShapeAnimator.current
@ -315,9 +316,8 @@ class LinesChartRenderer: BaseChartRenderer {
lines.removeLast() lines.removeLast()
} }
context.beginTransparencyLayer(auxiliaryInfo: nil) context.setLineCap(.round)
context.strokeLineSegments(between: lines) context.strokeLineSegments(between: lines)
context.endTransparencyLayer()
} else { } else {
if var index = toLine.points.firstIndex(where: { $0.x >= range.lowerBound }) { if var index = toLine.points.firstIndex(where: { $0.x >= range.lowerBound }) {
var lines: [CGPoint] = [] var lines: [CGPoint] = []
@ -433,9 +433,11 @@ class LinesChartRenderer: BaseChartRenderer {
lines.removeLast() lines.removeLast()
} }
context.setLineCap(.round)
context.strokeLineSegments(between: lines) context.strokeLineSegments(between: lines)
} }
} }
context.endTransparencyLayer()
context.setAlpha(1.0) context.setAlpha(1.0)
} }