Coreplot iOS - Remove border line around pie chart

core-plot, ios, objective-c

Solution

Use this and debug again, it's working.

piePlot.borderLineStyle = nil;

Problem

I've got a pie chart being generated through Coreplot. It's put a black line all the way around the chart and through all the segments like so: I generate the chart with the following code: ``` -(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index { CPTFill *areaGradientFill ; if (index==0) return areaGradientFill= [CPTFill fillWithColor:[CPTColor colorWithComponentRed:0.0f/255.0f green:111.0f/255.0f blue:115.0f/255.0f alpha:1.0f]]; else if (index==1) return areaGradientFill= [CPTFill fillWithColor:[CPTColor colorWithComponentRed:171.0f/255.0f green:213.0f/255.0f blue:199.0f/255.0f alpha:1.0f]]; else if (index==2) return areaGradientFill= [CPTFill fillWithColor:[CPTColor yellowColor]]; return areaGradientFill; } -(void)constructPieChart:(NSString *)datain; { NSArray *strings = [datain componentsSeparatedByString:@","]; dataforcharts = [datain componentsSeparatedByString:@","]; NSLog(@"dataforcharts: %@", dataforcharts); // Create pieChart from theme pieGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; CPTTheme *theme = [CPTTheme themeNamed:kCPTPlainWhiteTheme]; [pieGraph applyTheme:theme]; pieChartView.hostedGraph = pieGraph; pieGraph.plotAreaFrame.borderLineStyle = nil; pieGraph.plotAreaFrame.masksToBorder = NO; pieGraph.paddingLeft = 20.0; pieGraph.paddingTop = 20.0; pieGraph.paddingRight = 20.0; pieGraph.paddingBottom = 20.0; pieGraph.axisSet = nil; // Prepare a radial overlay gradient for shading/gloss CPTGradient *overlayGradient = [[CPTGradient alloc] init]; overlayGradient.gradientType = CPTGradientTypeRadial; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.0] atPosition:0.0]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.3] atPosition:0.9]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.7] atPosition:1.0]; // Add pie chart piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; piePlot.pieRadius = 100.0; piePlot.pieInnerRadius = 50.0; piePlot.identifier = @"Pie Chart 1"; piePlot.startAngle = M_PI_4; // piePlot.sliceDirection = CPTPieDirectionCounterClockwise; piePlot.borderLineStyle = [CPTLineStyle lineStyle]; piePlot.labelOffset = -40.0; piePlot.overlayFill = [CPTFill fillWithGradient:overlayGradient]; [pieGraph addPlot:piePlot]; CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; textStyle.color = [CPTColor blackColor]; textStyle.fontName = @"Helvetica-Bold"; textStyle.fontSize = 16.0f; pieGraph.title=@"Chart1"; pieGraph.titleTextStyle = textStyle; pieGraph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; pieGraph.titleDisplacement = CGPointMake(0.0f, -1.0f); int i = [[strings objectAtIndex:0] intValue]; int f = [[strings objectAtIndex:1] intValue]; NSLog(@"Int1: %i", i); NSLog(@"Int2: %i", f); // Add some initial data NSMutableArray *contentArray = [NSMutableArray arrayWithObjects:[NSNumber numberWithDouble:i], [NSNumber numberWithDouble:f], nil]; self.dataForChart = contentArray; CPTLegend *theLegend = [CPTLegend legendWithGraph:pieGraph]; theLegend.numberOfColumns = 2; theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; theLegend.borderLineStyle = [CPTLineStyle lineStyle]; theLegend.cornerRadius = 5.0; pieGraph.legend = theLegend; pieGraph.legendAnchor = CPTRectAnchorBottom; pieGraph.legendDisplacement = CGPointMake(0.0, -0.0); } ``` and I'd like to remove the black lines around the chart. I've already tried setting the `borderLineStyle` to `nil` but this doesn't seem to have any effect. Any help is appreciated. Thanks! Adam

Original source