Add padding to graph


It possible to adding padding to a ChartView so it matches the design for the screen.

This is what the screen currently looks like:

Current screen

and this what the padding should be like (note that the left and right most digits are completely visible):

Ideal padding

I’m only interested in adding the padding (the grid lines, line style, etc don’t matter). 


Hi Raybritton,

The easiest way to add padding around your chart is to give it a frame that includes the padding. You can easily do this using CGRectInset:

CGRect originalFrame = ...;

// Inset the chart by 30 on all sides.
self.chart = [[ShinobiChart alloc] initWithFrame:CGRectInset(originalFrame, 30, 30)];

Jan Akerman


Sorry, should have mentioned that I tried this, but this it results with:

As you can see the tick labels remain cut off.


Hi Raybritton,

I’ve just realised that this is clearly an Android chart and I gave you an Objective-C sample - sorry about that! It looks like insetting your frame has had the correct effect.

Now, you’ll just want to focus on styling your gridlines & axis ranges so that your tick mark labels are no longer clipped so that your chart matches the above example.

Jan Akerman