Hi, I need to remove marker when my touch ends. Is there any way to achieve this?
Also if possible remove marker when ever I want, as my chart is shown in a tableview, the marker is seen even I scroll out of the graph and come back to it, I want to remove it as soon as the user is not interested in the chart.
Please help.
hmm, with my PR https://github.com/danielgindi/Charts/pull/887 getting merged, there is a chance to turn off the marker value, can it solve your problem?
@liuxuan30 No, this is not addressing my scenario, but I did some tweaking in BarLineChartViewBase.swift and in ChartViewBase.swift, like making a separate public function for removing the highlighted markers, then overriding nstouchesbegan, nstouchesended and nstouchescnacled functions in BarLineChartViewBase.swift to handle markers. Some how thats what I needed for this scenario. Still removing markers for tableview scroll is not yet achieved.
Yep, wishing for this functionality too..
You can hook into BarLineChartViewBase's UIPanGestureRecognizer:
if let gestureRecognizers = gestureRecognizers {
for recognizer in gestureRecognizers {
if recognizer is UIPanGestureRecognizer {
recognizer.addTarget(self, action: #selector(hideMarker(_:)))
}
}
}
Then in hideMarker method:
func hideMarker(recognizer: UIPanGestureRecognizer) {
if recognizer.state == .Ended || recognizer.state == .Cancelled {
highlightValue(nil) // this hides the marker
}
}
On tableView scroll you just call highlightValue(nil)
Call this when you want to remove marker from chartview
yourChartViewInstance.highlightValue(nil, callDelegate: false)
Most helpful comment
Call this when you want to remove marker from chartview
yourChartViewInstance.highlightValue(nil, callDelegate: false)