I am using iOS Charts with Swift 3.
When a user clicks on a circle/point on my graph, I want to show a popup that has the value and a date.
I detect the click inside chartValueSelected()
and show the popup like this:
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
//Set and show the popup...
//...
self.presentViewController(vc, asPopoverRelativeTo: frame, of: graph, preferredEdge: .minY, behavior: .transient)
}
Right now I am just positioning the popup arbitrarily with frame
because I don't know how to determine where the user clicked.
Is there a way to know the x/y coordinates of where the clicked circle is?