SChartLineSeries, Change range between SChartNumberRange numbers


#1

Hello everyone,

I want to change the range between numbers to 25,000 instead of 5,000 this is the code I’m using :

NSNumber *minYNub = [numberPosSorted_Array objectAtIndex:0];
NSNumber *maxYNub = [numberPosSorted_Array objectAtIndex:([numberPosSorted_Array count]-1)];
maxYNub = @(maxYNub.intValue * 1.25);
SChartNumberRange *range = [[SChartNumberRange alloc] initWithMinimum:minYNub
andMaximum:maxYNub];
chartCashFlow.yAxis = [[SChartNumberAxis alloc] initWithRange:range];
chartCashFlow.yAxis.rangePaddingLow = @25000;
chartCashFlow.yAxis.rangePaddingHigh = @25000;
Result :


I’ve tried :
chartCashFlow.yAxis = [[SChartNumberAxis alloc] init];
chartCashFlow.yAxis.autoCalculateRange = NO ;
chartCashFlow.yAxis.rangePaddingLow = @25000;
chartCashFlow.yAxis.rangePaddingHigh = @25000;

i’ve got a padding on range with 0.1

Any Idea how to set the range between numbers to 25000 ex: yAxis should show 70,000 95,000 120,000 …

Thank you in advanced.


#2

The result of the second code :


#3

Hi Fouad,

Sounds like you want to use the “majorTickFrequency” property on your axis.

If you set this to 25,000 it should produce the behaviour you require.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#4

Thank you for your support, I’ve used your solution.
Is there anyway to reduce the spacing between the number on Y axis ?

this is what we got :

Thank you in advance


#5

Hi Fouad,

I’m not really sure what you mean by “reduce the spacing between the numbers on Y axis”.

Could you provide an image demonstrating what behaviour you would like to see on your Y-axis?

Kind regards,
Andrew Polkinghorn.


#6

Hello :smiley:

Well, its something like this attached image, the numbers are good, we just need to reduce this white space between them,

Thank you for your valuable support,


#7

Hi Fouad,

You need to increase the range on your Y-axis.

This is done using our SChartNumberRange object that can be initialised with a min and max value.

You can do this by initialising your Y-axis with the “initWithRange” method or set the range property on your axis once the chart has been drawn.

Sample code:

SChartNumberRange *range = [[SChartNumberRange alloc] initWithMinimum:@50000 andMaximum:@200000];
SChartNumberAxis *yAxis = [[SChartNumberAxis alloc] initWithRange:range];

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#8

Thanks a lot, we got it working :smiley:
Cheers