1

When I tap on the chart it shows a value and highlight indicator. How can I remove them after the tap finishes?

    func SetChart(_ dataPoints: [Date], values: [Double], lineChartView: LineChartView, description: String)  {

 lineChartDataSet.highlightEnabled = true
 lineChartView.highlightPerDragEnabled = true
 lineChartDataSet.drawVerticalHighlightIndicatorEnabled = true
}



 func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
     print("\(entry.y))
 }
Maruta
  • 1,063
  • 11
  • 24

1 Answers1

0

Tap does not work that way - explanation. What highlights your values is probably a pan gesture. It does not seem that the Charts framework supports the behaviour you described. You will have to implement your own touch down gesture recognizer. It is worth to check BarLineChartViewBase class, as you might need to subclass it and use it in your own subclass of LineChart. To unhighlight value use lineChart.highlightValue(nil). I hope that someone knows about the better way, but I worry that it does not exist.

Luzo
  • 1,336
  • 10
  • 15