Search code examples
iosswiftios-charts

How to set minimum and maximum of the x axis using iOS-Charts


I'm trying to use ios-charts to draw charts and I have figured out how to set the minimum and maximum of the y axis. However, I have spent more than 5 hours and I still cannot set the minimum and maximum for the x axis. So can anyone help me?

The code I used to limit the y axis is like this

statsView.leftAxis.customAxisMax = 21.00
statsView.leftAxis.customAxisMin = 0.00

and there are just too more points on the screen too many data


Solution

  • I just tried below code, works for me.

    lineChartView.xAxis.axisMinValue = 100;
    lineChartView.xAxis.axisMaxValue = 200;