From 7765c04838dea87ba88cf323907f201347714407 Mon Sep 17 00:00:00 2001 From: liuxuan30 Date: Wed, 27 Apr 2016 17:23:29 +0800 Subject: [PATCH] move fill before stroke for drawLinear(). if we fill after stroke, half of the stroke line width will be covered by the fill path. --- Charts/Classes/Renderers/LineChartRenderer.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Charts/Classes/Renderers/LineChartRenderer.swift b/Charts/Classes/Renderers/LineChartRenderer.swift index 81f98b450a..848fd42282 100644 --- a/Charts/Classes/Renderers/LineChartRenderer.swift +++ b/Charts/Classes/Renderers/LineChartRenderer.swift @@ -322,6 +322,12 @@ public class LineChartRenderer: LineRadarChartRenderer let minx = max(dataSet.entryIndex(entry: entryFrom) - diff, 0) let maxx = min(max(minx + 2, dataSet.entryIndex(entry: entryTo) + 1), entryCount) + // if drawing filled is enabled + if (dataSet.isDrawFilledEnabled && entryCount > 0) + { + drawLinearFill(context: context, dataSet: dataSet, minx: minx, maxx: maxx, trans: trans) + } + CGContextSaveGState(context) CGContextSetLineCap(context, dataSet.lineCapType) @@ -461,12 +467,6 @@ public class LineChartRenderer: LineRadarChartRenderer } CGContextRestoreGState(context) - - // if drawing filled is enabled - if (dataSet.isDrawFilledEnabled && entryCount > 0) - { - drawLinearFill(context: context, dataSet: dataSet, minx: minx, maxx: maxx, trans: trans) - } } public func drawLinearFill(context context: CGContext, dataSet: ILineChartDataSet, minx: Int, maxx: Int, trans: ChartTransformer)