我正在尝试使用核心绘图生成一个简单的折线图,但我无法获得实线。我遇到的问题是,这条线似乎默认为虚线。
我是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 :(得分:0)
它真的是虚线,还是只是抗锯齿伪像?尝试增加线宽和/或更改线条颜色以首先排除。