ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.51k stars 5.99k forks source link

Prevent auto scroll to the end on addEntry to the CandleStickChartView #5010

Closed sergeymild closed 1 year ago

sergeymild commented 1 year ago

ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag ios-charts.

Please remove this line and everything above it before submitting.

What did you do?

I am trying to make live candles chart and every second i insert a new candle, the problem is that chart auto scroll to the end on add new entry.

let stick = createCandlestick(index: chartView.data?.entryCount ?? 0, item: candle as! [String : Any])
chartView.data?.appendEntry(stick, toDataSet: 0)
chartView.notifyDataSetChanged()

I would like to keep user scroll position and just render new candle at the end of view.

What happened instead?

the problem is that chart auto scroll to the end on add new entry.

Charts Environment

Master: 14.1: 5: IOS:

Demo Project

https://user-images.githubusercontent.com/3685209/217563820-035c9607-8ef9-4faf-abe9-cfa243fe74d3.mp4