Wrong console messages with version 2.7.0: "Unable to get category name: invalid index"


#1

In our app I have a columnChart with yAxis=SChartNumberAxis and xAxis=SChartCategoryAxis.
Everything works with ShinobiChart version 2.5.x perfectly.
Now I updated to 2.7.0 and I have big problems with this chart.

With every rendering or zooming/panning I get this messages on the console:
ShinobiCharts: Unable to get category name: invalid index 18
From: SChartCategoryAxis at 0x160410e0, axisRange = { 6.000000, 18.000000 }, defaultRange = { 6.000000, 18.000000 }, maxRange = { -0.500000, 18.000000 }

In this example I return 18 on numberOfDataPointsForSeriesAtIndex and dataPointAtIndex is also only called for index 0 to 17.
I don’t know, where this console logs comes from.

Does anyone noticed similar things with the latest version 2.7.0? If yes, does anyone has a solution for this?


#2

Hi AxM,

Thanks for raising this. We’ll take a look into it and post any updates to this thread.

In the meantime, could you confirm if this problem is just logging to the console, or if it’s causing any other issues such as crashes or visual glitches? 

Thanks

Ryan


#3

Can I also request that you send in an example that reproduces the issue to info@shinobicontrols.com with the subject title “SC-2262”. This will enable us to get straight to debugging the issue.

It’s also occured to me that you should be able to turn logging off in the ShinobiCharts framework if this is annoying you. Something like [ShinobiChartsLog setLoggingEnabled:NO] when your app launches should work. The downside to this is that you won’t get warnings and errors logged for other issues, so you may only want to do this in the production version of your code.  


#4

>>> In the meantime, could you confirm if this problem is just logging to the console, or if it’s causing any other issues such as crashes or visual glitches? 

It’s not a visual problem and the chart behaves as expected. Only the console messages are confusing for me.

I will create a demo project later on, when I find time to do this. 


#5

Ok, I have sent you a demo project, that shows clearly, that the console messages are only coming with 2.7.0.

If you replace the shinobiChart framework with an older verseion (2.5.x in my case) the console messages are not there.


#6

Same error on 2.7.3.hotfix1-1.  The questions is “Is it just InfoLog or ErrorLog  and we have to fix it in some way?”

The reason I’m asking it is that I suspect it has something to do with the following artifact - first/minimum tickmark, like 0.0 , on the leftside Y axis plays hide and show while chart is panning! Rightside Y axis behaves OK.

P.S. I set a break point in

- (void)sChart:(ShinobiChart *)chart alterTickMark:(SChartTickMark *)tickMark beforeAddingToAxis:(SChartAxis *)axis





 





and here is what I've got when condition tickMark.tickMarkView == nil is fulfilled for tickMark:







 





<SChartTickMark: 0x7d8a0ea; isMajor: YES; tick pos: { 1686.00, 414.10 }; overAlternate: YES; value: 2.00; label: (null);>





 





At the same time I saw those "ShinobiCharts: Unable to get category name: invalid index" messages.

#7

Hello,

After further investigation we have found this is be an issue with our tick mark generation code. It tries to create tick marks for categories that simply don’t exist.

This is also the reason you may be seeing nil tick marks in your implementation of the SChartDelegate “sChart:alterTickMark:beforeAddingToAxis:” method.

The warning it spits out in console is harmless, however I can see how it can get annoying so below is a SChartCategoryAxis category I created to prevent it from displaying the warning.

@interface SChartCategoryAxis (FixedCategoryAxis)

@end

@implementation SChartCategoryAxis (FixedCategoryAxis)

-(NSString *)categoryNameFromIndex:(NSUInteger)index {
    if (index >= self.categories.count) {
        return @"";
    }
    
    return [self.categories objectAtIndex:index];
}

@end

I have added a task to our backlog to fix this issue and a member of our team will update this forum post when a fix has been released.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn