         rounding: ChartDataSetRounding) -> Int
     {
         var closest = partitioningIndex { $0.x >= xValue }
-        guard closest < endIndex else { return closest }
+        guard closest < endIndex else { return -1 }
 
         let closestXValue = self[closest].x
 

            break
        }

        guard closest < endIndex else { return endIndex }
            
        // Search by closest to y-value
        if !yValue.isNaN
        {

            var closestYValue = self[closest].y
            var closestYIndex = closest

            while closest < index(before: endIndex)
            {
                formIndex(after: &closest)
                let value = self[closest]
