Format numbers on y-axis and tick frequency


Hi -

I have a chart with a y-axis number range from 1 to 4, with a padding of 2 on the top and bottom.  On iPhone, these values show up as 1, 2, 3, 4 - which is what I want.  On iPad, the chart is a bit taller, and the values are coming up as 0.5, 1.0, 1.5, 2.0, 2.5…  etc.  

I’ve tried using the delegate method as follows to have the numbers display as integers, but it’s not working:

- (void)sChartRenderStarted:(ShinobiChart *)chart withFullRedraw:(BOOL)fullRedraw
     NSNumberFormatter *numberFormatter = (NSNumberFormatter*)_challengeLevelLineChart.yAxis.labelFormatter.formatter;
     [numberFormatter setNumberStyle:NSNumberFormatterNoStyle];


In addition, I only want to show 4 values on the yAxis, no matter the chart’s final size, but when I try to set the “yAxis.majorTickFrequency = 1.0” I get a typecast / assignment error, since majorTickFrequency is an ‘id.’

Any help would be much appreciated!

Thank you!


You were headed in the right direction with majorTickFrequency!

You just need to put an @ before the 1.0 due it being in Objective-C.

  • Matt