Charts (1.7.1) performance on android


#1

Hello.

I’m using charts for finance application (testing device: nexus 4, android 5.0) and ran into several problems.

First is aliasing in line chart. 

You can clearly see how ugly lines are. Is there any setting for it?

Second is very poor performance when zooming/panning. It’s nowhere near 60 fps, moving chart is laggy.

Additionally, when a lot of data is inserted in the chart it starts to stutter on panning. Just freezing for some 100ms several times during scroll. The more data in the adapter the more it freezes.

I’m using ChartView directly, since charts are part of my custom fragment and using ChartFragment gives me “retain of nested fragments error”.

OpenGL dependencies and hardwareAcceleration is enabled.


#2

Hi awesomelyamazing,

With regards to the anti-aliasing issue, is the image you added from your Nexus 4 test device or is it from the emulator? I wouldn’t have expected the lines to be as jaggy as that on a device though it very much depends on the device. There’s no configurable setting through the API but internally we have an EGLConfigChooser that will employ multi-sampling if the device allows it, thus providing anti-aliasing. The reason I ask about the emulator is that as far as I understand the multi-sampling is not able to be used on it.

As for your second point, while 60fps won’t be achievable on a number of Android devices I wouldn’t expect panning and zooming to be particularly laggy even on some older devices. Similarly, for large data sets, while there may be some initial data load delay I wouldn’t have expected the freezing/stuttering on panning that you are seeing. Could you elaborate a bit more on your chart and the data it has. For example, roughly how many data points are we talking about (and how many series)? What type of axes are you using? By its very nature the DateTimeAxis is not as performant as the NumberAxis but again I wouldn’t expect this to normally present a problem. Do you have any significant customisations such as custom listeners, custom label formats etc.

Hopefully with a bit more information we may be able to get the bottom of the problem. Feel free to email us directly at info@shinobicontrols.com - any code samples you can provide would be useful.

Kind regards,

Patrick