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 cae9697655..4811855e7e 100644 --- a/Charts/Classes/Renderers/ChartXAxisRenderer.swift +++ b/Charts/Classes/Renderers/ChartXAxisRenderer.swift @@ -212,7 +212,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 4162583290..d2ee98e4a7 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)