Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
IGAsyncCategoryDataSourceHelper Behavior on Empty Real-Time Graph
posted

A chart loaded with an empty dataset via IGSeriesDataSourceHelper displays an empty chart as perfect as I need it.  However, it seems that an empty dataset via IGAsyncCategoryDataSourceHelper just spins emptily waiting for data.  Moreover, this causes problems with code as such:

 [self.chartView insertItemAtIndex:index withSource:helper];   //<-- EXCEPTION THROWN

The currentSeries.dataPoints.count is zero (nil behind the scenes?), so when I try to add anything to it I get...

[CoreDataTVC controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:] - update (delete and insert)*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'

I had a similar problem in the past, and it was resolved with the following logic.  I think there is a deeper problem with the async data source handling an empty dataset.

-(void)dataInsertedAtIndex:(NSInteger)index fetchedResults:(NSArray*)fetchedResults

{

    for(id helperKey in self.dataSourceHelperDict)

    {        

        IGAsyncCategoryDataSourceHelper *helper = self.dataSourceHelperDict[helperKey];

        helper.data = fetchedResults;

        

        BOOL indexOutOfRange = NO;

        for (IGSeries *currentSeries in _chartView.series)

        {

            if ([currentSeries.dataSource isEqual:helper] && currentSeries.dataPoints.count <= index="" p="">

            {

                currentSeries.dataSource = helper;

                

                if(currentSeries.dataPoints.count <= index="" p="">

                {

                    indexOutOfRange = YES;

                }

            }

        }

                

        if(!indexOutOfRange)   // If this check is removed...

            [self.chartView insertItemAtIndex:index withSource:helper]; //<-- EXCEPTION THROWN

        

    }

}

I've tried a variety of different ways around this and my basic conclusion is that: an empty chart with an async data source can't have items inserted.

  • 23930
    Offline posted

    Hi Caylan,

    Thank you for contacting Infragistics Developer Support.

    I have created support ticket for this issue – CAS-137568-W5N1F9 and I have logged a development issue with ID 172199. As soon as I have more information for you I will update you through the case. You can view this case at https://ko.infragistics.com/my-account/support-activity.