Padding for SChartCategoryAxis


#1

Is there anyway I can add gap for SChartCategoryAxis to achieve the following?Currently, my chart occupied the entire plot area and doesn’t have any gap on start and ending.

Thanks!


#2

Hi Deyan,

Where exactly do you want the padding on you charts SChartCategoryAxis?

Kind Regards,

Andrew Polkinghorn


#3

hmm, this is the end result that i want…currently, i only managed to achieve the following :-

may I know where can I change the code to achieve this?


#4

HI Deyan,

Have you tried setting rangePaddingHigh, and rangePaddingLow on your x axis? Setting both of these properties should add a gap of fixed size at the start and end of your axis. The following code snippet demonstrates how to set both of these properties to 1:

xAxis.rangePaddingHigh = @1;
xAxis.rangePaddingLow = @1;

ForSchartCategoryAxis The padding is based on the number of elements in the axis. So if you graphs has two elements in it (as shown in your screenshot) this should add an extra elements width at either end of your axis and give you your desired look.

Kind regards,

Daniel Allsop


#5

Thanks it works well!!! :sunglasses:

xAxis.rangePaddingHigh = [NSNumber numberWithFloat:0.5f];
    xAxis.rangePaddingLow = [NSNumber numberWithFloat:0.5f];