Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Some tips for debugging an hidden chart:
* `delegate` – the delegate for listening to touch events.
* `highlightLineColor` – color of the highlight line.
* `highlightLineWidth` – width of the highlight line.
* `removesHighlighLineOnTouchesEnded` (default `false`) – if true will hide the highlight line as soon as you stop swiping over the chart.
* `gridColor` – the grid color.
* `labelColor` – the color of the labels.
* `labelFont` – the font used for the labels.
Expand Down
9 changes: 9 additions & 0 deletions Source/Chart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ open class Chart: UIControl {
Width for the highlight line.
*/
open var highlightLineWidth: CGFloat = 0.5
/**
Removes highlight line when touches end.
*/
open var removesHighlighLineOnTouchesEnded = false

/**
Alpha component for the area's color.
Expand Down Expand Up @@ -756,6 +760,11 @@ open class Chart: UIControl {

override open func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
handleTouchEvents(touches, event: event)
if self.removesHighlighLineOnTouchesEnded {
if let shapeLayer = highlightShapeLayer {
shapeLayer.path = nil
}
}
delegate?.didEndTouchingChart(self)
}

Expand Down