Rounding y-axis values
I am using the following delegate methods for setting the base value and incremental value.
- (CGFloat)baseValueForYAxisOnLineGraph:(BEMSimpleLineGraphView *)graph{
return [graph.calculateMinimumPointValue intValue];
}
- (CGFloat)incrementValueForYAxisOnLineGraph:(BEMSimpleLineGraphView *)graph{
int num = [graph.calculatePointValueAverage intValue] - [graph.calculateMinimumPointValue intValue]; // your number
int len = log10(num);
float div = pow(10, len);
int rounded = ceil(num / div) * div;
return rounded;
}
Using the above code, I get the following output:

Where as, I want the Y-Axis value to be as follows. Because the data displayed on the chart is dynamic:
53 comes out as 60.. 197 comes out as 200.. 4937 comes out as 5000..
Problems come bigger if you have data like from 0.112 to 1.0112 then y-axis labels are rounded to 0 and 1 and you have problem with y-axis labels(they are only 0 and 1). And the problem grow bigger if you turn pop up on to be always on screen, text on pop up is always 0. As work around for popups i see the adding suffix with needed number as text after dot. If we have 0 we are adding ".112" like a suffix string