我已经使用链接http://www.johnwordsworth.com/2011/10/adding-charts-to-your-iphone-ipad-app-using-core-plot/实现了核心绘图图
在此示例中,作者对 x,y 点使用了两个浮点值
但现在我需要为 y 轴点使用时间值我应该如何编写代码来分配 x,y 点
AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
NSMutableArray * times = app.timesArray;
NSMutableArray * painlevels = app.PainlevelsArray;
[super viewWillAppear:animated];
//Xand y Points to draw a graph
NSMutableArray *data = [NSMutableArray array];
for(int i=0 ; i< [painlevels count]; i++)
{
[data addObject:[NSValue valueWithCGPoint:CGPointMake([[painlevels objectAtIndex:i]floatValue] , [[times objectAtIndex:i]floatValue])]];
}
//X,y 点代表以前的值 在作者示例中浮动值
/* [data addObject:[NSValue valueWithCGPoint:CGPointMake(@"fd", 0)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(-8, 10)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(-6, 40)]]; [数据 addObject:[NSValue valueWithCGPoint:CGPointMake(-5, 20)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(0, 50)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(3, 3)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(4, 18)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(6, 36)]]; [data addObject:[NSValue valueWithCGPoint:CGPointMake(9, 66)]];*/
self.scatterPlot = [[ScatterPlot alloc] initWithHostingView:_graphHostingView andData:data];
[self.scatterPlot initialisePlot];