Using androidplot with a very large amounts of points

453 views
Skip to first unread message

Sergio Medialdea

unread,
Apr 30, 2014, 4:32:04 PM4/30/14
to andro...@googlegroups.com
I'm very interesting in how to use androidPlot with a large amounts of points (aproximately 2000-3000) to be drawn. I'm triying to do this but with no good results. The UI response excesive slowly to panning and zooming making it completely useless. Any idea if  it is possible to use this library in this way?

Nick

unread,
Apr 30, 2014, 5:08:42 PM4/30/14
to andro...@googlegroups.com
Hi Sergio,

While Androidplot is capable of plotting this number of points, there are a number of factors that influence performance:

-Number of series being displayed
-Number and type of renderers being used, along with their configuration (are shadows being drawn, etc.)
-Is the data dynamic? If so, how is it being updated and how often?
-Are you using SimpleXYSeries? If so, this can be a major bottleneck when dealing with dynamic data and large datasets.  The most efficient solution is almost always to implement XYSeries to fit your particular needs.

If you can provide some details about your performance requirements and your current implementation I may be able to give you some advice on how to improve performance.

Nick

Sergio Medialdea

unread,
May 1, 2014, 3:54:17 PM5/1/14
to andro...@googlegroups.com
Hi Nick,

Firstly thanks for you fast answer and congrats for this exciting library is androidplot.

I'm triying to replicate the listView example is in appDemo. Currently I'm testing with only one series but i'm interested on adding several series over the same plot but at a time always.

Here I provide some details of this test:

-XYPlotZoomPan as plot class.

-I try changing the renderMode="use_main_thread" or renderMode="use_background_thread" but I don't appreciate really significant differences.

-Basic formatter (i.e: new LineAndPointFormatter(Color.MAGENTA, null, null, new   PointLabelFormatter(Color.TRANSPARENT)));            

-Exactly I'm using SimpleXYSeries, will study the alternative XYSeries implementation you propose.

May be part of this lack of good performance will be in the memory used by the device in stored the data structure.


Thanking in advance for your answers!

Sergio.

Nick

unread,
May 1, 2014, 5:11:37 PM5/1/14
to
It sounds like your data is static; that is to say that you are not adding or removing points to each series while they are being displayed.  If that is the case then renderMode="use_main_thread" is the right render mode for you.  In the case of static data, there really isn't much to worry about in terms of performance outside of the number of points and number of series added to the plot.  A custom implementation of XYSeries is unlikely to improve performance either.  If I'm wrong about the data being static let me know, but otherwise you are left with 3 options:

1 - Minimize the graphical overhead of your chosen formatter.  In your case I notice that you are using a PointLabelFormatter initialized with a transparent color.  Have you tried passing in null here?  This should eliminate the superfluous calls to canvas.drawText(...) and speed things up a little.

2 - Implement your own custom Renderer & Formatter.  You can use LineAndPointRender as a reference and strip out any unnecessary overhead that your implementation doesn't require, such as replacing canvas.drawPath() with canvas.drawLine() etc.  This is usually the most effective approach.

3 - Use an interpolation technique to reduce the number of points in your dataset.  Rendering 3,000 points on a phone screen is usually extreme overkill since there are not that many (if any) phones around that have > 2,000 pixels on their wide edge anyway. (A state of the art Samsung Galaxy S5 has a resolution of 1920x1080 for example) No matter what approach you choose I would typically strongly suggest using interpolation to get your dataset down to < 1,000 points.

Hope this helps,
Nick
Reply all
Reply to author
Forward
0 new messages