2012-12-26 106 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