"setCurrentDisplayedRangePreservedOnUpdate" equivalence for iOS?



I’m trying to add a chart that support live data with single line series - adding new point every few seconds.

When the users sees the last point, I need to keep update the range, evertytime a new point arrive, in order to show live progress.

I’m doing it by:


 self.chart.xAxis?.defaultRange = SChartDateRange(dateMinimum: earlyDate, andDateMaximum: laterDate) 


It works fine.

When the user scolls to the left, to see the history, I need to keep update the chart WITHOUT  scrolling back to the newest point

However, after callnig to self.chart.reloadData()             

The chart is scrolled back to the newest point  smiley cry

How can I keep update the graph and stay at the position where the user scrolled?

I saw that in Android, it is being done by  setCurrentDisplayedRangePreservedOnUpdate

Thanks in Advance!



Hi Dors,

To do this for iOS you can simple turn off the autoCalculatedRange on the affected axis. This will mean your range stays the same every time reloadData and redrawChart/redrawChartIncludingPlotArea are called.

Let me know if you need any further help.

Kind regards,

Matt / iOS Developer