Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Source/Chart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,17 @@ open class Chart: UIControl {
return series.data[dataIndex!].y
}

/**
Finish touching the chart, by removing the highlight line and calling the delegate method.
*/
public func finishTouchingChart() {
// Remove highlight line at the end of the touch event
if let shapeLayer = highlightShapeLayer {
shapeLayer.path = nil
}
delegate?.didFinishTouchingChart(self)
}

fileprivate func drawIBPlaceholder() {
let placeholder = UIView(frame: self.frame)
placeholder.backgroundColor = UIColor(red: 0.93, green: 0.93, blue: 0.93, alpha: 1)
Expand Down Expand Up @@ -719,11 +730,7 @@ open class Chart: UIControl {
let x = valueFromPointAtX(left)

if left < 0 || left > (drawingWidth as CGFloat) {
// Remove highlight line at the end of the touch event
if let shapeLayer = highlightShapeLayer {
shapeLayer.path = nil
}
delegate?.didFinishTouchingChart(self)
finishTouchingChart()
return
}

Expand All @@ -748,8 +755,8 @@ open class Chart: UIControl {
}

delegate!.didTouchChart(self, indexes: indexes, x: x, left: left)

}

override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
handleTouchEvents(touches, event: event)
}
Expand Down