Clearing Set Axis Range to Automatic?

During certain user chart interaction, I need to define the axis data range. In order to do this I use: 
chart.xAxis.defaultRange = setXaxisRange;
chart.yAxis.defaultRange = setYaxisRange;
This works great and behaves how I expect. 
I would like to be able to clear the axis range setting and return to the default autoscale behavior after particular user interaction are completed. How do I do this? I tried "chart.xAxis.defaultRange = nil" but the chart seems to retain the previous setting.


I had an issue where it didn’t seem like new ranges were being adopted, but then I realized I had to set the ranges inside one of the delegate functions. When new data was loaded, I wanted a new range to be set, so I did it in the sChartDidFinishLoadingData delegate function and used [chart.xAxis setRangeWithMinimum:andMaximum:withAnimation] to set the range to what I wanted. I hope this helps.


Hi JP_UserPoco,

I think your problem may be that you are setting the defaultRange - this is the range that will be displayed after the chart initially loads, or if the zoom is reset.

As jghazarian has mentioned, the setRangeWithMinimum:andMaximum:withAnimation: may be more appropriate for you. Setting the min or max to nil using this method will cause the chart to auto calculate a min/max for itself which sounds like what you are after.

I hope this helps! Let us know if you need any further advice  :laughing: