|
@@ -214,7 +214,7 @@ open class ChartDataSet: ChartBaseDataSet
|
|
rounding: ChartDataSetRounding) -> Int
|
|
rounding: ChartDataSetRounding) -> Int
|
|
{
|
|
{
|
|
var closest = partitioningIndex { $0.x >= xValue }
|
|
var closest = partitioningIndex { $0.x >= xValue }
|
|
- guard closest < endIndex else { return closest }
|
|
|
|
|
|
+ guard closest < endIndex else { return -1 }
|
|
|
|
|
|
let closestXValue = self[closest].x
|
|
let closestXValue = self[closest].x
|
|
|
|
|
|
@@ -237,8 +237,6 @@ open class ChartDataSet: ChartBaseDataSet
|
|
break
|
|
break
|
|
}
|
|
}
|
|
|
|
|
|
- guard closest < endIndex else { return endIndex }
|
|
|
|
-
|
|
|
|
// Search by closest to y-value
|
|
// Search by closest to y-value
|
|
if !yValue.isNaN
|
|
if !yValue.isNaN
|
|
{
|
|
{
|
|
@@ -250,7 +248,7 @@ open class ChartDataSet: ChartBaseDataSet
|
|
var closestYValue = self[closest].y
|
|
var closestYValue = self[closest].y
|
|
var closestYIndex = closest
|
|
var closestYIndex = closest
|
|
|
|
|
|
- while closest < endIndex
|
|
|
|
|
|
+ while closest < index(before: endIndex)
|
|
{
|
|
{
|
|
formIndex(after: &closest)
|
|
formIndex(after: &closest)
|
|
let value = self[closest]
|
|
let value = self[closest]
|