I have implemented a bar chart and I would like to move to a more specific view when tapping a specific bar - just as if I tapped a UIButton
. Is this possible? I need to know which bar I tapped in order to fill my other view with correct data, but I can't seem to find any way to bind an action to a specific bar in a BarChart
. I'm using Swift
.
For anyone else looking for the answer it was quite straight forward. Just implement the ChartViewDelegate
where you have your BarChartView
and simply implement the method func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight)
and you're all set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With