2012-12-26 50 views
1
CPTXYGraph *graph = [[CPTXYGraph alloc]initWithFrame:self.hostingView.frame]; 
graph.borderColor = [CPTColor whiteColor].cgColor; 
graph.paddingTop = 0.0f; 
graph.paddingRight = 0.0f; 
graph.paddingLeft = 0.0f; 
graph.paddingBottom = 0.0f; 
self.hostingView.hostedGraph = graph; 
graph.axisSet = nil; 


//Apply for theme to graph 
self.graphTheme = [CPTTheme themeNamed:kCPTPlainWhiteTheme]; 
[graph applyTheme:self.graphTheme]; 
[graph release]; 

CPTPieChart *pieChart = [[CPTPieChart alloc]init]; 
pieChart.identifier = @"OverView"; 
pieChart.dataSource = self; 
pieChart.sliceDirection = CPTPieDirectionClockwise; 
pieChart.pieRadius = ((self.hostingView.frame.size.height/2) - 5); 
pieChart.startAngle = M_PI; 
CPTGraph *tempGraph = self.hostingView.hostedGraph; 
    [tempGraph addPlot:pieChart]; 
[pieChart release]; 

对于此代码我得到黑色的彩色边框,我认为这是由于图axisSet,但我不怎么删除。黑色方形边框出现在核心图饼图

+0

PLease post urponine method for drawing the pie chart, –

+1

[core plot axisset for piechart not working]可能的重复(http://stackoverflow.com/questions/13984708/core-plot-axisset-for-piechart-不工作) –

回答

8

如果你在谈论的是整个图形周围会出现边界框,我会说使用此代码的声明[graph applyTheme:self.graphTheme];后:

graph.plotAreaFrame.borderLineStyle = nil; 

这从图中区域完全消除边界。

+0

谢谢...它现在工作。 – karan