Multiple charts on 1 screen - performance issues


I need to show multiple charts (up to 16) in 1 UIScrollView, each with a single line series representing temperature data. The data comes in live from thermometers, potentially 1 reading per second, and gets stored for displaying on the chart. You can potentially have tens of thousands of data points per chart.

I can plot historical data ok but get serious performance issues over time with the chart updating live. CPU usage spikes to over 100% meaning that the app locks up. Also, memory usage goes very high (over 300MB) just to plot the initial data.

My datasource uses sChart:(ShinobiChart*)chart dataPointsForSeriesAtIndex:(NSInteger)seriesIndex to pre-create the data points. To update the charts, I add the new reading to the datasource, call chart.append(numberOfDataPoints: 1, toEndOfSeriesAtIndex: 0) then call chart.redraw(). I’ve also enabled loadDataInBackground.

Is there anything else I can do to improve performance? Am I trying to plot too much data?


Hi Chris,

Sixteen charts being plotted at once does seem like a pretty intensive task. May I ask if all of these charts need to displayed on screen at the same time? We often recommend using a UICollectionView in circumstances like this so that a few charts can be reused and reloaded.

Additionally, appending data continuously to the chart will eventually result in your application consuming a large amount of memory (as will displaying tens of thousands of data points). I’d encourage you to consider sampling the data either before providing your points to the chart or by using a sampler (series.dataSampler = <your sampler>). We provide a few samplers as part of our Advanced Charting Kit product which you may find useful (please see this blog post for more information). This should reduce the number of points the chart has to display and lower the memory consumption fairly substantially.