SwiftCharts icon indicating copy to clipboard operation
SwiftCharts copied to clipboard

Clicking on whole chart group

Open marcinrabieko opened this issue 6 years ago • 1 comments

Recognize taps on bars works very well. The problem is when I want to click on whole group of bars - even there is half or less of full bar size. I need to recognize these taps even on very small bar. I need to know when user clicked on February group (not only grey or red bar).

I checked in DebugViewHierarchy - there is no additional views as container of group bars, so I can't recognize clicking it.

I have idea to add gesture recognizer to whole view and check if tap X position contains any bar on chart, but it will be hard to control it. Do you have any other ideas to achieve that?

imageedit_2_4124220665

marcinrabieko avatar Oct 11 '18 13:10 marcinrabieko

Already resolved:

var touchLocationInContentView: CGPoint = recognizer.location(in: chart.contentView)

Which is location of gesture event in the chart contentView. The contentView is exactly frame that bars are located in. Then I can check if any bars is in range of gesture event tap location.

marcinrabieko avatar Oct 12 '18 11:10 marcinrabieko