Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the markerView if bar value is 0.0. in bar graph using iOS charts

I am adding on marker on tap using iOS charts. I want to open the marker only if value is not zero. Can we do this using iOS Charts library.

like image 869
Divya Saraswati Avatar asked Nov 30 '25 11:11

Divya Saraswati


1 Answers

First set the delegate of barChartView and then in chartValueSelected function write this code

  func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight){
    if entry.y == 0.0{
        barChartView.highlightValue(nil, callDelegate: false)
    }

}

wherever you need to hide the marker just add this code

 barChartView.highlightValue(nil, callDelegate: false)
like image 179
Divya Saraswati Avatar answered Dec 02 '25 03:12

Divya Saraswati



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!