Add padding to chartarea



my chart is contained inside a rounded view. As you can see on the image, the top caption of the chart gets cut off. Any way to give the chart a padding for all sides to center it inside the containg view?




Hi Daniel,

You should be able to achieve this by using the following line of code:

chart.frame = CGRectInset(chart.frame, dx, dy);

Using positive values for both dx and dy should reduce the size of the source rectangle by the amount you specify for each of x-coordinate value and y coordinate value respectively.

Kind regards,

Daniel Allsop


Hi Dan, 

This still doesn’t solve the problem of the labels getting cut off at the end of the chart. Any way to solve this problem?


Hi Dan - that doesnt add padding to the chart as such - just insets the view, I’m still getting values cut off as well. 



i achieved what i wanted by adding a top padding to the axis and by setting the clipping mode for the label.

_extraYAxis.tickLabelClippingModeHigh = SChartTickLabelClippingModeTicksPersist;

Maybe this helps.