How to detect tap gesture on chart marker?

后端 未结 2 1950
故里飘歌
故里飘歌 2021-01-24 13:36

I am using Charts to create custom graphs in an application. The one thing I am having trouble with is detecting touch events on the chart marker that is presented for the curre

2条回答
  •  天涯浪人
    2021-01-24 13:58

    As per your requirement Charts library already have that method in its delegate.

    Please check below code :

    1. Assign delegate to your ChartView like below
    lineChartView.delegate = self
    
    1. Implement Delegate method in your class
    public func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
    
    }
    

    Here you can write your code while user click on chart.

    Hope this info will helps!

提交回复
热议问题