2015-02-06 88 views
0

我正在繪製一個繪圖儀應用程序。創建繪圖區後,我設法使用-addCurve:index將圖添加到該區域,如下所示。在覈心繪圖中繪製切線圖

-(void)addCurve:(int)index { 

    // identifier 
    NSString *identifier = [NSString stringWithFormat:@"plot%d", index]; 

    CPTScatterPlot *boundLinePlot = [[CPTScatterPlot alloc] init]; 
    CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle]; 
    lineStyle.miterLimit  = 1.0f; 
    lineStyle.lineWidth   = 3.0f; 
    lineStyle.lineColor   = [CPTColor colorWithCGColor:[colorArray[index-1] CGColor]]; 
    boundLinePlot.dataLineStyle = lineStyle; 
    boundLinePlot.identifier = identifier; 
    boundLinePlot.dataSource = self; 
    [graph addPlot:boundLinePlot toPlotSpace:plotSpace]; 

    // interpolatiom 
    boundLinePlot.interpolation = CPTScatterPlotInterpolationCurved; 
} 

然而,當我繪製一個正切函數時,最高點和最低點連接並且每兩條曲線之間出現垂直線。任何人都知道我能如何擺脫它們?謝謝。

回答

0

您需要在數據中留下空隙(從數據源返回nil[NSNull null])以斷開不連續處的繪圖線。

+0

非常感謝你! – user 2015-02-10 10:25:53