如何在Core Plot Y轴上显示整数而不是小数?

div*_*vya 4 iphone core-plot ios

我正在使用Core Plot绘制折线图,​​我希望Y轴标签显示为整数.例如,我的范围是0到10,间隔为1,但图表当前显示的是1.0,2.0,3.0等轴标签.

如何使Core Plot将标签显示为1,2,3等?

Nil*_*ani 5

我只是在这里发布代码,我之前有相同的问题,并解决了,但目前我忘了我已经做了哪些改变所以请检查下面的代码,你会得到你想要的确切解决方案.

它工作正常只需要使用这个测试...

NSNumberFormatter *yAxisFormat = [[[NSNumberFormatter alloc] init] autorelease];
[yAxisFormat setNumberStyle:NSNumberFormatterNoStyle]; 

CPXYAxis *y = axisSet.yAxis;
y.axisLineStyle = lineStyle;
y.majorTickLineStyle = nil;
y.minorTickLineStyle = nil;
y.majorIntervalLength = CPDecimalFromString(@"20");
y.orthogonalCoordinateDecimal = CPDecimalFromString(@"0");
y.title = @"Number of Cards Learned";
y.titleOffset = 45.0f;
y.titleLocation = CPDecimalFromFloat(50.0f);
y.labelFormatter = yAxisFormat; 
Run Code Online (Sandbox Code Playgroud)

如果还有其他问题,请告知我.