Search code examples
iosswiftios-charts

How to have fixed points in one screen using and then swipe to get to the next page using ios-charts?


I am using Swift trying to generate chart using the ios-charts api and having trouble containing same amount of point in the scene now. The chart is beautiful when having 5 points, like this picture with 5 points, however, when it comes to more points, it is really messy: picture with more points. So is there a way for me to keep just 5 points every scene and let the user swipe to get to another page? Thanks!


Solution

  • Yes, you can limit visible X range like so..

    lineChartView.setVisibleXRange(minXRange: 5, maxXRange: 5);
    

    This will make only 5 points visible at a time, and will allow the user to scroll left or right for more.