0
我需要在iPhone中使用给定数组数组绘制散点图。我怎样才能做到这一点?如何使用核心图中的数字绘制散点图
我需要在iPhone中使用给定数组数组绘制散点图。我怎样才能做到这一点?如何使用核心图中的数字绘制散点图
你只需要编写一个方法,它将返回一个对象(NSNumber *)
并以NSInteger(它将作为你想要的值的索引)作为参数。在此方法中,您将从NSMutableArray
的特定索引中检索值。
现在步骤2)编写方法如下所示。通过这种方法,图表会知道要绘制多少个坐标。
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot {
return (here you should call your method that will return the length of your array);
}
步骤3)这是您的图形将绘制坐标的方法。
-(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
if (fieldEnum == CPScatterPlotFieldX)
{
return (value that you want to plot on X- axis. for example index);
}
else
{
return (call your method you implemented in step 1) that will fetch a value from your array and pass (index) as parameter); // It will plot the value on the y-axis.
}
}
非常感谢。 – ravoorinandan 2011-04-18 05:54:55
你需要什么样的帮助? – 2011-04-06 16:08:24
实际上正在回顾一些值并将它们存储在一个可变数组中。现在,我需要绘制一个带有这些retrived值的散点图! – ravoorinandan 2011-04-07 06:52:29