2012-05-31 120 views
0

我正嘗試使用核心圖產生一個簡單的線圖,並且無法獲得一個實線。我遇到的問題是,似乎該線路默認爲虛線。核心圖 - 折線圖

我是iOS和Xcode開發的新手,所以請原諒我,如果它很痛苦簡單。我附上我的代碼,任何人都可以看到我錯過了什麼? 在此先感謝!

的代碼是基於示例代碼包含項目:

-(void)constructScatterPlot 
{ 
graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; 
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; 
[graph applyTheme:theme]; 

graphView.hostedGraph = graph;  

graph.plotAreaFrame.borderLineStyle = nil; 
graph.paddingLeft = 0; 
graph.paddingTop = 0; 
graph.paddingRight = 0; 
graph.paddingBottom = 0; 


CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; 
plotSpace.allowsUserInteraction = YES; 
plotSpace.xRange    = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(1.0) length:CPTDecimalFromFloat(100.0)]; 
plotSpace.yRange    = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(1.0) length:CPTDecimalFromFloat(20.0)]; 


CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; 

CPTXYAxis *x   = axisSet.xAxis; 
x.labelFormatter = nil; 
x.labelingPolicy = CPTAxisLabelingPolicyNone; 
x.axisLineStyle = nil; 


CPTXYAxis *y = axisSet.yAxis; 
y.labelFormatter = nil; 
y.labelingPolicy = CPTAxisLabelingPolicyNone; 
y.axisLineStyle = nil; 

CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] init]; 

CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; 
lineStyle.lineWidth    = 1.f; 
lineStyle.lineColor    = [CPTColor whiteColor]; 
dataSourceLinePlot.dataLineStyle = lineStyle; 

dataSourceLinePlot.dataSource = self; 

[graph addPlot:dataSourceLinePlot]; 
} 

回答

0

難道真的虛線,或者只是抗混疊假象?嘗試增加線條寬度和/或更改線條顏色,以便首先排除。