diff --git a/Charts/Classes/Data/Implementations/Standard/LineChartDataSet.swift b/Charts/Classes/Data/Implementations/Standard/LineChartDataSet.swift index 6886428701..c626e5e329 100644 --- a/Charts/Classes/Data/Implementations/Standard/LineChartDataSet.swift +++ b/Charts/Classes/Data/Implementations/Standard/LineChartDataSet.swift @@ -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 diff --git a/Charts/Classes/Data/Interfaces/ILineChartDataSet.swift b/Charts/Classes/Data/Interfaces/ILineChartDataSet.swift index f6fb8312f1..b63dcd8b28 100644 --- a/Charts/Classes/Data/Interfaces/ILineChartDataSet.swift +++ b/Charts/Classes/Data/Interfaces/ILineChartDataSet.swift @@ -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 } diff --git a/Charts/Classes/Renderers/LineChartRenderer.swift b/Charts/Classes/Renderers/LineChartRenderer.swift index d601fc3a25..65e7145377 100644 --- a/Charts/Classes/Renderers/LineChartRenderer.swift +++ b/Charts/Classes/Renderers/LineChartRenderer.swift @@ -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) diff --git a/ChartsRealm/Classes/Data/RealmLineDataSet.swift b/ChartsRealm/Classes/Data/RealmLineDataSet.swift index 055a801b9e..9efb49414b 100644 --- a/ChartsRealm/Classes/Data/RealmLineDataSet.swift +++ b/ChartsRealm/Classes/Data/RealmLineDataSet.swift @@ -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