The difference is very huge. If we look at definition of type CPTBarPlotField
in CPTBarPlot
we will see that there are three values in that enum:
CPTBarPlotFieldBarLocation
: Bar location on independent coordinate axis.
CPTBarPlotFieldBarTip
: Bar tip value.
CPTBarPlotFieldBarBase
: Bar base (used only if barBasesVary is YES).
You can ask - where can I use that values? Ok, you should use this constants in method -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
. In that method you should return values of that properties for each individual bar. For example,
-(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")];
}
In my example I have dictionary which contains values for x axis (locations of bars) and y (values of bars).
I want to mention, that you should not set property plotRange
of your CPTBarPlot *plot
or CorePlot
will set locations of your bars automatically (at position 0,1,2,3,4....).