Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to turn off antialias for grid lines #462

Merged
merged 1 commit into from
Oct 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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