10

I have an application in which I have a BarChart and a CombinedChart but they spend 1-1.5 seconds until they show the chart with the data.

I retrieve data from a database with Volley doing a request to get the data but I would like that the time that both charts spend to show the data will be reduced as much as possible.

I guess that it could be by the form of import that library to the project:

compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'

but I could not find any other way to import that library or if it is the properly way to do this. Maybe it can be related by the fact that I am using Volley for this purpose.

What can I do to reduce the amount of time that both charts spend to show the data? Can it be something related with the form that I am importing it?

Any suggestion will be appreciated.

Thanks in advance!

Francisco Romero
  • 12,787
  • 22
  • 92
  • 167
  • 1
    Hi, the import has nothing to do with the loading time. Imports occur at compilation time. Have you checked that this 1-1.5 second is not caused by the volley request to the database instead of the MPAndroidChart library ? – FlyingPumba Aug 12 '16 at 04:20
  • @FlyingPumba If I do the request on Postman (for example) it spend less than 1 second, it is why I thought that it was something related with `MPAndroidChart`. – Francisco Romero Aug 12 '16 at 07:21
  • 1
    I use MPAndroidChart too togheter with a database, and i have similiar effect. This is because it takes some time to get the data from the database then it is processed. I just show a progress bar till my presenter passes me the data. Maybe try a different database that is proven to be faster. You can test greendao or realm for comparison – Tazz Aug 12 '16 at 12:31
  • @Tazz And is it impossible to reduce the time instead of show a progress bar? – Francisco Romero Aug 13 '16 at 14:43

1 Answers1

3

The delay you are experiencing has nothing to do the way you are importing the libraries since that is done in compile time and not runtime.

If you are requesting data from a local database that's just the time it takes to fetch the data. If you are looking for speed I would recommend you to use Realm which is the fastest read "database" for android right now.

As a bonus the PhilJay has integrated his MPAAndroidChar library directly with this,

you can find it here: MPAAndroidChart-Realm

Joaquim Ley
  • 4,038
  • 2
  • 24
  • 42