在numberOfRecordsForPlot:...
我有這樣的代碼:核心情節 - 餅圖沒有顯示足夠段
int count = [[optsDict objectForKey:@"Values"] count];
NSLog(@"pie count: %i", count);
return count;
它輸出pie count: 4
從而(除非我誤解)應該有4個片段的餅圖。
然後在numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
我有這樣的:
double percentage = ((float)counter/(float)total)*100;
num = (NSDecimalNumber *)[NSDecimalNumber numberWithInt:(int)percentage];
NSLog(@"index: %i, percentage: %f", index, percentage);
NSLog(@"%@", num);
return num;
此輸出:
index: 0, percentage: 9.090909
9
index: 1, percentage: 9.090909
9
index: 2, percentage: 63.636364
63
index: 3, percentage: 18.181818
18
所以我假設(合理的),該功能已得到各段運行一次和它返回一個數字爲他們所有!
但圖表看起來是這樣的:
即使世界真的沒有別的太多我可以告訴你。就我所知,我對核心情節瞭解不多!
如果有任何幫助你可以給我,我會非常感激!
謝謝
什麼顏色用於圖表繪製? – beryllium
我沒有選擇任何。但我然後將顏色設置爲漸變,肯定有兩個切片... –
檢查我的答案,並告訴我,如果它解決了您的問題 – Nekto