What is the best way to increase performance of multiple graphs on the same data set?
For example, 1200 data points are plotted on 3 charts:
Chart A) Two IGSplineSeries embedded in a IGRangeSelector
Chart B) Two IGLineSeries and one IGRangeAreaSeries
Chart C) Same as B: two IGLineSeries and one IGRangeAreaSeries
The iPad Air handles this data no problem. However, an iPad Mini loses many frames on basic scrolling. Here's an Instruments Time Profile with inverted call tree.
Thanks for your help!
#pragma mark - Chart Delegates
-(NSString*)chartView:(IGChartView*)chartView
labelForAxis:(IGAxis*)axis
withItem:(NSObject*)item
{
NSString *label = nil;
if ([axis isKindOfClass:[IGNumericYAxis class]])
label = [((NSNumber*)item) stringValue];
else if ([axis isKindOfClass:[IGCategoryDateTimeXAxis class]])
if([item isKindOfClass:[NSDate class]])
label = [self.dateFormatterDict[SemiPlotTimeFormatter] stringFromDate:(NSDate*)item];
}
else if([item isKindOfClass:[IGCategoryDatePoint class]])
IGCategoryDatePoint *datePoint = (IGCategoryDatePoint*)item;
label = [self.dateFormatterDict[SemiPlotTimeFormatter] stringFromDate:datePoint.date];
else
DDLogVerbose(@"%s - axis class unknown:%@", __PRETTY_FUNCTION__, [axis class]);
return label;
-(NSDateFormatter*)_timeFormatter
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateStyle = NSDateFormatterNoStyle;
formatter.timeStyle = NSDateFormatterMediumStyle;
return formatter;
Btw, it doesn't look like it here, but the NSDateFormatter is not being generated for every call. It's being instantiated once into self.dateFormatterDict.
Hi Caylan,
There really isn't anything that can provide optimizations for different charts using the same data. The charts are unaware of each other and even if the data is the same, the series are typically different and most of the time is taken up by rendering paths, gradients, etc.
It's very strange, that -renderAxisOverride takes so long. Are all these charts synced together? Do you get any improvements by not implementing -labelForAxis method?
So far my best efforts to reproduce this issue have yielded around 3% running time for renderAxisOverride on an iphone5s. I can test of a slower device tomorrow and will let you know what i find.
All of the processing for every chart is on one thread. Perhaps there could be some way to balance the rendering across multiple cores?
They are synced insofar as they use a delegate pattern to scroll each other. No, there are no improvements when I disable labelForAxis.
It would be my preference if there was some built-in facility to handle syncing the zoom/pan of charts... especially if the sync-controller logic was inside the IGRangeSelector. If this isn't possible because of monetary constraints, have someone contact me regarding how much it would cost to sponsor this feature.
Another infragistics support person named Darrell put together a demo project that I then modified to highlight a different bug. Can you meet me half way on that, too? Just publish what you have that's fast and I'll modify it to slow it down. :-) It will save me some precious hours.
I got a chance to test this out on an ipad 2, and I didn't see much time being spent in renderAxisOverride either.
I'm attaching a screenshot from the profiler and a project. It would be helpful if you could try modifying it to reproduce the problem. Maybe it's something in the app that's slowing down the axis. Note, the app does run pretty slow with all the charts and the data, but the majority of the time is spent rendering series shapes.
And screenshot. I get 1.6% for renderAxisOverride