Skip to content

Commit

Permalink
Merge pull request #462 from vvit/antialias
Browse files Browse the repository at this point in the history
Add ability to turn off antialias for grid lines
  • Loading branch information
danielgindi committed Oct 30, 2015
2 parents d389c4f + 48b9dc7 commit 19b0726
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 @@ -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)
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 19b0726

Please sign in to comment.