Skip to content

Commit

Permalink
Updated latest commits to Swift 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Sep 18, 2015
1 parent 390595f commit fcf5f60
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 53 deletions.
3 changes: 1 addition & 2 deletions Charts/Classes/Charts/ChartViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
{
let highlight = _indicesToHightlight[i]
let xIndex = highlight.xIndex
let dataSetIndex = highlight.dataSetIndex

if (xIndex <= Int(_deltaX) && xIndex <= Int(_deltaX * _animator.phaseX))
{
Expand Down Expand Up @@ -830,7 +829,7 @@ public class ChartViewBase: UIView, ChartAnimatorDelegate
internal typealias VoidClosureType = () -> ()
internal var _sizeChangeEventActions = [VoidClosureType]()

public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [NSObject : AnyObject]?, context: UnsafeMutablePointer<Void>)
public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>)
{
if (keyPath == "bounds" || keyPath == "frame")
{
Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Components/ChartMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ChartMarker: ChartComponentBase

/// This method enables a custom ChartMarker to update it's content everytime the MarkerView is redrawn according to the data entry it points to.
///
/// :param: highlight the highlight object contains information about the highlighted value such as it's dataset-index, the selected range or stack-index (only stacked bar entries).
/// - parameter highlight: the highlight object contains information about the highlighted value such as it's dataset-index, the selected range or stack-index (only stacked bar entries).
public func refreshContent(entry entry: ChartDataEntry, highlight: ChartHighlight)
{
// Do nothing here...
Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Components/ChartYAxis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public class ChartYAxis: ChartAxisBase

public var isStartAtZeroEnabled: Bool { return startAtZeroEnabled; }

/// :returns: true if focing the y-label count is enabled. Default: false
/// - returns: true if focing the y-label count is enabled. Default: false
public var isForceLabelsEnabled: Bool { return forceLabelsEnabled }

public var isShowOnlyMinMaxEnabled: Bool { return showOnlyMinMaxEnabled; }
Expand Down
8 changes: 4 additions & 4 deletions Charts/Classes/Data/BarChartDataEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public class BarChartDataEntry: ChartDataEntry
return remainder
}

/// :returns: the sum of all negative values this entry (if stacked) contains. (this is a positive number)
/// - returns: the sum of all negative values this entry (if stacked) contains. (this is a positive number)
public var negativeSum: Double
{
return _negativeSum
}

/// :returns: the sum of all positive values this entry (if stacked) contains.
/// - returns: the sum of all positive values this entry (if stacked) contains.
public var positiveSum: Double
{
return _positiveSum
Expand Down Expand Up @@ -140,8 +140,8 @@ public class BarChartDataEntry: ChartDataEntry

/// Calculates the sum across all values of the given stack.
///
/// :param: vals
/// :returns:
/// - parameter vals:
/// - returns:
private static func calcSum(vals: [Double]?) -> Double
{
if vals == nil
Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Data/BarChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class BarChartDataSet: BarLineScatterCandleChartDataSet
}
}

internal override func calcMinMax(#start : Int, end: Int)
internal override func calcMinMax(start start : Int, end: Int)
{
let yValCount = _yVals.count

Expand Down
40 changes: 20 additions & 20 deletions Charts/Classes/Highlight/BarChartHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ internal class BarChartHighlighter: ChartHighlighter
super.init(chart: chart)
}

internal override func getHighlight(#x: Double, y: Double) -> ChartHighlight?
internal override func getHighlight(x x: Double, y: Double) -> ChartHighlight?
{
var h = super.getHighlight(x: x, y: y)
let h = super.getHighlight(x: x, y: y)

if h === nil
{
Expand Down Expand Up @@ -86,7 +86,7 @@ internal class BarChartHighlighter: ChartHighlighter
}
}

internal override func getDataSetIndex(#xIndex: Int, x: Double, y: Double) -> Int
internal override func getDataSetIndex(xIndex xIndex: Int, x: Double, y: Double) -> Int
{
if let barChartData = _chart?.data as? BarChartData
{
Expand Down Expand Up @@ -120,15 +120,15 @@ internal class BarChartHighlighter: ChartHighlighter
}

/// This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected.
/// :param: old the old highlight object before looking for stacked values
/// :param: set
/// :param: xIndex
/// :param: dataSetIndex
/// :param: yValue
/// :returns:
internal func getStackedHighlight(#old: ChartHighlight?, set: BarChartDataSet, xIndex: Int, dataSetIndex: Int, yValue: Double) -> ChartHighlight?
/// - parameter old: the old highlight object before looking for stacked values
/// - parameter set:
/// - parameter xIndex:
/// - parameter dataSetIndex:
/// - parameter yValue:
/// - returns:
internal func getStackedHighlight(old old: ChartHighlight?, set: BarChartDataSet, xIndex: Int, dataSetIndex: Int, yValue: Double) -> ChartHighlight?
{
var entry = set.entryForXIndex(xIndex) as? BarChartDataEntry
let entry = set.entryForXIndex(xIndex) as? BarChartDataEntry

if entry?.values === nil
{
Expand All @@ -145,10 +145,10 @@ internal class BarChartHighlighter: ChartHighlighter
}

/// Returns the index of the closest value inside the values array / ranges (stacked barchart) to the value given as a parameter.
/// :param: entry
/// :param: value
/// :returns:
internal func getClosestStackIndex(#ranges: [ChartRange]?, value: Double) -> Int
/// - parameter entry:
/// - parameter value:
/// - returns:
internal func getClosestStackIndex(ranges ranges: [ChartRange]?, value: Double) -> Int
{
if ranges == nil
{
Expand All @@ -175,8 +175,8 @@ internal class BarChartHighlighter: ChartHighlighter
}

/// Returns the base x-value to the corresponding x-touch value in pixels.
/// :param: x
/// :returns:
/// - parameter x:
/// - returns:
internal func getBase(x: Double) -> Double
{
if let barChartData = _chart?.data as? BarChartData
Expand Down Expand Up @@ -207,9 +207,9 @@ internal class BarChartHighlighter: ChartHighlighter
}

/// Splits up the stack-values of the given bar-entry into Range objects.
/// :param: entry
/// :returns:
internal func getRanges(#entry: BarChartDataEntry) -> [ChartRange]?
/// - parameter entry:
/// - returns:
internal func getRanges(entry entry: BarChartDataEntry) -> [ChartRange]?
{
let values = entry.values
if (values == nil)
Expand Down
10 changes: 5 additions & 5 deletions Charts/Classes/Highlight/ChartHighlight.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public class ChartHighlight: NSObject

/// Constructor, only used for stacked-barchart.
///
/// :param: x the index of the highlighted value on the x-axis
/// :param: dataSet the index of the DataSet the highlighted value belongs to
/// :param: stackIndex references which value of a stacked-bar entry has been selected
/// :param: range the range the selected stack-value is in
/// - parameter x: the index of the highlighted value on the x-axis
/// - parameter dataSet: the index of the DataSet the highlighted value belongs to
/// - parameter stackIndex: references which value of a stacked-bar entry has been selected
/// - parameter range: the range the selected stack-value is in
public convenience init(xIndex x: Int, dataSetIndex: Int, stackIndex: Int, range: ChartRange)
{
self.init(xIndex: x, dataSetIndex: dataSetIndex, stackIndex: stackIndex)
Expand All @@ -69,7 +69,7 @@ public class ChartHighlight: NSObject
public var xIndex: Int { return _xIndex; }
public var stackIndex: Int { return _stackIndex; }

/// :returns: the range of values the selected value of a stacked bar is in. (this is only relevant for stacked-barchart)
/// - returns: the range of values the selected value of a stacked bar is in. (this is only relevant for stacked-barchart)
public var range: ChartRange? { return _range }

// MARK: NSObject
Expand Down
28 changes: 14 additions & 14 deletions Charts/Classes/Highlight/ChartHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ internal class ChartHighlighter
}

/// Returns a Highlight object corresponding to the given x- and y- touch positions in pixels.
/// :param: x
/// :param: y
/// :returns:
internal func getHighlight(#x: Double, y: Double) -> ChartHighlight?
/// - parameter x:
/// - parameter y:
/// - returns:
internal func getHighlight(x x: Double, y: Double) -> ChartHighlight?
{
let xIndex = getXIndex(x)
if (xIndex == -Int.max)
Expand All @@ -47,8 +47,8 @@ internal class ChartHighlighter
}

/// Returns the corresponding x-index for a given touch-position in pixels.
/// :param: x
/// :returns:
/// - parameter x:
/// - returns:
internal func getXIndex(x: Double) -> Int
{
// create an array of the touch-point
Expand All @@ -61,11 +61,11 @@ internal class ChartHighlighter
}

/// Returns the corresponding dataset-index for a given xIndex and xy-touch position in pixels.
/// :param: xIndex
/// :param: x
/// :param: y
/// :returns:
internal func getDataSetIndex(#xIndex: Int, x: Double, y: Double) -> Int
/// - parameter xIndex:
/// - parameter x:
/// - parameter y:
/// - returns:
internal func getDataSetIndex(xIndex xIndex: Int, x: Double, y: Double) -> Int
{
let valsAtIndex = getSelectionDetailsAtIndex(xIndex)

Expand All @@ -80,16 +80,16 @@ internal class ChartHighlighter
}

/// Returns a list of SelectionDetail object corresponding to the given xIndex.
/// :param: xIndex
/// :return:
/// - parameter xIndex:
/// - returns:
internal func getSelectionDetailsAtIndex(xIndex: Int) -> [ChartSelectionDetail]
{
var vals = [ChartSelectionDetail]()
var pt = CGPoint()

for (var i = 0, dataSetCount = _chart?.data?.dataSetCount; i < dataSetCount; i++)
{
var dataSet = _chart!.data!.getDataSetByIndex(i)
let dataSet = _chart!.data!.getDataSetByIndex(i)

// dont include datasets that cannot be highlighted
if !dataSet.isHighlightEnabled
Expand Down
2 changes: 1 addition & 1 deletion Charts/Classes/Highlight/ChartRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ChartRange: NSObject
}

/// Returns true if this range contains (if the value is in between) the given value, false if not.
/// :param: value
/// - parameter value:
public func contains(value: Double) -> Bool
{
if value > from && value <= to
Expand Down
8 changes: 4 additions & 4 deletions Charts/Classes/Highlight/HorizontalBarChartHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import CoreGraphics

internal class HorizontalBarChartHighlighter: BarChartHighlighter
{
internal override func getHighlight(#x: Double, y: Double) -> ChartHighlight?
internal override func getHighlight(x x: Double, y: Double) -> ChartHighlight?
{
var h = super.getHighlight(x: x, y: y)
let h = super.getHighlight(x: x, y: y)

if h === nil
{
Expand Down Expand Up @@ -88,8 +88,8 @@ internal class HorizontalBarChartHighlighter: BarChartHighlighter
}

/// Returns the base y-value to the corresponding x-touch value in pixels.
/// :param: y
/// :returns:
/// - parameter y:
/// - returns:
internal override func getBase(y: Double) -> Double
{
if let barChartData = _chart?.data as? BarChartData
Expand Down

0 comments on commit fcf5f60

Please sign in to comment.