2012-05-31 79 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

难道真的虚线,或者只是抗混叠假象?尝试增加线条宽度和/或更改线条颜色,以便首先排除。