rangePaddingLow and rangePaddingHigh, how to use them?



I don’t get how to correctly use the rangePaddingHigh and rangePaddingLow

I have a chart with autorange yaxis, but I would like to put some padding on bottom and on top to have a better look. 

Any snippet you can share?




Hey Paolo,

The rangePaddingLow & rangePaddingHigh are properies on the SChart axis and they effectively add a certain amount onto the axis range. This should work even with axes that haven’t been given a set range. It is just a case of setting the property on an axis object to the amount of padding you want to have, below is an example of setting an upper padding of 5 on a chart’s Y axis:

chart.yAxis.rangePaddingHigh = [NSNumber numberWithFloat:5.0];

If you change the rangePaddingHigh, and rangePaddingLow properties on an axis you have made, you should be able to see the effect of these properties.

A small note, is when using SChartDateTimeAxis you have to set this property to a SChartDateFrequency object, not an NSNumber. For example, if you would like to have one month padding either side of a date/time X axis you would have to do the following:

chart.xAxis.rangePaddingHigh = [SChartDateFrequency dateFrequencyWithMonth:1];
chart.xAxis.rangePaddingLow = [SChartDateFrequency dateFrequencyWithMonth:1];

I hope this has helped.



Are there conditions under which the rangePaddingHigh and rangePaddingLow properties are ignore?  I ask because I have a line chart which is behaving in this way.  For example, see this chart

line chart

In this case, the maximum yAxis range is set to the (0,69) where 69 is the value of the data point depicted.  Despite setting

yAxis.rangePaddingHigh = @10;

no vertical padding is provided by the chart.

Similarly, setting the range padding on the xAxis (an SChartDateTimeAxis) has no effect.  In the illustrated case, the date of the single point depicted is Aug 14 and the xAxis range padding is set as follows:

xAxis.rangePaddingLow = [SChartDateFrequency dateFrequencyWithDay:7];

No lower padding is provided for the axis.  Am I missing something else here?


Same thing is happening to me — range padding appears to be completely ignored on my chart.  :rolling_eyes:


I can only second this. I get no padding either…


Same here. The fix for me was making sure tha minimum date is the first day of the month and the maximum date in the range is the last day of the month (not 1st) when displaying months 1 - 12. Hope this helps.


Hi, did the rangePadding for the DateTimeAxis work ? I am getting the same issue as well 


Hi sim777,

I think I may have answered this on another thread, but just in case I haven’t:

It’s likely that you may be setting a default range. If an explicit default range is set any range padding you add will be ignored by the chart.

Hope that helps!


so what would be the solution if you set the explicit default range?


Hi Veerun,

If you’re setting your own default range, then you could just take into account your desired padding and add that on. For example, you want padding of ‘5’ on either side, you could just minus 5 from your default range’s minimum and add 5 to your default range’s maximum. This would give the same result as setting rangePaddingHigh and rangePaddingLow to 5.

Unfortunately the chart doesn’t support adding padding if your default range is less than the data range (i.e. data range on x-axis = 0 to 5, but default range = 1 to 2). In this case, you could listen to the delegate method ’ didAlterRangeOnAxis’ and then constrain the axis to not pan/zoom beyond your desired range with padding applied.

I hope that’s of some help.



Thanks sburnstone,

It worked. In my case, i wanted a padding on the right side of the x-axis. I am using CategoryAxis and I added to the maximum and used the following method

SChartRange* axisChartRange = [[SChartRange alloc] initWithMinimum:minimum andMaximum:maximum];