I've implemented a custom MarkerView, but every time the delegate function is called:
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
let position = chartView.getMarkerPosition(highlight: highlight)
}
The value of the position is always (0.0, 0.0). But the marker is being designed:

open func getMarkerPosition(highlight: Highlight) -> CGPoint
{
return CGPoint(x: highlight.drawX, y: highlight.drawY)
}
Would you please debug highlight.drawX and drawY, to see what's the problem? I tried in ChartsDemo, it's fine.
so the way to get the markerPosition now seems to be by getting the hightlight.xPx and highlight.xPy. However, these values are given within the bounds of the chartView.
Yes, it seems that highlight.drawX and drawY always returns values (0.0, 0.0).
As mentioned @Rnorback you could use highlight.xPx & highlight.yPx. Marker position could be converted to any view like this:
let rectInTableView = chartView.convert(CGRect(x: highlight.xPx, y: highlight.yPx, width: 0, height: 0), to: tableView)
I guess you may have to debug why highlight.drawX is 0.0. In charts demo, I am seeing valid values.
Tested on ChartDemo with LineChart1ViewController.
Breakpoint at
Result :

@jndefosse It's an old issue; are you breaking at the beginning?
let x = high.x // get the x-position
let y = high.y * Double(animator.phaseY)
if x > chartXMax * animator.phaseX
{
continue
}
let trans = dataProvider.getTransformer(forAxis: set.axisDependency)
let pt = trans.pixelForValues(x: x, y: y)
There is chance that x, y is 0 when chart just starts. You are welcome to debug, as I don't know the real issue. No update for quite a while, and Chart marker seems working all the time.
Most helpful comment
Yes, it seems that
highlight.drawXanddrawYalways returns values (0.0, 0.0).As mentioned @Rnorback you could use
highlight.xPx&highlight.yPx. Marker position could be converted to any view like this:let rectInTableView = chartView.convert(CGRect(x: highlight.xPx, y: highlight.yPx, width: 0, height: 0), to: tableView)