diff --git a/Charts/Classes/Components/ChartAxisBase.swift b/Charts/Classes/Components/ChartAxisBase.swift index 1bfda86692..3119844ec2 100644 --- a/Charts/Classes/Components/ChartAxisBase.swift +++ b/Charts/Classes/Components/ChartAxisBase.swift @@ -44,6 +44,9 @@ public class ChartAxisBase: ChartComponentBase /// **default**: false public var drawLimitLinesBehindDataEnabled = false + /// the flag can be used to turn off the antialias for grid lines + public var gridAntialiasEnabled = true + public override init() { super.init() diff --git a/Charts/Classes/Renderers/ChartXAxisRenderer.swift b/Charts/Classes/Renderers/ChartXAxisRenderer.swift index 5394302863..29f241a9f1 100644 --- a/Charts/Classes/Renderers/ChartXAxisRenderer.swift +++ b/Charts/Classes/Renderers/ChartXAxisRenderer.swift @@ -201,7 +201,12 @@ public class ChartXAxisRenderer: ChartAxisRendererBase } CGContextSaveGState(context) - + + if (!_xAxis.gridAntialiasEnabled) + { + CGContextSetShouldAntialias(context, false) + } + CGContextSetStrokeColorWithColor(context, _xAxis.gridColor.CGColor) CGContextSetLineWidth(context, _xAxis.gridLineWidth) if (_xAxis.gridLineDashLengths != nil) diff --git a/Charts/Classes/Renderers/ChartYAxisRenderer.swift b/Charts/Classes/Renderers/ChartYAxisRenderer.swift index d2ef5d3059..419a7cd171 100644 --- a/Charts/Classes/Renderers/ChartYAxisRenderer.swift +++ b/Charts/Classes/Renderers/ChartYAxisRenderer.swift @@ -274,7 +274,12 @@ public class ChartYAxisRenderer: ChartAxisRendererBase } CGContextSaveGState(context) - + + if (!_yAxis.gridAntialiasEnabled) + { + CGContextSetShouldAntialias(context, false) + } + CGContextSetStrokeColorWithColor(context, _yAxis.gridColor.CGColor) CGContextSetLineWidth(context, _yAxis.gridLineWidth) if (_yAxis.gridLineDashLengths != nil)