我是 iPhone 开发新手,谁能帮我只使用三个值在 iPhone 中绘制曲线图
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot
{
NSLog(@"Array1-->%@",Array1);
return [Array1 count];
}
-(NSNumber *)numberForPlot:(CPPlot *)plot
field:(NSUInteger)fieldEnum
recordIndex:(NSUInteger)index
{
NSLog(@"Array1-->%@",Array1);
NSLog(@"marks1-->%@",marks1);
if(fieldEnum == CPScatterPlotFieldX)
{
return [Array1 objectAtIndex:index];
}
else
{
if(plot.identifier == @"X Squared Plot")
{
return [marks1 objectAtIndex:index];
}
}
}
使用上面的代码绘制了曲线图,但我在每个数组中有很多值..但我想在每个数组中仅使用三个值进行绘图。
替换以下代码:
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot{
NSLog(@"Array1-->%@",Array1);
return [Array1 count];
//return 50;
}
与以下一项:
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot{
NSLog(@"Array1-->%@",Array1);
return 3;
}
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)