Skip to content

Commit

Permalink
refactor lineCapType to latest architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxuan30 committed Feb 24, 2016
1 parent 901d390 commit 6e9f64b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
10 changes: 0 additions & 10 deletions Charts/Classes/Charts/CombinedChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public class CombinedChartView: BarLineChartViewBase, LineChartDataProvider, Bar
/// the fill-formatter used for determining the position of the fill-line
internal var _fillFormatter: ChartFillFormatter!

public var lineCapType = CGLineCap.Butt

/// enum that allows to specify the order in which the different data objects for the combined-chart are drawn
@objc
public enum CombinedChartDrawOrder: Int
Expand Down Expand Up @@ -126,14 +124,6 @@ public class CombinedChartView: BarLineChartViewBase, LineChartDataProvider, Bar
}
}

public var lineCap: CGLineCap
{
get
{
return lineCapType
}
}

// MARK: - BarChartDataProvider

public var barData: BarChartData?
Expand Down
4 changes: 0 additions & 4 deletions Charts/Classes/Charts/LineChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import CoreGraphics
/// Chart that draws lines, surfaces, circles, ...
public class LineChartView: BarLineChartViewBase, LineChartDataProvider
{
public var lineCapType = CGLineCap.Butt

internal override func initialize()
{
super.initialize()
Expand All @@ -39,6 +37,4 @@ public class LineChartView: BarLineChartViewBase, LineChartDataProvider
// MARK: - LineChartDataProvider

public var lineData: LineChartData? { return _data as? LineChartData }

public var lineCap: CGLineCap { return lineCapType }
}
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: 0 additions & 2 deletions Charts/Classes/Interfaces/LineChartDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ public protocol LineChartDataProvider: BarLineScatterCandleBubbleChartDataProvid
{
var lineData: LineChartData? { get }

optional var lineCap: CGLineCap { get }

func getAxis(axis: ChartYAxis.AxisDependency) -> ChartYAxis
}
3 changes: 1 addition & 2 deletions Charts/Classes/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public class LineChartRenderer: LineRadarChartRenderer
animator = animator
else { return }

let lineCap = dataProvider?.lineCap ?? CGLineCap.Butt
let valueToPixelMatrix = trans.valueToPixelMatrix

let entryCount = dataSet.entryCount
Expand All @@ -255,7 +254,7 @@ public class LineChartRenderer: LineRadarChartRenderer

CGContextSaveGState(context)

CGContextSetLineCap(context, lineCap)
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

0 comments on commit 6e9f64b

Please sign in to comment.