Android: ShinobiChart#addSeries() slow


#1

I have a chart with about a 100 lines series. Why 100? That’s the only way I see to have one continuous-looking path but with different color segments in different places.

The problem is calling addSeries() 100 times in a for loop takes several seconds. I can try breaking it up, adding one series every x seconds until they’re all added, but this is not desirable.

Any advice here?


#2

I could actually get away with using just a few series if discontinuous gaps were supported like they supposedly are in the latest iOS. Any expected date for this to hit Android?


#3

I would be interested in this too :laughing:


#4

Hi guys,

One thing you could try is adding the series to the chart before the axes are added (or temporarily removing the axes). The reason for this is without the axes the data points can’t be internalised and so in theory you should miss out a whole load of repeated data processing. We don’t enforce adding axes and series in any specific order - we only require axes to have been added to the chart by the time drawing occurs and only if you’ve added a cartesian series.

With regards to discontinuous line series, it is on our roadmap but I’m unable to say exactly when this will be available in ShinobiCharts for Android at the moment. We do prioritise feature development based on customer demand and while this feature hasn’t been requested very much I will certainly make a note of your interest in it.

Hope that helps!

Patrick


#5

Thanks for the reply. Adding series before the axes is indeed faster but still pretty slow compared to using just one series. Once you get up to about 50 series (with just a few points in each series) there’s a noticeable second or two pause on my S5 before the graph appears and the thread continues. This is better than the several second pause if you add the axes first, but still not usable, so I’m going back to using just one series.

For other people looking for a workaround, I had some success with adding one series to the graph every .1 seconds or so using a Handler#postDelayed() loop. You could also try adding the series on a separate thread and show a spinner above the graph, but it may have to be done on the main thread.