Iphone 如何使用核心图中的数字绘制散点图

Iphone 如何使用核心图中的数字绘制散点图,iphone,core-plot,Iphone,Core Plot,我需要用iPhone中给定的数字数组绘制散点图。如何实现这一点?您只需编写一个方法,该方法将返回(NSNumber*)的对象,并将NSInteger(它将是您想要其值的索引)作为参数。在此方法中,您将从NSMutableArray的特定索引中检索值 现在,第2步)编写如下所示的方法。通过这种方法,图形将知道要绘制多少坐标 -(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot { return (here you should call yo

我需要用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.
    }
}

您只需要编写一个方法,该方法将返回一个对象
(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.
    }
}

你到底需要什么样的帮助?实际上我正在检索一些值并将它们存储在可变数组中。现在我需要用检索到的值绘制散点图!你到底需要什么样的帮助?实际上我正在检索一些值并将它们存储在可变数组中。现在我需要用检索到的值绘制散点图!