Add padding to chartarea


#1

Hi,

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?

https://www.dropbox.com/s/u7h7vq4z87trwkq/screen.png

Regards,

Daniel


#2

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


#3

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?


#4

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


#5

Hey,

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.

Regards,

Daniel