strange bar behaviour in coreplot

84 Views Asked by At

I am having a very bizarre situation with barPlot. Firstly, even when the data is null, it gives me two large barplot at indexes 1 and 2, which i can't work out where they are coming from?

enter image description here

And secondly, when I then call the reloadDataIfNeeded/reloadData method, it then seems to place the bars in the middle (it appears identically each time)

enter image description here

Ill post the code below, but it seems odd that when i don't call reload data, it gives me bars already on the barplot. - it never calls:

 -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {

it just places bars on the barplot. When i reload the data it calls that method, and despite the indexes being correct, it still misplaces the bars?

1

There are 1 best solutions below

0
On BEST ANSWER

To solve this problem I used:

 switch ( fieldEnum ) {            
case CPTBarPlotFieldBarLocation: return [NSNumber numberWithUnsignedInteger:index]; break; 
case CPTBarPlotFieldBarTip: 
if ([plot.identifier isEqual:_nameComingThrough]) { 
return [_averageDataValuesMultiple objectAtIndex:index]; } 
else if ([plot.identifier isEqual:PAR]) { 

return [_averageOfPar objectAtIndex:index]; } 
}