Hi,
I worked around the code. And found the closest visible point in plot area. Following is my code:
func plotSpace(_ space: CPTPlotSpace, shouldHandlePointingDeviceDownEvent event: UIEvent, at point: CGPoint) -> Bool {lastPlotSpaceDownPoint = point
return true
}
func plotSpace(_ space: CPTPlotSpace, shouldHandlePointingDeviceUp event: UIEvent, at point: CGPoint) -> Bool {
let distance: CGFloat = CGFloat(hypotf((Float(lastPlotSpaceDownPoint.x - point.x)), (Float(lastPlotSpaceDownPoint.y - point.y))))
if abs(distance) < 5 {
let recordIndex = linePlotDS.indexOfVisiblePointClosest(toPlotAreaPoint: point)
print(recordIndex)
}
return true
When user taps near 3rd data point it gives me record index as 3. But how can I find whether it is tapped between 2&3 or 3&4?