我有 y 轴和总测试数
和 x 轴时间
以下是我用来绘制的代码:
- (NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot {
NSUInteger recordplot;
if (plot.identifier == @"Plot Error")
{
recordplot = [HourErroroArray count];
recordplot--;
}
return recordplot;
}
- (NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {
NSDecimalNumber *num = nil;
int eTemp1;
int eHour1;
int eMin1;
int eSec1;
// Number of the X axis asked
if (fieldEnum == CPScatterPlotFieldX)
{
if (plot.identifier == @"Plot Error")
{
eHour1=[[HourErroroArray objectAtIndex:index]intValue ];
eMin1=[[MinErrorArray objectAtIndex:index]intValue ];
eSec1=[[SecErrorArray objectAtIndex:index]intValue ];
eTemp1=eHour1*eMin1*eSec1;
num = (NSDecimalNumber *)[NSDecimalNumber numberWithInt:eTemp1];
}
}
// Number of the Y axis asked
else if (fieldEnum == CPScatterPlotFieldY)
{
if (plot.identifier == @"Plot Error")
{
num = (NSDecimalNumber *)[NSNumber numberWithInteger:index];
}
}
return num;
}
我可以看到图表正在绘制,但仅在一条直线上,即平行于 xaxis
!->y 轴,_ ->x 轴和 . -> 线正在绘制值
y轴 ! ! !............ ! _____________ x 轴
但我想要以下内容:
http://www.buggyprogrammer.co.uk/2010/10/03/using-core-plot-to-draw-line-graphs/
也许不是上下线,但至少有一些角度。