Hi i am new to iOS charts.
I am using double tap to zoom into my LineChart, but cannot find a way to zoom back out.
Is there a simple way to do this or do I have to intercept the double tap and save my state and restore it later?
I am using Charts 3.0.1 and Swift 3.0.2.
Thanks.
This is how you zoom out in Charts
chartView.fitScreen()
Since iOS Charts is analogy to MPAndroidChart , huge part of its documentation, wiki and Q&A applies to both libraries.
This is how we did it. We put this line of code when a button was tapped to reset the zoom.
self.lineChartView.zoomToCenter(scaleX: 0, scaleY: 0)
If you want, you can also put in a plus and minus button and zoom in/out accordingly. You can get the current scale by using this line of code self.lineChartView.scaleX
or self.lineChartView.scaleY
and then add/subtract a fixed amount every time the zoom in/out button is tapped.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.