2013-05-28 146 views
0

我已成功創建兩個系列(每個繪圖空間中有一個),每個系列都使用其自己的比例。我創建了軸與此代碼:帶有核心繪圖輔助軸的標籤顯示問題

CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.hostView.hostedGraph.axisSet; 
CPTXYAxis *x = axisSet.xAxis; 
CPTXYAxis *y = axisSet.yAxis; 
CPTXYAxis *y2 = axisSet.yAxis; 
y.plotSpace = plotSpace; 
y2.plotSpace = plotSpace2; 
graph.axisSet.axes = [NSArray arrayWithObjects:x, y, y2, nil]; 

代碼正常設置y的性能,但是當代碼達到了Y2設置屬性,如:

y2.title = @"Velocity (m/s)"; 

ÿ獲取其標題屬性已更改。

這裏是我的plotspace設置:

塊引用

graph = self.hostView.hostedGraph; 
plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace; 
graph.plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor clearColor]]; 
[graph addPlotSpace:plotSpace]; 

CPTScatterPlot *forcePlot = [[CPTScatterPlot alloc] init]; 
forcePlot.dataSource = self; 
forcePlot.identifier = CPDForce; 
[graph addPlot:forcePlot toPlotSpace:plotSpace]; 
[graph addPlotSpace:plotSpace2]; 
CPTScatterPlot *velPlot = [[CPTScatterPlot alloc] init]; 
velPlot.dataSource = self; 
velPlot.identifier = CPDVelocity; 
[graph addPlot:velPlot toPlotSpace:plotSpace2]; 

[plotSpace scaleToFitPlots:[NSArray arrayWithObjects:forcePlot, nil]]; 
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0) length:CPTDecimalFromFloat(SlopeTime)]; 
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0) length:CPTDecimalFromFloat(MaxForce+0.1*MaxForce)]; 

[plotSpace2 scaleToFitPlots:[NSArray arrayWithObjects:velPlot, nil]]; 
plotSpace2.xRange = plotSpace.xRange; 
plotSpace2.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0) length:CPTDecimalFromFloat(MaxVelocity+0.1*MaxVelocity)]; 

回答

1

你已經設置yy2相同的軸對象。創建一個新的軸對象y2,而不是:

CPTXYAxis *y2 = [[CPTXYAxis alloc] init]; 
+0

這樣做。非常感謝。 – user2428818

相關問題