0
votes

I am trying to produce a simple line graph using core plot and am having trouble getting a solid line. The issue I am having, is that it seems the line is defaulting to a dashed line.

I am new to iOS and Xcode development so forgive me if it's painfully simple. I have attached my code, can anyone see what am I missing? thanks in advance!

The code is based on the example code included with the project:

-(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];
}
1

1 Answers

0
votes

Is it really a dashed line, or just anti-aliasing artifacts? Try increasing the line width and/or changing the line color to rule that out first.