2011-07-19 32 views

回答

4

區別是非常巨大的。如果我們看一下在CPTBarPlotCPTBarPlotField類型的定義,我們會看到有三個值在枚舉:

  1. CPTBarPlotFieldBarLocation:獨立座標軸條的位置。
  2. CPTBarPlotFieldBarTip酒吧小費值。
  3. CPTBarPlotFieldBarBaseBar base(僅在barBasesVary爲YES時才使用)。

你可以問 - 我在哪裏可以使用該值?好的,你應該在方法-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index中使用這個常量。在該方法中,您應該爲每個單獨的欄返回該屬性的值。例如,

-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index 
{  
    int plotIndex = [(NSNumber *)plot.identifier intValue]; 
    return [[[datas objectAtIndex:plotIndex] objectAtIndex:index] valueForKey:(fieldEnum == CPTBarPlotFieldBarLocation ? @"x" : @"y")]; 
} 

在我的例子我有字典包含用於X軸線(酒吧位置)和ÿ(酒吧值)的值。

我想提一下,你不應該設置屬性plotRange你的CPTBarPlot *plotCorePlot會自動設置你的酒吧的位置(在位置0,1,2,3,4 ....)。

+0

謝謝你的回答! – user851369

+1

如果它幫助你不要忘記接受它=) – Nekto