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 support for lineCap setting for line chart #658

Merged
merged 2 commits into from
Mar 17, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class LineChartDataSet: LineRadarChartDataSet, ILineChartDataSet
}
}

/// Line cap type, default is CGLineCap.Butt
public var lineCapType = CGLineCap.Butt

/// If true, cubic lines are drawn instead of linear
public var drawCubicEnabled = false

Expand Down
3 changes: 3 additions & 0 deletions Charts/Classes/Data/Interfaces/ILineChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public protocol ILineChartDataSet: ILineRadarChartDataSet
/// **default**: 0.2
var cubicIntensity: CGFloat { get set }

/// Line cap type, default is CGLineCap.Butt
var lineCapType: CGLineCap { get set }

/// If true, cubic lines are drawn instead of linear
var drawCubicEnabled: Bool { get set }

Expand Down
2 changes: 2 additions & 0 deletions Charts/Classes/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ public class LineChartRenderer: LineRadarChartRenderer
let maxx = min(max(minx + 2, dataSet.entryIndex(entry: entryTo) + 1), entryCount)

CGContextSaveGState(context)

CGContextSetLineCap(context, dataSet.lineCapType)

// more than 1 color
if (dataSet.colors.count > 1)
Expand Down
3 changes: 3 additions & 0 deletions ChartsRealm/Classes/Data/RealmLineDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class RealmLineDataSet: RealmLineRadarDataSet, ILineChartDataSet
}
}

/// Line cap type, default is CGLineCap.Butt
public var lineCapType = CGLineCap.Butt

/// If true, cubic lines are drawn instead of linear
public var drawCubicEnabled = false

Expand Down