I have a bar chart with 128 elements which I want to update every 4mS, I created a test App using the ColumnSeries demo as a base. I have a 4mS timer in which the data for the chart is updated and reloaddata\redrawchart is issued. However the chart visually only updates about once per second. Is a chart of this size able to update at time period of 4mS?
Hi I am having the same speed problems that you are talking about. What is the maximum reloaddata/redraw rate that shinobicontrols can handle?
The update speed of the chart will depend on a large number of factors, including the amount of data being shown (though sounds like this is modest in your case), the hardware you’re running on, what sorts of axes you’re using, how many tick marks and labels are showing, how many other elements there are (titles, legend, annotations, etc), the complexity of the styling applied and a number of other variables. However, you aren’t going to be able to get a chart that redraws on a 4ms frequency as that would equate to about 250 frames per second. The ipad/iphone updates at a screen refresh rate of 60Hz, which is a limitation of the device/OS and so you aren’t going ot be able to go faster than that (which is about one update per 16.66ms). There is considerable work and delay, however, in transferring data onto the GPU hardware so it’s unlikely you’ll be able to achieve that speed on a reload of data (though you should be seeing something close to 60fps for panning and zooming operations as the data is already in place and most of the work is done on the GPU).
I have managed to replicate your scenario of 128 columns and I turned on background data loading and was seeing about 30fps on an ipad 3. Clearly, I don’t know much about your specific use cases but I think it should be possible for you to hit anywhere between 20 and 30 fps unless you’re working with large amounts of data or complex data processing scenarios. Note that this applies only when you are loading new data. The chart can certainly redraw and/or pan and zoom at a much higher frequency, all the way up to the max 60fps.
While you can certainly accept data every 4ms, on iOS you won’t be able to get your screen refreshing faster than once every 16ms at the very best. I hope that’s useful information.
Thanks for the info Jesse,
Between my original post and your reply I found that for our app we can reduce the number of columns to 45 and increase update period to 50mS.
However I’m still seeing some lag, so I’m guessing its now my setup, as I mentioned I’m working off the ColumnSeries demo with the addition of a timer (50mS) to reload / redraw the chart. I tried setting loadDataInBackground = yes, but I get an exception: 'Auto Layout still required after executing -layoutSubviews. ShinobiChart’s implementation of -layoutSubviews needs to call super.'
You indicated you replicated my scenario and saw about 30fps, are you able to provide that code?
I’m not sure about the AutoLayout problem - I’ll ask someone to have a look at that.
Regarding the performance, one are where I found some sizeable wins was to take control of the axis ranges. The need for the axis to calculate its ranges is pretty (or at least can be) expensive. So if you set defaultRange on the axis to a range that matches your data that helps. It’s also worth setting majorTickFrequency to something to reduce the number of tick marks. UIKit is fairly slow and so the more lines and text labels you render the slower things go. That made about 5fps difference for me. Additionally you can improve things further by disabling the legend (if shown) as that is also having to render various UIKit elements on each frame. The styling applied to the series has some effect, though not as great, as gradients are more expensive to render than straight fills, but that’s fairly minor.
I hope that helps and if we find anything on the example to do with the background loading, I’ll let you know, but I was basing my example off the column series example as well, so it’s basically what you already have, with the above changes applied.