Skip to content

Commit

Permalink
Add ability to turn off antialias for grid lines
Browse files Browse the repository at this point in the history
  • Loading branch information
vvit committed Oct 11, 2015
1 parent 36f67bc commit 48b9dc7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Charts/Classes/Components/ChartAxisBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion Charts/Classes/Renderers/ChartXAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion Charts/Classes/Renderers/ChartYAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 48b9dc7

Please sign in to comment.