Dynamic yAxis paddingHigh


#1

I want to set yAxis.rangePaddingHigh vary by maximum data of yAxis about 10%.

I try something like this

NSNumber * testNum = [NSNumbernumberWithDouble:[mainChart.yAxis.axisRange.maximumdoubleValue]*0.1];

mainChart.yAxis.rangePaddingHigh = testNum;

but the maximum value is always null and the chart did not change anything.

I don’t understand when the minimum and maximum of range will have value.

Is there any solutions for my case?

Thank you


#2

Hi TaTeeMan,

It sounds to me like you might be attempting to obtain the axis’ maximum value before the chart has rendered.

If you do this then the axis will have no axis range values. I suggest waiting until the chart has finished rendering before you set the rangePaddingHigh, and then redraw the chart. Let me know how you get on.

Kind regards,
Daniel Allsop


#3

How could I know the chart is already render. Is there any delegate methods for checking this?


#4

Hi TaTeeMan,

There is a delegate method you can use to know when the chart has finished rendering. It is sChartRenderFinished:

Kind regards,  

Daniel Allsop