Click bar callback in BarChart in iOS charts

I applied a histogram, and I would like to go to a more specific view when I click on a specific panel - just as if I clicked UIButton. Is it possible? I need to know which bar I used to populate my other view with the correct data, but I cannot find a way to bind the action to a specific line in BarChart. I use Swift.

+4
source share
1 answer

For anyone looking for an answer, he was fairly straightforward. Just implement ChartViewDelegatewhere you have it BarChartView, and just implement the method func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight), and you are all set.

+10
source

Source: https://habr.com/ru/post/1626182/


All Articles