I am using the Charts framework from Daniel Cohen Gindi. I am scrolling chart horizontally by increasing scaleX value and enabled drag as described in answer of this question
Set an horizontal scroll to my Barchart in swift
I want to add marker at center position when user scrolls horizontally. I know "chartTranslated" delegate is called whenever user drags the chart but it doesn't contain the value of "ChartDataEntry" and "Highlighted" like in "chartValueSelected" delegate method.
Unfortunately
ChartViewBase.swift
is full of private function and internal vars and you can't extend some method or obtain some var to get the values you searching for.Anyway, you can always improve sources adding some other method you want to use inside the
public protocol ChartViewDelegate
:ChartViewBase.swift
under the line:
add this:
Then , you can easily call this new delegate method to the only source part of the code where
chartTranslated
is called:BarLineChartViewBase.swift
search the part of the code where you see these lines:
and change it with:
Usage:
Now, with this new delegate method you can make your marker to the center indices.
A gif to show a little demonstration: