From fce2702c50741068f8f25c3ec35e50500423ede2 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 23 Mar 2020 22:19:10 +0400 Subject: [PATCH] Fix chart line rendering --- .../Stacked Bars/TwoAxisStepBarsChartController.swift | 1 - .../Sources/Charts/Renderes/LinesChartRenderer.swift | 5 +++-- .../GraphCore/Sources/Charts/Renderes/PieChartRenderer.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/TwoAxisStepBarsChartController.swift b/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/TwoAxisStepBarsChartController.swift index 83807f7af9..8a7bf111b0 100644 --- a/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/TwoAxisStepBarsChartController.swift +++ b/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/TwoAxisStepBarsChartController.swift @@ -89,7 +89,6 @@ public class TwoAxisStepBarsChartController: BaseLinesChartController { } else { controller.mainBarsRenderer.bars = BarChartRenderer.BarsData(barWidth: 0.0, locations: [], components: []) controller.previewBarsRenderer.bars = BarChartRenderer.BarsData(barWidth: 0.0, locations: [], components: []) - controller.verticalScalesRenderer.setHorizontalLinesVisible(false, animated: animated) } } diff --git a/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift b/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift index 1086140be4..efa8f1407d 100644 --- a/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift +++ b/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift @@ -68,6 +68,7 @@ class LinesChartRenderer: BaseChartRenderer { context.setAlpha(alpha) context.setStrokeColor(toLine.color.cgColor) context.setLineWidth(lineWidth) + context.setLineCap(.round) if linesShapeAnimator.isAnimating { let animationOffset = linesShapeAnimator.current @@ -314,8 +315,9 @@ class LinesChartRenderer: BaseChartRenderer { lines.removeLast() } - context.setLineCap(.round) + context.beginTransparencyLayer(auxiliaryInfo: nil) context.strokeLineSegments(between: lines) + context.endTransparencyLayer() } else { if var index = toLine.points.firstIndex(where: { $0.x >= range.lowerBound }) { var lines: [CGPoint] = [] @@ -431,7 +433,6 @@ class LinesChartRenderer: BaseChartRenderer { lines.removeLast() } - context.setLineCap(.round) context.strokeLineSegments(between: lines) } } diff --git a/submodules/GraphCore/Sources/Charts/Renderes/PieChartRenderer.swift b/submodules/GraphCore/Sources/Charts/Renderes/PieChartRenderer.swift index d0e06ed2ff..6eb6e5c2f1 100644 --- a/submodules/GraphCore/Sources/Charts/Renderes/PieChartRenderer.swift +++ b/submodules/GraphCore/Sources/Charts/Renderes/PieChartRenderer.swift @@ -138,7 +138,7 @@ class PieChartRenderer: BaseChartRenderer { let maximumFontSize: CGFloat = radius / 7 let minimumFontSize: CGFloat = 4 let centerOffsetStartAngle = CGFloat.pi / 4 - let minimumValueToDraw: CGFloat = 0.01 + let minimumValueToDraw: CGFloat = 1.01 let diagramRadius = radius - animationSelectionOffset let numberOfVisibleItems = currentlyVisibleData.filter { $0.value > 0 }.count